Skip to content

Commit 05936db

Browse files
author
SDKAuto
committed
CodeGen from PR 31831 in Azure/azure-rest-api-specs
Merge 8234dfb03b984836d73ad1820e557c52a8256d70 into 494d37ef9b1ab34ebab08c00da5675302594dc78
1 parent d90e4e4 commit 05936db

File tree

175 files changed

+18833
-3066
lines changed

Some content is hidden

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

175 files changed

+18833
-3066
lines changed

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

Lines changed: 2 additions & 5 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 Cognitive Services Management Client Library.
4-
This package has been tested with Python 3.7+.
4+
This package has been tested with Python 3.8+.
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,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For
1212

1313
### Prerequisites
1414

15-
- Python 3.7+ is required to use this package.
15+
- Python 3.8+ is required to use this package.
1616
- [Azure subscription](https://azure.microsoft.com/free/)
1717

1818
### Install the package
@@ -59,6 +59,3 @@ Code samples for this package can be found at:
5959
If you encounter any bugs or have suggestions, please file an issue in the
6060
[Issues](https://github.com/Azure/azure-sdk-for-python/issues)
6161
section of the project.
62-
63-
64-
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-cognitiveservices%2FREADME.png)
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"commit": "4b7481587132ce0bde5f0a6d6ab590129f7b7179",
2+
"commit": "b5ddb840cd181e9498ef1c8cfedf72c6995c7538",
33
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
4-
"autorest": "3.9.2",
4+
"autorest": "3.10.2",
55
"use": [
6-
"@autorest/python@6.6.0",
7-
"@autorest/modelerfour@4.24.3"
6+
"@autorest/python@6.26.4",
7+
"@autorest/modelerfour@4.27.0"
88
],
9-
"autorest_command": "autorest specification/cognitiveservices/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.6.0 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
9+
"autorest_command": "autorest specification/cognitiveservices/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.26.4 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False",
1010
"readme": "specification/cognitiveservices/resource-manager/readme.md"
1111
}

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,28 @@
55
# Code generated by Microsoft (R) AutoRest Code Generator.
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
8+
# pylint: disable=wrong-import-position
89

9-
from ._cognitive_services_management_client import CognitiveServicesManagementClient
10+
from typing import TYPE_CHECKING
11+
12+
if TYPE_CHECKING:
13+
from ._patch import * # pylint: disable=unused-wildcard-import
14+
15+
from ._cognitive_services_management_client import CognitiveServicesManagementClient # type: ignore
1016
from ._version import VERSION
1117

1218
__version__ = VERSION
1319

1420
try:
1521
from ._patch import __all__ as _patch_all
16-
from ._patch import * # pylint: disable=unused-wildcard-import
22+
from ._patch import *
1723
except ImportError:
1824
_patch_all = []
1925
from ._patch import patch_sdk as _patch_sdk
2026

2127
__all__ = [
2228
"CognitiveServicesManagementClient",
2329
]
24-
__all__.extend([p for p in _patch_all if p not in __all__])
30+
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
2531

2632
_patch_sdk()

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

Lines changed: 83 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@
88

99
from copy import deepcopy
1010
from typing import Any, TYPE_CHECKING
11+
from typing_extensions import Self
1112

13+
from azure.core.pipeline import policies
1214
from azure.core.rest import HttpRequest, HttpResponse
1315
from azure.mgmt.core import ARMPipelineClient
16+
from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
1417

1518
from . import models as _models
1619
from ._configuration import CognitiveServicesManagementClientConfiguration
@@ -20,24 +23,32 @@
2023
CognitiveServicesManagementClientOperationsMixin,
2124
CommitmentPlansOperations,
2225
CommitmentTiersOperations,
26+
DefenderForAISettingsOperations,
2327
DeletedAccountsOperations,
2428
DeploymentsOperations,
29+
EncryptionScopesOperations,
30+
LocationBasedModelCapacitiesOperations,
31+
ModelCapacitiesOperations,
2532
ModelsOperations,
33+
NetworkSecurityPerimeterConfigurationsOperations,
2634
Operations,
2735
PrivateEndpointConnectionsOperations,
2836
PrivateLinkResourcesOperations,
37+
RaiBlocklistItemsOperations,
38+
RaiBlocklistsOperations,
39+
RaiContentFiltersOperations,
40+
RaiPoliciesOperations,
2941
ResourceSkusOperations,
3042
UsagesOperations,
3143
)
3244

3345
if TYPE_CHECKING:
34-
# pylint: disable=unused-import,ungrouped-imports
3546
from azure.core.credentials import TokenCredential
3647

3748

3849
class CognitiveServicesManagementClient(
3950
CognitiveServicesManagementClientOperationsMixin
40-
): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
51+
): # pylint: disable=too-many-instance-attributes
4152
"""Cognitive Services Management Client.
4253
4354
:ivar accounts: AccountsOperations operations
@@ -54,6 +65,11 @@ class CognitiveServicesManagementClient(
5465
:vartype commitment_tiers: azure.mgmt.cognitiveservices.operations.CommitmentTiersOperations
5566
:ivar models: ModelsOperations operations
5667
:vartype models: azure.mgmt.cognitiveservices.operations.ModelsOperations
68+
:ivar location_based_model_capacities: LocationBasedModelCapacitiesOperations operations
69+
:vartype location_based_model_capacities:
70+
azure.mgmt.cognitiveservices.operations.LocationBasedModelCapacitiesOperations
71+
:ivar model_capacities: ModelCapacitiesOperations operations
72+
:vartype model_capacities: azure.mgmt.cognitiveservices.operations.ModelCapacitiesOperations
5773
:ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations
5874
:vartype private_endpoint_connections:
5975
azure.mgmt.cognitiveservices.operations.PrivateEndpointConnectionsOperations
@@ -64,13 +80,32 @@ class CognitiveServicesManagementClient(
6480
:vartype deployments: azure.mgmt.cognitiveservices.operations.DeploymentsOperations
6581
:ivar commitment_plans: CommitmentPlansOperations operations
6682
:vartype commitment_plans: azure.mgmt.cognitiveservices.operations.CommitmentPlansOperations
83+
:ivar encryption_scopes: EncryptionScopesOperations operations
84+
:vartype encryption_scopes: azure.mgmt.cognitiveservices.operations.EncryptionScopesOperations
85+
:ivar rai_policies: RaiPoliciesOperations operations
86+
:vartype rai_policies: azure.mgmt.cognitiveservices.operations.RaiPoliciesOperations
87+
:ivar rai_blocklists: RaiBlocklistsOperations operations
88+
:vartype rai_blocklists: azure.mgmt.cognitiveservices.operations.RaiBlocklistsOperations
89+
:ivar rai_blocklist_items: RaiBlocklistItemsOperations operations
90+
:vartype rai_blocklist_items:
91+
azure.mgmt.cognitiveservices.operations.RaiBlocklistItemsOperations
92+
:ivar rai_content_filters: RaiContentFiltersOperations operations
93+
:vartype rai_content_filters:
94+
azure.mgmt.cognitiveservices.operations.RaiContentFiltersOperations
95+
:ivar network_security_perimeter_configurations:
96+
NetworkSecurityPerimeterConfigurationsOperations operations
97+
:vartype network_security_perimeter_configurations:
98+
azure.mgmt.cognitiveservices.operations.NetworkSecurityPerimeterConfigurationsOperations
99+
:ivar defender_for_ai_settings: DefenderForAISettingsOperations operations
100+
:vartype defender_for_ai_settings:
101+
azure.mgmt.cognitiveservices.operations.DefenderForAISettingsOperations
67102
:param credential: Credential needed for the client to connect to Azure. Required.
68103
:type credential: ~azure.core.credentials.TokenCredential
69104
:param subscription_id: The ID of the target subscription. Required.
70105
:type subscription_id: str
71106
:param base_url: Service URL. Default value is "https://management.azure.com".
72107
:type base_url: str
73-
:keyword api_version: Api Version. Default value is "2023-05-01". Note that overriding this
108+
:keyword api_version: Api Version. Default value is "2024-10-01". Note that overriding this
74109
default value may result in unsupported behavior.
75110
:paramtype api_version: str
76111
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
@@ -87,7 +122,25 @@ def __init__(
87122
self._config = CognitiveServicesManagementClientConfiguration(
88123
credential=credential, subscription_id=subscription_id, **kwargs
89124
)
90-
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
125+
_policies = kwargs.pop("policies", None)
126+
if _policies is None:
127+
_policies = [
128+
policies.RequestIdPolicy(**kwargs),
129+
self._config.headers_policy,
130+
self._config.user_agent_policy,
131+
self._config.proxy_policy,
132+
policies.ContentDecodePolicy(**kwargs),
133+
ARMAutoResourceProviderRegistrationPolicy(),
134+
self._config.redirect_policy,
135+
self._config.retry_policy,
136+
self._config.authentication_policy,
137+
self._config.custom_hook_policy,
138+
self._config.logging_policy,
139+
policies.DistributedTracingPolicy(**kwargs),
140+
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
141+
self._config.http_logging_policy,
142+
]
143+
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
91144

92145
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
93146
self._serialize = Serializer(client_models)
@@ -104,6 +157,12 @@ def __init__(
104157
self._client, self._config, self._serialize, self._deserialize
105158
)
106159
self.models = ModelsOperations(self._client, self._config, self._serialize, self._deserialize)
160+
self.location_based_model_capacities = LocationBasedModelCapacitiesOperations(
161+
self._client, self._config, self._serialize, self._deserialize
162+
)
163+
self.model_capacities = ModelCapacitiesOperations(
164+
self._client, self._config, self._serialize, self._deserialize
165+
)
107166
self.private_endpoint_connections = PrivateEndpointConnectionsOperations(
108167
self._client, self._config, self._serialize, self._deserialize
109168
)
@@ -114,8 +173,25 @@ def __init__(
114173
self.commitment_plans = CommitmentPlansOperations(
115174
self._client, self._config, self._serialize, self._deserialize
116175
)
176+
self.encryption_scopes = EncryptionScopesOperations(
177+
self._client, self._config, self._serialize, self._deserialize
178+
)
179+
self.rai_policies = RaiPoliciesOperations(self._client, self._config, self._serialize, self._deserialize)
180+
self.rai_blocklists = RaiBlocklistsOperations(self._client, self._config, self._serialize, self._deserialize)
181+
self.rai_blocklist_items = RaiBlocklistItemsOperations(
182+
self._client, self._config, self._serialize, self._deserialize
183+
)
184+
self.rai_content_filters = RaiContentFiltersOperations(
185+
self._client, self._config, self._serialize, self._deserialize
186+
)
187+
self.network_security_perimeter_configurations = NetworkSecurityPerimeterConfigurationsOperations(
188+
self._client, self._config, self._serialize, self._deserialize
189+
)
190+
self.defender_for_ai_settings = DefenderForAISettingsOperations(
191+
self._client, self._config, self._serialize, self._deserialize
192+
)
117193

118-
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
194+
def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
119195
"""Runs the network request through the client's chained policies.
120196
121197
>>> from azure.core.rest import HttpRequest
@@ -135,12 +211,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
135211

136212
request_copy = deepcopy(request)
137213
request_copy.url = self._client.format_url(request_copy.url)
138-
return self._client.send_request(request_copy, **kwargs)
214+
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
139215

140216
def close(self) -> None:
141217
self._client.close()
142218

143-
def __enter__(self) -> "CognitiveServicesManagementClient":
219+
def __enter__(self) -> Self:
144220
self._client.__enter__()
145221
return self
146222

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,16 @@
88

99
from typing import Any, TYPE_CHECKING
1010

11-
from azure.core.configuration import Configuration
1211
from azure.core.pipeline import policies
1312
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
1413

1514
from ._version import VERSION
1615

1716
if TYPE_CHECKING:
18-
# pylint: disable=unused-import,ungrouped-imports
1917
from azure.core.credentials import TokenCredential
2018

2119

22-
class CognitiveServicesManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
20+
class CognitiveServicesManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
2321
"""Configuration for CognitiveServicesManagementClient.
2422
2523
Note that all parameters used to create this instance are saved as instance
@@ -29,14 +27,13 @@ class CognitiveServicesManagementClientConfiguration(Configuration): # pylint:
2927
:type credential: ~azure.core.credentials.TokenCredential
3028
:param subscription_id: The ID of the target subscription. Required.
3129
:type subscription_id: str
32-
:keyword api_version: Api Version. Default value is "2023-05-01". Note that overriding this
30+
:keyword api_version: Api Version. Default value is "2024-10-01". Note that overriding this
3331
default value may result in unsupported behavior.
3432
:paramtype api_version: str
3533
"""
3634

3735
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
38-
super(CognitiveServicesManagementClientConfiguration, self).__init__(**kwargs)
39-
api_version: str = kwargs.pop("api_version", "2023-05-01")
36+
api_version: str = kwargs.pop("api_version", "2024-10-01")
4037

4138
if credential is None:
4239
raise ValueError("Parameter 'credential' must not be None.")
@@ -48,6 +45,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs
4845
self.api_version = api_version
4946
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
5047
kwargs.setdefault("sdk_moniker", "mgmt-cognitiveservices/{}".format(VERSION))
48+
self.polling_interval = kwargs.get("polling_interval", 30)
5149
self._configure(**kwargs)
5250

5351
def _configure(self, **kwargs: Any) -> None:
@@ -56,9 +54,9 @@ def _configure(self, **kwargs: Any) -> None:
5654
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
5755
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
5856
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
59-
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
6057
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
6158
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
59+
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
6260
self.authentication_policy = kwargs.get("authentication_policy")
6361
if self.credential and not self.authentication_policy:
6462
self.authentication_policy = ARMChallengeAuthenticationPolicy(

0 commit comments

Comments
 (0)