Skip to content

Commit c4013f0

Browse files
[AutoRelease] t2-cognitiveservices-2022-10-19-45579(Do not merge) (#26904)
* code and test * Update CHANGELOG.md Co-authored-by: PythonSdkPipelines <PythonSdkPipelines> Co-authored-by: zhenbiao wei <[email protected]>
1 parent 52d8dce commit c4013f0

Some content is hidden

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

43 files changed

+7647
-4490
lines changed

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

+10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Release History
22

3+
## 13.3.0 (2022-10-24)
4+
5+
### Features Added
6+
7+
- Model AccountModel has a new parameter call_rate_limit
8+
- Model DeploymentModel has a new parameter call_rate_limit
9+
- Model DeploymentProperties has a new parameter call_rate_limit
10+
- Model DeploymentProperties has a new parameter capabilities
11+
- Model DeploymentProperties has a new parameter rai_policy_name
12+
313
## 13.2.0 (2022-06-08)
414

515
**Features**

sdk/cognitiveservices/azure-mgmt-cognitiveservices/MANIFEST.in

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
include _meta.json
22
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
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"autorest": "3.7.2",
2+
"autorest": "3.9.2",
33
"use": [
4-
"@autorest/python@5.13.0",
5-
"@autorest/modelerfour@4.19.3"
4+
"@autorest/python@6.1.11",
5+
"@autorest/modelerfour@4.24.3"
66
],
7-
"commit": "ad5110c7ba2113d5f77946338231f45ac4d09c82",
7+
"commit": "f3312d0962e91b065f287e44f5ae76db038fcd87",
88
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
9-
"autorest_command": "autorest specification/cognitiveservices/resource-manager/readme.md --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.13.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2",
9+
"autorest_command": "autorest specification/cognitiveservices/resource-manager/readme.md --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.1.11 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
1010
"readme": "specification/cognitiveservices/resource-manager/readme.md"
1111
}

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

+11-5
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,15 @@
1010
from ._version import VERSION
1111

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

15-
# `._patch.py` is used for handwritten extensions to the generated code
16-
# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
17-
from ._patch import patch_sdk
18-
patch_sdk()
14+
try:
15+
from ._patch import __all__ as _patch_all
16+
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
17+
except ImportError:
18+
_patch_all = []
19+
from ._patch import patch_sdk as _patch_sdk
20+
21+
__all__ = ["CognitiveServicesManagementClient"]
22+
__all__.extend([p for p in _patch_all if p not in __all__])
23+
24+
_patch_sdk()

sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_cognitive_services_management_client.py

+40-20
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,33 @@
99
from copy import deepcopy
1010
from typing import Any, TYPE_CHECKING
1111

12-
from msrest import Deserializer, Serializer
13-
1412
from azure.core.rest import HttpRequest, HttpResponse
1513
from azure.mgmt.core import ARMPipelineClient
1614

1715
from . import models
1816
from ._configuration import CognitiveServicesManagementClientConfiguration
19-
from .operations import AccountsOperations, CognitiveServicesManagementClientOperationsMixin, CommitmentPlansOperations, CommitmentTiersOperations, DeletedAccountsOperations, DeploymentsOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResourceSkusOperations
17+
from ._serialization import Deserializer, Serializer
18+
from .operations import (
19+
AccountsOperations,
20+
CognitiveServicesManagementClientOperationsMixin,
21+
CommitmentPlansOperations,
22+
CommitmentTiersOperations,
23+
DeletedAccountsOperations,
24+
DeploymentsOperations,
25+
Operations,
26+
PrivateEndpointConnectionsOperations,
27+
PrivateLinkResourcesOperations,
28+
ResourceSkusOperations,
29+
)
2030

2131
if TYPE_CHECKING:
2232
# pylint: disable=unused-import,ungrouped-imports
2333
from azure.core.credentials import TokenCredential
2434

25-
class CognitiveServicesManagementClient(CognitiveServicesManagementClientOperationsMixin): # pylint: disable=too-many-instance-attributes
35+
36+
class CognitiveServicesManagementClient(
37+
CognitiveServicesManagementClientOperationsMixin
38+
): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
2639
"""Cognitive Services Management Client.
2740
2841
:ivar accounts: AccountsOperations operations
@@ -45,13 +58,13 @@ class CognitiveServicesManagementClient(CognitiveServicesManagementClientOperati
4558
:vartype deployments: azure.mgmt.cognitiveservices.operations.DeploymentsOperations
4659
:ivar commitment_plans: CommitmentPlansOperations operations
4760
:vartype commitment_plans: azure.mgmt.cognitiveservices.operations.CommitmentPlansOperations
48-
:param credential: Credential needed for the client to connect to Azure.
61+
:param credential: Credential needed for the client to connect to Azure. Required.
4962
:type credential: ~azure.core.credentials.TokenCredential
50-
:param subscription_id: The ID of the target subscription.
63+
:param subscription_id: The ID of the target subscription. Required.
5164
:type subscription_id: str
5265
:param base_url: Service URL. Default value is "https://management.azure.com".
5366
:type base_url: str
54-
:keyword api_version: Api Version. Default value is "2022-03-01". Note that overriding this
67+
:keyword api_version: Api Version. Default value is "2022-10-01". Note that overriding this
5568
default value may result in unsupported behavior.
5669
:paramtype api_version: str
5770
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
@@ -65,29 +78,36 @@ def __init__(
6578
base_url: str = "https://management.azure.com",
6679
**kwargs: Any
6780
) -> None:
68-
self._config = CognitiveServicesManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs)
81+
self._config = CognitiveServicesManagementClientConfiguration(
82+
credential=credential, subscription_id=subscription_id, **kwargs
83+
)
6984
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
7085

7186
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
7287
self._serialize = Serializer(client_models)
7388
self._deserialize = Deserializer(client_models)
7489
self._serialize.client_side_validation = False
7590
self.accounts = AccountsOperations(self._client, self._config, self._serialize, self._deserialize)
76-
self.deleted_accounts = DeletedAccountsOperations(self._client, self._config, self._serialize, self._deserialize)
91+
self.deleted_accounts = DeletedAccountsOperations(
92+
self._client, self._config, self._serialize, self._deserialize
93+
)
7794
self.resource_skus = ResourceSkusOperations(self._client, self._config, self._serialize, self._deserialize)
7895
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
79-
self.commitment_tiers = CommitmentTiersOperations(self._client, self._config, self._serialize, self._deserialize)
80-
self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize)
81-
self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize)
96+
self.commitment_tiers = CommitmentTiersOperations(
97+
self._client, self._config, self._serialize, self._deserialize
98+
)
99+
self.private_endpoint_connections = PrivateEndpointConnectionsOperations(
100+
self._client, self._config, self._serialize, self._deserialize
101+
)
102+
self.private_link_resources = PrivateLinkResourcesOperations(
103+
self._client, self._config, self._serialize, self._deserialize
104+
)
82105
self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize)
83-
self.commitment_plans = CommitmentPlansOperations(self._client, self._config, self._serialize, self._deserialize)
84-
106+
self.commitment_plans = CommitmentPlansOperations(
107+
self._client, self._config, self._serialize, self._deserialize
108+
)
85109

86-
def _send_request(
87-
self,
88-
request: HttpRequest,
89-
**kwargs: Any
90-
) -> HttpResponse:
110+
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
91111
"""Runs the network request through the client's chained policies.
92112
93113
>>> from azure.core.rest import HttpRequest
@@ -96,7 +116,7 @@ def _send_request(
96116
>>> response = client._send_request(request)
97117
<HttpResponse: 200 OK>
98118
99-
For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart
119+
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
100120
101121
:param request: The network request you want to make. Required.
102122
:type request: ~azure.core.rest.HttpRequest

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

+20-24
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,18 @@ class CognitiveServicesManagementClientConfiguration(Configuration): # pylint:
2525
Note that all parameters used to create this instance are saved as instance
2626
attributes.
2727
28-
:param credential: Credential needed for the client to connect to Azure.
28+
:param credential: Credential needed for the client to connect to Azure. Required.
2929
:type credential: ~azure.core.credentials.TokenCredential
30-
:param subscription_id: The ID of the target subscription.
30+
:param subscription_id: The ID of the target subscription. Required.
3131
:type subscription_id: str
32-
:keyword api_version: Api Version. Default value is "2022-03-01". Note that overriding this
32+
:keyword api_version: Api Version. Default value is "2022-10-01". Note that overriding this
3333
default value may result in unsupported behavior.
3434
:paramtype api_version: str
3535
"""
3636

37-
def __init__(
38-
self,
39-
credential: "TokenCredential",
40-
subscription_id: str,
41-
**kwargs: Any
42-
) -> None:
37+
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
4338
super(CognitiveServicesManagementClientConfiguration, self).__init__(**kwargs)
44-
api_version = kwargs.pop('api_version', "2022-03-01") # type: str
39+
api_version = kwargs.pop("api_version", "2022-10-01") # type: str
4540

4641
if credential is None:
4742
raise ValueError("Parameter 'credential' must not be None.")
@@ -51,23 +46,24 @@ def __init__(
5146
self.credential = credential
5247
self.subscription_id = subscription_id
5348
self.api_version = api_version
54-
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
55-
kwargs.setdefault('sdk_moniker', 'mgmt-cognitiveservices/{}'.format(VERSION))
49+
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
50+
kwargs.setdefault("sdk_moniker", "mgmt-cognitiveservices/{}".format(VERSION))
5651
self._configure(**kwargs)
5752

5853
def _configure(
59-
self,
60-
**kwargs # type: Any
54+
self, **kwargs # type: Any
6155
):
6256
# type: (...) -> None
63-
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
64-
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
65-
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
66-
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
67-
self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs)
68-
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
69-
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
70-
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
71-
self.authentication_policy = kwargs.get('authentication_policy')
57+
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
58+
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
59+
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
60+
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
61+
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
62+
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
63+
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
64+
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
65+
self.authentication_policy = kwargs.get("authentication_policy")
7266
if self.credential and not self.authentication_policy:
73-
self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)
67+
self.authentication_policy = ARMChallengeAuthenticationPolicy(
68+
self.credential, *self.credential_scopes, **kwargs
69+
)

sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_patch.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@
2828
# This file is used for handwritten extensions to the generated code. Example:
2929
# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
3030
def patch_sdk():
31-
pass
31+
pass

0 commit comments

Comments
 (0)