Skip to content

Commit 3012f59

Browse files
[AutoRelease] t2-managedservices-2022-10-31-95566(Do not merge) (Azure#27193)
* code and test * Update CHANGELOG.md * Update _version.py Co-authored-by: PythonSdkPipelines <PythonSdkPipelines> Co-authored-by: zhenbiao wei <424401670@qq.com>
1 parent a4c1461 commit 3012f59

File tree

54 files changed

+6546
-2934
lines changed

Some content is hidden

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

54 files changed

+6546
-2934
lines changed

sdk/managedservices/azure-mgmt-managedservices/CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
# Release History
22

3+
## 7.0.0b1 (2022-10-31)
4+
5+
### Features Added
6+
7+
- Added operation group OperationsWithScopeOperations
8+
- Model JustInTimeAccessPolicy has a new parameter managed_by_tenant_approvers
9+
- Model RegistrationAssignment has a new parameter system_data
10+
- Model RegistrationAssignmentPropertiesRegistrationDefinition has a new parameter system_data
11+
- Model RegistrationDefinition has a new parameter system_data
12+
- Model RegistrationDefinitionProperties has a new parameter managee_tenant_id
13+
- Model RegistrationDefinitionProperties has a new parameter managee_tenant_name
14+
15+
### Breaking Changes
16+
17+
- Operation RegistrationAssignmentsOperations.list has a new parameter filter
18+
- Operation RegistrationDefinitionsOperations.list has a new parameter filter
19+
320
## 6.0.0 (2021-04-22)
421

522
**Features**
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
include _meta.json
2-
recursive-include tests *.py *.yaml
2+
recursive-include tests *.py *.json
3+
recursive-include samples *.py *.md
34
include *.md
45
include azure/__init__.py
56
include azure/mgmt/__init__.py
67
include LICENSE
8+
include azure/mgmt/managedservices/py.typed

sdk/managedservices/azure-mgmt-managedservices/README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Microsoft Azure SDK for Python
22

33
This is the Microsoft Azure Managed Services Client Library.
4-
This package has been tested with Python 3.6+.
4+
This package has been tested with Python 3.7+.
55
For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all).
66

77
## _Disclaimer_
@@ -12,8 +12,6 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For
1212

1313

1414
To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt)
15-
16-
1715

1816
For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/)
1917
Code samples for this package can be found at [Managed Services](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com.
Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
{
2-
"autorest": "3.3.0",
3-
"use": "@autorest/python@5.6.6",
4-
"commit": "528c0cffd4de3d4acdf451a1ea5f7cf6f3cb790c",
2+
"commit": "5fc05d0f0b15cbf16de942cadce464b495c66a58",
53
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
6-
"autorest_command": "autorest specification/managedservices/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.6.6 --version=3.3.0",
4+
"autorest": "3.9.2",
5+
"use": [
6+
"@autorest/python@6.2.1",
7+
"@autorest/modelerfour@4.24.3"
8+
],
9+
"autorest_command": "autorest specification/managedservices/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.1 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
710
"readme": "specification/managedservices/resource-manager/readme.md"
811
}

sdk/managedservices/azure-mgmt-managedservices/azure/mgmt/managedservices/__init__.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,17 @@
1010
from ._version import VERSION
1111

1212
__version__ = VERSION
13-
__all__ = ['ManagedServicesClient']
1413

1514
try:
16-
from ._patch import patch_sdk # type: ignore
17-
patch_sdk()
15+
from ._patch import __all__ as _patch_all
16+
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
1817
except ImportError:
19-
pass
18+
_patch_all = []
19+
from ._patch import patch_sdk as _patch_sdk
20+
21+
__all__ = [
22+
"ManagedServicesClient",
23+
]
24+
__all__.extend([p for p in _patch_all if p not in __all__])
25+
26+
_patch_sdk()

sdk/managedservices/azure-mgmt-managedservices/azure/mgmt/managedservices/_configuration.py

Lines changed: 33 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,60 +6,65 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
from typing import TYPE_CHECKING
9+
import sys
10+
from typing import Any, TYPE_CHECKING
1011

1112
from azure.core.configuration import Configuration
1213
from azure.core.pipeline import policies
13-
from azure.mgmt.core.policies import ARMHttpLoggingPolicy
14+
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
1415

1516
from ._version import VERSION
1617

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+
1723
if TYPE_CHECKING:
1824
# pylint: disable=unused-import,ungrouped-imports
19-
from typing import Any
20-
2125
from azure.core.credentials import TokenCredential
2226

2327

24-
class ManagedServicesClientConfiguration(Configuration):
28+
class ManagedServicesClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
2529
"""Configuration for ManagedServicesClient.
2630
2731
Note that all parameters used to create this instance are saved as instance
2832
attributes.
2933
30-
:param credential: Credential needed for the client to connect to Azure.
34+
:param credential: Credential needed for the client to connect to Azure. Required.
3135
:type credential: ~azure.core.credentials.TokenCredential
36+
:keyword api_version: Api Version. Default value is "2022-10-01". Note that overriding this
37+
default value may result in unsupported behavior.
38+
:paramtype api_version: str
3239
"""
3340

34-
def __init__(
35-
self,
36-
credential, # type: "TokenCredential"
37-
**kwargs # type: Any
38-
):
39-
# type: (...) -> None
41+
def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None:
42+
super(ManagedServicesClientConfiguration, self).__init__(**kwargs)
43+
api_version = kwargs.pop("api_version", "2022-10-01") # type: Literal["2022-10-01"]
44+
4045
if credential is None:
4146
raise ValueError("Parameter 'credential' must not be None.")
42-
super(ManagedServicesClientConfiguration, self).__init__(**kwargs)
4347

4448
self.credential = credential
45-
self.api_version = "2020-02-01-preview"
46-
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
47-
kwargs.setdefault('sdk_moniker', 'mgmt-managedservices/{}'.format(VERSION))
49+
self.api_version = api_version
50+
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
51+
kwargs.setdefault("sdk_moniker", "mgmt-managedservices/{}".format(VERSION))
4852
self._configure(**kwargs)
4953

5054
def _configure(
51-
self,
52-
**kwargs # type: Any
55+
self, **kwargs # type: Any
5356
):
5457
# type: (...) -> None
55-
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
56-
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
57-
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
58-
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
59-
self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs)
60-
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
61-
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
62-
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
63-
self.authentication_policy = kwargs.get('authentication_policy')
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")
6467
if self.credential and not self.authentication_policy:
65-
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
68+
self.authentication_policy = ARMChallengeAuthenticationPolicy(
69+
self.credential, *self.credential_scopes, **kwargs
70+
)

sdk/managedservices/azure-mgmt-managedservices/azure/mgmt/managedservices/_managed_services_client.py

Lines changed: 77 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -6,88 +6,112 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
from typing import TYPE_CHECKING
9+
from copy import deepcopy
10+
from typing import Any, TYPE_CHECKING
1011

12+
from azure.core.rest import HttpRequest, HttpResponse
1113
from azure.mgmt.core import ARMPipelineClient
12-
from msrest import Deserializer, Serializer
14+
15+
from . import models
16+
from ._configuration import ManagedServicesClientConfiguration
17+
from ._serialization import Deserializer, Serializer
18+
from .operations import (
19+
MarketplaceRegistrationDefinitionsOperations,
20+
MarketplaceRegistrationDefinitionsWithoutScopeOperations,
21+
Operations,
22+
OperationsWithScopeOperations,
23+
RegistrationAssignmentsOperations,
24+
RegistrationDefinitionsOperations,
25+
)
1326

1427
if TYPE_CHECKING:
1528
# pylint: disable=unused-import,ungrouped-imports
16-
from typing import Any, Optional
17-
1829
from azure.core.credentials import TokenCredential
19-
from azure.core.pipeline.transport import HttpRequest, HttpResponse
20-
21-
from ._configuration import ManagedServicesClientConfiguration
22-
from .operations import RegistrationDefinitionsOperations
23-
from .operations import RegistrationAssignmentsOperations
24-
from .operations import MarketplaceRegistrationDefinitionsOperations
25-
from .operations import MarketplaceRegistrationDefinitionsWithoutScopeOperations
26-
from .operations import Operations
27-
from . import models
2830

2931

30-
class ManagedServicesClient(object):
31-
"""Specification for ManagedServices.
32+
class ManagedServicesClient: # pylint: disable=client-accepts-api-version-keyword
33+
"""The specification for ManagedServices.
3234
3335
:ivar registration_definitions: RegistrationDefinitionsOperations operations
34-
:vartype registration_definitions: azure.mgmt.managedservices.operations.RegistrationDefinitionsOperations
36+
:vartype registration_definitions:
37+
azure.mgmt.managedservices.operations.RegistrationDefinitionsOperations
3538
:ivar registration_assignments: RegistrationAssignmentsOperations operations
36-
:vartype registration_assignments: azure.mgmt.managedservices.operations.RegistrationAssignmentsOperations
37-
:ivar marketplace_registration_definitions: MarketplaceRegistrationDefinitionsOperations operations
38-
:vartype marketplace_registration_definitions: azure.mgmt.managedservices.operations.MarketplaceRegistrationDefinitionsOperations
39-
:ivar marketplace_registration_definitions_without_scope: MarketplaceRegistrationDefinitionsWithoutScopeOperations operations
40-
:vartype marketplace_registration_definitions_without_scope: azure.mgmt.managedservices.operations.MarketplaceRegistrationDefinitionsWithoutScopeOperations
39+
:vartype registration_assignments:
40+
azure.mgmt.managedservices.operations.RegistrationAssignmentsOperations
41+
:ivar marketplace_registration_definitions: MarketplaceRegistrationDefinitionsOperations
42+
operations
43+
:vartype marketplace_registration_definitions:
44+
azure.mgmt.managedservices.operations.MarketplaceRegistrationDefinitionsOperations
45+
:ivar marketplace_registration_definitions_without_scope:
46+
MarketplaceRegistrationDefinitionsWithoutScopeOperations operations
47+
:vartype marketplace_registration_definitions_without_scope:
48+
azure.mgmt.managedservices.operations.MarketplaceRegistrationDefinitionsWithoutScopeOperations
4149
:ivar operations: Operations operations
4250
:vartype operations: azure.mgmt.managedservices.operations.Operations
43-
:param credential: Credential needed for the client to connect to Azure.
51+
:ivar operations_with_scope: OperationsWithScopeOperations operations
52+
:vartype operations_with_scope:
53+
azure.mgmt.managedservices.operations.OperationsWithScopeOperations
54+
:param credential: Credential needed for the client to connect to Azure. Required.
4455
:type credential: ~azure.core.credentials.TokenCredential
45-
:param str base_url: Service URL
46-
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
56+
:param base_url: Service URL. Default value is "https://management.azure.com".
57+
:type base_url: str
58+
:keyword api_version: Api Version. Default value is "2022-10-01". Note that overriding this
59+
default value may result in unsupported behavior.
60+
:paramtype api_version: str
61+
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
62+
Retry-After header is present.
4763
"""
4864

4965
def __init__(
50-
self,
51-
credential, # type: "TokenCredential"
52-
base_url=None, # type: Optional[str]
53-
**kwargs # type: Any
54-
):
55-
# type: (...) -> None
56-
if not base_url:
57-
base_url = 'https://management.azure.com'
58-
self._config = ManagedServicesClientConfiguration(credential, **kwargs)
66+
self, credential: "TokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any
67+
) -> None:
68+
self._config = ManagedServicesClientConfiguration(credential=credential, **kwargs)
5969
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
6070

6171
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
6272
self._serialize = Serializer(client_models)
63-
self._serialize.client_side_validation = False
6473
self._deserialize = Deserializer(client_models)
65-
74+
self._serialize.client_side_validation = False
6675
self.registration_definitions = RegistrationDefinitionsOperations(
67-
self._client, self._config, self._serialize, self._deserialize)
76+
self._client, self._config, self._serialize, self._deserialize
77+
)
6878
self.registration_assignments = RegistrationAssignmentsOperations(
69-
self._client, self._config, self._serialize, self._deserialize)
79+
self._client, self._config, self._serialize, self._deserialize
80+
)
7081
self.marketplace_registration_definitions = MarketplaceRegistrationDefinitionsOperations(
71-
self._client, self._config, self._serialize, self._deserialize)
72-
self.marketplace_registration_definitions_without_scope = MarketplaceRegistrationDefinitionsWithoutScopeOperations(
73-
self._client, self._config, self._serialize, self._deserialize)
74-
self.operations = Operations(
75-
self._client, self._config, self._serialize, self._deserialize)
76-
77-
def _send_request(self, http_request, **kwargs):
78-
# type: (HttpRequest, Any) -> HttpResponse
82+
self._client, self._config, self._serialize, self._deserialize
83+
)
84+
self.marketplace_registration_definitions_without_scope = (
85+
MarketplaceRegistrationDefinitionsWithoutScopeOperations(
86+
self._client, self._config, self._serialize, self._deserialize
87+
)
88+
)
89+
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
90+
self.operations_with_scope = OperationsWithScopeOperations(
91+
self._client, self._config, self._serialize, self._deserialize
92+
)
93+
94+
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
7995
"""Runs the network request through the client's chained policies.
8096
81-
:param http_request: The network request you want to make. Required.
82-
:type http_request: ~azure.core.pipeline.transport.HttpRequest
83-
:keyword bool stream: Whether the response payload will be streamed. Defaults to True.
97+
>>> from azure.core.rest import HttpRequest
98+
>>> request = HttpRequest("GET", "https://www.example.org/")
99+
<HttpRequest [GET], url: 'https://www.example.org/'>
100+
>>> response = client._send_request(request)
101+
<HttpResponse: 200 OK>
102+
103+
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
104+
105+
:param request: The network request you want to make. Required.
106+
:type request: ~azure.core.rest.HttpRequest
107+
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
84108
:return: The response of your network call. Does not do error handling on your response.
85-
:rtype: ~azure.core.pipeline.transport.HttpResponse
109+
:rtype: ~azure.core.rest.HttpResponse
86110
"""
87-
http_request.url = self._client.format_url(http_request.url)
88-
stream = kwargs.pop("stream", True)
89-
pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs)
90-
return pipeline_response.http_response
111+
112+
request_copy = deepcopy(request)
113+
request_copy.url = self._client.format_url(request_copy.url)
114+
return self._client.send_request(request_copy, **kwargs)
91115

92116
def close(self):
93117
# type: () -> None

0 commit comments

Comments
 (0)