Skip to content

Commit 85954be

Browse files
author
SDK Automation
committed
Update from release/v3
1 parent b4638b5 commit 85954be

File tree

2,133 files changed

+960040
-690686
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,133 files changed

+960040
-690686
lines changed
Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
# coding=utf-8
22
# --------------------------------------------------------------------------
33
# Copyright (c) Microsoft Corporation. All rights reserved.
4-
# Licensed under the MIT License. See License.txt in the project root for
5-
# license information.
6-
#
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
75
# Code generated by Microsoft (R) AutoRest Code Generator.
8-
# Changes may cause incorrect behavior and will be lost if the code is
9-
# regenerated.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
107
# --------------------------------------------------------------------------
118

12-
from ._configuration import NetworkManagementClientConfiguration
139
from ._network_management_client import NetworkManagementClient
14-
__all__ = ['NetworkManagementClient', 'NetworkManagementClientConfiguration']
15-
16-
from .version import VERSION
17-
18-
__version__ = VERSION
10+
__all__ = ['NetworkManagementClient']
1911

12+
try:
13+
from ._patch import patch_sdk
14+
patch_sdk()
15+
except ImportError:
16+
pass
Lines changed: 49 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,68 @@
11
# coding=utf-8
22
# --------------------------------------------------------------------------
33
# Copyright (c) Microsoft Corporation. All rights reserved.
4-
# Licensed under the MIT License. See License.txt in the project root for
5-
# license information.
6-
#
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
75
# Code generated by Microsoft (R) AutoRest Code Generator.
8-
# Changes may cause incorrect behavior and will be lost if the code is
9-
# regenerated.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
107
# --------------------------------------------------------------------------
11-
from msrestazure import AzureConfiguration
128

13-
from .version import VERSION
9+
from typing import TYPE_CHECKING
1410

11+
from azure.core.configuration import Configuration
12+
from azure.core.pipeline import policies
13+
14+
if TYPE_CHECKING:
15+
# pylint: disable=unused-import,ungrouped-imports
16+
from typing import Any
17+
18+
from azure.core.credentials import TokenCredential
19+
20+
VERSION = "unknown"
21+
22+
class NetworkManagementClientConfiguration(Configuration):
23+
"""Configuration for NetworkManagementClient.
1524
16-
class NetworkManagementClientConfiguration(AzureConfiguration):
17-
"""Configuration for NetworkManagementClient
1825
Note that all parameters used to create this instance are saved as instance
1926
attributes.
2027
21-
:param credentials: Credentials needed for the client to connect to Azure.
22-
:type credentials: :mod:`A msrestazure Credentials
23-
object<msrestazure.azure_active_directory>`
24-
:param subscription_id: The subscription credentials which uniquely
25-
identify the Microsoft Azure subscription. The subscription ID forms part
26-
of the URI for every service call.
28+
:param credential: Credential needed for the client to connect to Azure.
29+
:type credential: ~azure.core.credentials.TokenCredential
30+
:param subscription_id: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
2731
:type subscription_id: str
28-
:param str base_url: Service URL
2932
"""
3033

3134
def __init__(
32-
self, credentials, subscription_id, base_url=None):
33-
34-
if credentials is None:
35-
raise ValueError("Parameter 'credentials' must not be None.")
35+
self,
36+
credential, # type: "TokenCredential"
37+
subscription_id, # type: str
38+
**kwargs # type: Any
39+
):
40+
# type: (...) -> None
41+
if credential is None:
42+
raise ValueError("Parameter 'credential' must not be None.")
3643
if subscription_id is None:
3744
raise ValueError("Parameter 'subscription_id' must not be None.")
38-
if not base_url:
39-
base_url = 'https://management.azure.com'
45+
super(NetworkManagementClientConfiguration, self).__init__(**kwargs)
4046

41-
super(NetworkManagementClientConfiguration, self).__init__(base_url)
42-
43-
# Starting Autorest.Python 4.0.64, make connection pool activated by default
44-
self.keep_alive = True
45-
46-
self.add_user_agent('azure-mgmt-network/{}'.format(VERSION))
47-
self.add_user_agent('Azure-SDK-For-Python')
48-
49-
self.credentials = credentials
47+
self.credential = credential
5048
self.subscription_id = subscription_id
49+
self.credential_scopes = ['https://management.azure.com/.default']
50+
self.credential_scopes.extend(kwargs.pop('credential_scopes', []))
51+
kwargs.setdefault('sdk_moniker', 'mgmt-network/{}'.format(VERSION))
52+
self._configure(**kwargs)
53+
54+
def _configure(
55+
self,
56+
**kwargs # type: Any
57+
):
58+
# type: (...) -> None
59+
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
60+
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
61+
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
62+
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**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')
67+
if self.credential and not self.authentication_policy:
68+
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)

0 commit comments

Comments
 (0)