diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/CHANGELOG.md b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/CHANGELOG.md index da0153c8214c..7017ecf00e10 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/CHANGELOG.md +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/CHANGELOG.md @@ -1,5 +1,82 @@ # Release History +## 13.7.0b1 (2025-04-10) + +### Features Added + + - Client `CognitiveServicesManagementClient` added operation group `projects` + - Client `CognitiveServicesManagementClient` added operation group `account_connection` + - Client `CognitiveServicesManagementClient` added operation group `project_connection` + - Client `CognitiveServicesManagementClient` added operation group `account_capability_hosts` + - Client `CognitiveServicesManagementClient` added operation group `project_capability_hosts` + - Model `AccountProperties` added property `network_injections` + - Model `AccountProperties` added property `allow_project_management` + - Model `AccountProperties` added property `default_project` + - Model `AccountProperties` added property `associated_projects` + - Enum `ProvisioningState` added member `CANCELED` + - Added model `AADAuthTypeConnectionProperties` + - Added model `AccessKeyAuthTypeConnectionProperties` + - Added model `AccountKeyAuthTypeConnectionProperties` + - Added model `ApiKeyAuthConnectionProperties` + - Added model `CapabilityHost` + - Added enum `CapabilityHostKind` + - Added model `CapabilityHostProperties` + - Added enum `CapabilityHostProvisioningState` + - Added model `ConnectionAccessKey` + - Added model `ConnectionAccountKey` + - Added model `ConnectionApiKey` + - Added enum `ConnectionAuthType` + - Added enum `ConnectionCategory` + - Added enum `ConnectionGroup` + - Added model `ConnectionManagedIdentity` + - Added model `ConnectionOAuth2` + - Added model `ConnectionPersonalAccessToken` + - Added model `ConnectionPropertiesV2` + - Added model `ConnectionPropertiesV2BasicResource` + - Added model `ConnectionPropertiesV2BasicResourceArmPaginatedResult` + - Added model `ConnectionServicePrincipal` + - Added model `ConnectionSharedAccessSignature` + - Added model `ConnectionUpdateContent` + - Added model `ConnectionUsernamePassword` + - Added model `CustomKeys` + - Added model `CustomKeysConnectionProperties` + - Added model `ManagedIdentityAuthTypeConnectionProperties` + - Added enum `ManagedPERequirement` + - Added enum `ManagedPEStatus` + - Added model `NetworkInjections` + - Added model `NoneAuthTypeConnectionProperties` + - Added model `OAuth2AuthTypeConnectionProperties` + - Added model `PATAuthTypeConnectionProperties` + - Added model `Project` + - Added model `ProjectListResult` + - Added model `ProjectProperties` + - Added model `ResourceBase` + - Added model `SASAuthTypeConnectionProperties` + - Added enum `ScenarioType` + - Added model `ServicePrincipalAuthTypeConnectionProperties` + - Added model `UsernamePasswordAuthTypeConnectionProperties` + - Added model `AccountCapabilityHostsOperations` + - Added model `AccountConnectionOperations` + - Added model `ProjectCapabilityHostsOperations` + - Added model `ProjectConnectionOperations` + - Added model `ProjectsOperations` + - Method `AccountCapabilityHostsOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, account_name: str, capability_host_name: str, body: CapabilityHost, content_type: str)` + - Method `AccountCapabilityHostsOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, account_name: str, capability_host_name: str, body: IO[bytes], content_type: str)` + - Method `AccountConnectionOperations.create` has a new overload `def create(self: None, resource_group_name: str, account_name: str, connection_name: str, body: Optional[ConnectionPropertiesV2BasicResource], content_type: str)` + - Method `AccountConnectionOperations.create` has a new overload `def create(self: None, resource_group_name: str, account_name: str, connection_name: str, body: Optional[IO[bytes]], content_type: str)` + - Method `AccountConnectionOperations.update` has a new overload `def update(self: None, resource_group_name: str, account_name: str, connection_name: str, body: Optional[ConnectionUpdateContent], content_type: str)` + - Method `AccountConnectionOperations.update` has a new overload `def update(self: None, resource_group_name: str, account_name: str, connection_name: str, body: Optional[IO[bytes]], content_type: str)` + - Method `ProjectCapabilityHostsOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, account_name: str, project_name: str, capability_host_name: str, body: CapabilityHost, content_type: str)` + - Method `ProjectCapabilityHostsOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, account_name: str, project_name: str, capability_host_name: str, body: IO[bytes], content_type: str)` + - Method `ProjectConnectionOperations.create` has a new overload `def create(self: None, resource_group_name: str, account_name: str, project_name: str, connection_name: str, body: Optional[ConnectionPropertiesV2BasicResource], content_type: str)` + - Method `ProjectConnectionOperations.create` has a new overload `def create(self: None, resource_group_name: str, account_name: str, project_name: str, connection_name: str, body: Optional[IO[bytes]], content_type: str)` + - Method `ProjectConnectionOperations.update` has a new overload `def update(self: None, resource_group_name: str, account_name: str, project_name: str, connection_name: str, body: Optional[ConnectionUpdateContent], content_type: str)` + - Method `ProjectConnectionOperations.update` has a new overload `def update(self: None, resource_group_name: str, account_name: str, project_name: str, connection_name: str, body: Optional[IO[bytes]], content_type: str)` + - Method `ProjectsOperations.begin_create` has a new overload `def begin_create(self: None, resource_group_name: str, account_name: str, project_name: str, project: Project, content_type: str)` + - Method `ProjectsOperations.begin_create` has a new overload `def begin_create(self: None, resource_group_name: str, account_name: str, project_name: str, project: IO[bytes], content_type: str)` + - Method `ProjectsOperations.begin_update` has a new overload `def begin_update(self: None, resource_group_name: str, account_name: str, project_name: str, project: Project, content_type: str)` + - Method `ProjectsOperations.begin_update` has a new overload `def begin_update(self: None, resource_group_name: str, account_name: str, project_name: str, project: IO[bytes], content_type: str)` + ## 13.6.0 (2024-12-19) ### Features Added diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/README.md b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/README.md index da310df8a0f8..46dfe481351d 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/README.md +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/README.md @@ -24,7 +24,7 @@ pip install azure-identity ### Authentication -By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configuration of the following environment variables. - `AZURE_CLIENT_ID` for Azure client ID. - `AZURE_TENANT_ID` for Azure tenant ID. diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/_meta.json b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/_meta.json index cdaa7a9724c7..e989d92e97b4 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/_meta.json +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/_meta.json @@ -1,11 +1,11 @@ { - "commit": "0383d4a163beb3e58e7b4cb3c06172d32ddd8c85", + "commit": "2269fe45bfc3b338a433ced89c579b3e9b24a5f4", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.10.2", "use": [ - "@autorest/python@6.19.0", + "@autorest/python@6.27.4", "@autorest/modelerfour@4.27.0" ], - "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/azure-sdk-for-python/sdk --use=@autorest/python@6.19.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", + "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.27.4 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "readme": "specification/cognitiveservices/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/__init__.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/__init__.py index 534cb95c3a3f..cf2ee8a715df 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/__init__.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/__init__.py @@ -5,15 +5,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._cognitive_services_management_client import CognitiveServicesManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._cognitive_services_management_client import CognitiveServicesManagementClient # type: ignore from ._version import VERSION __version__ = VERSION try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -21,6 +27,6 @@ __all__ = [ "CognitiveServicesManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_cognitive_services_management_client.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_cognitive_services_management_client.py index a1f1c2283335..623f4236ad03 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_cognitive_services_management_client.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_cognitive_services_management_client.py @@ -19,6 +19,8 @@ from ._configuration import CognitiveServicesManagementClientConfiguration from ._serialization import Deserializer, Serializer from .operations import ( + AccountCapabilityHostsOperations, + AccountConnectionOperations, AccountsOperations, CognitiveServicesManagementClientOperationsMixin, CommitmentPlansOperations, @@ -34,6 +36,9 @@ Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, + ProjectCapabilityHostsOperations, + ProjectConnectionOperations, + ProjectsOperations, RaiBlocklistItemsOperations, RaiBlocklistsOperations, RaiContentFiltersOperations, @@ -43,13 +48,12 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential class CognitiveServicesManagementClient( CognitiveServicesManagementClientOperationsMixin -): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +): # pylint: disable=too-many-instance-attributes """Cognitive Services Management Client. :ivar accounts: AccountsOperations operations @@ -100,14 +104,28 @@ class CognitiveServicesManagementClient( :ivar defender_for_ai_settings: DefenderForAISettingsOperations operations :vartype defender_for_ai_settings: azure.mgmt.cognitiveservices.operations.DefenderForAISettingsOperations + :ivar projects: ProjectsOperations operations + :vartype projects: azure.mgmt.cognitiveservices.operations.ProjectsOperations + :ivar account_connection: AccountConnectionOperations operations + :vartype account_connection: + azure.mgmt.cognitiveservices.operations.AccountConnectionOperations + :ivar project_connection: ProjectConnectionOperations operations + :vartype project_connection: + azure.mgmt.cognitiveservices.operations.ProjectConnectionOperations + :ivar account_capability_hosts: AccountCapabilityHostsOperations operations + :vartype account_capability_hosts: + azure.mgmt.cognitiveservices.operations.AccountCapabilityHostsOperations + :ivar project_capability_hosts: ProjectCapabilityHostsOperations operations + :vartype project_capability_hosts: + azure.mgmt.cognitiveservices.operations.ProjectCapabilityHostsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2024-10-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2025-04-01-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -191,6 +209,19 @@ def __init__( self.defender_for_ai_settings = DefenderForAISettingsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.projects = ProjectsOperations(self._client, self._config, self._serialize, self._deserialize) + self.account_connection = AccountConnectionOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.project_connection = ProjectConnectionOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.account_capability_hosts = AccountCapabilityHostsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.project_capability_hosts = ProjectCapabilityHostsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_configuration.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_configuration.py index fe5d779db3a0..92b95f87f5e2 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_configuration.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_configuration.py @@ -14,7 +14,6 @@ from ._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -28,13 +27,13 @@ class CognitiveServicesManagementClientConfiguration: # pylint: disable=too-man :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2024-10-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2025-04-01-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2024-10-01") + api_version: str = kwargs.pop("api_version", "2025-04-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_serialization.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_serialization.py index 8139854b97bb..b24ab2885450 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_serialization.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_serialization.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # # Copyright (c) Microsoft Corporation. All rights reserved. @@ -24,7 +25,6 @@ # # -------------------------------------------------------------------------- -# pylint: skip-file # pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode @@ -52,7 +52,6 @@ MutableMapping, Type, List, - Mapping, ) try: @@ -91,6 +90,8 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: :param data: Input, could be bytes or stream (will be decoded with UTF8) or text :type data: str or bytes or IO :param str content_type: The content type. + :return: The deserialized data. + :rtype: object """ if hasattr(data, "read"): # Assume a stream @@ -112,7 +113,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: try: return json.loads(data_as_str) except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) + raise DeserializationError("JSON is invalid: {}".format(err), err) from err elif "xml" in (content_type or []): try: @@ -155,6 +156,11 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], Use bytes and headers to NOT use any requests/aiohttp or whatever specific implementation. Headers will tested for "content-type" + + :param bytes body_bytes: The body of the response. + :param dict headers: The headers of the response. + :returns: The deserialized data. + :rtype: object """ # Try to use content-type from headers if available content_type = None @@ -184,15 +190,30 @@ class UTC(datetime.tzinfo): """Time Zone info for handling UTC""" def utcoffset(self, dt): - """UTF offset for UTC is 0.""" + """UTF offset for UTC is 0. + + :param datetime.datetime dt: The datetime + :returns: The offset + :rtype: datetime.timedelta + """ return datetime.timedelta(0) def tzname(self, dt): - """Timestamp representation.""" + """Timestamp representation. + + :param datetime.datetime dt: The datetime + :returns: The timestamp representation + :rtype: str + """ return "Z" def dst(self, dt): - """No daylight saving for UTC.""" + """No daylight saving for UTC. + + :param datetime.datetime dt: The datetime + :returns: The daylight saving time + :rtype: datetime.timedelta + """ return datetime.timedelta(hours=1) @@ -206,7 +227,7 @@ class _FixedOffset(datetime.tzinfo): # type: ignore :param datetime.timedelta offset: offset in timedelta format """ - def __init__(self, offset): + def __init__(self, offset) -> None: self.__offset = offset def utcoffset(self, dt): @@ -235,24 +256,26 @@ def __getinitargs__(self): _FLATTEN = re.compile(r"(? None: self.additional_properties: Optional[Dict[str, Any]] = {} - for k in kwargs: + for k in kwargs: # pylint: disable=consider-using-dict-items if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) elif k in self._validation and self._validation[k].get("readonly", False): @@ -300,13 +330,23 @@ def __init__(self, **kwargs: Any) -> None: setattr(self, k, kwargs[k]) def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are equal + :rtype: bool + """ if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are not equal + :rtype: bool + """ return not self.__eq__(other) def __str__(self) -> str: @@ -326,7 +366,11 @@ def is_xml_model(cls) -> bool: @classmethod def _create_xml_node(cls): - """Create XML node.""" + """Create XML node. + + :returns: The XML node + :rtype: xml.etree.ElementTree.Element + """ try: xml_map = cls._xml_map # type: ignore except AttributeError: @@ -346,7 +390,9 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, keep_readonly=keep_readonly, **kwargs + ) def as_dict( self, @@ -380,12 +426,15 @@ def my_key_transformer(key, attr_desc, value): If you want XML serialization, you can pass the kwargs is_xml=True. + :param bool keep_readonly: If you want to serialize the readonly attributes :param function key_transformer: A key transformer function. :returns: A dict JSON compatible object :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs + ) @classmethod def _infer_class_models(cls): @@ -395,7 +444,7 @@ def _infer_class_models(cls): client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} if cls.__name__ not in client_models: raise ValueError("Not Autorest generated code") - except Exception: + except Exception: # pylint: disable=broad-exception-caught # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. client_models = {cls.__name__: cls} return client_models @@ -408,6 +457,7 @@ def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = N :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model :raises: DeserializationError if something went wrong + :rtype: ModelType """ deserializer = Deserializer(cls._infer_class_models()) return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @@ -426,9 +476,11 @@ def from_dict( and last_rest_key_case_insensitive_extractor) :param dict data: A dict using RestAPI structure + :param function key_extractors: A key extractor function. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model :raises: DeserializationError if something went wrong + :rtype: ModelType """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -448,21 +500,25 @@ def _flatten_subtype(cls, key, objects): return {} result = dict(cls._subtype_map[key]) for valuetype in cls._subtype_map[key].values(): - result.update(objects[valuetype]._flatten_subtype(key, objects)) + result.update(objects[valuetype]._flatten_subtype(key, objects)) # pylint: disable=protected-access return result @classmethod def _classify(cls, response, objects): """Check the class _subtype_map for any child classes. We want to ignore any inherited _subtype_maps. - Remove the polymorphic key from the initial data. + + :param dict response: The initial data + :param dict objects: The class objects + :returns: The class to be used + :rtype: class """ for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): subtype_value = None if not isinstance(response, ET.Element): rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) + subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) else: subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) if subtype_value: @@ -501,11 +557,13 @@ def _decode_attribute_map_key(key): inside the received data. :param str key: A key string from the generated code + :returns: The decoded key + :rtype: str """ return key.replace("\\.", ".") -class Serializer(object): +class Serializer: # pylint: disable=too-many-public-methods """Request object model serializer.""" basic_types = {str: "str", int: "int", bool: "bool", float: "float"} @@ -540,7 +598,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, type]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -560,13 +618,16 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None): self.key_transformer = full_restapi_key_transformer self.client_side_validation = True - def _serialize(self, target_obj, data_type=None, **kwargs): + def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals + self, target_obj, data_type=None, **kwargs + ): """Serialize data into a string according to type. - :param target_obj: The data to be serialized. + :param object target_obj: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, dict :raises: SerializationError if serialization fails. + :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) keep_readonly = kwargs.get("keep_readonly", False) @@ -592,12 +653,14 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized = {} if is_xml_model_serialization: - serialized = target_obj._create_xml_node() + serialized = target_obj._create_xml_node() # pylint: disable=protected-access try: - attributes = target_obj._attribute_map + attributes = target_obj._attribute_map # pylint: disable=protected-access for attr, attr_desc in attributes.items(): attr_name = attr - if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): + if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access + attr_name, {} + ).get("readonly", False): continue if attr_name == "additional_properties" and attr_desc["key"] == "": @@ -633,7 +696,8 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if isinstance(new_attr, list): serialized.extend(new_attr) # type: ignore elif isinstance(new_attr, ET.Element): - # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. + # If the down XML has no XML/Name, + # we MUST replace the tag with the local tag. But keeping the namespaces. if "name" not in getattr(orig_attr, "_xml_map", {}): splitted_tag = new_attr.tag.split("}") if len(splitted_tag) == 2: # Namespace @@ -664,17 +728,17 @@ def _serialize(self, target_obj, data_type=None, **kwargs): except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) raise SerializationError(msg) from err - else: - return serialized + return serialized def body(self, data, data_type, **kwargs): """Serialize data intended for a request body. - :param data: The data to be serialized. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: dict :raises: SerializationError if serialization fails. :raises: ValueError if data is None + :returns: The serialized request body """ # Just in case this is a dict @@ -703,7 +767,7 @@ def body(self, data, data_type, **kwargs): attribute_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, ] - data = deserializer._deserialize(data_type, data) + data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access except DeserializationError as err: raise SerializationError("Unable to build a model: " + str(err)) from err @@ -712,9 +776,11 @@ def body(self, data, data_type, **kwargs): def url(self, name, data, data_type, **kwargs): """Serialize data intended for a URL path. - :param data: The data to be serialized. + :param str name: The name of the URL path parameter. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str + :returns: The serialized URL path :raises: TypeError if serialization fails. :raises: ValueError if data is None """ @@ -728,21 +794,20 @@ def url(self, name, data, data_type, **kwargs): output = output.replace("{", quote("{")).replace("}", quote("}")) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return output + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return output def query(self, name, data, data_type, **kwargs): """Serialize data intended for a URL query. - :param data: The data to be serialized. + :param str name: The name of the query parameter. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :keyword bool skip_quote: Whether to skip quote the serialized result. - Defaults to False. :rtype: str, list :raises: TypeError if serialization fails. :raises: ValueError if data is None + :returns: The serialized query parameter """ try: # Treat the list aside, since we don't want to encode the div separator @@ -759,19 +824,20 @@ def query(self, name, data, data_type, **kwargs): output = str(output) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) def header(self, name, data, data_type, **kwargs): """Serialize data intended for a request header. - :param data: The data to be serialized. + :param str name: The name of the header. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str :raises: TypeError if serialization fails. :raises: ValueError if data is None + :returns: The serialized header """ try: if data_type in ["[str]"]: @@ -780,21 +846,20 @@ def header(self, name, data, data_type, **kwargs): output = self.serialize_data(data, data_type, **kwargs) if data_type == "bool": output = json.dumps(output) - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) def serialize_data(self, data, data_type, **kwargs): """Serialize generic data according to supplied data type. - :param data: The data to be serialized. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :param bool required: Whether it's essential that the data not be - empty or None :raises: AttributeError if required data is None. :raises: ValueError if data is None :raises: SerializationError if serialization fails. + :returns: The serialized data. + :rtype: str, int, float, bool, dict, list """ if data is None: raise ValueError("No value for given attribute") @@ -805,7 +870,7 @@ def serialize_data(self, data, data_type, **kwargs): if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) - elif data_type in self.serialize_type: + if data_type in self.serialize_type: return self.serialize_type[data_type](data, **kwargs) # If dependencies is empty, try with current data class @@ -821,11 +886,10 @@ def serialize_data(self, data, data_type, **kwargs): except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." raise SerializationError(msg.format(data, data_type)) from err - else: - return self._serialize(data, **kwargs) + return self._serialize(data, **kwargs) @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): + def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) if custom_serializer: return custom_serializer @@ -841,23 +905,26 @@ def serialize_basic(cls, data, data_type, **kwargs): - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - is_xml bool : If set, use xml_basic_types_serializers - :param data: Object to be serialized. + :param obj data: Object to be serialized. :param str data_type: Type of object in the iterable. + :rtype: str, int, float, bool + :return: serialized object """ custom_serializer = cls._get_custom_serializers(data_type, **kwargs) if custom_serializer: return custom_serializer(data) if data_type == "str": return cls.serialize_unicode(data) - return eval(data_type)(data) # nosec + return eval(data_type)(data) # nosec # pylint: disable=eval-used @classmethod def serialize_unicode(cls, data): """Special handling for serializing unicode strings in Py2. Encode to UTF-8 if unicode, otherwise handle as a str. - :param data: Object to be serialized. + :param str data: Object to be serialized. :rtype: str + :return: serialized object """ try: # If I received an enum, return its value return data.value @@ -871,8 +938,7 @@ def serialize_unicode(cls, data): return data except NameError: return str(data) - else: - return str(data) + return str(data) def serialize_iter(self, data, iter_type, div=None, **kwargs): """Serialize iterable. @@ -882,15 +948,13 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): serialization_ctxt['type'] should be same as data_type. - is_xml bool : If set, serialize as XML - :param list attr: Object to be serialized. + :param list data: Object to be serialized. :param str iter_type: Type of object in the iterable. - :param bool required: Whether the objects in the iterable must - not be None or empty. :param str div: If set, this str will be used to combine the elements in the iterable into a combined string. Default is 'None'. - :keyword bool do_quote: Whether to quote the serialized result of each iterable element. Defaults to False. :rtype: list, str + :return: serialized iterable """ if isinstance(data, str): raise SerializationError("Refuse str type as a valid iter type.") @@ -945,9 +1009,8 @@ def serialize_dict(self, attr, dict_type, **kwargs): :param dict attr: Object to be serialized. :param str dict_type: Type of object in the dictionary. - :param bool required: Whether the objects in the dictionary must - not be None or empty. :rtype: dict + :return: serialized dictionary """ serialization_ctxt = kwargs.get("serialization_ctxt", {}) serialized = {} @@ -971,7 +1034,7 @@ def serialize_dict(self, attr, dict_type, **kwargs): return serialized - def serialize_object(self, attr, **kwargs): + def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """Serialize a generic object. This will be handled as a dictionary. If object passed in is not a basic type (str, int, float, dict, list) it will simply be @@ -979,6 +1042,7 @@ def serialize_object(self, attr, **kwargs): :param dict attr: Object to be serialized. :rtype: dict or str + :return: serialized object """ if attr is None: return None @@ -1003,7 +1067,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_decimal(attr) # If it's a model or I know this dependency, serialize as a Model - elif obj_type in self.dependencies.values() or isinstance(attr, Model): + if obj_type in self.dependencies.values() or isinstance(attr, Model): return self._serialize(attr) if obj_type == dict: @@ -1034,56 +1098,61 @@ def serialize_enum(attr, enum_obj=None): try: enum_obj(result) # type: ignore return result - except ValueError: + except ValueError as exc: for enum_value in enum_obj: # type: ignore if enum_value.value.lower() == str(attr).lower(): return enum_value.value error = "{!r} is not valid value for enum {!r}" - raise SerializationError(error.format(attr, enum_obj)) + raise SerializationError(error.format(attr, enum_obj)) from exc @staticmethod - def serialize_bytearray(attr, **kwargs): + def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument """Serialize bytearray into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ return b64encode(attr).decode() @staticmethod - def serialize_base64(attr, **kwargs): + def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument """Serialize str into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ encoded = b64encode(attr).decode("ascii") return encoded.strip("=").replace("+", "-").replace("/", "_") @staticmethod - def serialize_decimal(attr, **kwargs): + def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument """Serialize Decimal object to float. - :param attr: Object to be serialized. + :param decimal attr: Object to be serialized. :rtype: float + :return: serialized decimal """ return float(attr) @staticmethod - def serialize_long(attr, **kwargs): + def serialize_long(attr, **kwargs): # pylint: disable=unused-argument """Serialize long (Py2) or int (Py3). - :param attr: Object to be serialized. + :param int attr: Object to be serialized. :rtype: int/long + :return: serialized long """ return _long_type(attr) @staticmethod - def serialize_date(attr, **kwargs): + def serialize_date(attr, **kwargs): # pylint: disable=unused-argument """Serialize Date object into ISO-8601 formatted string. :param Date attr: Object to be serialized. :rtype: str + :return: serialized date """ if isinstance(attr, str): attr = isodate.parse_date(attr) @@ -1091,11 +1160,12 @@ def serialize_date(attr, **kwargs): return t @staticmethod - def serialize_time(attr, **kwargs): + def serialize_time(attr, **kwargs): # pylint: disable=unused-argument """Serialize Time object into ISO-8601 formatted string. :param datetime.time attr: Object to be serialized. :rtype: str + :return: serialized time """ if isinstance(attr, str): attr = isodate.parse_time(attr) @@ -1105,30 +1175,32 @@ def serialize_time(attr, **kwargs): return t @staticmethod - def serialize_duration(attr, **kwargs): + def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument """Serialize TimeDelta object into ISO-8601 formatted string. :param TimeDelta attr: Object to be serialized. :rtype: str + :return: serialized duration """ if isinstance(attr, str): attr = isodate.parse_duration(attr) return isodate.duration_isoformat(attr) @staticmethod - def serialize_rfc(attr, **kwargs): + def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into RFC-1123 formatted string. :param Datetime attr: Object to be serialized. :rtype: str :raises: TypeError if format invalid. + :return: serialized rfc """ try: if not attr.tzinfo: _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") utc = attr.utctimetuple() - except AttributeError: - raise TypeError("RFC1123 object must be valid Datetime object.") + except AttributeError as exc: + raise TypeError("RFC1123 object must be valid Datetime object.") from exc return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( Serializer.days[utc.tm_wday], @@ -1141,12 +1213,13 @@ def serialize_rfc(attr, **kwargs): ) @staticmethod - def serialize_iso(attr, **kwargs): + def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into ISO-8601 formatted string. :param Datetime attr: Object to be serialized. :rtype: str :raises: SerializationError if format invalid. + :return: serialized iso """ if isinstance(attr, str): attr = isodate.parse_datetime(attr) @@ -1172,13 +1245,14 @@ def serialize_iso(attr, **kwargs): raise TypeError(msg) from err @staticmethod - def serialize_unix(attr, **kwargs): + def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into IntTime format. This is represented as seconds. :param Datetime attr: Object to be serialized. :rtype: int :raises: SerializationError if format invalid + :return: serialied unix """ if isinstance(attr, int): return attr @@ -1186,11 +1260,11 @@ def serialize_unix(attr, **kwargs): if not attr.tzinfo: _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") return int(calendar.timegm(attr.utctimetuple())) - except AttributeError: - raise TypeError("Unix time object must be valid Datetime object.") + except AttributeError as exc: + raise TypeError("Unix time object must be valid Datetime object.") from exc -def rest_key_extractor(attr, attr_desc, data): +def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument key = attr_desc["key"] working_data = data @@ -1211,7 +1285,9 @@ def rest_key_extractor(attr, attr_desc, data): return working_data.get(key) -def rest_key_case_insensitive_extractor(attr, attr_desc, data): +def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements + attr, attr_desc, data +): key = attr_desc["key"] working_data = data @@ -1232,17 +1308,29 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): return attribute_key_case_insensitive_extractor(key, None, working_data) -def last_rest_key_extractor(attr, attr_desc, data): - """Extract the attribute in "data" based on the last part of the JSON path key.""" +def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ key = attr_desc["key"] dict_keys = _FLATTEN.split(key) return attribute_key_extractor(dict_keys[-1], None, data) -def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument """Extract the attribute in "data" based on the last part of the JSON path key. This is the case insensitive version of "last_rest_key_extractor" + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute """ key = attr_desc["key"] dict_keys = _FLATTEN.split(key) @@ -1279,7 +1367,7 @@ def _extract_name_from_internal_type(internal_type): return xml_name -def xml_key_extractor(attr, attr_desc, data): +def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements if isinstance(data, dict): return None @@ -1331,22 +1419,21 @@ def xml_key_extractor(attr, attr_desc, data): if is_iter_type: if is_wrapped: return None # is_wrapped no node, we want None - else: - return [] # not wrapped, assume empty list + return [] # not wrapped, assume empty list return None # Assume it's not there, maybe an optional node. # If is_iter_type and not wrapped, return all found children if is_iter_type: if not is_wrapped: return children - else: # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) + # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( # pylint: disable=line-too-long + xml_name ) - return list(children[0]) # Might be empty list and that's ok. + ) + return list(children[0]) # Might be empty list and that's ok. # Here it's not a itertype, we should have found one element only or empty if len(children) > 1: @@ -1354,7 +1441,7 @@ def xml_key_extractor(attr, attr_desc, data): return children[0] -class Deserializer(object): +class Deserializer: """Response object model deserializer. :param dict classes: Class type dictionary for deserializing complex types. @@ -1363,9 +1450,9 @@ class Deserializer(object): basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, type]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1403,11 +1490,12 @@ def __call__(self, target_obj, response_data, content_type=None): :param str content_type: Swagger "produces" if available. :raises: DeserializationError if deserialization fails. :return: Deserialized object. + :rtype: object """ data = self._unpack_content(response_data, content_type) return self._deserialize(target_obj, data) - def _deserialize(self, target_obj, data): + def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements """Call the deserializer on a model. Data needs to be already deserialized as JSON or XML ElementTree @@ -1416,12 +1504,13 @@ def _deserialize(self, target_obj, data): :param object data: Object to deserialize. :raises: DeserializationError if deserialization fails. :return: Deserialized object. + :rtype: object """ # This is already a model, go recursive just in case if hasattr(data, "_attribute_map"): constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] try: - for attr, mapconfig in data._attribute_map.items(): + for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access if attr in constants: continue value = getattr(data, attr) @@ -1440,13 +1529,13 @@ def _deserialize(self, target_obj, data): if isinstance(response, str): return self.deserialize_data(data, response) - elif isinstance(response, type) and issubclass(response, Enum): + if isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) if data is None or data is CoreNull: return data try: - attributes = response._attribute_map # type: ignore + attributes = response._attribute_map # type: ignore # pylint: disable=protected-access d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... @@ -1476,9 +1565,8 @@ def _deserialize(self, target_obj, data): except (AttributeError, TypeError, KeyError) as err: msg = "Unable to deserialize to object: " + class_name # type: ignore raise DeserializationError(msg) from err - else: - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) def _build_additional_properties(self, attribute_map, data): if not self.additional_properties_detection: @@ -1505,6 +1593,8 @@ def _classify_target(self, target, data): :param str target: The target object type to deserialize to. :param str/dict data: The response data to deserialize. + :return: The classified target object and its class name. + :rtype: tuple """ if target is None: return None, None @@ -1516,7 +1606,7 @@ def _classify_target(self, target, data): return target, target try: - target = target._classify(data, self.dependencies) # type: ignore + target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1531,10 +1621,12 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): :param str target_obj: The target object type to deserialize to. :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. + :return: Deserialized object. + :rtype: object """ try: return self(target_obj, data, content_type=content_type) - except: + except: # pylint: disable=bare-except _LOGGER.debug( "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True ) @@ -1552,10 +1644,12 @@ def _unpack_content(raw_data, content_type=None): If raw_data is something else, bypass all logic and return it directly. - :param raw_data: Data to be processed. - :param content_type: How to parse if raw_data is a string/bytes. + :param obj raw_data: Data to be processed. + :param str content_type: How to parse if raw_data is a string/bytes. :raises JSONDecodeError: If JSON is requested and parsing is impossible. :raises UnicodeDecodeError: If bytes is not UTF8 + :rtype: object + :return: Unpacked content. """ # Assume this is enough to detect a Pipeline Response without importing it context = getattr(raw_data, "context", {}) @@ -1579,24 +1673,35 @@ def _unpack_content(raw_data, content_type=None): def _instantiate_model(self, response, attrs, additional_properties=None): """Instantiate a response model passing in deserialized args. - :param response: The response model class. - :param d_attrs: The deserialized response attributes. + :param Response response: The response model class. + :param dict attrs: The deserialized response attributes. + :param dict additional_properties: Additional properties to be set. + :rtype: Response + :return: The instantiated response model. """ if callable(response): subtype = getattr(response, "_subtype_map", {}) try: - readonly = [k for k, v in response._validation.items() if v.get("readonly")] - const = [k for k, v in response._validation.items() if v.get("constant")] + readonly = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("readonly") + ] + const = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("constant") + ] kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} response_obj = response(**kwargs) for attr in readonly: setattr(response_obj, attr, attrs.get(attr)) if additional_properties: - response_obj.additional_properties = additional_properties + response_obj.additional_properties = additional_properties # type: ignore return response_obj except TypeError as err: msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) + raise DeserializationError(msg + str(err)) from err else: try: for attr, value in attrs.items(): @@ -1605,15 +1710,16 @@ def _instantiate_model(self, response, attrs, additional_properties=None): except Exception as exp: msg = "Unable to populate response model. " msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) + raise DeserializationError(msg) from exp - def deserialize_data(self, data, data_type): + def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements """Process data for deserialization according to data type. :param str data: The response string to be deserialized. :param str data_type: The type to deserialize to. :raises: DeserializationError if deserialization fails. :return: Deserialized object. + :rtype: object """ if data is None: return data @@ -1627,7 +1733,11 @@ def deserialize_data(self, data, data_type): if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): return data - is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] + is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment + "object", + "[]", + r"{}", + ] if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: return None data_val = self.deserialize_type[data_type](data) @@ -1647,14 +1757,14 @@ def deserialize_data(self, data, data_type): msg = "Unable to deserialize response data." msg += " Data: {}, {}".format(data, data_type) raise DeserializationError(msg) from err - else: - return self._deserialize(obj_type, data) + return self._deserialize(obj_type, data) def deserialize_iter(self, attr, iter_type): """Deserialize an iterable. :param list attr: Iterable to be deserialized. :param str iter_type: The type of object in the iterable. + :return: Deserialized iterable. :rtype: list """ if attr is None: @@ -1671,6 +1781,7 @@ def deserialize_dict(self, attr, dict_type): :param dict/list attr: Dictionary to be deserialized. Also accepts a list of key, value pairs. :param str dict_type: The object type of the items in the dictionary. + :return: Deserialized dictionary. :rtype: dict """ if isinstance(attr, list): @@ -1681,11 +1792,12 @@ def deserialize_dict(self, attr, dict_type): attr = {el.tag: el.text for el in attr} return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} - def deserialize_object(self, attr, **kwargs): + def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """Deserialize a generic object. This will be handled as a dictionary. :param dict attr: Dictionary to be deserialized. + :return: Deserialized object. :rtype: dict :raises: TypeError if non-builtin datatype encountered. """ @@ -1720,11 +1832,10 @@ def deserialize_object(self, attr, **kwargs): pass return deserialized - else: - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) - def deserialize_basic(self, attr, data_type): + def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements """Deserialize basic builtin data type from string. Will attempt to convert to str, int, float and bool. This function will also accept '1', '0', 'true' and 'false' as @@ -1732,6 +1843,7 @@ def deserialize_basic(self, attr, data_type): :param str attr: response string to be deserialized. :param str data_type: deserialization data type. + :return: Deserialized basic type. :rtype: str, int, float or bool :raises: TypeError if string format is not valid. """ @@ -1743,24 +1855,23 @@ def deserialize_basic(self, attr, data_type): if data_type == "str": # None or '', node is empty string. return "" - else: - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, str): + if isinstance(attr, str): if attr.lower() in ["true", "1"]: return True - elif attr.lower() in ["false", "0"]: + if attr.lower() in ["false", "0"]: return False raise TypeError("Invalid boolean value: {}".format(attr)) if data_type == "str": return self.deserialize_unicode(attr) - return eval(data_type)(attr) # nosec + return eval(data_type)(attr) # nosec # pylint: disable=eval-used @staticmethod def deserialize_unicode(data): @@ -1768,6 +1879,7 @@ def deserialize_unicode(data): as a string. :param str data: response string to be deserialized. + :return: Deserialized string. :rtype: str or unicode """ # We might be here because we have an enum modeled as string, @@ -1781,8 +1893,7 @@ def deserialize_unicode(data): return data except NameError: return str(data) - else: - return str(data) + return str(data) @staticmethod def deserialize_enum(data, enum_obj): @@ -1794,6 +1905,7 @@ def deserialize_enum(data, enum_obj): :param str data: Response string to be deserialized. If this value is None or invalid it will be returned as-is. :param Enum enum_obj: Enum object to deserialize to. + :return: Deserialized enum object. :rtype: Enum """ if isinstance(data, enum_obj) or data is None: @@ -1804,9 +1916,9 @@ def deserialize_enum(data, enum_obj): # Workaround. We might consider remove it in the future. try: return list(enum_obj.__members__.values())[data] - except IndexError: + except IndexError as exc: error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) + raise DeserializationError(error.format(data, enum_obj)) from exc try: return enum_obj(str(data)) except ValueError: @@ -1822,6 +1934,7 @@ def deserialize_bytearray(attr): """Deserialize string into bytearray. :param str attr: response string to be deserialized. + :return: Deserialized bytearray :rtype: bytearray :raises: TypeError if string format invalid. """ @@ -1834,6 +1947,7 @@ def deserialize_base64(attr): """Deserialize base64 encoded string into string. :param str attr: response string to be deserialized. + :return: Deserialized base64 string :rtype: bytearray :raises: TypeError if string format invalid. """ @@ -1849,8 +1963,9 @@ def deserialize_decimal(attr): """Deserialize string into Decimal object. :param str attr: response string to be deserialized. - :rtype: Decimal + :return: Deserialized decimal :raises: DeserializationError if string format invalid. + :rtype: decimal """ if isinstance(attr, ET.Element): attr = attr.text @@ -1865,6 +1980,7 @@ def deserialize_long(attr): """Deserialize string into long (Py2) or int (Py3). :param str attr: response string to be deserialized. + :return: Deserialized int :rtype: long or int :raises: ValueError if string format invalid. """ @@ -1877,6 +1993,7 @@ def deserialize_duration(attr): """Deserialize ISO-8601 formatted string into TimeDelta object. :param str attr: response string to be deserialized. + :return: Deserialized duration :rtype: TimeDelta :raises: DeserializationError if string format invalid. """ @@ -1887,14 +2004,14 @@ def deserialize_duration(attr): except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." raise DeserializationError(msg) from err - else: - return duration + return duration @staticmethod def deserialize_date(attr): """Deserialize ISO-8601 formatted string into Date object. :param str attr: response string to be deserialized. + :return: Deserialized date :rtype: Date :raises: DeserializationError if string format invalid. """ @@ -1910,6 +2027,7 @@ def deserialize_time(attr): """Deserialize ISO-8601 formatted string into time object. :param str attr: response string to be deserialized. + :return: Deserialized time :rtype: datetime.time :raises: DeserializationError if string format invalid. """ @@ -1924,6 +2042,7 @@ def deserialize_rfc(attr): """Deserialize RFC-1123 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized RFC datetime :rtype: Datetime :raises: DeserializationError if string format invalid. """ @@ -1939,14 +2058,14 @@ def deserialize_rfc(attr): except ValueError as err: msg = "Cannot deserialize to rfc datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj @staticmethod def deserialize_iso(attr): """Deserialize ISO-8601 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized ISO datetime :rtype: Datetime :raises: DeserializationError if string format invalid. """ @@ -1976,8 +2095,7 @@ def deserialize_iso(attr): except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj @staticmethod def deserialize_unix(attr): @@ -1985,6 +2103,7 @@ def deserialize_unix(attr): This is represented as seconds. :param int attr: Object to be serialized. + :return: Deserialized datetime :rtype: Datetime :raises: DeserializationError if format invalid """ @@ -1996,5 +2115,4 @@ def deserialize_unix(attr): except ValueError as err: msg = "Cannot deserialize to unix datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_vendor.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_vendor.py index d064dd73a618..5be61c8f9141 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_vendor.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_vendor.py @@ -11,7 +11,6 @@ from ._configuration import CognitiveServicesManagementClientConfiguration if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core import PipelineClient from ._serialization import Deserializer, Serializer diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_version.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_version.py index 1e5104a3d415..d84d844762d5 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_version.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "13.6.0" +VERSION = "13.7.0b1" diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/__init__.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/__init__.py index 2e952442ec90..7ac2db0cdcfd 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/__init__.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/__init__.py @@ -5,12 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._cognitive_services_management_client import CognitiveServicesManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._cognitive_services_management_client import CognitiveServicesManagementClient # type: ignore try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -18,6 +24,6 @@ __all__ = [ "CognitiveServicesManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/_cognitive_services_management_client.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/_cognitive_services_management_client.py index 78ef2a21910e..ac28be2fe436 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/_cognitive_services_management_client.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/_cognitive_services_management_client.py @@ -19,6 +19,8 @@ from .._serialization import Deserializer, Serializer from ._configuration import CognitiveServicesManagementClientConfiguration from .operations import ( + AccountCapabilityHostsOperations, + AccountConnectionOperations, AccountsOperations, CognitiveServicesManagementClientOperationsMixin, CommitmentPlansOperations, @@ -34,6 +36,9 @@ Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, + ProjectCapabilityHostsOperations, + ProjectConnectionOperations, + ProjectsOperations, RaiBlocklistItemsOperations, RaiBlocklistsOperations, RaiContentFiltersOperations, @@ -43,13 +48,12 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential class CognitiveServicesManagementClient( CognitiveServicesManagementClientOperationsMixin -): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +): # pylint: disable=too-many-instance-attributes """Cognitive Services Management Client. :ivar accounts: AccountsOperations operations @@ -105,14 +109,28 @@ class CognitiveServicesManagementClient( :ivar defender_for_ai_settings: DefenderForAISettingsOperations operations :vartype defender_for_ai_settings: azure.mgmt.cognitiveservices.aio.operations.DefenderForAISettingsOperations + :ivar projects: ProjectsOperations operations + :vartype projects: azure.mgmt.cognitiveservices.aio.operations.ProjectsOperations + :ivar account_connection: AccountConnectionOperations operations + :vartype account_connection: + azure.mgmt.cognitiveservices.aio.operations.AccountConnectionOperations + :ivar project_connection: ProjectConnectionOperations operations + :vartype project_connection: + azure.mgmt.cognitiveservices.aio.operations.ProjectConnectionOperations + :ivar account_capability_hosts: AccountCapabilityHostsOperations operations + :vartype account_capability_hosts: + azure.mgmt.cognitiveservices.aio.operations.AccountCapabilityHostsOperations + :ivar project_capability_hosts: ProjectCapabilityHostsOperations operations + :vartype project_capability_hosts: + azure.mgmt.cognitiveservices.aio.operations.ProjectCapabilityHostsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2024-10-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2025-04-01-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -196,6 +214,19 @@ def __init__( self.defender_for_ai_settings = DefenderForAISettingsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.projects = ProjectsOperations(self._client, self._config, self._serialize, self._deserialize) + self.account_connection = AccountConnectionOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.project_connection = ProjectConnectionOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.account_capability_hosts = AccountCapabilityHostsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.project_capability_hosts = ProjectCapabilityHostsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( self, request: HttpRequest, *, stream: bool = False, **kwargs: Any diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/_configuration.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/_configuration.py index 2ce4b4dddddf..0854368610d3 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/_configuration.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/_configuration.py @@ -14,7 +14,6 @@ from .._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -28,13 +27,13 @@ class CognitiveServicesManagementClientConfiguration: # pylint: disable=too-man :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2024-10-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2025-04-01-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2024-10-01") + api_version: str = kwargs.pop("api_version", "2025-04-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/_vendor.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/_vendor.py index 9d3c651db221..c0716bd10dfe 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/_vendor.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/_vendor.py @@ -11,7 +11,6 @@ from ._configuration import CognitiveServicesManagementClientConfiguration if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core import AsyncPipelineClient from .._serialization import Deserializer, Serializer diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/__init__.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/__init__.py index fdaa24c0f86a..2666b0f9a1bd 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/__init__.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/__init__.py @@ -5,31 +5,42 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._accounts_operations import AccountsOperations -from ._deleted_accounts_operations import DeletedAccountsOperations -from ._resource_skus_operations import ResourceSkusOperations -from ._usages_operations import UsagesOperations -from ._operations import Operations -from ._cognitive_services_management_client_operations import CognitiveServicesManagementClientOperationsMixin -from ._commitment_tiers_operations import CommitmentTiersOperations -from ._models_operations import ModelsOperations -from ._location_based_model_capacities_operations import LocationBasedModelCapacitiesOperations -from ._model_capacities_operations import ModelCapacitiesOperations -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations -from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._deployments_operations import DeploymentsOperations -from ._commitment_plans_operations import CommitmentPlansOperations -from ._encryption_scopes_operations import EncryptionScopesOperations -from ._rai_policies_operations import RaiPoliciesOperations -from ._rai_blocklists_operations import RaiBlocklistsOperations -from ._rai_blocklist_items_operations import RaiBlocklistItemsOperations -from ._rai_content_filters_operations import RaiContentFiltersOperations -from ._network_security_perimeter_configurations_operations import NetworkSecurityPerimeterConfigurationsOperations -from ._defender_for_ai_settings_operations import DefenderForAISettingsOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._accounts_operations import AccountsOperations # type: ignore +from ._deleted_accounts_operations import DeletedAccountsOperations # type: ignore +from ._resource_skus_operations import ResourceSkusOperations # type: ignore +from ._usages_operations import UsagesOperations # type: ignore +from ._operations import Operations # type: ignore +from ._cognitive_services_management_client_operations import CognitiveServicesManagementClientOperationsMixin # type: ignore +from ._commitment_tiers_operations import CommitmentTiersOperations # type: ignore +from ._models_operations import ModelsOperations # type: ignore +from ._location_based_model_capacities_operations import LocationBasedModelCapacitiesOperations # type: ignore +from ._model_capacities_operations import ModelCapacitiesOperations # type: ignore +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore +from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore +from ._deployments_operations import DeploymentsOperations # type: ignore +from ._commitment_plans_operations import CommitmentPlansOperations # type: ignore +from ._encryption_scopes_operations import EncryptionScopesOperations # type: ignore +from ._rai_policies_operations import RaiPoliciesOperations # type: ignore +from ._rai_blocklists_operations import RaiBlocklistsOperations # type: ignore +from ._rai_blocklist_items_operations import RaiBlocklistItemsOperations # type: ignore +from ._rai_content_filters_operations import RaiContentFiltersOperations # type: ignore +from ._network_security_perimeter_configurations_operations import NetworkSecurityPerimeterConfigurationsOperations # type: ignore +from ._defender_for_ai_settings_operations import DefenderForAISettingsOperations # type: ignore +from ._projects_operations import ProjectsOperations # type: ignore +from ._account_connection_operations import AccountConnectionOperations # type: ignore +from ._project_connection_operations import ProjectConnectionOperations # type: ignore +from ._account_capability_hosts_operations import AccountCapabilityHostsOperations # type: ignore +from ._project_capability_hosts_operations import ProjectCapabilityHostsOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -54,6 +65,11 @@ "RaiContentFiltersOperations", "NetworkSecurityPerimeterConfigurationsOperations", "DefenderForAISettingsOperations", + "ProjectsOperations", + "AccountConnectionOperations", + "ProjectConnectionOperations", + "AccountCapabilityHostsOperations", + "ProjectCapabilityHostsOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_account_capability_hosts_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_account_capability_hosts_operations.py new file mode 100644 index 000000000000..aa649b82f2d8 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_account_capability_hosts_operations.py @@ -0,0 +1,475 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._account_capability_hosts_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class AccountCapabilityHostsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cognitiveservices.aio.CognitiveServicesManagementClient`'s + :attr:`account_capability_hosts` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + async def _delete_initial( + self, resource_group_name: str, account_name: str, capability_host_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + capability_host_name=capability_host_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, account_name: str, capability_host_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete account capabilityHost. + + Delete account capabilityHost. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param capability_host_name: The name of the capability host associated with the Cognitive + Services Resource. Required. + :type capability_host_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + account_name=account_name, + capability_host_name=capability_host_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace_async + async def get( + self, resource_group_name: str, account_name: str, capability_host_name: str, **kwargs: Any + ) -> _models.CapabilityHost: + """Get account capabilityHost. + + Get account capabilityHost. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param capability_host_name: The name of the capability host associated with the Cognitive + Services Resource. Required. + :type capability_host_name: str + :return: CapabilityHost or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.CapabilityHost + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CapabilityHost] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + capability_host_name=capability_host_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CapabilityHost", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + account_name: str, + capability_host_name: str, + body: Union[_models.CapabilityHost, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "CapabilityHost") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + capability_host_name=capability_host_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + capability_host_name: str, + body: _models.CapabilityHost, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CapabilityHost]: + """Create or update account capabilityHost. + + Create or update account capabilityHost. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param capability_host_name: The name of the capability host associated with the Cognitive + Services Resource. Required. + :type capability_host_name: str + :param body: CapabilityHost definition. Required. + :type body: ~azure.mgmt.cognitiveservices.models.CapabilityHost + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either CapabilityHost or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.CapabilityHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + capability_host_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CapabilityHost]: + """Create or update account capabilityHost. + + Create or update account capabilityHost. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param capability_host_name: The name of the capability host associated with the Cognitive + Services Resource. Required. + :type capability_host_name: str + :param body: CapabilityHost definition. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either CapabilityHost or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.CapabilityHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + capability_host_name: str, + body: Union[_models.CapabilityHost, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.CapabilityHost]: + """Create or update account capabilityHost. + + Create or update account capabilityHost. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param capability_host_name: The name of the capability host associated with the Cognitive + Services Resource. Required. + :type capability_host_name: str + :param body: CapabilityHost definition. Is either a CapabilityHost type or a IO[bytes] type. + Required. + :type body: ~azure.mgmt.cognitiveservices.models.CapabilityHost or IO[bytes] + :return: An instance of AsyncLROPoller that returns either CapabilityHost or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.CapabilityHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CapabilityHost] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + account_name=account_name, + capability_host_name=capability_host_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CapabilityHost", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.CapabilityHost].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.CapabilityHost]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_account_connection_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_account_connection_operations.py new file mode 100644 index 000000000000..e65600f77e53 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_account_connection_operations.py @@ -0,0 +1,591 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ...operations._account_connection_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class AccountConnectionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cognitiveservices.aio.CognitiveServicesManagementClient`'s + :attr:`account_connection` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def delete(self, resource_group_name: str, account_name: str, connection_name: str, **kwargs: Any) -> None: + """Delete Cognitive Services account connection by name. + + Delete Cognitive Services account connection by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param connection_name: Friendly name of the connection. Required. + :type connection_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def get( + self, resource_group_name: str, account_name: str, connection_name: str, **kwargs: Any + ) -> _models.ConnectionPropertiesV2BasicResource: + """Lists Cognitive Services account connection by name. + + Lists Cognitive Services account connection by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param connection_name: Friendly name of the connection. Required. + :type connection_name: str + :return: ConnectionPropertiesV2BasicResource or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ConnectionPropertiesV2BasicResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ConnectionPropertiesV2BasicResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + account_name: str, + connection_name: str, + body: Optional[_models.ConnectionUpdateContent] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectionPropertiesV2BasicResource: + """Update Cognitive Services account connection under the specified account. + + Update Cognitive Services account connection under the specified account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param connection_name: Friendly name of the connection. Required. + :type connection_name: str + :param body: Parameters for account connection update. Default value is None. + :type body: ~azure.mgmt.cognitiveservices.models.ConnectionUpdateContent + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ConnectionPropertiesV2BasicResource or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + account_name: str, + connection_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectionPropertiesV2BasicResource: + """Update Cognitive Services account connection under the specified account. + + Update Cognitive Services account connection under the specified account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param connection_name: Friendly name of the connection. Required. + :type connection_name: str + :param body: Parameters for account connection update. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ConnectionPropertiesV2BasicResource or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + account_name: str, + connection_name: str, + body: Optional[Union[_models.ConnectionUpdateContent, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.ConnectionPropertiesV2BasicResource: + """Update Cognitive Services account connection under the specified account. + + Update Cognitive Services account connection under the specified account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param connection_name: Friendly name of the connection. Required. + :type connection_name: str + :param body: Parameters for account connection update. Is either a ConnectionUpdateContent type + or a IO[bytes] type. Default value is None. + :type body: ~azure.mgmt.cognitiveservices.models.ConnectionUpdateContent or IO[bytes] + :return: ConnectionPropertiesV2BasicResource or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectionPropertiesV2BasicResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "ConnectionUpdateContent") + else: + _json = None + + _request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ConnectionPropertiesV2BasicResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create( + self, + resource_group_name: str, + account_name: str, + connection_name: str, + body: Optional[_models.ConnectionPropertiesV2BasicResource] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectionPropertiesV2BasicResource: + """Create or update Cognitive Services account connection under the specified account. + + Create or update Cognitive Services account connection under the specified account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param connection_name: Friendly name of the connection. Required. + :type connection_name: str + :param body: The object for creating or updating a new account connection. Default value is + None. + :type body: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ConnectionPropertiesV2BasicResource or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + account_name: str, + connection_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectionPropertiesV2BasicResource: + """Create or update Cognitive Services account connection under the specified account. + + Create or update Cognitive Services account connection under the specified account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param connection_name: Friendly name of the connection. Required. + :type connection_name: str + :param body: The object for creating or updating a new account connection. Default value is + None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ConnectionPropertiesV2BasicResource or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create( + self, + resource_group_name: str, + account_name: str, + connection_name: str, + body: Optional[Union[_models.ConnectionPropertiesV2BasicResource, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.ConnectionPropertiesV2BasicResource: + """Create or update Cognitive Services account connection under the specified account. + + Create or update Cognitive Services account connection under the specified account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param connection_name: Friendly name of the connection. Required. + :type connection_name: str + :param body: The object for creating or updating a new account connection. Is either a + ConnectionPropertiesV2BasicResource type or a IO[bytes] type. Default value is None. + :type body: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource or + IO[bytes] + :return: ConnectionPropertiesV2BasicResource or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectionPropertiesV2BasicResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "ConnectionPropertiesV2BasicResource") + else: + _json = None + + _request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ConnectionPropertiesV2BasicResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + account_name: str, + target: Optional[str] = None, + category: Optional[str] = None, + include_all: bool = False, + **kwargs: Any + ) -> AsyncIterable["_models.ConnectionPropertiesV2BasicResource"]: + # pylint: disable=line-too-long + """Lists all the available Cognitive Services account connections under the specified account. + + Lists all the available Cognitive Services account connections under the specified account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param target: Target of the connection. Default value is None. + :type target: str + :param category: Category of the connection. Default value is None. + :type category: str + :param include_all: query parameter that indicates if get connection call should return both + connections and datastores. Default value is False. + :type include_all: bool + :return: An iterator like instance of either ConnectionPropertiesV2BasicResource or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ConnectionPropertiesV2BasicResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + target=target, + category=category, + include_all=include_all, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ConnectionPropertiesV2BasicResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_accounts_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_accounts_operations.py index d3a2bb7e4b48..88e794edc5ca 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_accounts_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -49,7 +49,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +76,7 @@ def __init__(self, *args, **kwargs) -> None: async def _create_initial( self, resource_group_name: str, account_name: str, account: Union[_models.Account, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -264,7 +264,7 @@ def get_long_running_output(pipeline_response): async def _update_initial( self, resource_group_name: str, account_name: str, account: Union[_models.Account, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -447,7 +447,7 @@ def get_long_running_output(pipeline_response): ) async def _delete_initial(self, resource_group_name: str, account_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -561,7 +561,7 @@ async def get(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.cognitiveservices.models.Account :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -621,7 +621,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -697,7 +697,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Account"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -771,7 +771,7 @@ async def list_keys(self, resource_group_name: str, account_name: str, **kwargs: :rtype: ~azure.mgmt.cognitiveservices.models.ApiKeys :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -832,7 +832,7 @@ async def regenerate_key( :rtype: ~azure.mgmt.cognitiveservices.models.ApiKeys :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -896,7 +896,7 @@ async def list_skus( :rtype: ~azure.mgmt.cognitiveservices.models.AccountSkuListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -958,7 +958,7 @@ async def list_usages( :rtype: ~azure.mgmt.cognitiveservices.models.UsageListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1024,7 +1024,7 @@ def list_models( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AccountModelListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_cognitive_services_management_client_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_cognitive_services_management_client_operations.py index e566a4959840..4215bfa26562 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_cognitive_services_management_client_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_cognitive_services_management_client_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar +from typing import Any, Callable, Dict, List, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -34,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -61,7 +60,7 @@ async def check_sku_availability( :rtype: ~azure.mgmt.cognitiveservices.models.SkuAvailabilityListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -125,7 +124,7 @@ async def check_domain_availability( :rtype: ~azure.mgmt.cognitiveservices.models.DomainAvailability :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -192,7 +191,7 @@ async def calculate_model_capacity( :rtype: ~azure.mgmt.cognitiveservices.models.CalculateModelCapacityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_commitment_plans_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_commitment_plans_operations.py index ee9103a0dd8c..99bf8b25eb35 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_commitment_plans_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_commitment_plans_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -52,7 +52,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -98,7 +98,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CommitmentPlanListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -179,7 +179,7 @@ async def get( :rtype: ~azure.mgmt.cognitiveservices.models.CommitmentPlan :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -311,7 +311,7 @@ async def create_or_update( :rtype: ~azure.mgmt.cognitiveservices.models.CommitmentPlan :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -370,7 +370,7 @@ async def create_or_update( async def _delete_initial( self, resource_group_name: str, account_name: str, commitment_plan_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -485,7 +485,7 @@ async def _create_or_update_plan_initial( commitment_plan: Union[_models.CommitmentPlan, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -684,7 +684,7 @@ async def _update_plan_initial( commitment_plan: Union[_models.PatchResourceTagsAndSku, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -883,7 +883,7 @@ def get_long_running_output(pipeline_response): async def _delete_plan_initial( self, resource_group_name: str, commitment_plan_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1009,7 +1009,7 @@ async def get_plan( :rtype: ~azure.mgmt.cognitiveservices.models.CommitmentPlan :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1072,7 +1072,7 @@ def list_plans_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CommitmentPlanListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1149,7 +1149,7 @@ def list_plans_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Co api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CommitmentPlanListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1234,7 +1234,7 @@ def list_associations( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CommitmentPlanAccountAssociationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1316,7 +1316,7 @@ async def get_association( :rtype: ~azure.mgmt.cognitiveservices.models.CommitmentPlanAccountAssociation :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1368,7 +1368,7 @@ async def _create_or_update_association_initial( association: Union[_models.CommitmentPlanAccountAssociation, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1581,7 +1581,7 @@ def get_long_running_output(pipeline_response): async def _delete_association_initial( self, resource_group_name: str, commitment_plan_name: str, commitment_plan_association_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_commitment_tiers_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_commitment_tiers_operations.py index f1f9faf98f1d..19c8614a505b 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_commitment_tiers_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_commitment_tiers_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +71,7 @@ def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.Commitmen api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CommitmentTierListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_defender_for_ai_settings_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_defender_for_ai_settings_operations.py index 228da076938b..4524a4083f5d 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_defender_for_ai_settings_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_defender_for_ai_settings_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -38,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -85,7 +84,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DefenderForAISettingResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -165,7 +164,7 @@ async def get( :rtype: ~azure.mgmt.cognitiveservices.models.DefenderForAISetting :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -295,7 +294,7 @@ async def create_or_update( :rtype: ~azure.mgmt.cognitiveservices.models.DefenderForAISetting :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -437,7 +436,7 @@ async def update( :rtype: ~azure.mgmt.cognitiveservices.models.DefenderForAISetting :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_deleted_accounts_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_deleted_accounts_operations.py index db5d37aca5c7..e0de7e92756b 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_deleted_accounts_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_deleted_accounts_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, TypeVar, Union, cast import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -36,7 +35,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,7 +74,7 @@ async def get(self, location: str, resource_group_name: str, account_name: str, :rtype: ~azure.mgmt.cognitiveservices.models.Account :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -122,7 +121,7 @@ async def get(self, location: str, resource_group_name: str, account_name: str, async def _purge_initial( self, location: str, resource_group_name: str, account_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -243,7 +242,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Account"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_deployments_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_deployments_operations.py index c6b90b7b0bc8..309dbe71ec2a 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_deployments_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_deployments_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -44,7 +43,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -88,7 +87,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> As api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DeploymentListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -169,7 +168,7 @@ async def get( :rtype: ~azure.mgmt.cognitiveservices.models.Deployment :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -221,7 +220,7 @@ async def _create_or_update_initial( deployment: Union[_models.Deployment, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -432,7 +431,7 @@ async def _update_initial( deployment: Union[_models.PatchResourceTagsAndSku, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -641,7 +640,7 @@ def get_long_running_output(pipeline_response): async def _delete_initial( self, resource_group_name: str, account_name: str, deployment_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -774,7 +773,7 @@ def list_skus( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DeploymentSkuListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_encryption_scopes_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_encryption_scopes_operations.py index 08428d59d993..4abb1b9b83f0 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_encryption_scopes_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_encryption_scopes_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -42,7 +41,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -88,7 +87,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EncryptionScopeListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -169,7 +168,7 @@ async def get( :rtype: ~azure.mgmt.cognitiveservices.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -301,7 +300,7 @@ async def create_or_update( :rtype: ~azure.mgmt.cognitiveservices.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -360,7 +359,7 @@ async def create_or_update( async def _delete_initial( self, resource_group_name: str, account_name: str, encryption_scope_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_location_based_model_capacities_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_location_based_model_capacities_operations.py index ed37d79e5290..b9c3b8dc868d 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_location_based_model_capacities_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_location_based_model_capacities_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -81,7 +80,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ModelCapacityListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_model_capacities_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_model_capacities_operations.py index 287d3c7da2f9..50bc5c5c997c 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_model_capacities_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_model_capacities_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -79,7 +78,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ModelCapacityListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_models_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_models_operations.py index ed4de7ac009c..8ddc5e50149d 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_models_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_models_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,7 +70,7 @@ def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.Model"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ModelListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_network_security_perimeter_configurations_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_network_security_perimeter_configurations_operations.py index e4c5721f6481..9b7788f3b699 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_network_security_perimeter_configurations_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_network_security_perimeter_configurations_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, TypeVar, Union, cast import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -40,7 +39,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -68,6 +67,7 @@ def __init__(self, *args, **kwargs) -> None: def list( self, resource_group_name: str, account_name: str, **kwargs: Any ) -> AsyncIterable["_models.NetworkSecurityPerimeterConfiguration"]: + # pylint: disable=line-too-long """Gets a list of NSP configurations for an account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -87,7 +87,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.NetworkSecurityPerimeterConfigurationList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -167,7 +167,7 @@ async def get( :rtype: ~azure.mgmt.cognitiveservices.models.NetworkSecurityPerimeterConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -214,7 +214,7 @@ async def get( async def _reconcile_initial( self, resource_group_name: str, account_name: str, nsp_configuration_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_operations.py index ff191e3e8446..37f95b84214d 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,7 +68,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_private_endpoint_connections_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_private_endpoint_connections_operations.py index f6b5a668220f..9283cf2c9a3c 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_private_endpoint_connections_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -39,7 +38,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -78,7 +77,7 @@ async def list( :rtype: ~azure.mgmt.cognitiveservices.models.PrivateEndpointConnectionListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -139,7 +138,7 @@ async def get( :rtype: ~azure.mgmt.cognitiveservices.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -191,7 +190,7 @@ async def _create_or_update_initial( properties: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -400,7 +399,7 @@ def get_long_running_output(pipeline_response): async def _delete_initial( self, resource_group_name: str, account_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_private_link_resources_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_private_link_resources_operations.py index 29ee4f4d5b3d..cc8e20e1eb8d 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_private_link_resources_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_private_link_resources_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,7 +28,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -68,7 +67,7 @@ async def list( :rtype: ~azure.mgmt.cognitiveservices.models.PrivateLinkResourceListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_project_capability_hosts_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_project_capability_hosts_operations.py new file mode 100644 index 000000000000..4c867f346d31 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_project_capability_hosts_operations.py @@ -0,0 +1,494 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._project_capability_hosts_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ProjectCapabilityHostsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cognitiveservices.aio.CognitiveServicesManagementClient`'s + :attr:`project_capability_hosts` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + async def _delete_initial( + self, resource_group_name: str, account_name: str, project_name: str, capability_host_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + capability_host_name=capability_host_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, account_name: str, project_name: str, capability_host_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete project capabilityHost. + + Delete project capabilityHost. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param capability_host_name: The name of the capability host associated with the Cognitive + Services Resource. Required. + :type capability_host_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + capability_host_name=capability_host_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace_async + async def get( + self, resource_group_name: str, account_name: str, project_name: str, capability_host_name: str, **kwargs: Any + ) -> _models.CapabilityHost: + """Get project capabilityHost. + + Get project capabilityHost. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param capability_host_name: The name of the capability host associated with the Cognitive + Services Resource. Required. + :type capability_host_name: str + :return: CapabilityHost or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.CapabilityHost + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CapabilityHost] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + capability_host_name=capability_host_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CapabilityHost", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + account_name: str, + project_name: str, + capability_host_name: str, + body: Union[_models.CapabilityHost, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "CapabilityHost") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + capability_host_name=capability_host_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + project_name: str, + capability_host_name: str, + body: _models.CapabilityHost, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CapabilityHost]: + """Create or update project capabilityHost. + + Create or update project capabilityHost. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param capability_host_name: The name of the capability host associated with the Cognitive + Services Resource. Required. + :type capability_host_name: str + :param body: CapabilityHost definition. Required. + :type body: ~azure.mgmt.cognitiveservices.models.CapabilityHost + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either CapabilityHost or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.CapabilityHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + project_name: str, + capability_host_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CapabilityHost]: + """Create or update project capabilityHost. + + Create or update project capabilityHost. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param capability_host_name: The name of the capability host associated with the Cognitive + Services Resource. Required. + :type capability_host_name: str + :param body: CapabilityHost definition. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either CapabilityHost or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.CapabilityHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + project_name: str, + capability_host_name: str, + body: Union[_models.CapabilityHost, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.CapabilityHost]: + """Create or update project capabilityHost. + + Create or update project capabilityHost. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param capability_host_name: The name of the capability host associated with the Cognitive + Services Resource. Required. + :type capability_host_name: str + :param body: CapabilityHost definition. Is either a CapabilityHost type or a IO[bytes] type. + Required. + :type body: ~azure.mgmt.cognitiveservices.models.CapabilityHost or IO[bytes] + :return: An instance of AsyncLROPoller that returns either CapabilityHost or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.CapabilityHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CapabilityHost] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + capability_host_name=capability_host_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CapabilityHost", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.CapabilityHost].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.CapabilityHost]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_project_connection_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_project_connection_operations.py new file mode 100644 index 000000000000..6520ccc1aeeb --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_project_connection_operations.py @@ -0,0 +1,623 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ...operations._project_connection_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ProjectConnectionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cognitiveservices.aio.CognitiveServicesManagementClient`'s + :attr:`project_connection` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def delete( + self, resource_group_name: str, account_name: str, project_name: str, connection_name: str, **kwargs: Any + ) -> None: + """Delete Cognitive Services project connection by name. + + Delete Cognitive Services project connection by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param connection_name: Friendly name of the connection. Required. + :type connection_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def get( + self, resource_group_name: str, account_name: str, project_name: str, connection_name: str, **kwargs: Any + ) -> _models.ConnectionPropertiesV2BasicResource: + """Lists Cognitive Services project connection by name. + + Lists Cognitive Services project connection by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param connection_name: Friendly name of the connection. Required. + :type connection_name: str + :return: ConnectionPropertiesV2BasicResource or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ConnectionPropertiesV2BasicResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ConnectionPropertiesV2BasicResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + account_name: str, + project_name: str, + connection_name: str, + body: Optional[_models.ConnectionUpdateContent] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectionPropertiesV2BasicResource: + """Update Cognitive Services project connection under the specified project. + + Update Cognitive Services project connection under the specified project. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param connection_name: Friendly name of the connection. Required. + :type connection_name: str + :param body: Parameters for account connection update. Default value is None. + :type body: ~azure.mgmt.cognitiveservices.models.ConnectionUpdateContent + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ConnectionPropertiesV2BasicResource or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + account_name: str, + project_name: str, + connection_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectionPropertiesV2BasicResource: + """Update Cognitive Services project connection under the specified project. + + Update Cognitive Services project connection under the specified project. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param connection_name: Friendly name of the connection. Required. + :type connection_name: str + :param body: Parameters for account connection update. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ConnectionPropertiesV2BasicResource or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + account_name: str, + project_name: str, + connection_name: str, + body: Optional[Union[_models.ConnectionUpdateContent, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.ConnectionPropertiesV2BasicResource: + """Update Cognitive Services project connection under the specified project. + + Update Cognitive Services project connection under the specified project. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param connection_name: Friendly name of the connection. Required. + :type connection_name: str + :param body: Parameters for account connection update. Is either a ConnectionUpdateContent type + or a IO[bytes] type. Default value is None. + :type body: ~azure.mgmt.cognitiveservices.models.ConnectionUpdateContent or IO[bytes] + :return: ConnectionPropertiesV2BasicResource or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectionPropertiesV2BasicResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "ConnectionUpdateContent") + else: + _json = None + + _request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ConnectionPropertiesV2BasicResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create( + self, + resource_group_name: str, + account_name: str, + project_name: str, + connection_name: str, + body: Optional[_models.ConnectionPropertiesV2BasicResource] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectionPropertiesV2BasicResource: + """Create or update Cognitive Services project connection under the specified project. + + Create or update Cognitive Services project connection under the specified project. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param connection_name: Friendly name of the connection. Required. + :type connection_name: str + :param body: The object for creating or updating a new account connection. Default value is + None. + :type body: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ConnectionPropertiesV2BasicResource or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + account_name: str, + project_name: str, + connection_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectionPropertiesV2BasicResource: + """Create or update Cognitive Services project connection under the specified project. + + Create or update Cognitive Services project connection under the specified project. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param connection_name: Friendly name of the connection. Required. + :type connection_name: str + :param body: The object for creating or updating a new account connection. Default value is + None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ConnectionPropertiesV2BasicResource or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create( + self, + resource_group_name: str, + account_name: str, + project_name: str, + connection_name: str, + body: Optional[Union[_models.ConnectionPropertiesV2BasicResource, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.ConnectionPropertiesV2BasicResource: + """Create or update Cognitive Services project connection under the specified project. + + Create or update Cognitive Services project connection under the specified project. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param connection_name: Friendly name of the connection. Required. + :type connection_name: str + :param body: The object for creating or updating a new account connection. Is either a + ConnectionPropertiesV2BasicResource type or a IO[bytes] type. Default value is None. + :type body: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource or + IO[bytes] + :return: ConnectionPropertiesV2BasicResource or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectionPropertiesV2BasicResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "ConnectionPropertiesV2BasicResource") + else: + _json = None + + _request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ConnectionPropertiesV2BasicResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + account_name: str, + project_name: str, + target: Optional[str] = None, + category: Optional[str] = None, + include_all: bool = False, + **kwargs: Any + ) -> AsyncIterable["_models.ConnectionPropertiesV2BasicResource"]: + # pylint: disable=line-too-long + """Lists all the available Cognitive Services project connections under the specified project. + + Lists all the available Cognitive Services project connections under the specified project. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param target: Target of the connection. Default value is None. + :type target: str + :param category: Category of the connection. Default value is None. + :type category: str + :param include_all: query parameter that indicates if get connection call should return both + connections and datastores. Default value is False. + :type include_all: bool + :return: An iterator like instance of either ConnectionPropertiesV2BasicResource or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ConnectionPropertiesV2BasicResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + subscription_id=self._config.subscription_id, + target=target, + category=category, + include_all=include_all, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ConnectionPropertiesV2BasicResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_projects_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_projects_operations.py new file mode 100644 index 000000000000..96c4861a9c89 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_projects_operations.py @@ -0,0 +1,733 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._projects_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ProjectsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cognitiveservices.aio.CognitiveServicesManagementClient`'s + :attr:`projects` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + async def _create_initial( + self, + resource_group_name: str, + account_name: str, + project_name: str, + project: Union[_models.Project, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(project, (IOBase, bytes)): + _content = project + else: + _json = self._serialize.body(project, "Project") + + _request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create( + self, + resource_group_name: str, + account_name: str, + project_name: str, + project: _models.Project, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Project]: + """Create Cognitive Services Account's Project. Project is a sub-resource of an account which give + AI developer it's individual container to work on. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param project: The parameters to provide for the created project. Required. + :type project: ~azure.mgmt.cognitiveservices.models.Project + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either Project or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.Project] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + account_name: str, + project_name: str, + project: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Project]: + """Create Cognitive Services Account's Project. Project is a sub-resource of an account which give + AI developer it's individual container to work on. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param project: The parameters to provide for the created project. Required. + :type project: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either Project or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.Project] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + account_name: str, + project_name: str, + project: Union[_models.Project, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.Project]: + """Create Cognitive Services Account's Project. Project is a sub-resource of an account which give + AI developer it's individual container to work on. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param project: The parameters to provide for the created project. Is either a Project type or + a IO[bytes] type. Required. + :type project: ~azure.mgmt.cognitiveservices.models.Project or IO[bytes] + :return: An instance of AsyncLROPoller that returns either Project or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.Project] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Project] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + project=project, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Project", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.Project].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Project]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + account_name: str, + project_name: str, + project: Union[_models.Project, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(project, (IOBase, bytes)): + _content = project + else: + _json = self._serialize.body(project, "Project") + + _request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + account_name: str, + project_name: str, + project: _models.Project, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Project]: + """Updates a Cognitive Services Project. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param project: The parameters to provide for the created project. Required. + :type project: ~azure.mgmt.cognitiveservices.models.Project + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either Project or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.Project] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + account_name: str, + project_name: str, + project: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Project]: + """Updates a Cognitive Services Project. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param project: The parameters to provide for the created project. Required. + :type project: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either Project or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.Project] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + account_name: str, + project_name: str, + project: Union[_models.Project, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.Project]: + """Updates a Cognitive Services Project. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param project: The parameters to provide for the created project. Is either a Project type or + a IO[bytes] type. Required. + :type project: ~azure.mgmt.cognitiveservices.models.Project or IO[bytes] + :return: An instance of AsyncLROPoller that returns either Project or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.Project] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Project] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + project=project, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Project", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.Project].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Project]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, account_name: str, project_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, account_name: str, project_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a Cognitive Services project from the resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace_async + async def get( + self, resource_group_name: str, account_name: str, project_name: str, **kwargs: Any + ) -> _models.Project: + """Returns a Cognitive Services project specified by the parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :return: Project or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.Project + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Project] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Project", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> AsyncIterable["_models.Project"]: + """Returns all the projects in a Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :return: An iterator like instance of either Project or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cognitiveservices.models.Project] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ProjectListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ProjectListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_rai_blocklist_items_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_rai_blocklist_items_operations.py index b8594b008c62..18a397fcbe53 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_rai_blocklist_items_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_rai_blocklist_items_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,21 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import ( - Any, - AsyncIterable, - AsyncIterator, - Callable, - Dict, - IO, - List, - Optional, - Type, - TypeVar, - Union, - cast, - overload, -) +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -58,7 +43,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -108,7 +93,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RaiBlockListItemsResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -198,7 +183,7 @@ async def get( :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklistItem :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -343,7 +328,7 @@ async def create_or_update( :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklistItem :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -408,7 +393,7 @@ async def _delete_initial( rai_blocklist_item_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -622,7 +607,7 @@ async def batch_add( :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklist :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -679,7 +664,7 @@ async def batch_add( return deserialized # type: ignore @distributed_trace_async - async def batch_delete( # pylint: disable=inconsistent-return-statements + async def batch_delete( self, resource_group_name: str, account_name: str, @@ -703,7 +688,7 @@ async def batch_delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_rai_blocklists_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_rai_blocklists_operations.py index 7382d6fd797f..577644e6de63 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_rai_blocklists_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_rai_blocklists_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -42,7 +41,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,7 +85,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> As api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RaiBlockListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -167,7 +166,7 @@ async def get( :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklist :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -299,7 +298,7 @@ async def create_or_update( :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklist :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -358,7 +357,7 @@ async def create_or_update( async def _delete_initial( self, resource_group_name: str, account_name: str, rai_blocklist_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_rai_content_filters_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_rai_content_filters_operations.py index a35659689d30..516e13fc2855 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_rai_content_filters_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_rai_content_filters_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -32,7 +31,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +72,7 @@ def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.RaiConten api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RaiContentFilterListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -147,7 +146,7 @@ async def get(self, location: str, filter_name: str, **kwargs: Any) -> _models.R :rtype: ~azure.mgmt.cognitiveservices.models.RaiContentFilter :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_rai_policies_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_rai_policies_operations.py index bf33aae3b66b..54f8ac441553 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_rai_policies_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_rai_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -42,7 +41,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -85,7 +84,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> As api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RaiPolicyListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -166,7 +165,7 @@ async def get( :rtype: ~azure.mgmt.cognitiveservices.models.RaiPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -298,7 +297,7 @@ async def create_or_update( :rtype: ~azure.mgmt.cognitiveservices.models.RaiPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -357,7 +356,7 @@ async def create_or_update( async def _delete_initial( self, resource_group_name: str, account_name: str, rai_policy_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_resource_skus_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_resource_skus_operations.py index 7e1f28a2e878..fe53b2f8fee8 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_resource_skus_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_resource_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,7 +69,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceSku"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ResourceSkuListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_usages_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_usages_operations.py index 7e512e322353..75f831c771d2 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_usages_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_usages_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,7 +74,7 @@ def list(self, location: str, filter: Optional[str] = None, **kwargs: Any) -> As api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/__init__.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/__init__.py index db9ddda03068..3cc5d025f539 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/__init__.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/__init__.py @@ -5,181 +5,237 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._models_py3 import AbusePenalty -from ._models_py3 import Account -from ._models_py3 import AccountListResult -from ._models_py3 import AccountModel -from ._models_py3 import AccountModelListResult -from ._models_py3 import AccountProperties -from ._models_py3 import AccountSku -from ._models_py3 import AccountSkuListResult -from ._models_py3 import ApiKeys -from ._models_py3 import ApiProperties -from ._models_py3 import AzureEntityResource -from ._models_py3 import BillingMeterInfo -from ._models_py3 import CalculateModelCapacityParameter -from ._models_py3 import CalculateModelCapacityResult -from ._models_py3 import CalculateModelCapacityResultEstimatedCapacity -from ._models_py3 import CallRateLimit -from ._models_py3 import CapacityConfig -from ._models_py3 import CheckDomainAvailabilityParameter -from ._models_py3 import CheckSkuAvailabilityParameter -from ._models_py3 import CommitmentCost -from ._models_py3 import CommitmentPeriod -from ._models_py3 import CommitmentPlan -from ._models_py3 import CommitmentPlanAccountAssociation -from ._models_py3 import CommitmentPlanAccountAssociationListResult -from ._models_py3 import CommitmentPlanAssociation -from ._models_py3 import CommitmentPlanListResult -from ._models_py3 import CommitmentPlanProperties -from ._models_py3 import CommitmentQuota -from ._models_py3 import CommitmentTier -from ._models_py3 import CommitmentTierListResult -from ._models_py3 import CustomBlocklistConfig -from ._models_py3 import DefenderForAISetting -from ._models_py3 import DefenderForAISettingResult -from ._models_py3 import Deployment -from ._models_py3 import DeploymentCapacitySettings -from ._models_py3 import DeploymentListResult -from ._models_py3 import DeploymentModel -from ._models_py3 import DeploymentProperties -from ._models_py3 import DeploymentScaleSettings -from ._models_py3 import DeploymentSkuListResult -from ._models_py3 import DomainAvailability -from ._models_py3 import Encryption -from ._models_py3 import EncryptionScope -from ._models_py3 import EncryptionScopeListResult -from ._models_py3 import EncryptionScopeProperties -from ._models_py3 import ErrorAdditionalInfo -from ._models_py3 import ErrorDetail -from ._models_py3 import ErrorResponse -from ._models_py3 import Identity -from ._models_py3 import IpRule -from ._models_py3 import KeyVaultProperties -from ._models_py3 import MetricName -from ._models_py3 import Model -from ._models_py3 import ModelCapacityCalculatorWorkload -from ._models_py3 import ModelCapacityCalculatorWorkloadRequestParam -from ._models_py3 import ModelCapacityListResult -from ._models_py3 import ModelCapacityListResultValueItem -from ._models_py3 import ModelDeprecationInfo -from ._models_py3 import ModelListResult -from ._models_py3 import ModelSku -from ._models_py3 import ModelSkuCapacityProperties -from ._models_py3 import MultiRegionSettings -from ._models_py3 import NetworkRuleSet -from ._models_py3 import NetworkSecurityPerimeter -from ._models_py3 import NetworkSecurityPerimeterAccessRule -from ._models_py3 import NetworkSecurityPerimeterAccessRuleProperties -from ._models_py3 import NetworkSecurityPerimeterAccessRulePropertiesSubscriptionsItem -from ._models_py3 import NetworkSecurityPerimeterConfiguration -from ._models_py3 import NetworkSecurityPerimeterConfigurationAssociationInfo -from ._models_py3 import NetworkSecurityPerimeterConfigurationList -from ._models_py3 import NetworkSecurityPerimeterConfigurationProperties -from ._models_py3 import NetworkSecurityPerimeterProfileInfo -from ._models_py3 import Operation -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationListResult -from ._models_py3 import PatchResourceTags -from ._models_py3 import PatchResourceTagsAndSku -from ._models_py3 import PrivateEndpoint -from ._models_py3 import PrivateEndpointConnection -from ._models_py3 import PrivateEndpointConnectionListResult -from ._models_py3 import PrivateEndpointConnectionProperties -from ._models_py3 import PrivateLinkResource -from ._models_py3 import PrivateLinkResourceListResult -from ._models_py3 import PrivateLinkResourceProperties -from ._models_py3 import PrivateLinkServiceConnectionState -from ._models_py3 import ProvisioningIssue -from ._models_py3 import ProvisioningIssueProperties -from ._models_py3 import ProxyResource -from ._models_py3 import QuotaLimit -from ._models_py3 import RaiBlockListItemsResult -from ._models_py3 import RaiBlockListResult -from ._models_py3 import RaiBlocklist -from ._models_py3 import RaiBlocklistConfig -from ._models_py3 import RaiBlocklistItem -from ._models_py3 import RaiBlocklistItemBulkRequest -from ._models_py3 import RaiBlocklistItemProperties -from ._models_py3 import RaiBlocklistProperties -from ._models_py3 import RaiContentFilter -from ._models_py3 import RaiContentFilterListResult -from ._models_py3 import RaiContentFilterProperties -from ._models_py3 import RaiMonitorConfig -from ._models_py3 import RaiPolicy -from ._models_py3 import RaiPolicyContentFilter -from ._models_py3 import RaiPolicyListResult -from ._models_py3 import RaiPolicyProperties -from ._models_py3 import RegenerateKeyParameters -from ._models_py3 import RegionSetting -from ._models_py3 import RequestMatchPattern -from ._models_py3 import Resource -from ._models_py3 import ResourceSku -from ._models_py3 import ResourceSkuListResult -from ._models_py3 import ResourceSkuRestrictionInfo -from ._models_py3 import ResourceSkuRestrictions -from ._models_py3 import Sku -from ._models_py3 import SkuAvailability -from ._models_py3 import SkuAvailabilityListResult -from ._models_py3 import SkuCapability -from ._models_py3 import SkuChangeInfo -from ._models_py3 import SkuResource -from ._models_py3 import SystemData -from ._models_py3 import ThrottlingRule -from ._models_py3 import Usage -from ._models_py3 import UsageListResult -from ._models_py3 import UserAssignedIdentity -from ._models_py3 import UserOwnedAmlWorkspace -from ._models_py3 import UserOwnedStorage -from ._models_py3 import VirtualNetworkRule +from typing import TYPE_CHECKING -from ._cognitive_services_management_client_enums import AbusePenaltyAction -from ._cognitive_services_management_client_enums import ActionType -from ._cognitive_services_management_client_enums import ByPassSelection -from ._cognitive_services_management_client_enums import CommitmentPlanProvisioningState -from ._cognitive_services_management_client_enums import ContentLevel -from ._cognitive_services_management_client_enums import CreatedByType -from ._cognitive_services_management_client_enums import DefenderForAISettingState -from ._cognitive_services_management_client_enums import DeploymentModelVersionUpgradeOption -from ._cognitive_services_management_client_enums import DeploymentProvisioningState -from ._cognitive_services_management_client_enums import DeploymentScaleType -from ._cognitive_services_management_client_enums import EncryptionScopeProvisioningState -from ._cognitive_services_management_client_enums import EncryptionScopeState -from ._cognitive_services_management_client_enums import HostingModel -from ._cognitive_services_management_client_enums import KeyName -from ._cognitive_services_management_client_enums import KeySource -from ._cognitive_services_management_client_enums import ModelLifecycleStatus -from ._cognitive_services_management_client_enums import NetworkRuleAction -from ._cognitive_services_management_client_enums import NspAccessRuleDirection -from ._cognitive_services_management_client_enums import Origin -from ._cognitive_services_management_client_enums import PrivateEndpointConnectionProvisioningState -from ._cognitive_services_management_client_enums import PrivateEndpointServiceConnectionStatus -from ._cognitive_services_management_client_enums import ProvisioningState -from ._cognitive_services_management_client_enums import PublicNetworkAccess -from ._cognitive_services_management_client_enums import QuotaUsageStatus -from ._cognitive_services_management_client_enums import RaiPolicyContentSource -from ._cognitive_services_management_client_enums import RaiPolicyMode -from ._cognitive_services_management_client_enums import RaiPolicyType -from ._cognitive_services_management_client_enums import ResourceIdentityType -from ._cognitive_services_management_client_enums import ResourceSkuRestrictionsReasonCode -from ._cognitive_services_management_client_enums import ResourceSkuRestrictionsType -from ._cognitive_services_management_client_enums import RoutingMethods -from ._cognitive_services_management_client_enums import SkuTier -from ._cognitive_services_management_client_enums import UnitType +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + AADAuthTypeConnectionProperties, + AbusePenalty, + AccessKeyAuthTypeConnectionProperties, + Account, + AccountKeyAuthTypeConnectionProperties, + AccountListResult, + AccountModel, + AccountModelListResult, + AccountProperties, + AccountSku, + AccountSkuListResult, + ApiKeyAuthConnectionProperties, + ApiKeys, + ApiProperties, + AzureEntityResource, + BillingMeterInfo, + CalculateModelCapacityParameter, + CalculateModelCapacityResult, + CalculateModelCapacityResultEstimatedCapacity, + CallRateLimit, + CapabilityHost, + CapabilityHostProperties, + CapacityConfig, + CheckDomainAvailabilityParameter, + CheckSkuAvailabilityParameter, + CommitmentCost, + CommitmentPeriod, + CommitmentPlan, + CommitmentPlanAccountAssociation, + CommitmentPlanAccountAssociationListResult, + CommitmentPlanAssociation, + CommitmentPlanListResult, + CommitmentPlanProperties, + CommitmentQuota, + CommitmentTier, + CommitmentTierListResult, + ConnectionAccessKey, + ConnectionAccountKey, + ConnectionApiKey, + ConnectionManagedIdentity, + ConnectionOAuth2, + ConnectionPersonalAccessToken, + ConnectionPropertiesV2, + ConnectionPropertiesV2BasicResource, + ConnectionPropertiesV2BasicResourceArmPaginatedResult, + ConnectionServicePrincipal, + ConnectionSharedAccessSignature, + ConnectionUpdateContent, + ConnectionUsernamePassword, + CustomBlocklistConfig, + CustomKeys, + CustomKeysConnectionProperties, + DefenderForAISetting, + DefenderForAISettingResult, + Deployment, + DeploymentCapacitySettings, + DeploymentListResult, + DeploymentModel, + DeploymentProperties, + DeploymentScaleSettings, + DeploymentSkuListResult, + DomainAvailability, + Encryption, + EncryptionScope, + EncryptionScopeListResult, + EncryptionScopeProperties, + ErrorAdditionalInfo, + ErrorDetail, + ErrorResponse, + Identity, + IpRule, + KeyVaultProperties, + ManagedIdentityAuthTypeConnectionProperties, + MetricName, + Model, + ModelCapacityCalculatorWorkload, + ModelCapacityCalculatorWorkloadRequestParam, + ModelCapacityListResult, + ModelCapacityListResultValueItem, + ModelDeprecationInfo, + ModelListResult, + ModelSku, + ModelSkuCapacityProperties, + MultiRegionSettings, + NetworkInjections, + NetworkRuleSet, + NetworkSecurityPerimeter, + NetworkSecurityPerimeterAccessRule, + NetworkSecurityPerimeterAccessRuleProperties, + NetworkSecurityPerimeterAccessRulePropertiesSubscriptionsItem, + NetworkSecurityPerimeterConfiguration, + NetworkSecurityPerimeterConfigurationAssociationInfo, + NetworkSecurityPerimeterConfigurationList, + NetworkSecurityPerimeterConfigurationProperties, + NetworkSecurityPerimeterProfileInfo, + NoneAuthTypeConnectionProperties, + OAuth2AuthTypeConnectionProperties, + Operation, + OperationDisplay, + OperationListResult, + PATAuthTypeConnectionProperties, + PatchResourceTags, + PatchResourceTagsAndSku, + PrivateEndpoint, + PrivateEndpointConnection, + PrivateEndpointConnectionListResult, + PrivateEndpointConnectionProperties, + PrivateLinkResource, + PrivateLinkResourceListResult, + PrivateLinkResourceProperties, + PrivateLinkServiceConnectionState, + Project, + ProjectListResult, + ProjectProperties, + ProvisioningIssue, + ProvisioningIssueProperties, + ProxyResource, + QuotaLimit, + RaiBlockListItemsResult, + RaiBlockListResult, + RaiBlocklist, + RaiBlocklistConfig, + RaiBlocklistItem, + RaiBlocklistItemBulkRequest, + RaiBlocklistItemProperties, + RaiBlocklistProperties, + RaiContentFilter, + RaiContentFilterListResult, + RaiContentFilterProperties, + RaiMonitorConfig, + RaiPolicy, + RaiPolicyContentFilter, + RaiPolicyListResult, + RaiPolicyProperties, + RegenerateKeyParameters, + RegionSetting, + RequestMatchPattern, + Resource, + ResourceBase, + ResourceSku, + ResourceSkuListResult, + ResourceSkuRestrictionInfo, + ResourceSkuRestrictions, + SASAuthTypeConnectionProperties, + ServicePrincipalAuthTypeConnectionProperties, + Sku, + SkuAvailability, + SkuAvailabilityListResult, + SkuCapability, + SkuChangeInfo, + SkuResource, + SystemData, + ThrottlingRule, + Usage, + UsageListResult, + UserAssignedIdentity, + UserOwnedAmlWorkspace, + UserOwnedStorage, + UsernamePasswordAuthTypeConnectionProperties, + VirtualNetworkRule, +) + +from ._cognitive_services_management_client_enums import ( # type: ignore + AbusePenaltyAction, + ActionType, + ByPassSelection, + CapabilityHostKind, + CapabilityHostProvisioningState, + CommitmentPlanProvisioningState, + ConnectionAuthType, + ConnectionCategory, + ConnectionGroup, + ContentLevel, + CreatedByType, + DefenderForAISettingState, + DeploymentModelVersionUpgradeOption, + DeploymentProvisioningState, + DeploymentScaleType, + EncryptionScopeProvisioningState, + EncryptionScopeState, + HostingModel, + KeyName, + KeySource, + ManagedPERequirement, + ManagedPEStatus, + ModelLifecycleStatus, + NetworkRuleAction, + NspAccessRuleDirection, + Origin, + PrivateEndpointConnectionProvisioningState, + PrivateEndpointServiceConnectionStatus, + ProvisioningState, + PublicNetworkAccess, + QuotaUsageStatus, + RaiPolicyContentSource, + RaiPolicyMode, + RaiPolicyType, + ResourceIdentityType, + ResourceSkuRestrictionsReasonCode, + ResourceSkuRestrictionsType, + RoutingMethods, + ScenarioType, + SkuTier, + UnitType, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ + "AADAuthTypeConnectionProperties", "AbusePenalty", + "AccessKeyAuthTypeConnectionProperties", "Account", + "AccountKeyAuthTypeConnectionProperties", "AccountListResult", "AccountModel", "AccountModelListResult", "AccountProperties", "AccountSku", "AccountSkuListResult", + "ApiKeyAuthConnectionProperties", "ApiKeys", "ApiProperties", "AzureEntityResource", @@ -188,6 +244,8 @@ "CalculateModelCapacityResult", "CalculateModelCapacityResultEstimatedCapacity", "CallRateLimit", + "CapabilityHost", + "CapabilityHostProperties", "CapacityConfig", "CheckDomainAvailabilityParameter", "CheckSkuAvailabilityParameter", @@ -202,7 +260,22 @@ "CommitmentQuota", "CommitmentTier", "CommitmentTierListResult", + "ConnectionAccessKey", + "ConnectionAccountKey", + "ConnectionApiKey", + "ConnectionManagedIdentity", + "ConnectionOAuth2", + "ConnectionPersonalAccessToken", + "ConnectionPropertiesV2", + "ConnectionPropertiesV2BasicResource", + "ConnectionPropertiesV2BasicResourceArmPaginatedResult", + "ConnectionServicePrincipal", + "ConnectionSharedAccessSignature", + "ConnectionUpdateContent", + "ConnectionUsernamePassword", "CustomBlocklistConfig", + "CustomKeys", + "CustomKeysConnectionProperties", "DefenderForAISetting", "DefenderForAISettingResult", "Deployment", @@ -223,6 +296,7 @@ "Identity", "IpRule", "KeyVaultProperties", + "ManagedIdentityAuthTypeConnectionProperties", "MetricName", "Model", "ModelCapacityCalculatorWorkload", @@ -234,6 +308,7 @@ "ModelSku", "ModelSkuCapacityProperties", "MultiRegionSettings", + "NetworkInjections", "NetworkRuleSet", "NetworkSecurityPerimeter", "NetworkSecurityPerimeterAccessRule", @@ -244,9 +319,12 @@ "NetworkSecurityPerimeterConfigurationList", "NetworkSecurityPerimeterConfigurationProperties", "NetworkSecurityPerimeterProfileInfo", + "NoneAuthTypeConnectionProperties", + "OAuth2AuthTypeConnectionProperties", "Operation", "OperationDisplay", "OperationListResult", + "PATAuthTypeConnectionProperties", "PatchResourceTags", "PatchResourceTagsAndSku", "PrivateEndpoint", @@ -257,6 +335,9 @@ "PrivateLinkResourceListResult", "PrivateLinkResourceProperties", "PrivateLinkServiceConnectionState", + "Project", + "ProjectListResult", + "ProjectProperties", "ProvisioningIssue", "ProvisioningIssueProperties", "ProxyResource", @@ -281,10 +362,13 @@ "RegionSetting", "RequestMatchPattern", "Resource", + "ResourceBase", "ResourceSku", "ResourceSkuListResult", "ResourceSkuRestrictionInfo", "ResourceSkuRestrictions", + "SASAuthTypeConnectionProperties", + "ServicePrincipalAuthTypeConnectionProperties", "Sku", "SkuAvailability", "SkuAvailabilityListResult", @@ -298,11 +382,17 @@ "UserAssignedIdentity", "UserOwnedAmlWorkspace", "UserOwnedStorage", + "UsernamePasswordAuthTypeConnectionProperties", "VirtualNetworkRule", "AbusePenaltyAction", "ActionType", "ByPassSelection", + "CapabilityHostKind", + "CapabilityHostProvisioningState", "CommitmentPlanProvisioningState", + "ConnectionAuthType", + "ConnectionCategory", + "ConnectionGroup", "ContentLevel", "CreatedByType", "DefenderForAISettingState", @@ -314,6 +404,8 @@ "HostingModel", "KeyName", "KeySource", + "ManagedPERequirement", + "ManagedPEStatus", "ModelLifecycleStatus", "NetworkRuleAction", "NspAccessRuleDirection", @@ -330,8 +422,9 @@ "ResourceSkuRestrictionsReasonCode", "ResourceSkuRestrictionsType", "RoutingMethods", + "ScenarioType", "SkuTier", "UnitType", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_cognitive_services_management_client_enums.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_cognitive_services_management_client_enums.py index dd6c2d3b7c4d..84cda2cf8c65 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_cognitive_services_management_client_enums.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_cognitive_services_management_client_enums.py @@ -30,6 +30,23 @@ class ByPassSelection(str, Enum, metaclass=CaseInsensitiveEnumMeta): AZURE_SERVICES = "AzureServices" +class CapabilityHostKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """CapabilityHostKind.""" + + AGENTS = "Agents" + + +class CapabilityHostProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning state of capability host.""" + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + + class CommitmentPlanProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Gets the status of the resource at the time the operation was called.""" @@ -42,6 +59,145 @@ class CommitmentPlanProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMe CANCELED = "Canceled" +class ConnectionAuthType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Authentication type of the connection target.""" + + PAT = "PAT" + MANAGED_IDENTITY = "ManagedIdentity" + USERNAME_PASSWORD = "UsernamePassword" + NONE = "None" + SAS = "SAS" + ACCOUNT_KEY = "AccountKey" + SERVICE_PRINCIPAL = "ServicePrincipal" + ACCESS_KEY = "AccessKey" + API_KEY = "ApiKey" + CUSTOM_KEYS = "CustomKeys" + O_AUTH2 = "OAuth2" + AAD = "AAD" + + +class ConnectionCategory(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Category of the connection.""" + + PYTHON_FEED = "PythonFeed" + CONTAINER_REGISTRY = "ContainerRegistry" + GIT = "Git" + S3 = "S3" + SNOWFLAKE = "Snowflake" + AZURE_SQL_DB = "AzureSqlDb" + AZURE_SYNAPSE_ANALYTICS = "AzureSynapseAnalytics" + AZURE_MY_SQL_DB = "AzureMySqlDb" + AZURE_POSTGRES_DB = "AzurePostgresDb" + ADLS_GEN2 = "ADLSGen2" + REDIS = "Redis" + API_KEY = "ApiKey" + AZURE_OPEN_AI = "AzureOpenAI" + AI_SERVICES = "AIServices" + COGNITIVE_SEARCH = "CognitiveSearch" + COGNITIVE_SERVICE = "CognitiveService" + CUSTOM_KEYS = "CustomKeys" + AZURE_BLOB = "AzureBlob" + AZURE_ONE_LAKE = "AzureOneLake" + COSMOS_DB = "CosmosDb" + COSMOS_DB_MONGO_DB_API = "CosmosDbMongoDbApi" + AZURE_DATA_EXPLORER = "AzureDataExplorer" + AZURE_MARIA_DB = "AzureMariaDb" + AZURE_DATABRICKS_DELTA_LAKE = "AzureDatabricksDeltaLake" + AZURE_SQL_MI = "AzureSqlMi" + AZURE_TABLE_STORAGE = "AzureTableStorage" + AMAZON_RDS_FOR_ORACLE = "AmazonRdsForOracle" + AMAZON_RDS_FOR_SQL_SERVER = "AmazonRdsForSqlServer" + AMAZON_REDSHIFT = "AmazonRedshift" + DB2 = "Db2" + DRILL = "Drill" + GOOGLE_BIG_QUERY = "GoogleBigQuery" + GREENPLUM = "Greenplum" + HBASE = "Hbase" + HIVE = "Hive" + IMPALA = "Impala" + INFORMIX = "Informix" + MARIA_DB = "MariaDb" + MICROSOFT_ACCESS = "MicrosoftAccess" + MY_SQL = "MySql" + NETEZZA = "Netezza" + ORACLE = "Oracle" + PHOENIX = "Phoenix" + POSTGRE_SQL = "PostgreSql" + PRESTO = "Presto" + SAP_OPEN_HUB = "SapOpenHub" + SAP_BW = "SapBw" + SAP_HANA = "SapHana" + SAP_TABLE = "SapTable" + SPARK = "Spark" + SQL_SERVER = "SqlServer" + SYBASE = "Sybase" + TERADATA = "Teradata" + VERTICA = "Vertica" + PINECONE = "Pinecone" + CASSANDRA = "Cassandra" + COUCHBASE = "Couchbase" + MONGO_DB_V2 = "MongoDbV2" + MONGO_DB_ATLAS = "MongoDbAtlas" + AMAZON_S3_COMPATIBLE = "AmazonS3Compatible" + FILE_SERVER = "FileServer" + FTP_SERVER = "FtpServer" + GOOGLE_CLOUD_STORAGE = "GoogleCloudStorage" + HDFS = "Hdfs" + ORACLE_CLOUD_STORAGE = "OracleCloudStorage" + SFTP = "Sftp" + GENERIC_HTTP = "GenericHttp" + O_DATA_REST = "ODataRest" + ODBC = "Odbc" + GENERIC_REST = "GenericRest" + AMAZON_MWS = "AmazonMws" + CONCUR = "Concur" + DYNAMICS = "Dynamics" + DYNAMICS_AX = "DynamicsAx" + DYNAMICS_CRM = "DynamicsCrm" + GOOGLE_AD_WORDS = "GoogleAdWords" + HUBSPOT = "Hubspot" + JIRA = "Jira" + MAGENTO = "Magento" + MARKETO = "Marketo" + OFFICE365 = "Office365" + ELOQUA = "Eloqua" + RESPONSYS = "Responsys" + ORACLE_SERVICE_CLOUD = "OracleServiceCloud" + PAY_PAL = "PayPal" + QUICK_BOOKS = "QuickBooks" + SALESFORCE = "Salesforce" + SALESFORCE_SERVICE_CLOUD = "SalesforceServiceCloud" + SALESFORCE_MARKETING_CLOUD = "SalesforceMarketingCloud" + SAP_CLOUD_FOR_CUSTOMER = "SapCloudForCustomer" + SAP_ECC = "SapEcc" + SERVICE_NOW = "ServiceNow" + SHARE_POINT_ONLINE_LIST = "SharePointOnlineList" + SHOPIFY = "Shopify" + SQUARE = "Square" + WEB_TABLE = "WebTable" + XERO = "Xero" + ZOHO = "Zoho" + GENERIC_CONTAINER_REGISTRY = "GenericContainerRegistry" + ELASTICSEARCH = "Elasticsearch" + OPEN_AI = "OpenAI" + SERP = "Serp" + BING_LLM_SEARCH = "BingLLMSearch" + SERVERLESS = "Serverless" + MANAGED_ONLINE_ENDPOINT = "ManagedOnlineEndpoint" + + +class ConnectionGroup(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Group based on connection category.""" + + AZURE = "Azure" + AZURE_AI = "AzureAI" + DATABASE = "Database" + NO_SQL = "NoSQL" + FILE = "File" + GENERIC_PROTOCOL = "GenericProtocol" + SERVICES_AND_APPS = "ServicesAndApps" + + class ContentLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Level at which content is filtered.""" @@ -136,6 +292,22 @@ class KeySource(str, Enum, metaclass=CaseInsensitiveEnumMeta): MICROSOFT_KEY_VAULT = "Microsoft.KeyVault" +class ManagedPERequirement(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """ManagedPERequirement.""" + + REQUIRED = "Required" + NOT_REQUIRED = "NotRequired" + NOT_APPLICABLE = "NotApplicable" + + +class ManagedPEStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """ManagedPEStatus.""" + + INACTIVE = "Inactive" + ACTIVE = "Active" + NOT_APPLICABLE = "NotApplicable" + + class ModelLifecycleStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Model lifecycle status.""" @@ -199,6 +371,7 @@ class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): FAILED = "Failed" SUCCEEDED = "Succeeded" RESOLVING_DNS = "ResolvingDNS" + CANCELED = "Canceled" class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -226,8 +399,8 @@ class RaiPolicyContentSource(str, Enum, metaclass=CaseInsensitiveEnumMeta): class RaiPolicyMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Rai policy mode. The enum value mapping is as below: Default = 0, Deferred=1, Blocking=2, - Asynchronous_filter =3. Please use 'Asynchronous_filter' after 2024-10-01. It is the same as - 'Deferred' in previous version. + Asynchronous_filter =3. Please use 'Asynchronous_filter' after 2025-04-01-preview. It is the + same as 'Deferred' in previous version. """ DEFAULT = "Default" @@ -274,6 +447,15 @@ class RoutingMethods(str, Enum, metaclass=CaseInsensitiveEnumMeta): PERFORMANCE = "Performance" +class ScenarioType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Specifies what features in AI Foundry network injection applies to. Currently only supports + 'agent' for agent scenarios. 'none' means no network injection. + """ + + NONE = "none" + AGENT = "agent" + + class SkuTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_models_py3.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_models_py3.py index 832cd00a6a3f..da61119c6a4b 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_models_py3.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_models_py3.py @@ -1,5 +1,5 @@ -# coding=utf-8 # pylint: disable=too-many-lines +# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,14 +16,332 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from .. import models as _models JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +class ConnectionPropertiesV2(_serialization.Model): + """Connection property base schema. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AADAuthTypeConnectionProperties, AccessKeyAuthTypeConnectionProperties, + AccountKeyAuthTypeConnectionProperties, ApiKeyAuthConnectionProperties, + CustomKeysConnectionProperties, ManagedIdentityAuthTypeConnectionProperties, + NoneAuthTypeConnectionProperties, OAuth2AuthTypeConnectionProperties, + PATAuthTypeConnectionProperties, SASAuthTypeConnectionProperties, + ServicePrincipalAuthTypeConnectionProperties, UsernamePasswordAuthTypeConnectionProperties + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar auth_type: Authentication type of the connection target. Required. Known values are: + "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", "AccountKey", "ServicePrincipal", + "AccessKey", "ApiKey", "CustomKeys", "OAuth2", and "AAD". + :vartype auth_type: str or ~azure.mgmt.cognitiveservices.models.ConnectionAuthType + :ivar category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :vartype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str + :ivar expiry_time: + :vartype expiry_time: ~datetime.datetime + :ivar group: Group based on connection category. Known values are: "Azure", "AzureAI", + "Database", "NoSQL", "File", "GenericProtocol", and "ServicesAndApps". + :vartype group: str or ~azure.mgmt.cognitiveservices.models.ConnectionGroup + :ivar is_shared_to_all: + :vartype is_shared_to_all: bool + :ivar metadata: Store user metadata for this connection. + :vartype metadata: dict[str, str] + :ivar pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :ivar pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool + """ + + _validation = { + "auth_type": {"required": True}, + "created_by_workspace_arm_id": {"readonly": True}, + "group": {"readonly": True}, + } + + _attribute_map = { + "auth_type": {"key": "authType", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "created_by_workspace_arm_id": {"key": "createdByWorkspaceArmId", "type": "str"}, + "error": {"key": "error", "type": "str"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, + "group": {"key": "group", "type": "str"}, + "is_shared_to_all": {"key": "isSharedToAll", "type": "bool"}, + "metadata": {"key": "metadata", "type": "{str}"}, + "pe_requirement": {"key": "peRequirement", "type": "str"}, + "pe_status": {"key": "peStatus", "type": "str"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + "use_workspace_managed_identity": {"key": "useWorkspaceManagedIdentity", "type": "bool"}, + } + + _subtype_map = { + "auth_type": { + "AAD": "AADAuthTypeConnectionProperties", + "AccessKey": "AccessKeyAuthTypeConnectionProperties", + "AccountKey": "AccountKeyAuthTypeConnectionProperties", + "ApiKey": "ApiKeyAuthConnectionProperties", + "CustomKeys": "CustomKeysConnectionProperties", + "ManagedIdentity": "ManagedIdentityAuthTypeConnectionProperties", + "None": "NoneAuthTypeConnectionProperties", + "OAuth2": "OAuth2AuthTypeConnectionProperties", + "PAT": "PATAuthTypeConnectionProperties", + "SAS": "SASAuthTypeConnectionProperties", + "ServicePrincipal": "ServicePrincipalAuthTypeConnectionProperties", + "UsernamePassword": "UsernamePasswordAuthTypeConnectionProperties", + } + } + + def __init__( + self, + *, + category: Optional[Union[str, "_models.ConnectionCategory"]] = None, + error: Optional[str] = None, + expiry_time: Optional[datetime.datetime] = None, + is_shared_to_all: Optional[bool] = None, + metadata: Optional[Dict[str, str]] = None, + pe_requirement: Optional[Union[str, "_models.ManagedPERequirement"]] = None, + pe_status: Optional[Union[str, "_models.ManagedPEStatus"]] = None, + shared_user_list: Optional[List[str]] = None, + target: Optional[str] = None, + use_workspace_managed_identity: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :paramtype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :keyword error: + :paramtype error: str + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Store user metadata for this connection. + :paramtype metadata: dict[str, str] + :keyword pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :paramtype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :keyword pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool + """ + super().__init__(**kwargs) + self.auth_type: Optional[str] = None + self.category = category + self.created_by_workspace_arm_id = None + self.error = error + self.expiry_time = expiry_time + self.group = None + self.is_shared_to_all = is_shared_to_all + self.metadata = metadata + self.pe_requirement = pe_requirement + self.pe_status = pe_status + self.shared_user_list = shared_user_list + self.target = target + self.use_workspace_managed_identity = use_workspace_managed_identity + + +class AADAuthTypeConnectionProperties(ConnectionPropertiesV2): + """This connection type covers the AAD auth for any applicable Azure service. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar auth_type: Authentication type of the connection target. Required. Known values are: + "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", "AccountKey", "ServicePrincipal", + "AccessKey", "ApiKey", "CustomKeys", "OAuth2", and "AAD". + :vartype auth_type: str or ~azure.mgmt.cognitiveservices.models.ConnectionAuthType + :ivar category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :vartype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str + :ivar expiry_time: + :vartype expiry_time: ~datetime.datetime + :ivar group: Group based on connection category. Known values are: "Azure", "AzureAI", + "Database", "NoSQL", "File", "GenericProtocol", and "ServicesAndApps". + :vartype group: str or ~azure.mgmt.cognitiveservices.models.ConnectionGroup + :ivar is_shared_to_all: + :vartype is_shared_to_all: bool + :ivar metadata: Store user metadata for this connection. + :vartype metadata: dict[str, str] + :ivar pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :ivar pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool + """ + + _validation = { + "auth_type": {"required": True}, + "created_by_workspace_arm_id": {"readonly": True}, + "group": {"readonly": True}, + } + + _attribute_map = { + "auth_type": {"key": "authType", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "created_by_workspace_arm_id": {"key": "createdByWorkspaceArmId", "type": "str"}, + "error": {"key": "error", "type": "str"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, + "group": {"key": "group", "type": "str"}, + "is_shared_to_all": {"key": "isSharedToAll", "type": "bool"}, + "metadata": {"key": "metadata", "type": "{str}"}, + "pe_requirement": {"key": "peRequirement", "type": "str"}, + "pe_status": {"key": "peStatus", "type": "str"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + "use_workspace_managed_identity": {"key": "useWorkspaceManagedIdentity", "type": "bool"}, + } + + def __init__( + self, + *, + category: Optional[Union[str, "_models.ConnectionCategory"]] = None, + error: Optional[str] = None, + expiry_time: Optional[datetime.datetime] = None, + is_shared_to_all: Optional[bool] = None, + metadata: Optional[Dict[str, str]] = None, + pe_requirement: Optional[Union[str, "_models.ManagedPERequirement"]] = None, + pe_status: Optional[Union[str, "_models.ManagedPEStatus"]] = None, + shared_user_list: Optional[List[str]] = None, + target: Optional[str] = None, + use_workspace_managed_identity: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :paramtype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :keyword error: + :paramtype error: str + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Store user metadata for this connection. + :paramtype metadata: dict[str, str] + :keyword pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :paramtype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :keyword pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool + """ + super().__init__( + category=category, + error=error, + expiry_time=expiry_time, + is_shared_to_all=is_shared_to_all, + metadata=metadata, + pe_requirement=pe_requirement, + pe_status=pe_status, + shared_user_list=shared_user_list, + target=target, + use_workspace_managed_identity=use_workspace_managed_identity, + **kwargs + ) + self.auth_type: str = "AAD" + + class AbusePenalty(_serialization.Model): """The abuse penalty. @@ -63,6 +381,160 @@ def __init__( self.expiration = expiration +class AccessKeyAuthTypeConnectionProperties(ConnectionPropertiesV2): + """AccessKeyAuthTypeConnectionProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar auth_type: Authentication type of the connection target. Required. Known values are: + "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", "AccountKey", "ServicePrincipal", + "AccessKey", "ApiKey", "CustomKeys", "OAuth2", and "AAD". + :vartype auth_type: str or ~azure.mgmt.cognitiveservices.models.ConnectionAuthType + :ivar category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :vartype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str + :ivar expiry_time: + :vartype expiry_time: ~datetime.datetime + :ivar group: Group based on connection category. Known values are: "Azure", "AzureAI", + "Database", "NoSQL", "File", "GenericProtocol", and "ServicesAndApps". + :vartype group: str or ~azure.mgmt.cognitiveservices.models.ConnectionGroup + :ivar is_shared_to_all: + :vartype is_shared_to_all: bool + :ivar metadata: Store user metadata for this connection. + :vartype metadata: dict[str, str] + :ivar pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :ivar pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool + :ivar credentials: + :vartype credentials: ~azure.mgmt.cognitiveservices.models.ConnectionAccessKey + """ + + _validation = { + "auth_type": {"required": True}, + "created_by_workspace_arm_id": {"readonly": True}, + "group": {"readonly": True}, + } + + _attribute_map = { + "auth_type": {"key": "authType", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "created_by_workspace_arm_id": {"key": "createdByWorkspaceArmId", "type": "str"}, + "error": {"key": "error", "type": "str"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, + "group": {"key": "group", "type": "str"}, + "is_shared_to_all": {"key": "isSharedToAll", "type": "bool"}, + "metadata": {"key": "metadata", "type": "{str}"}, + "pe_requirement": {"key": "peRequirement", "type": "str"}, + "pe_status": {"key": "peStatus", "type": "str"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + "use_workspace_managed_identity": {"key": "useWorkspaceManagedIdentity", "type": "bool"}, + "credentials": {"key": "credentials", "type": "ConnectionAccessKey"}, + } + + def __init__( + self, + *, + category: Optional[Union[str, "_models.ConnectionCategory"]] = None, + error: Optional[str] = None, + expiry_time: Optional[datetime.datetime] = None, + is_shared_to_all: Optional[bool] = None, + metadata: Optional[Dict[str, str]] = None, + pe_requirement: Optional[Union[str, "_models.ManagedPERequirement"]] = None, + pe_status: Optional[Union[str, "_models.ManagedPEStatus"]] = None, + shared_user_list: Optional[List[str]] = None, + target: Optional[str] = None, + use_workspace_managed_identity: Optional[bool] = None, + credentials: Optional["_models.ConnectionAccessKey"] = None, + **kwargs: Any + ) -> None: + """ + :keyword category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :paramtype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :keyword error: + :paramtype error: str + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Store user metadata for this connection. + :paramtype metadata: dict[str, str] + :keyword pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :paramtype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :keyword pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool + :keyword credentials: + :paramtype credentials: ~azure.mgmt.cognitiveservices.models.ConnectionAccessKey + """ + super().__init__( + category=category, + error=error, + expiry_time=expiry_time, + is_shared_to_all=is_shared_to_all, + metadata=metadata, + pe_requirement=pe_requirement, + pe_status=pe_status, + shared_user_list=shared_user_list, + target=target, + use_workspace_managed_identity=use_workspace_managed_identity, + **kwargs + ) + self.auth_type: str = "AccessKey" + self.credentials = credentials + + class Resource(_serialization.Model): """Common fields that are returned in the response for all Azure Resource Manager resources. @@ -135,7 +607,7 @@ def __init__(self, **kwargs: Any) -> None: self.etag = None -class Account(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class Account(AzureEntityResource): """Cognitive Services account is an Azure resource representing the provisioned account, it's type, location and SKU. @@ -224,6 +696,160 @@ def __init__( self.properties = properties +class AccountKeyAuthTypeConnectionProperties(ConnectionPropertiesV2): + """This connection type covers the account key connection for Azure storage. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar auth_type: Authentication type of the connection target. Required. Known values are: + "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", "AccountKey", "ServicePrincipal", + "AccessKey", "ApiKey", "CustomKeys", "OAuth2", and "AAD". + :vartype auth_type: str or ~azure.mgmt.cognitiveservices.models.ConnectionAuthType + :ivar category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :vartype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str + :ivar expiry_time: + :vartype expiry_time: ~datetime.datetime + :ivar group: Group based on connection category. Known values are: "Azure", "AzureAI", + "Database", "NoSQL", "File", "GenericProtocol", and "ServicesAndApps". + :vartype group: str or ~azure.mgmt.cognitiveservices.models.ConnectionGroup + :ivar is_shared_to_all: + :vartype is_shared_to_all: bool + :ivar metadata: Store user metadata for this connection. + :vartype metadata: dict[str, str] + :ivar pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :ivar pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool + :ivar credentials: Account key object for connection credential. + :vartype credentials: ~azure.mgmt.cognitiveservices.models.ConnectionAccountKey + """ + + _validation = { + "auth_type": {"required": True}, + "created_by_workspace_arm_id": {"readonly": True}, + "group": {"readonly": True}, + } + + _attribute_map = { + "auth_type": {"key": "authType", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "created_by_workspace_arm_id": {"key": "createdByWorkspaceArmId", "type": "str"}, + "error": {"key": "error", "type": "str"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, + "group": {"key": "group", "type": "str"}, + "is_shared_to_all": {"key": "isSharedToAll", "type": "bool"}, + "metadata": {"key": "metadata", "type": "{str}"}, + "pe_requirement": {"key": "peRequirement", "type": "str"}, + "pe_status": {"key": "peStatus", "type": "str"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + "use_workspace_managed_identity": {"key": "useWorkspaceManagedIdentity", "type": "bool"}, + "credentials": {"key": "credentials", "type": "ConnectionAccountKey"}, + } + + def __init__( + self, + *, + category: Optional[Union[str, "_models.ConnectionCategory"]] = None, + error: Optional[str] = None, + expiry_time: Optional[datetime.datetime] = None, + is_shared_to_all: Optional[bool] = None, + metadata: Optional[Dict[str, str]] = None, + pe_requirement: Optional[Union[str, "_models.ManagedPERequirement"]] = None, + pe_status: Optional[Union[str, "_models.ManagedPEStatus"]] = None, + shared_user_list: Optional[List[str]] = None, + target: Optional[str] = None, + use_workspace_managed_identity: Optional[bool] = None, + credentials: Optional["_models.ConnectionAccountKey"] = None, + **kwargs: Any + ) -> None: + """ + :keyword category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :paramtype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :keyword error: + :paramtype error: str + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Store user metadata for this connection. + :paramtype metadata: dict[str, str] + :keyword pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :paramtype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :keyword pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool + :keyword credentials: Account key object for connection credential. + :paramtype credentials: ~azure.mgmt.cognitiveservices.models.ConnectionAccountKey + """ + super().__init__( + category=category, + error=error, + expiry_time=expiry_time, + is_shared_to_all=is_shared_to_all, + metadata=metadata, + pe_requirement=pe_requirement, + pe_status=pe_status, + shared_user_list=shared_user_list, + target=target, + use_workspace_managed_identity=use_workspace_managed_identity, + **kwargs + ) + self.auth_type: str = "AccountKey" + self.credentials = credentials + + class AccountListResult(_serialization.Model): """The list of cognitive services accounts operation response. @@ -332,7 +958,7 @@ def __init__( self.call_rate_limit = None -class AccountModel(DeploymentModel): # pylint: disable=too-many-instance-attributes +class AccountModel(DeploymentModel): """Cognitive Services account Model. Variables are only populated by the server, and will be ignored when sending a request. @@ -502,14 +1128,14 @@ def __init__( self.value = value -class AccountProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes +class AccountProperties(_serialization.Model): """Properties of Cognitive Services account. Variables are only populated by the server, and will be ignored when sending a request. :ivar provisioning_state: Gets the status of the cognitive services account at the time the operation was called. Known values are: "Accepted", "Creating", "Deleting", "Moving", "Failed", - "Succeeded", and "ResolvingDNS". + "Succeeded", "ResolvingDNS", and "Canceled". :vartype provisioning_state: str or ~azure.mgmt.cognitiveservices.models.ProvisioningState :ivar endpoint: Endpoint of the created account. :vartype endpoint: str @@ -534,7 +1160,7 @@ class AccountProperties(_serialization.Model): # pylint: disable=too-many-insta :vartype encryption: ~azure.mgmt.cognitiveservices.models.Encryption :ivar user_owned_storage: The storage accounts for this resource. :vartype user_owned_storage: list[~azure.mgmt.cognitiveservices.models.UserOwnedStorage] - :ivar aml_workspace: The user owned AML workspace properties. + :ivar aml_workspace: The user owned AML account properties. :vartype aml_workspace: ~azure.mgmt.cognitiveservices.models.UserOwnedAmlWorkspace :ivar private_endpoint_connections: The private endpoint connection associated with the Cognitive Services account. @@ -577,6 +1203,19 @@ class AccountProperties(_serialization.Model): # pylint: disable=too-many-insta :vartype abuse_penalty: ~azure.mgmt.cognitiveservices.models.AbusePenalty :ivar rai_monitor_config: Cognitive Services Rai Monitor Config. :vartype rai_monitor_config: ~azure.mgmt.cognitiveservices.models.RaiMonitorConfig + :ivar network_injections: Specifies in AI Foundry where virtual network injection occurs to + secure scenarios like Agents entirely within the user's private network, eliminating public + internet exposure while maintaining control over network configurations and resources. + :vartype network_injections: ~azure.mgmt.cognitiveservices.models.NetworkInjections + :ivar allow_project_management: Specifies whether this resource support project management as + child resources, used as containers for access management, data isolation and cost in AI + Foundry. + :vartype allow_project_management: bool + :ivar default_project: Specifies the project that is targeted when data plane endpoints are + called without a project parameter. + :vartype default_project: str + :ivar associated_projects: Specifies the projects that are associated with this resource. + :vartype associated_projects: list[str] """ _validation = { @@ -628,6 +1267,10 @@ class AccountProperties(_serialization.Model): # pylint: disable=too-many-insta "commitment_plan_associations": {"key": "commitmentPlanAssociations", "type": "[CommitmentPlanAssociation]"}, "abuse_penalty": {"key": "abusePenalty", "type": "AbusePenalty"}, "rai_monitor_config": {"key": "raiMonitorConfig", "type": "RaiMonitorConfig"}, + "network_injections": {"key": "networkInjections", "type": "NetworkInjections"}, + "allow_project_management": {"key": "allowProjectManagement", "type": "bool"}, + "default_project": {"key": "defaultProject", "type": "str"}, + "associated_projects": {"key": "associatedProjects", "type": "[str]"}, } def __init__( # pylint: disable=too-many-locals @@ -648,6 +1291,10 @@ def __init__( # pylint: disable=too-many-locals restore: Optional[bool] = None, locations: Optional["_models.MultiRegionSettings"] = None, rai_monitor_config: Optional["_models.RaiMonitorConfig"] = None, + network_injections: Optional["_models.NetworkInjections"] = None, + allow_project_management: Optional[bool] = None, + default_project: Optional[str] = None, + associated_projects: Optional[List[str]] = None, **kwargs: Any ) -> None: """ @@ -662,7 +1309,7 @@ def __init__( # pylint: disable=too-many-locals :paramtype encryption: ~azure.mgmt.cognitiveservices.models.Encryption :keyword user_owned_storage: The storage accounts for this resource. :paramtype user_owned_storage: list[~azure.mgmt.cognitiveservices.models.UserOwnedStorage] - :keyword aml_workspace: The user owned AML workspace properties. + :keyword aml_workspace: The user owned AML account properties. :paramtype aml_workspace: ~azure.mgmt.cognitiveservices.models.UserOwnedAmlWorkspace :keyword public_network_access: Whether or not public endpoint access is allowed for this account. Known values are: "Enabled" and "Disabled". @@ -684,6 +1331,19 @@ def __init__( # pylint: disable=too-many-locals :paramtype locations: ~azure.mgmt.cognitiveservices.models.MultiRegionSettings :keyword rai_monitor_config: Cognitive Services Rai Monitor Config. :paramtype rai_monitor_config: ~azure.mgmt.cognitiveservices.models.RaiMonitorConfig + :keyword network_injections: Specifies in AI Foundry where virtual network injection occurs to + secure scenarios like Agents entirely within the user's private network, eliminating public + internet exposure while maintaining control over network configurations and resources. + :paramtype network_injections: ~azure.mgmt.cognitiveservices.models.NetworkInjections + :keyword allow_project_management: Specifies whether this resource support project management + as child resources, used as containers for access management, data isolation and cost in AI + Foundry. + :paramtype allow_project_management: bool + :keyword default_project: Specifies the project that is targeted when data plane endpoints are + called without a project parameter. + :paramtype default_project: str + :keyword associated_projects: Specifies the projects that are associated with this resource. + :paramtype associated_projects: list[str] """ super().__init__(**kwargs) self.provisioning_state = None @@ -716,6 +1376,10 @@ def __init__( # pylint: disable=too-many-locals self.commitment_plan_associations = None self.abuse_penalty = None self.rai_monitor_config = rai_monitor_config + self.network_injections = network_injections + self.allow_project_management = allow_project_management + self.default_project = default_project + self.associated_projects = associated_projects class AccountSku(_serialization.Model): @@ -766,6 +1430,179 @@ def __init__(self, *, value: Optional[List["_models.AccountSku"]] = None, **kwar self.value = value +class ApiKeyAuthConnectionProperties(ConnectionPropertiesV2): + """This connection type covers the generic ApiKey auth connection categories, for examples: + AzureOpenAI: + Category:= AzureOpenAI + AuthType:= ApiKey (as type discriminator) + Credentials:= {ApiKey} as .ApiKey + Target:= {ApiBase} + + CognitiveService: + Category:= CognitiveService + AuthType:= ApiKey (as type discriminator) + Credentials:= {SubscriptionKey} as ApiKey + Target:= ServiceRegion={serviceRegion} + + CognitiveSearch: + Category:= CognitiveSearch + AuthType:= ApiKey (as type discriminator) + Credentials:= {Key} as ApiKey + Target:= {Endpoint} + + Use Metadata property bag for ApiType, ApiVersion, Kind and other metadata fields. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar auth_type: Authentication type of the connection target. Required. Known values are: + "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", "AccountKey", "ServicePrincipal", + "AccessKey", "ApiKey", "CustomKeys", "OAuth2", and "AAD". + :vartype auth_type: str or ~azure.mgmt.cognitiveservices.models.ConnectionAuthType + :ivar category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :vartype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str + :ivar expiry_time: + :vartype expiry_time: ~datetime.datetime + :ivar group: Group based on connection category. Known values are: "Azure", "AzureAI", + "Database", "NoSQL", "File", "GenericProtocol", and "ServicesAndApps". + :vartype group: str or ~azure.mgmt.cognitiveservices.models.ConnectionGroup + :ivar is_shared_to_all: + :vartype is_shared_to_all: bool + :ivar metadata: Store user metadata for this connection. + :vartype metadata: dict[str, str] + :ivar pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :ivar pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool + :ivar credentials: Api key object for connection credential. + :vartype credentials: ~azure.mgmt.cognitiveservices.models.ConnectionApiKey + """ + + _validation = { + "auth_type": {"required": True}, + "created_by_workspace_arm_id": {"readonly": True}, + "group": {"readonly": True}, + } + + _attribute_map = { + "auth_type": {"key": "authType", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "created_by_workspace_arm_id": {"key": "createdByWorkspaceArmId", "type": "str"}, + "error": {"key": "error", "type": "str"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, + "group": {"key": "group", "type": "str"}, + "is_shared_to_all": {"key": "isSharedToAll", "type": "bool"}, + "metadata": {"key": "metadata", "type": "{str}"}, + "pe_requirement": {"key": "peRequirement", "type": "str"}, + "pe_status": {"key": "peStatus", "type": "str"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + "use_workspace_managed_identity": {"key": "useWorkspaceManagedIdentity", "type": "bool"}, + "credentials": {"key": "credentials", "type": "ConnectionApiKey"}, + } + + def __init__( + self, + *, + category: Optional[Union[str, "_models.ConnectionCategory"]] = None, + error: Optional[str] = None, + expiry_time: Optional[datetime.datetime] = None, + is_shared_to_all: Optional[bool] = None, + metadata: Optional[Dict[str, str]] = None, + pe_requirement: Optional[Union[str, "_models.ManagedPERequirement"]] = None, + pe_status: Optional[Union[str, "_models.ManagedPEStatus"]] = None, + shared_user_list: Optional[List[str]] = None, + target: Optional[str] = None, + use_workspace_managed_identity: Optional[bool] = None, + credentials: Optional["_models.ConnectionApiKey"] = None, + **kwargs: Any + ) -> None: + """ + :keyword category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :paramtype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :keyword error: + :paramtype error: str + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Store user metadata for this connection. + :paramtype metadata: dict[str, str] + :keyword pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :paramtype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :keyword pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool + :keyword credentials: Api key object for connection credential. + :paramtype credentials: ~azure.mgmt.cognitiveservices.models.ConnectionApiKey + """ + super().__init__( + category=category, + error=error, + expiry_time=expiry_time, + is_shared_to_all=is_shared_to_all, + metadata=metadata, + pe_requirement=pe_requirement, + pe_status=pe_status, + shared_user_list=shared_user_list, + target=target, + use_workspace_managed_identity=use_workspace_managed_identity, + **kwargs + ) + self.auth_type: str = "ApiKey" + self.credentials = credentials + + class ApiKeys(_serialization.Model): """The access keys for the cognitive services account. @@ -792,7 +1629,7 @@ def __init__(self, *, key1: Optional[str] = None, key2: Optional[str] = None, ** self.key2 = key2 -class ApiProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes +class ApiProperties(_serialization.Model): """The api properties for special APIs. :ivar additional_properties: Unmatched properties from the message are deserialized to this @@ -1090,6 +1927,177 @@ def __init__( self.rules = rules +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have + tags and a location. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + """ + + +class CapabilityHost(ProxyResource): + """Azure Resource Manager resource envelope. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar properties: [Required] Additional attributes of the entity. Required. + :vartype properties: ~azure.mgmt.cognitiveservices.models.CapabilityHostProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "properties": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "properties": {"key": "properties", "type": "CapabilityHostProperties"}, + } + + def __init__(self, *, properties: "_models.CapabilityHostProperties", **kwargs: Any) -> None: + """ + :keyword properties: [Required] Additional attributes of the entity. Required. + :paramtype properties: ~azure.mgmt.cognitiveservices.models.CapabilityHostProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class ResourceBase(_serialization.Model): + """ResourceBase. + + :ivar description: The asset description text. + :vartype description: str + :ivar tags: Tag dictionary. Tags can be added, removed, and updated. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + "description": {"key": "description", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__( + self, *, description: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs: Any + ) -> None: + """ + :keyword description: The asset description text. + :paramtype description: str + :keyword tags: Tag dictionary. Tags can be added, removed, and updated. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.description = description + self.tags = tags + + +class CapabilityHostProperties(ResourceBase): + """CapabilityHostProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar description: The asset description text. + :vartype description: str + :ivar tags: Tag dictionary. Tags can be added, removed, and updated. + :vartype tags: dict[str, str] + :ivar ai_services_connections: List of AI services connections. + :vartype ai_services_connections: list[str] + :ivar capability_host_kind: Kind of this capability host. "Agents" + :vartype capability_host_kind: str or ~azure.mgmt.cognitiveservices.models.CapabilityHostKind + :ivar customer_subnet: Customer subnet info to help set up this capability host. + :vartype customer_subnet: str + :ivar provisioning_state: Provisioning state for the CapabilityHost. Known values are: + "Succeeded", "Failed", "Canceled", "Creating", "Updating", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.cognitiveservices.models.CapabilityHostProvisioningState + :ivar storage_connections: List of Storage connections. + :vartype storage_connections: list[str] + :ivar thread_storage_connections: List of Thread storage connections. + :vartype thread_storage_connections: list[str] + :ivar vector_store_connections: List of VectorStore connections. + :vartype vector_store_connections: list[str] + """ + + _validation = { + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "description": {"key": "description", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "ai_services_connections": {"key": "aiServicesConnections", "type": "[str]"}, + "capability_host_kind": {"key": "capabilityHostKind", "type": "str"}, + "customer_subnet": {"key": "customerSubnet", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "storage_connections": {"key": "storageConnections", "type": "[str]"}, + "thread_storage_connections": {"key": "threadStorageConnections", "type": "[str]"}, + "vector_store_connections": {"key": "vectorStoreConnections", "type": "[str]"}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + ai_services_connections: Optional[List[str]] = None, + capability_host_kind: Optional[Union[str, "_models.CapabilityHostKind"]] = None, + customer_subnet: Optional[str] = None, + storage_connections: Optional[List[str]] = None, + thread_storage_connections: Optional[List[str]] = None, + vector_store_connections: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword description: The asset description text. + :paramtype description: str + :keyword tags: Tag dictionary. Tags can be added, removed, and updated. + :paramtype tags: dict[str, str] + :keyword ai_services_connections: List of AI services connections. + :paramtype ai_services_connections: list[str] + :keyword capability_host_kind: Kind of this capability host. "Agents" + :paramtype capability_host_kind: str or ~azure.mgmt.cognitiveservices.models.CapabilityHostKind + :keyword customer_subnet: Customer subnet info to help set up this capability host. + :paramtype customer_subnet: str + :keyword storage_connections: List of Storage connections. + :paramtype storage_connections: list[str] + :keyword thread_storage_connections: List of Thread storage connections. + :paramtype thread_storage_connections: list[str] + :keyword vector_store_connections: List of VectorStore connections. + :paramtype vector_store_connections: list[str] + """ + super().__init__(description=description, tags=tags, **kwargs) + self.ai_services_connections = ai_services_connections + self.capability_host_kind = capability_host_kind + self.customer_subnet = customer_subnet + self.provisioning_state = None + self.storage_connections = storage_connections + self.thread_storage_connections = thread_storage_connections + self.vector_store_connections = vector_store_connections + + class CapacityConfig(_serialization.Model): """The capacity configuration. @@ -1296,25 +2304,8 @@ def __init__(self, *, tier: Optional[str] = None, count: Optional[int] = None, * self.end_date = None -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have - tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - -class CommitmentPlan(ProxyResource): - """Cognitive Services account commitment plan. +class CommitmentPlan(ProxyResource): + """Cognitive Services account commitment plan. Variables are only populated by the server, and will be ignored when sending a request. @@ -1626,136 +2617,527 @@ def __init__( self.provisioning_issues = None -class CommitmentQuota(_serialization.Model): - """Cognitive Services account commitment quota. +class CommitmentQuota(_serialization.Model): + """Cognitive Services account commitment quota. + + :ivar quantity: Commitment quota quantity. + :vartype quantity: int + :ivar unit: Commitment quota unit. + :vartype unit: str + """ + + _attribute_map = { + "quantity": {"key": "quantity", "type": "int"}, + "unit": {"key": "unit", "type": "str"}, + } + + def __init__(self, *, quantity: Optional[int] = None, unit: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword quantity: Commitment quota quantity. + :paramtype quantity: int + :keyword unit: Commitment quota unit. + :paramtype unit: str + """ + super().__init__(**kwargs) + self.quantity = quantity + self.unit = unit + + +class CommitmentTier(_serialization.Model): + """Cognitive Services account commitment tier. + + :ivar kind: The Kind of the resource. + :vartype kind: str + :ivar sku_name: The name of the SKU. Ex - P3. It is typically a letter+number code. + :vartype sku_name: str + :ivar hosting_model: Account hosting model. Known values are: "Web", "ConnectedContainer", + "DisconnectedContainer", and "ProvisionedWeb". + :vartype hosting_model: str or ~azure.mgmt.cognitiveservices.models.HostingModel + :ivar plan_type: Commitment plan type. + :vartype plan_type: str + :ivar tier: Commitment period commitment tier. + :vartype tier: str + :ivar max_count: Commitment period commitment max count. + :vartype max_count: int + :ivar quota: Cognitive Services account commitment quota. + :vartype quota: ~azure.mgmt.cognitiveservices.models.CommitmentQuota + :ivar cost: Cognitive Services account commitment cost. + :vartype cost: ~azure.mgmt.cognitiveservices.models.CommitmentCost + """ + + _attribute_map = { + "kind": {"key": "kind", "type": "str"}, + "sku_name": {"key": "skuName", "type": "str"}, + "hosting_model": {"key": "hostingModel", "type": "str"}, + "plan_type": {"key": "planType", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "quota": {"key": "quota", "type": "CommitmentQuota"}, + "cost": {"key": "cost", "type": "CommitmentCost"}, + } + + def __init__( + self, + *, + kind: Optional[str] = None, + sku_name: Optional[str] = None, + hosting_model: Optional[Union[str, "_models.HostingModel"]] = None, + plan_type: Optional[str] = None, + tier: Optional[str] = None, + max_count: Optional[int] = None, + quota: Optional["_models.CommitmentQuota"] = None, + cost: Optional["_models.CommitmentCost"] = None, + **kwargs: Any + ) -> None: + """ + :keyword kind: The Kind of the resource. + :paramtype kind: str + :keyword sku_name: The name of the SKU. Ex - P3. It is typically a letter+number code. + :paramtype sku_name: str + :keyword hosting_model: Account hosting model. Known values are: "Web", "ConnectedContainer", + "DisconnectedContainer", and "ProvisionedWeb". + :paramtype hosting_model: str or ~azure.mgmt.cognitiveservices.models.HostingModel + :keyword plan_type: Commitment plan type. + :paramtype plan_type: str + :keyword tier: Commitment period commitment tier. + :paramtype tier: str + :keyword max_count: Commitment period commitment max count. + :paramtype max_count: int + :keyword quota: Cognitive Services account commitment quota. + :paramtype quota: ~azure.mgmt.cognitiveservices.models.CommitmentQuota + :keyword cost: Cognitive Services account commitment cost. + :paramtype cost: ~azure.mgmt.cognitiveservices.models.CommitmentCost + """ + super().__init__(**kwargs) + self.kind = kind + self.sku_name = sku_name + self.hosting_model = hosting_model + self.plan_type = plan_type + self.tier = tier + self.max_count = max_count + self.quota = quota + self.cost = cost + + +class CommitmentTierListResult(_serialization.Model): + """The list of cognitive services accounts operation response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar next_link: The link used to get the next page of CommitmentTier. + :vartype next_link: str + :ivar value: Gets the list of Cognitive Services accounts CommitmentTier and their properties. + :vartype value: list[~azure.mgmt.cognitiveservices.models.CommitmentTier] + """ + + _validation = { + "value": {"readonly": True}, + } + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[CommitmentTier]"}, + } + + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword next_link: The link used to get the next page of CommitmentTier. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.next_link = next_link + self.value = None + + +class ConnectionAccessKey(_serialization.Model): + """ConnectionAccessKey. + + :ivar access_key_id: + :vartype access_key_id: str + :ivar secret_access_key: + :vartype secret_access_key: str + """ + + _attribute_map = { + "access_key_id": {"key": "accessKeyId", "type": "str"}, + "secret_access_key": {"key": "secretAccessKey", "type": "str"}, + } + + def __init__( + self, *, access_key_id: Optional[str] = None, secret_access_key: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword access_key_id: + :paramtype access_key_id: str + :keyword secret_access_key: + :paramtype secret_access_key: str + """ + super().__init__(**kwargs) + self.access_key_id = access_key_id + self.secret_access_key = secret_access_key + + +class ConnectionAccountKey(_serialization.Model): + """Account key object for connection credential. + + :ivar key: + :vartype key: str + """ + + _attribute_map = { + "key": {"key": "key", "type": "str"}, + } + + def __init__(self, *, key: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword key: + :paramtype key: str + """ + super().__init__(**kwargs) + self.key = key + + +class ConnectionApiKey(_serialization.Model): + """Api key object for connection credential. + + :ivar key: + :vartype key: str + """ + + _attribute_map = { + "key": {"key": "key", "type": "str"}, + } + + def __init__(self, *, key: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword key: + :paramtype key: str + """ + super().__init__(**kwargs) + self.key = key + + +class ConnectionManagedIdentity(_serialization.Model): + """ConnectionManagedIdentity. + + :ivar client_id: + :vartype client_id: str + :ivar resource_id: + :vartype resource_id: str + """ + + _attribute_map = { + "client_id": {"key": "clientId", "type": "str"}, + "resource_id": {"key": "resourceId", "type": "str"}, + } + + def __init__(self, *, client_id: Optional[str] = None, resource_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword client_id: + :paramtype client_id: str + :keyword resource_id: + :paramtype resource_id: str + """ + super().__init__(**kwargs) + self.client_id = client_id + self.resource_id = resource_id + + +class ConnectionOAuth2(_serialization.Model): + """ClientId and ClientSecret are required. Other properties are optional + depending on each OAuth2 provider's implementation. + + :ivar auth_url: Required by Concur connection category. + :vartype auth_url: str + :ivar client_id: Client id in the format of UUID. + :vartype client_id: str + :ivar client_secret: + :vartype client_secret: str + :ivar developer_token: Required by GoogleAdWords connection category. + :vartype developer_token: str + :ivar password: + :vartype password: str + :ivar refresh_token: Required by GoogleBigQuery, GoogleAdWords, Hubspot, QuickBooks, Square, + Xero, Zoho + where user needs to get RefreshToken offline. + :vartype refresh_token: str + :ivar tenant_id: Required by QuickBooks and Xero connection categories. + :vartype tenant_id: str + :ivar username: Concur, ServiceNow auth server AccessToken grant type is 'Password' + which requires UsernamePassword. + :vartype username: str + """ + + _attribute_map = { + "auth_url": {"key": "authUrl", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "client_secret": {"key": "clientSecret", "type": "str"}, + "developer_token": {"key": "developerToken", "type": "str"}, + "password": {"key": "password", "type": "str"}, + "refresh_token": {"key": "refreshToken", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "username": {"key": "username", "type": "str"}, + } + + def __init__( + self, + *, + auth_url: Optional[str] = None, + client_id: Optional[str] = None, + client_secret: Optional[str] = None, + developer_token: Optional[str] = None, + password: Optional[str] = None, + refresh_token: Optional[str] = None, + tenant_id: Optional[str] = None, + username: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword auth_url: Required by Concur connection category. + :paramtype auth_url: str + :keyword client_id: Client id in the format of UUID. + :paramtype client_id: str + :keyword client_secret: + :paramtype client_secret: str + :keyword developer_token: Required by GoogleAdWords connection category. + :paramtype developer_token: str + :keyword password: + :paramtype password: str + :keyword refresh_token: Required by GoogleBigQuery, GoogleAdWords, Hubspot, QuickBooks, Square, + Xero, Zoho + where user needs to get RefreshToken offline. + :paramtype refresh_token: str + :keyword tenant_id: Required by QuickBooks and Xero connection categories. + :paramtype tenant_id: str + :keyword username: Concur, ServiceNow auth server AccessToken grant type is 'Password' + which requires UsernamePassword. + :paramtype username: str + """ + super().__init__(**kwargs) + self.auth_url = auth_url + self.client_id = client_id + self.client_secret = client_secret + self.developer_token = developer_token + self.password = password + self.refresh_token = refresh_token + self.tenant_id = tenant_id + self.username = username + + +class ConnectionPersonalAccessToken(_serialization.Model): + """ConnectionPersonalAccessToken. + + :ivar pat: + :vartype pat: str + """ + + _attribute_map = { + "pat": {"key": "pat", "type": "str"}, + } + + def __init__(self, *, pat: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword pat: + :paramtype pat: str + """ + super().__init__(**kwargs) + self.pat = pat + + +class ConnectionPropertiesV2BasicResource(Resource): + """Connection base resource schema. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar properties: Connection property base schema. Required. + :vartype properties: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2 + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "properties": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "properties": {"key": "properties", "type": "ConnectionPropertiesV2"}, + } + + def __init__(self, *, properties: "_models.ConnectionPropertiesV2", **kwargs: Any) -> None: + """ + :keyword properties: Connection property base schema. Required. + :paramtype properties: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2 + """ + super().__init__(**kwargs) + self.properties = properties + + +class ConnectionPropertiesV2BasicResourceArmPaginatedResult(_serialization.Model): # pylint: disable=name-too-long + """ConnectionPropertiesV2BasicResourceArmPaginatedResult. + + :ivar next_link: + :vartype next_link: str + :ivar value: + :vartype value: list[~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource] + """ + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[ConnectionPropertiesV2BasicResource]"}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + value: Optional[List["_models.ConnectionPropertiesV2BasicResource"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword next_link: + :paramtype next_link: str + :keyword value: + :paramtype value: + list[~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource] + """ + super().__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class ConnectionServicePrincipal(_serialization.Model): + """ConnectionServicePrincipal. + + :ivar client_id: + :vartype client_id: str + :ivar client_secret: + :vartype client_secret: str + :ivar tenant_id: + :vartype tenant_id: str + """ + + _attribute_map = { + "client_id": {"key": "clientId", "type": "str"}, + "client_secret": {"key": "clientSecret", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + } + + def __init__( + self, + *, + client_id: Optional[str] = None, + client_secret: Optional[str] = None, + tenant_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword client_id: + :paramtype client_id: str + :keyword client_secret: + :paramtype client_secret: str + :keyword tenant_id: + :paramtype tenant_id: str + """ + super().__init__(**kwargs) + self.client_id = client_id + self.client_secret = client_secret + self.tenant_id = tenant_id + + +class ConnectionSharedAccessSignature(_serialization.Model): + """ConnectionSharedAccessSignature. - :ivar quantity: Commitment quota quantity. - :vartype quantity: int - :ivar unit: Commitment quota unit. - :vartype unit: str + :ivar sas: + :vartype sas: str """ _attribute_map = { - "quantity": {"key": "quantity", "type": "int"}, - "unit": {"key": "unit", "type": "str"}, + "sas": {"key": "sas", "type": "str"}, } - def __init__(self, *, quantity: Optional[int] = None, unit: Optional[str] = None, **kwargs: Any) -> None: + def __init__(self, *, sas: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword quantity: Commitment quota quantity. - :paramtype quantity: int - :keyword unit: Commitment quota unit. - :paramtype unit: str + :keyword sas: + :paramtype sas: str """ super().__init__(**kwargs) - self.quantity = quantity - self.unit = unit + self.sas = sas -class CommitmentTier(_serialization.Model): - """Cognitive Services account commitment tier. +class ConnectionUpdateContent(_serialization.Model): + """The properties that the Cognitive services connection will be updated with. - :ivar kind: The Kind of the resource. - :vartype kind: str - :ivar sku_name: The name of the SKU. Ex - P3. It is typically a letter+number code. - :vartype sku_name: str - :ivar hosting_model: Account hosting model. Known values are: "Web", "ConnectedContainer", - "DisconnectedContainer", and "ProvisionedWeb". - :vartype hosting_model: str or ~azure.mgmt.cognitiveservices.models.HostingModel - :ivar plan_type: Commitment plan type. - :vartype plan_type: str - :ivar tier: Commitment period commitment tier. - :vartype tier: str - :ivar max_count: Commitment period commitment max count. - :vartype max_count: int - :ivar quota: Cognitive Services account commitment quota. - :vartype quota: ~azure.mgmt.cognitiveservices.models.CommitmentQuota - :ivar cost: Cognitive Services account commitment cost. - :vartype cost: ~azure.mgmt.cognitiveservices.models.CommitmentCost + :ivar properties: The properties that the Cognitive services connection will be updated with. + :vartype properties: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2 """ _attribute_map = { - "kind": {"key": "kind", "type": "str"}, - "sku_name": {"key": "skuName", "type": "str"}, - "hosting_model": {"key": "hostingModel", "type": "str"}, - "plan_type": {"key": "planType", "type": "str"}, - "tier": {"key": "tier", "type": "str"}, - "max_count": {"key": "maxCount", "type": "int"}, - "quota": {"key": "quota", "type": "CommitmentQuota"}, - "cost": {"key": "cost", "type": "CommitmentCost"}, + "properties": {"key": "properties", "type": "ConnectionPropertiesV2"}, } - def __init__( - self, - *, - kind: Optional[str] = None, - sku_name: Optional[str] = None, - hosting_model: Optional[Union[str, "_models.HostingModel"]] = None, - plan_type: Optional[str] = None, - tier: Optional[str] = None, - max_count: Optional[int] = None, - quota: Optional["_models.CommitmentQuota"] = None, - cost: Optional["_models.CommitmentCost"] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, properties: Optional["_models.ConnectionPropertiesV2"] = None, **kwargs: Any) -> None: """ - :keyword kind: The Kind of the resource. - :paramtype kind: str - :keyword sku_name: The name of the SKU. Ex - P3. It is typically a letter+number code. - :paramtype sku_name: str - :keyword hosting_model: Account hosting model. Known values are: "Web", "ConnectedContainer", - "DisconnectedContainer", and "ProvisionedWeb". - :paramtype hosting_model: str or ~azure.mgmt.cognitiveservices.models.HostingModel - :keyword plan_type: Commitment plan type. - :paramtype plan_type: str - :keyword tier: Commitment period commitment tier. - :paramtype tier: str - :keyword max_count: Commitment period commitment max count. - :paramtype max_count: int - :keyword quota: Cognitive Services account commitment quota. - :paramtype quota: ~azure.mgmt.cognitiveservices.models.CommitmentQuota - :keyword cost: Cognitive Services account commitment cost. - :paramtype cost: ~azure.mgmt.cognitiveservices.models.CommitmentCost + :keyword properties: The properties that the Cognitive services connection will be updated + with. + :paramtype properties: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2 """ super().__init__(**kwargs) - self.kind = kind - self.sku_name = sku_name - self.hosting_model = hosting_model - self.plan_type = plan_type - self.tier = tier - self.max_count = max_count - self.quota = quota - self.cost = cost - + self.properties = properties -class CommitmentTierListResult(_serialization.Model): - """The list of cognitive services accounts operation response. - Variables are only populated by the server, and will be ignored when sending a request. +class ConnectionUsernamePassword(_serialization.Model): + """ConnectionUsernamePassword. - :ivar next_link: The link used to get the next page of CommitmentTier. - :vartype next_link: str - :ivar value: Gets the list of Cognitive Services accounts CommitmentTier and their properties. - :vartype value: list[~azure.mgmt.cognitiveservices.models.CommitmentTier] + :ivar password: + :vartype password: str + :ivar security_token: Optional, required by connections like SalesForce for extra security in + addition to UsernamePassword. + :vartype security_token: str + :ivar username: + :vartype username: str """ - _validation = { - "value": {"readonly": True}, - } - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[CommitmentTier]"}, + "password": {"key": "password", "type": "str"}, + "security_token": {"key": "securityToken", "type": "str"}, + "username": {"key": "username", "type": "str"}, } - def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + password: Optional[str] = None, + security_token: Optional[str] = None, + username: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword next_link: The link used to get the next page of CommitmentTier. - :paramtype next_link: str + :keyword password: + :paramtype password: str + :keyword security_token: Optional, required by connections like SalesForce for extra security + in addition to UsernamePassword. + :paramtype security_token: str + :keyword username: + :paramtype username: str """ super().__init__(**kwargs) - self.next_link = next_link - self.value = None + self.password = password + self.security_token = security_token + self.username = username class RaiBlocklistConfig(_serialization.Model): @@ -1823,6 +3205,184 @@ def __init__( self.source = source +class CustomKeys(_serialization.Model): + """Custom Keys credential object. + + :ivar keys: Dictionary of :code:``. + :vartype keys: dict[str, str] + """ + + _attribute_map = { + "keys": {"key": "keys", "type": "{str}"}, + } + + def __init__(self, *, keys: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword keys: Dictionary of :code:``. + :paramtype keys: dict[str, str] + """ + super().__init__(**kwargs) + self.keys = keys + + +class CustomKeysConnectionProperties(ConnectionPropertiesV2): + """Category:= CustomKeys + AuthType:= CustomKeys (as type discriminator) + Credentials:= {CustomKeys} as CustomKeys + Target:= {any value} + Use Metadata property bag for ApiVersion and other metadata fields. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar auth_type: Authentication type of the connection target. Required. Known values are: + "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", "AccountKey", "ServicePrincipal", + "AccessKey", "ApiKey", "CustomKeys", "OAuth2", and "AAD". + :vartype auth_type: str or ~azure.mgmt.cognitiveservices.models.ConnectionAuthType + :ivar category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :vartype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str + :ivar expiry_time: + :vartype expiry_time: ~datetime.datetime + :ivar group: Group based on connection category. Known values are: "Azure", "AzureAI", + "Database", "NoSQL", "File", "GenericProtocol", and "ServicesAndApps". + :vartype group: str or ~azure.mgmt.cognitiveservices.models.ConnectionGroup + :ivar is_shared_to_all: + :vartype is_shared_to_all: bool + :ivar metadata: Store user metadata for this connection. + :vartype metadata: dict[str, str] + :ivar pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :ivar pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool + :ivar credentials: Custom Keys credential object. + :vartype credentials: ~azure.mgmt.cognitiveservices.models.CustomKeys + """ + + _validation = { + "auth_type": {"required": True}, + "created_by_workspace_arm_id": {"readonly": True}, + "group": {"readonly": True}, + } + + _attribute_map = { + "auth_type": {"key": "authType", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "created_by_workspace_arm_id": {"key": "createdByWorkspaceArmId", "type": "str"}, + "error": {"key": "error", "type": "str"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, + "group": {"key": "group", "type": "str"}, + "is_shared_to_all": {"key": "isSharedToAll", "type": "bool"}, + "metadata": {"key": "metadata", "type": "{str}"}, + "pe_requirement": {"key": "peRequirement", "type": "str"}, + "pe_status": {"key": "peStatus", "type": "str"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + "use_workspace_managed_identity": {"key": "useWorkspaceManagedIdentity", "type": "bool"}, + "credentials": {"key": "credentials", "type": "CustomKeys"}, + } + + def __init__( + self, + *, + category: Optional[Union[str, "_models.ConnectionCategory"]] = None, + error: Optional[str] = None, + expiry_time: Optional[datetime.datetime] = None, + is_shared_to_all: Optional[bool] = None, + metadata: Optional[Dict[str, str]] = None, + pe_requirement: Optional[Union[str, "_models.ManagedPERequirement"]] = None, + pe_status: Optional[Union[str, "_models.ManagedPEStatus"]] = None, + shared_user_list: Optional[List[str]] = None, + target: Optional[str] = None, + use_workspace_managed_identity: Optional[bool] = None, + credentials: Optional["_models.CustomKeys"] = None, + **kwargs: Any + ) -> None: + """ + :keyword category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :paramtype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :keyword error: + :paramtype error: str + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Store user metadata for this connection. + :paramtype metadata: dict[str, str] + :keyword pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :paramtype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :keyword pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool + :keyword credentials: Custom Keys credential object. + :paramtype credentials: ~azure.mgmt.cognitiveservices.models.CustomKeys + """ + super().__init__( + category=category, + error=error, + expiry_time=expiry_time, + is_shared_to_all=is_shared_to_all, + metadata=metadata, + pe_requirement=pe_requirement, + pe_status=pe_status, + shared_user_list=shared_user_list, + target=target, + use_workspace_managed_identity=use_workspace_managed_identity, + **kwargs + ) + self.auth_type: str = "CustomKeys" + self.credentials = credentials + + class DefenderForAISetting(ProxyResource): """The Defender for AI resource. @@ -2049,7 +3609,7 @@ def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: self.value = None -class DeploymentProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes +class DeploymentProperties(_serialization.Model): """Properties of Cognitive Services account deployment. Variables are only populated by the server, and will be ignored when sending a request. @@ -2678,6 +4238,160 @@ def __init__( self.identity_client_id = identity_client_id +class ManagedIdentityAuthTypeConnectionProperties(ConnectionPropertiesV2): # pylint: disable=name-too-long + """ManagedIdentityAuthTypeConnectionProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar auth_type: Authentication type of the connection target. Required. Known values are: + "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", "AccountKey", "ServicePrincipal", + "AccessKey", "ApiKey", "CustomKeys", "OAuth2", and "AAD". + :vartype auth_type: str or ~azure.mgmt.cognitiveservices.models.ConnectionAuthType + :ivar category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :vartype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str + :ivar expiry_time: + :vartype expiry_time: ~datetime.datetime + :ivar group: Group based on connection category. Known values are: "Azure", "AzureAI", + "Database", "NoSQL", "File", "GenericProtocol", and "ServicesAndApps". + :vartype group: str or ~azure.mgmt.cognitiveservices.models.ConnectionGroup + :ivar is_shared_to_all: + :vartype is_shared_to_all: bool + :ivar metadata: Store user metadata for this connection. + :vartype metadata: dict[str, str] + :ivar pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :ivar pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool + :ivar credentials: + :vartype credentials: ~azure.mgmt.cognitiveservices.models.ConnectionManagedIdentity + """ + + _validation = { + "auth_type": {"required": True}, + "created_by_workspace_arm_id": {"readonly": True}, + "group": {"readonly": True}, + } + + _attribute_map = { + "auth_type": {"key": "authType", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "created_by_workspace_arm_id": {"key": "createdByWorkspaceArmId", "type": "str"}, + "error": {"key": "error", "type": "str"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, + "group": {"key": "group", "type": "str"}, + "is_shared_to_all": {"key": "isSharedToAll", "type": "bool"}, + "metadata": {"key": "metadata", "type": "{str}"}, + "pe_requirement": {"key": "peRequirement", "type": "str"}, + "pe_status": {"key": "peStatus", "type": "str"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + "use_workspace_managed_identity": {"key": "useWorkspaceManagedIdentity", "type": "bool"}, + "credentials": {"key": "credentials", "type": "ConnectionManagedIdentity"}, + } + + def __init__( + self, + *, + category: Optional[Union[str, "_models.ConnectionCategory"]] = None, + error: Optional[str] = None, + expiry_time: Optional[datetime.datetime] = None, + is_shared_to_all: Optional[bool] = None, + metadata: Optional[Dict[str, str]] = None, + pe_requirement: Optional[Union[str, "_models.ManagedPERequirement"]] = None, + pe_status: Optional[Union[str, "_models.ManagedPEStatus"]] = None, + shared_user_list: Optional[List[str]] = None, + target: Optional[str] = None, + use_workspace_managed_identity: Optional[bool] = None, + credentials: Optional["_models.ConnectionManagedIdentity"] = None, + **kwargs: Any + ) -> None: + """ + :keyword category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :paramtype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :keyword error: + :paramtype error: str + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Store user metadata for this connection. + :paramtype metadata: dict[str, str] + :keyword pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :paramtype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :keyword pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool + :keyword credentials: + :paramtype credentials: ~azure.mgmt.cognitiveservices.models.ConnectionManagedIdentity + """ + super().__init__( + category=category, + error=error, + expiry_time=expiry_time, + is_shared_to_all=is_shared_to_all, + metadata=metadata, + pe_requirement=pe_requirement, + pe_status=pe_status, + shared_user_list=shared_user_list, + target=target, + use_workspace_managed_identity=use_workspace_managed_identity, + **kwargs + ) + self.auth_type: str = "ManagedIdentity" + self.credentials = credentials + + class MetricName(_serialization.Model): """A metric name. @@ -3091,6 +4805,53 @@ def __init__( self.regions = regions +class NetworkInjections(_serialization.Model): + """Specifies in AI Foundry where virtual network injection occurs to secure scenarios like Agents + entirely within the user's private network, eliminating public internet exposure while + maintaining control over network configurations and resources. + + :ivar scenario: Specifies what features in AI Foundry network injection applies to. Currently + only supports 'agent' for agent scenarios. 'none' means no network injection. Known values are: + "none" and "agent". + :vartype scenario: str or ~azure.mgmt.cognitiveservices.models.ScenarioType + :ivar subnet_arm_id: Specify the subnet for which your Agent Client is injected into. + :vartype subnet_arm_id: str + :ivar use_microsoft_managed_network: Boolean to enable Microsoft Managed Network for subnet + delegation. + :vartype use_microsoft_managed_network: bool + """ + + _attribute_map = { + "scenario": {"key": "scenario", "type": "str"}, + "subnet_arm_id": {"key": "subnetArmId", "type": "str"}, + "use_microsoft_managed_network": {"key": "useMicrosoftManagedNetwork", "type": "bool"}, + } + + def __init__( + self, + *, + scenario: Optional[Union[str, "_models.ScenarioType"]] = None, + subnet_arm_id: Optional[str] = None, + use_microsoft_managed_network: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword scenario: Specifies what features in AI Foundry network injection applies to. + Currently only supports 'agent' for agent scenarios. 'none' means no network injection. Known + values are: "none" and "agent". + :paramtype scenario: str or ~azure.mgmt.cognitiveservices.models.ScenarioType + :keyword subnet_arm_id: Specify the subnet for which your Agent Client is injected into. + :paramtype subnet_arm_id: str + :keyword use_microsoft_managed_network: Boolean to enable Microsoft Managed Network for subnet + delegation. + :paramtype use_microsoft_managed_network: bool + """ + super().__init__(**kwargs) + self.scenario = scenario + self.subnet_arm_id = subnet_arm_id + self.use_microsoft_managed_network = use_microsoft_managed_network + + class NetworkRuleSet(_serialization.Model): """A set of rules governing the network accessibility. @@ -3490,32 +5251,335 @@ class NetworkSecurityPerimeterProfileInfo(_serialization.Model): def __init__( self, *, - name: Optional[str] = None, - access_rules_version: Optional[int] = None, - access_rules: Optional[List["_models.NetworkSecurityPerimeterAccessRule"]] = None, - diagnostic_settings_version: Optional[int] = None, - enabled_log_categories: Optional[List[str]] = None, + name: Optional[str] = None, + access_rules_version: Optional[int] = None, + access_rules: Optional[List["_models.NetworkSecurityPerimeterAccessRule"]] = None, + diagnostic_settings_version: Optional[int] = None, + enabled_log_categories: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of the resource profile. + :paramtype name: str + :keyword access_rules_version: Access rules version of the resource profile. + :paramtype access_rules_version: int + :keyword access_rules: + :paramtype access_rules: + list[~azure.mgmt.cognitiveservices.models.NetworkSecurityPerimeterAccessRule] + :keyword diagnostic_settings_version: Current diagnostic settings version. + :paramtype diagnostic_settings_version: int + :keyword enabled_log_categories: List of enabled log categories. + :paramtype enabled_log_categories: list[str] + """ + super().__init__(**kwargs) + self.name = name + self.access_rules_version = access_rules_version + self.access_rules = access_rules + self.diagnostic_settings_version = diagnostic_settings_version + self.enabled_log_categories = enabled_log_categories + + +class NoneAuthTypeConnectionProperties(ConnectionPropertiesV2): + """NoneAuthTypeConnectionProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar auth_type: Authentication type of the connection target. Required. Known values are: + "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", "AccountKey", "ServicePrincipal", + "AccessKey", "ApiKey", "CustomKeys", "OAuth2", and "AAD". + :vartype auth_type: str or ~azure.mgmt.cognitiveservices.models.ConnectionAuthType + :ivar category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :vartype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str + :ivar expiry_time: + :vartype expiry_time: ~datetime.datetime + :ivar group: Group based on connection category. Known values are: "Azure", "AzureAI", + "Database", "NoSQL", "File", "GenericProtocol", and "ServicesAndApps". + :vartype group: str or ~azure.mgmt.cognitiveservices.models.ConnectionGroup + :ivar is_shared_to_all: + :vartype is_shared_to_all: bool + :ivar metadata: Store user metadata for this connection. + :vartype metadata: dict[str, str] + :ivar pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :ivar pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool + """ + + _validation = { + "auth_type": {"required": True}, + "created_by_workspace_arm_id": {"readonly": True}, + "group": {"readonly": True}, + } + + _attribute_map = { + "auth_type": {"key": "authType", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "created_by_workspace_arm_id": {"key": "createdByWorkspaceArmId", "type": "str"}, + "error": {"key": "error", "type": "str"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, + "group": {"key": "group", "type": "str"}, + "is_shared_to_all": {"key": "isSharedToAll", "type": "bool"}, + "metadata": {"key": "metadata", "type": "{str}"}, + "pe_requirement": {"key": "peRequirement", "type": "str"}, + "pe_status": {"key": "peStatus", "type": "str"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + "use_workspace_managed_identity": {"key": "useWorkspaceManagedIdentity", "type": "bool"}, + } + + def __init__( + self, + *, + category: Optional[Union[str, "_models.ConnectionCategory"]] = None, + error: Optional[str] = None, + expiry_time: Optional[datetime.datetime] = None, + is_shared_to_all: Optional[bool] = None, + metadata: Optional[Dict[str, str]] = None, + pe_requirement: Optional[Union[str, "_models.ManagedPERequirement"]] = None, + pe_status: Optional[Union[str, "_models.ManagedPEStatus"]] = None, + shared_user_list: Optional[List[str]] = None, + target: Optional[str] = None, + use_workspace_managed_identity: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :paramtype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :keyword error: + :paramtype error: str + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Store user metadata for this connection. + :paramtype metadata: dict[str, str] + :keyword pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :paramtype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :keyword pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool + """ + super().__init__( + category=category, + error=error, + expiry_time=expiry_time, + is_shared_to_all=is_shared_to_all, + metadata=metadata, + pe_requirement=pe_requirement, + pe_status=pe_status, + shared_user_list=shared_user_list, + target=target, + use_workspace_managed_identity=use_workspace_managed_identity, + **kwargs + ) + self.auth_type: str = "None" + + +class OAuth2AuthTypeConnectionProperties(ConnectionPropertiesV2): + """OAuth2AuthTypeConnectionProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar auth_type: Authentication type of the connection target. Required. Known values are: + "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", "AccountKey", "ServicePrincipal", + "AccessKey", "ApiKey", "CustomKeys", "OAuth2", and "AAD". + :vartype auth_type: str or ~azure.mgmt.cognitiveservices.models.ConnectionAuthType + :ivar category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :vartype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str + :ivar expiry_time: + :vartype expiry_time: ~datetime.datetime + :ivar group: Group based on connection category. Known values are: "Azure", "AzureAI", + "Database", "NoSQL", "File", "GenericProtocol", and "ServicesAndApps". + :vartype group: str or ~azure.mgmt.cognitiveservices.models.ConnectionGroup + :ivar is_shared_to_all: + :vartype is_shared_to_all: bool + :ivar metadata: Store user metadata for this connection. + :vartype metadata: dict[str, str] + :ivar pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :ivar pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool + :ivar credentials: ClientId and ClientSecret are required. Other properties are optional + depending on each OAuth2 provider's implementation. + :vartype credentials: ~azure.mgmt.cognitiveservices.models.ConnectionOAuth2 + """ + + _validation = { + "auth_type": {"required": True}, + "created_by_workspace_arm_id": {"readonly": True}, + "group": {"readonly": True}, + } + + _attribute_map = { + "auth_type": {"key": "authType", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "created_by_workspace_arm_id": {"key": "createdByWorkspaceArmId", "type": "str"}, + "error": {"key": "error", "type": "str"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, + "group": {"key": "group", "type": "str"}, + "is_shared_to_all": {"key": "isSharedToAll", "type": "bool"}, + "metadata": {"key": "metadata", "type": "{str}"}, + "pe_requirement": {"key": "peRequirement", "type": "str"}, + "pe_status": {"key": "peStatus", "type": "str"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + "use_workspace_managed_identity": {"key": "useWorkspaceManagedIdentity", "type": "bool"}, + "credentials": {"key": "credentials", "type": "ConnectionOAuth2"}, + } + + def __init__( + self, + *, + category: Optional[Union[str, "_models.ConnectionCategory"]] = None, + error: Optional[str] = None, + expiry_time: Optional[datetime.datetime] = None, + is_shared_to_all: Optional[bool] = None, + metadata: Optional[Dict[str, str]] = None, + pe_requirement: Optional[Union[str, "_models.ManagedPERequirement"]] = None, + pe_status: Optional[Union[str, "_models.ManagedPEStatus"]] = None, + shared_user_list: Optional[List[str]] = None, + target: Optional[str] = None, + use_workspace_managed_identity: Optional[bool] = None, + credentials: Optional["_models.ConnectionOAuth2"] = None, **kwargs: Any ) -> None: """ - :keyword name: Name of the resource profile. - :paramtype name: str - :keyword access_rules_version: Access rules version of the resource profile. - :paramtype access_rules_version: int - :keyword access_rules: - :paramtype access_rules: - list[~azure.mgmt.cognitiveservices.models.NetworkSecurityPerimeterAccessRule] - :keyword diagnostic_settings_version: Current diagnostic settings version. - :paramtype diagnostic_settings_version: int - :keyword enabled_log_categories: List of enabled log categories. - :paramtype enabled_log_categories: list[str] + :keyword category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :paramtype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :keyword error: + :paramtype error: str + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Store user metadata for this connection. + :paramtype metadata: dict[str, str] + :keyword pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :paramtype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :keyword pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool + :keyword credentials: ClientId and ClientSecret are required. Other properties are optional + depending on each OAuth2 provider's implementation. + :paramtype credentials: ~azure.mgmt.cognitiveservices.models.ConnectionOAuth2 """ - super().__init__(**kwargs) - self.name = name - self.access_rules_version = access_rules_version - self.access_rules = access_rules - self.diagnostic_settings_version = diagnostic_settings_version - self.enabled_log_categories = enabled_log_categories + super().__init__( + category=category, + error=error, + expiry_time=expiry_time, + is_shared_to_all=is_shared_to_all, + metadata=metadata, + pe_requirement=pe_requirement, + pe_status=pe_status, + shared_user_list=shared_user_list, + target=target, + use_workspace_managed_identity=use_workspace_managed_identity, + **kwargs + ) + self.auth_type: str = "OAuth2" + self.credentials = credentials class Operation(_serialization.Model): @@ -3639,6 +5703,160 @@ def __init__(self, **kwargs: Any) -> None: self.next_link = None +class PATAuthTypeConnectionProperties(ConnectionPropertiesV2): + """PATAuthTypeConnectionProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar auth_type: Authentication type of the connection target. Required. Known values are: + "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", "AccountKey", "ServicePrincipal", + "AccessKey", "ApiKey", "CustomKeys", "OAuth2", and "AAD". + :vartype auth_type: str or ~azure.mgmt.cognitiveservices.models.ConnectionAuthType + :ivar category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :vartype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str + :ivar expiry_time: + :vartype expiry_time: ~datetime.datetime + :ivar group: Group based on connection category. Known values are: "Azure", "AzureAI", + "Database", "NoSQL", "File", "GenericProtocol", and "ServicesAndApps". + :vartype group: str or ~azure.mgmt.cognitiveservices.models.ConnectionGroup + :ivar is_shared_to_all: + :vartype is_shared_to_all: bool + :ivar metadata: Store user metadata for this connection. + :vartype metadata: dict[str, str] + :ivar pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :ivar pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool + :ivar credentials: + :vartype credentials: ~azure.mgmt.cognitiveservices.models.ConnectionPersonalAccessToken + """ + + _validation = { + "auth_type": {"required": True}, + "created_by_workspace_arm_id": {"readonly": True}, + "group": {"readonly": True}, + } + + _attribute_map = { + "auth_type": {"key": "authType", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "created_by_workspace_arm_id": {"key": "createdByWorkspaceArmId", "type": "str"}, + "error": {"key": "error", "type": "str"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, + "group": {"key": "group", "type": "str"}, + "is_shared_to_all": {"key": "isSharedToAll", "type": "bool"}, + "metadata": {"key": "metadata", "type": "{str}"}, + "pe_requirement": {"key": "peRequirement", "type": "str"}, + "pe_status": {"key": "peStatus", "type": "str"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + "use_workspace_managed_identity": {"key": "useWorkspaceManagedIdentity", "type": "bool"}, + "credentials": {"key": "credentials", "type": "ConnectionPersonalAccessToken"}, + } + + def __init__( + self, + *, + category: Optional[Union[str, "_models.ConnectionCategory"]] = None, + error: Optional[str] = None, + expiry_time: Optional[datetime.datetime] = None, + is_shared_to_all: Optional[bool] = None, + metadata: Optional[Dict[str, str]] = None, + pe_requirement: Optional[Union[str, "_models.ManagedPERequirement"]] = None, + pe_status: Optional[Union[str, "_models.ManagedPEStatus"]] = None, + shared_user_list: Optional[List[str]] = None, + target: Optional[str] = None, + use_workspace_managed_identity: Optional[bool] = None, + credentials: Optional["_models.ConnectionPersonalAccessToken"] = None, + **kwargs: Any + ) -> None: + """ + :keyword category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :paramtype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :keyword error: + :paramtype error: str + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Store user metadata for this connection. + :paramtype metadata: dict[str, str] + :keyword pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :paramtype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :keyword pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool + :keyword credentials: + :paramtype credentials: ~azure.mgmt.cognitiveservices.models.ConnectionPersonalAccessToken + """ + super().__init__( + category=category, + error=error, + expiry_time=expiry_time, + is_shared_to_all=is_shared_to_all, + metadata=metadata, + pe_requirement=pe_requirement, + pe_status=pe_status, + shared_user_list=shared_user_list, + target=target, + use_workspace_managed_identity=use_workspace_managed_identity, + **kwargs + ) + self.auth_type: str = "PAT" + self.credentials = credentials + + class PatchResourceTags(_serialization.Model): """The object being used to update tags of a resource, in general used for PATCH operations. @@ -3996,6 +6214,159 @@ def __init__( self.actions_required = actions_required +class Project(AzureEntityResource): + """Cognitive Services project is an Azure resource representing the provisioned account's project, + it's type, location and SKU. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar etag: Resource Etag. + :vartype etag: str + :ivar identity: Identity for the resource. + :vartype identity: ~azure.mgmt.cognitiveservices.models.Identity + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.cognitiveservices.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. + :vartype location: str + :ivar properties: Properties of Cognitive Services project. + :vartype properties: ~azure.mgmt.cognitiveservices.models.ProjectProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "identity": {"key": "identity", "type": "Identity"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "ProjectProperties"}, + } + + def __init__( + self, + *, + identity: Optional["_models.Identity"] = None, + tags: Optional[Dict[str, str]] = None, + location: Optional[str] = None, + properties: Optional["_models.ProjectProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword identity: Identity for the resource. + :paramtype identity: ~azure.mgmt.cognitiveservices.models.Identity + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. + :paramtype location: str + :keyword properties: Properties of Cognitive Services project. + :paramtype properties: ~azure.mgmt.cognitiveservices.models.ProjectProperties + """ + super().__init__(**kwargs) + self.identity = identity + self.system_data = None + self.tags = tags + self.location = location + self.properties = properties + + +class ProjectListResult(_serialization.Model): + """The list of cognitive services projects operation response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar next_link: The link used to get the next page of projects. + :vartype next_link: str + :ivar value: Gets the list of Cognitive Services projects and their properties. + :vartype value: list[~azure.mgmt.cognitiveservices.models.Project] + """ + + _validation = { + "value": {"readonly": True}, + } + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[Project]"}, + } + + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword next_link: The link used to get the next page of projects. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.next_link = next_link + self.value = None + + +class ProjectProperties(_serialization.Model): + """Properties of Cognitive Services Project'. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: Gets the status of the cognitive services project at the time the + operation was called. Known values are: "Accepted", "Creating", "Deleting", "Moving", "Failed", + "Succeeded", "ResolvingDNS", and "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.cognitiveservices.models.ProvisioningState + :ivar display_name: The display name of the Cognitive Services Project. + :vartype display_name: str + :ivar description: The description of the Cognitive Services Project. + :vartype description: str + :ivar endpoints: The list of endpoint for this Cognitive Services Project. + :vartype endpoints: dict[str, str] + :ivar is_default: Indicates whether the project is the default project for the account. + :vartype is_default: bool + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "endpoints": {"readonly": True}, + "is_default": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "endpoints": {"key": "endpoints", "type": "{str}"}, + "is_default": {"key": "isDefault", "type": "bool"}, + } + + def __init__(self, *, display_name: Optional[str] = None, description: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword display_name: The display name of the Cognitive Services Project. + :paramtype display_name: str + :keyword description: The description of the Cognitive Services Project. + :paramtype description: str + """ + super().__init__(**kwargs) + self.provisioning_state = None + self.display_name = display_name + self.description = description + self.endpoints = None + self.is_default = None + + class ProvisioningIssue(_serialization.Model): """ProvisioningIssue. @@ -4680,8 +7051,8 @@ class RaiPolicyProperties(_serialization.Model): :ivar type: Content Filters policy type. Known values are: "UserManaged" and "SystemManaged". :vartype type: str or ~azure.mgmt.cognitiveservices.models.RaiPolicyType :ivar mode: Rai policy mode. The enum value mapping is as below: Default = 0, Deferred=1, - Blocking=2, Asynchronous_filter =3. Please use 'Asynchronous_filter' after 2024-10-01. It is - the same as 'Deferred' in previous version. Known values are: "Default", "Deferred", + Blocking=2, Asynchronous_filter =3. Please use 'Asynchronous_filter' after 2025-04-01-preview. + It is the same as 'Deferred' in previous version. Known values are: "Default", "Deferred", "Blocking", and "Asynchronous_filter". :vartype mode: str or ~azure.mgmt.cognitiveservices.models.RaiPolicyMode :ivar base_policy_name: Name of Rai policy. @@ -4715,8 +7086,8 @@ def __init__( ) -> None: """ :keyword mode: Rai policy mode. The enum value mapping is as below: Default = 0, Deferred=1, - Blocking=2, Asynchronous_filter =3. Please use 'Asynchronous_filter' after 2024-10-01. It is - the same as 'Deferred' in previous version. Known values are: "Default", "Deferred", + Blocking=2, Asynchronous_filter =3. Please use 'Asynchronous_filter' after 2025-04-01-preview. + It is the same as 'Deferred' in previous version. Known values are: "Default", "Deferred", "Blocking", and "Asynchronous_filter". :paramtype mode: str or ~azure.mgmt.cognitiveservices.models.RaiPolicyMode :keyword base_policy_name: Name of Rai policy. @@ -5001,6 +7372,314 @@ def __init__( self.reason_code = reason_code +class SASAuthTypeConnectionProperties(ConnectionPropertiesV2): + """SASAuthTypeConnectionProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar auth_type: Authentication type of the connection target. Required. Known values are: + "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", "AccountKey", "ServicePrincipal", + "AccessKey", "ApiKey", "CustomKeys", "OAuth2", and "AAD". + :vartype auth_type: str or ~azure.mgmt.cognitiveservices.models.ConnectionAuthType + :ivar category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :vartype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str + :ivar expiry_time: + :vartype expiry_time: ~datetime.datetime + :ivar group: Group based on connection category. Known values are: "Azure", "AzureAI", + "Database", "NoSQL", "File", "GenericProtocol", and "ServicesAndApps". + :vartype group: str or ~azure.mgmt.cognitiveservices.models.ConnectionGroup + :ivar is_shared_to_all: + :vartype is_shared_to_all: bool + :ivar metadata: Store user metadata for this connection. + :vartype metadata: dict[str, str] + :ivar pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :ivar pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool + :ivar credentials: + :vartype credentials: ~azure.mgmt.cognitiveservices.models.ConnectionSharedAccessSignature + """ + + _validation = { + "auth_type": {"required": True}, + "created_by_workspace_arm_id": {"readonly": True}, + "group": {"readonly": True}, + } + + _attribute_map = { + "auth_type": {"key": "authType", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "created_by_workspace_arm_id": {"key": "createdByWorkspaceArmId", "type": "str"}, + "error": {"key": "error", "type": "str"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, + "group": {"key": "group", "type": "str"}, + "is_shared_to_all": {"key": "isSharedToAll", "type": "bool"}, + "metadata": {"key": "metadata", "type": "{str}"}, + "pe_requirement": {"key": "peRequirement", "type": "str"}, + "pe_status": {"key": "peStatus", "type": "str"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + "use_workspace_managed_identity": {"key": "useWorkspaceManagedIdentity", "type": "bool"}, + "credentials": {"key": "credentials", "type": "ConnectionSharedAccessSignature"}, + } + + def __init__( + self, + *, + category: Optional[Union[str, "_models.ConnectionCategory"]] = None, + error: Optional[str] = None, + expiry_time: Optional[datetime.datetime] = None, + is_shared_to_all: Optional[bool] = None, + metadata: Optional[Dict[str, str]] = None, + pe_requirement: Optional[Union[str, "_models.ManagedPERequirement"]] = None, + pe_status: Optional[Union[str, "_models.ManagedPEStatus"]] = None, + shared_user_list: Optional[List[str]] = None, + target: Optional[str] = None, + use_workspace_managed_identity: Optional[bool] = None, + credentials: Optional["_models.ConnectionSharedAccessSignature"] = None, + **kwargs: Any + ) -> None: + """ + :keyword category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :paramtype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :keyword error: + :paramtype error: str + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Store user metadata for this connection. + :paramtype metadata: dict[str, str] + :keyword pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :paramtype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :keyword pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool + :keyword credentials: + :paramtype credentials: ~azure.mgmt.cognitiveservices.models.ConnectionSharedAccessSignature + """ + super().__init__( + category=category, + error=error, + expiry_time=expiry_time, + is_shared_to_all=is_shared_to_all, + metadata=metadata, + pe_requirement=pe_requirement, + pe_status=pe_status, + shared_user_list=shared_user_list, + target=target, + use_workspace_managed_identity=use_workspace_managed_identity, + **kwargs + ) + self.auth_type: str = "SAS" + self.credentials = credentials + + +class ServicePrincipalAuthTypeConnectionProperties(ConnectionPropertiesV2): # pylint: disable=name-too-long + """ServicePrincipalAuthTypeConnectionProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar auth_type: Authentication type of the connection target. Required. Known values are: + "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", "AccountKey", "ServicePrincipal", + "AccessKey", "ApiKey", "CustomKeys", "OAuth2", and "AAD". + :vartype auth_type: str or ~azure.mgmt.cognitiveservices.models.ConnectionAuthType + :ivar category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :vartype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str + :ivar expiry_time: + :vartype expiry_time: ~datetime.datetime + :ivar group: Group based on connection category. Known values are: "Azure", "AzureAI", + "Database", "NoSQL", "File", "GenericProtocol", and "ServicesAndApps". + :vartype group: str or ~azure.mgmt.cognitiveservices.models.ConnectionGroup + :ivar is_shared_to_all: + :vartype is_shared_to_all: bool + :ivar metadata: Store user metadata for this connection. + :vartype metadata: dict[str, str] + :ivar pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :ivar pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool + :ivar credentials: + :vartype credentials: ~azure.mgmt.cognitiveservices.models.ConnectionServicePrincipal + """ + + _validation = { + "auth_type": {"required": True}, + "created_by_workspace_arm_id": {"readonly": True}, + "group": {"readonly": True}, + } + + _attribute_map = { + "auth_type": {"key": "authType", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "created_by_workspace_arm_id": {"key": "createdByWorkspaceArmId", "type": "str"}, + "error": {"key": "error", "type": "str"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, + "group": {"key": "group", "type": "str"}, + "is_shared_to_all": {"key": "isSharedToAll", "type": "bool"}, + "metadata": {"key": "metadata", "type": "{str}"}, + "pe_requirement": {"key": "peRequirement", "type": "str"}, + "pe_status": {"key": "peStatus", "type": "str"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + "use_workspace_managed_identity": {"key": "useWorkspaceManagedIdentity", "type": "bool"}, + "credentials": {"key": "credentials", "type": "ConnectionServicePrincipal"}, + } + + def __init__( + self, + *, + category: Optional[Union[str, "_models.ConnectionCategory"]] = None, + error: Optional[str] = None, + expiry_time: Optional[datetime.datetime] = None, + is_shared_to_all: Optional[bool] = None, + metadata: Optional[Dict[str, str]] = None, + pe_requirement: Optional[Union[str, "_models.ManagedPERequirement"]] = None, + pe_status: Optional[Union[str, "_models.ManagedPEStatus"]] = None, + shared_user_list: Optional[List[str]] = None, + target: Optional[str] = None, + use_workspace_managed_identity: Optional[bool] = None, + credentials: Optional["_models.ConnectionServicePrincipal"] = None, + **kwargs: Any + ) -> None: + """ + :keyword category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :paramtype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :keyword error: + :paramtype error: str + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Store user metadata for this connection. + :paramtype metadata: dict[str, str] + :keyword pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :paramtype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :keyword pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool + :keyword credentials: + :paramtype credentials: ~azure.mgmt.cognitiveservices.models.ConnectionServicePrincipal + """ + super().__init__( + category=category, + error=error, + expiry_time=expiry_time, + is_shared_to_all=is_shared_to_all, + metadata=metadata, + pe_requirement=pe_requirement, + pe_status=pe_status, + shared_user_list=shared_user_list, + target=target, + use_workspace_managed_identity=use_workspace_managed_identity, + **kwargs + ) + self.auth_type: str = "ServicePrincipal" + self.credentials = credentials + + class Sku(_serialization.Model): """The resource model definition representing SKU. @@ -5505,12 +8184,166 @@ def __init__(self, **kwargs: Any) -> None: self.client_id = None +class UsernamePasswordAuthTypeConnectionProperties(ConnectionPropertiesV2): # pylint: disable=name-too-long + """UsernamePasswordAuthTypeConnectionProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar auth_type: Authentication type of the connection target. Required. Known values are: + "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", "AccountKey", "ServicePrincipal", + "AccessKey", "ApiKey", "CustomKeys", "OAuth2", and "AAD". + :vartype auth_type: str or ~azure.mgmt.cognitiveservices.models.ConnectionAuthType + :ivar category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :vartype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str + :ivar expiry_time: + :vartype expiry_time: ~datetime.datetime + :ivar group: Group based on connection category. Known values are: "Azure", "AzureAI", + "Database", "NoSQL", "File", "GenericProtocol", and "ServicesAndApps". + :vartype group: str or ~azure.mgmt.cognitiveservices.models.ConnectionGroup + :ivar is_shared_to_all: + :vartype is_shared_to_all: bool + :ivar metadata: Store user metadata for this connection. + :vartype metadata: dict[str, str] + :ivar pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :ivar pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool + :ivar credentials: + :vartype credentials: ~azure.mgmt.cognitiveservices.models.ConnectionUsernamePassword + """ + + _validation = { + "auth_type": {"required": True}, + "created_by_workspace_arm_id": {"readonly": True}, + "group": {"readonly": True}, + } + + _attribute_map = { + "auth_type": {"key": "authType", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "created_by_workspace_arm_id": {"key": "createdByWorkspaceArmId", "type": "str"}, + "error": {"key": "error", "type": "str"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, + "group": {"key": "group", "type": "str"}, + "is_shared_to_all": {"key": "isSharedToAll", "type": "bool"}, + "metadata": {"key": "metadata", "type": "{str}"}, + "pe_requirement": {"key": "peRequirement", "type": "str"}, + "pe_status": {"key": "peStatus", "type": "str"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + "use_workspace_managed_identity": {"key": "useWorkspaceManagedIdentity", "type": "bool"}, + "credentials": {"key": "credentials", "type": "ConnectionUsernamePassword"}, + } + + def __init__( + self, + *, + category: Optional[Union[str, "_models.ConnectionCategory"]] = None, + error: Optional[str] = None, + expiry_time: Optional[datetime.datetime] = None, + is_shared_to_all: Optional[bool] = None, + metadata: Optional[Dict[str, str]] = None, + pe_requirement: Optional[Union[str, "_models.ManagedPERequirement"]] = None, + pe_status: Optional[Union[str, "_models.ManagedPEStatus"]] = None, + shared_user_list: Optional[List[str]] = None, + target: Optional[str] = None, + use_workspace_managed_identity: Optional[bool] = None, + credentials: Optional["_models.ConnectionUsernamePassword"] = None, + **kwargs: Any + ) -> None: + """ + :keyword category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :paramtype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :keyword error: + :paramtype error: str + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Store user metadata for this connection. + :paramtype metadata: dict[str, str] + :keyword pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :paramtype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :keyword pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool + :keyword credentials: + :paramtype credentials: ~azure.mgmt.cognitiveservices.models.ConnectionUsernamePassword + """ + super().__init__( + category=category, + error=error, + expiry_time=expiry_time, + is_shared_to_all=is_shared_to_all, + metadata=metadata, + pe_requirement=pe_requirement, + pe_status=pe_status, + shared_user_list=shared_user_list, + target=target, + use_workspace_managed_identity=use_workspace_managed_identity, + **kwargs + ) + self.auth_type: str = "UsernamePassword" + self.credentials = credentials + + class UserOwnedAmlWorkspace(_serialization.Model): - """The user owned AML workspace for Cognitive Services account. + """The user owned AML account for Cognitive Services account. - :ivar resource_id: Full resource id of a AML workspace resource. + :ivar resource_id: Full resource id of a AML account resource. :vartype resource_id: str - :ivar identity_client_id: Identity Client id of a AML workspace resource. + :ivar identity_client_id: Identity Client id of a AML account resource. :vartype identity_client_id: str """ @@ -5523,9 +8356,9 @@ def __init__( self, *, resource_id: Optional[str] = None, identity_client_id: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword resource_id: Full resource id of a AML workspace resource. + :keyword resource_id: Full resource id of a AML account resource. :paramtype resource_id: str - :keyword identity_client_id: Identity Client id of a AML workspace resource. + :keyword identity_client_id: Identity Client id of a AML account resource. :paramtype identity_client_id: str """ super().__init__(**kwargs) diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/__init__.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/__init__.py index fdaa24c0f86a..2666b0f9a1bd 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/__init__.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/__init__.py @@ -5,31 +5,42 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._accounts_operations import AccountsOperations -from ._deleted_accounts_operations import DeletedAccountsOperations -from ._resource_skus_operations import ResourceSkusOperations -from ._usages_operations import UsagesOperations -from ._operations import Operations -from ._cognitive_services_management_client_operations import CognitiveServicesManagementClientOperationsMixin -from ._commitment_tiers_operations import CommitmentTiersOperations -from ._models_operations import ModelsOperations -from ._location_based_model_capacities_operations import LocationBasedModelCapacitiesOperations -from ._model_capacities_operations import ModelCapacitiesOperations -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations -from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._deployments_operations import DeploymentsOperations -from ._commitment_plans_operations import CommitmentPlansOperations -from ._encryption_scopes_operations import EncryptionScopesOperations -from ._rai_policies_operations import RaiPoliciesOperations -from ._rai_blocklists_operations import RaiBlocklistsOperations -from ._rai_blocklist_items_operations import RaiBlocklistItemsOperations -from ._rai_content_filters_operations import RaiContentFiltersOperations -from ._network_security_perimeter_configurations_operations import NetworkSecurityPerimeterConfigurationsOperations -from ._defender_for_ai_settings_operations import DefenderForAISettingsOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._accounts_operations import AccountsOperations # type: ignore +from ._deleted_accounts_operations import DeletedAccountsOperations # type: ignore +from ._resource_skus_operations import ResourceSkusOperations # type: ignore +from ._usages_operations import UsagesOperations # type: ignore +from ._operations import Operations # type: ignore +from ._cognitive_services_management_client_operations import CognitiveServicesManagementClientOperationsMixin # type: ignore +from ._commitment_tiers_operations import CommitmentTiersOperations # type: ignore +from ._models_operations import ModelsOperations # type: ignore +from ._location_based_model_capacities_operations import LocationBasedModelCapacitiesOperations # type: ignore +from ._model_capacities_operations import ModelCapacitiesOperations # type: ignore +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore +from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore +from ._deployments_operations import DeploymentsOperations # type: ignore +from ._commitment_plans_operations import CommitmentPlansOperations # type: ignore +from ._encryption_scopes_operations import EncryptionScopesOperations # type: ignore +from ._rai_policies_operations import RaiPoliciesOperations # type: ignore +from ._rai_blocklists_operations import RaiBlocklistsOperations # type: ignore +from ._rai_blocklist_items_operations import RaiBlocklistItemsOperations # type: ignore +from ._rai_content_filters_operations import RaiContentFiltersOperations # type: ignore +from ._network_security_perimeter_configurations_operations import NetworkSecurityPerimeterConfigurationsOperations # type: ignore +from ._defender_for_ai_settings_operations import DefenderForAISettingsOperations # type: ignore +from ._projects_operations import ProjectsOperations # type: ignore +from ._account_connection_operations import AccountConnectionOperations # type: ignore +from ._project_connection_operations import ProjectConnectionOperations # type: ignore +from ._account_capability_hosts_operations import AccountCapabilityHostsOperations # type: ignore +from ._project_capability_hosts_operations import ProjectCapabilityHostsOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -54,6 +65,11 @@ "RaiContentFiltersOperations", "NetworkSecurityPerimeterConfigurationsOperations", "DefenderForAISettingsOperations", + "ProjectsOperations", + "AccountConnectionOperations", + "ProjectConnectionOperations", + "AccountCapabilityHostsOperations", + "ProjectCapabilityHostsOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_account_capability_hosts_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_account_capability_hosts_operations.py new file mode 100644 index 000000000000..79362b7616b7 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_account_capability_hosts_operations.py @@ -0,0 +1,590 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterator, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_delete_request( + resource_group_name: str, account_name: str, capability_host_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/capabilityHosts/{capabilityHostName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "capabilityHostName": _SERIALIZER.url( + "capability_host_name", capability_host_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, account_name: str, capability_host_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/capabilityHosts/{capabilityHostName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "capabilityHostName": _SERIALIZER.url( + "capability_host_name", capability_host_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, account_name: str, capability_host_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/capabilityHosts/{capabilityHostName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "capabilityHostName": _SERIALIZER.url( + "capability_host_name", capability_host_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +class AccountCapabilityHostsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s + :attr:`account_capability_hosts` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _delete_initial( + self, resource_group_name: str, account_name: str, capability_host_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + capability_host_name=capability_host_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, account_name: str, capability_host_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete account capabilityHost. + + Delete account capabilityHost. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param capability_host_name: The name of the capability host associated with the Cognitive + Services Resource. Required. + :type capability_host_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + account_name=account_name, + capability_host_name=capability_host_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def get( + self, resource_group_name: str, account_name: str, capability_host_name: str, **kwargs: Any + ) -> _models.CapabilityHost: + """Get account capabilityHost. + + Get account capabilityHost. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param capability_host_name: The name of the capability host associated with the Cognitive + Services Resource. Required. + :type capability_host_name: str + :return: CapabilityHost or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.CapabilityHost + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CapabilityHost] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + capability_host_name=capability_host_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CapabilityHost", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + account_name: str, + capability_host_name: str, + body: Union[_models.CapabilityHost, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "CapabilityHost") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + capability_host_name=capability_host_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + capability_host_name: str, + body: _models.CapabilityHost, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CapabilityHost]: + """Create or update account capabilityHost. + + Create or update account capabilityHost. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param capability_host_name: The name of the capability host associated with the Cognitive + Services Resource. Required. + :type capability_host_name: str + :param body: CapabilityHost definition. Required. + :type body: ~azure.mgmt.cognitiveservices.models.CapabilityHost + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either CapabilityHost or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.CapabilityHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + capability_host_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CapabilityHost]: + """Create or update account capabilityHost. + + Create or update account capabilityHost. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param capability_host_name: The name of the capability host associated with the Cognitive + Services Resource. Required. + :type capability_host_name: str + :param body: CapabilityHost definition. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either CapabilityHost or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.CapabilityHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + capability_host_name: str, + body: Union[_models.CapabilityHost, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.CapabilityHost]: + """Create or update account capabilityHost. + + Create or update account capabilityHost. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param capability_host_name: The name of the capability host associated with the Cognitive + Services Resource. Required. + :type capability_host_name: str + :param body: CapabilityHost definition. Is either a CapabilityHost type or a IO[bytes] type. + Required. + :type body: ~azure.mgmt.cognitiveservices.models.CapabilityHost or IO[bytes] + :return: An instance of LROPoller that returns either CapabilityHost or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.CapabilityHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CapabilityHost] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + account_name=account_name, + capability_host_name=capability_host_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CapabilityHost", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.CapabilityHost].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.CapabilityHost]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_account_connection_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_account_connection_operations.py new file mode 100644 index 000000000000..1ee01c49603e --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_account_connection_operations.py @@ -0,0 +1,794 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_delete_request( + resource_group_name: str, account_name: str, connection_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/connections/{connectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, account_name: str, connection_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/connections/{connectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, account_name: str, connection_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/connections/{connectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_request( + resource_group_name: str, account_name: str, connection_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/connections/{connectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request( + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + target: Optional[str] = None, + category: Optional[str] = None, + include_all: bool = False, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/connections", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if target is not None: + _params["target"] = _SERIALIZER.query("target", target, "str") + if category is not None: + _params["category"] = _SERIALIZER.query("category", category, "str") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if include_all is not None: + _params["includeAll"] = _SERIALIZER.query("include_all", include_all, "bool") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class AccountConnectionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s + :attr:`account_connection` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, account_name: str, connection_name: str, **kwargs: Any + ) -> None: + """Delete Cognitive Services account connection by name. + + Delete Cognitive Services account connection by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param connection_name: Friendly name of the connection. Required. + :type connection_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def get( + self, resource_group_name: str, account_name: str, connection_name: str, **kwargs: Any + ) -> _models.ConnectionPropertiesV2BasicResource: + """Lists Cognitive Services account connection by name. + + Lists Cognitive Services account connection by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param connection_name: Friendly name of the connection. Required. + :type connection_name: str + :return: ConnectionPropertiesV2BasicResource or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ConnectionPropertiesV2BasicResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ConnectionPropertiesV2BasicResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update( + self, + resource_group_name: str, + account_name: str, + connection_name: str, + body: Optional[_models.ConnectionUpdateContent] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectionPropertiesV2BasicResource: + """Update Cognitive Services account connection under the specified account. + + Update Cognitive Services account connection under the specified account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param connection_name: Friendly name of the connection. Required. + :type connection_name: str + :param body: Parameters for account connection update. Default value is None. + :type body: ~azure.mgmt.cognitiveservices.models.ConnectionUpdateContent + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ConnectionPropertiesV2BasicResource or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + account_name: str, + connection_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectionPropertiesV2BasicResource: + """Update Cognitive Services account connection under the specified account. + + Update Cognitive Services account connection under the specified account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param connection_name: Friendly name of the connection. Required. + :type connection_name: str + :param body: Parameters for account connection update. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ConnectionPropertiesV2BasicResource or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + account_name: str, + connection_name: str, + body: Optional[Union[_models.ConnectionUpdateContent, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.ConnectionPropertiesV2BasicResource: + """Update Cognitive Services account connection under the specified account. + + Update Cognitive Services account connection under the specified account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param connection_name: Friendly name of the connection. Required. + :type connection_name: str + :param body: Parameters for account connection update. Is either a ConnectionUpdateContent type + or a IO[bytes] type. Default value is None. + :type body: ~azure.mgmt.cognitiveservices.models.ConnectionUpdateContent or IO[bytes] + :return: ConnectionPropertiesV2BasicResource or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectionPropertiesV2BasicResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "ConnectionUpdateContent") + else: + _json = None + + _request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ConnectionPropertiesV2BasicResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create( + self, + resource_group_name: str, + account_name: str, + connection_name: str, + body: Optional[_models.ConnectionPropertiesV2BasicResource] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectionPropertiesV2BasicResource: + """Create or update Cognitive Services account connection under the specified account. + + Create or update Cognitive Services account connection under the specified account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param connection_name: Friendly name of the connection. Required. + :type connection_name: str + :param body: The object for creating or updating a new account connection. Default value is + None. + :type body: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ConnectionPropertiesV2BasicResource or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + account_name: str, + connection_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectionPropertiesV2BasicResource: + """Create or update Cognitive Services account connection under the specified account. + + Create or update Cognitive Services account connection under the specified account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param connection_name: Friendly name of the connection. Required. + :type connection_name: str + :param body: The object for creating or updating a new account connection. Default value is + None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ConnectionPropertiesV2BasicResource or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create( + self, + resource_group_name: str, + account_name: str, + connection_name: str, + body: Optional[Union[_models.ConnectionPropertiesV2BasicResource, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.ConnectionPropertiesV2BasicResource: + """Create or update Cognitive Services account connection under the specified account. + + Create or update Cognitive Services account connection under the specified account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param connection_name: Friendly name of the connection. Required. + :type connection_name: str + :param body: The object for creating or updating a new account connection. Is either a + ConnectionPropertiesV2BasicResource type or a IO[bytes] type. Default value is None. + :type body: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource or + IO[bytes] + :return: ConnectionPropertiesV2BasicResource or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectionPropertiesV2BasicResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "ConnectionPropertiesV2BasicResource") + else: + _json = None + + _request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ConnectionPropertiesV2BasicResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + account_name: str, + target: Optional[str] = None, + category: Optional[str] = None, + include_all: bool = False, + **kwargs: Any + ) -> Iterable["_models.ConnectionPropertiesV2BasicResource"]: + """Lists all the available Cognitive Services account connections under the specified account. + + Lists all the available Cognitive Services account connections under the specified account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param target: Target of the connection. Default value is None. + :type target: str + :param category: Category of the connection. Default value is None. + :type category: str + :param include_all: query parameter that indicates if get connection call should return both + connections and datastores. Default value is False. + :type include_all: bool + :return: An iterator like instance of either ConnectionPropertiesV2BasicResource or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ConnectionPropertiesV2BasicResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + target=target, + category=category, + include_all=include_all, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ConnectionPropertiesV2BasicResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_accounts_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_accounts_operations.py index 5233db0f6856..bf3a26f4c2c2 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_accounts_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -36,7 +36,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +50,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -88,7 +88,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -126,7 +126,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -159,7 +159,7 @@ def build_get_request(resource_group_name: str, account_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -192,7 +192,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -222,7 +222,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -248,7 +248,7 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -283,7 +283,7 @@ def build_regenerate_key_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -321,7 +321,7 @@ def build_list_skus_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -356,7 +356,7 @@ def build_list_usages_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -393,7 +393,7 @@ def build_list_models_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -444,7 +444,7 @@ def __init__(self, *args, **kwargs): def _create_initial( self, resource_group_name: str, account_name: str, account: Union[_models.Account, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -629,7 +629,7 @@ def get_long_running_output(pipeline_response): def _update_initial( self, resource_group_name: str, account_name: str, account: Union[_models.Account, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -809,7 +809,7 @@ def get_long_running_output(pipeline_response): ) def _delete_initial(self, resource_group_name: str, account_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -923,7 +923,7 @@ def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _mo :rtype: ~azure.mgmt.cognitiveservices.models.Account :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -983,7 +983,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1059,7 +1059,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Account"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1133,7 +1133,7 @@ def list_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.cognitiveservices.models.ApiKeys :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1194,7 +1194,7 @@ def regenerate_key( :rtype: ~azure.mgmt.cognitiveservices.models.ApiKeys :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1256,7 +1256,7 @@ def list_skus(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.cognitiveservices.models.AccountSkuListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1318,7 +1318,7 @@ def list_usages( :rtype: ~azure.mgmt.cognitiveservices.models.UsageListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1383,7 +1383,7 @@ def list_models( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AccountModelListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_cognitive_services_management_client_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_cognitive_services_management_client_operations.py index 411c651e4fed..68cfe624421c 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_cognitive_services_management_client_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_cognitive_services_management_client_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar +from typing import Any, Callable, Dict, List, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -30,7 +29,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +41,7 @@ def build_check_sku_availability_request(location: str, subscription_id: str, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -73,7 +72,7 @@ def build_check_domain_availability_request(subscription_id: str, **kwargs: Any) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -102,7 +101,7 @@ def build_calculate_model_capacity_request(subscription_id: str, **kwargs: Any) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -149,7 +148,7 @@ def check_sku_availability( :rtype: ~azure.mgmt.cognitiveservices.models.SkuAvailabilityListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -213,7 +212,7 @@ def check_domain_availability( :rtype: ~azure.mgmt.cognitiveservices.models.DomainAvailability :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -280,7 +279,7 @@ def calculate_model_capacity( :rtype: ~azure.mgmt.cognitiveservices.models.CalculateModelCapacityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_commitment_plans_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_commitment_plans_operations.py index 1ad7dc62c8aa..f409e8c44baa 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_commitment_plans_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_commitment_plans_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -36,7 +36,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +48,7 @@ def build_list_request(resource_group_name: str, account_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -83,7 +83,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -119,7 +119,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -158,7 +158,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -194,7 +194,7 @@ def build_create_or_update_plan_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -232,7 +232,7 @@ def build_update_plan_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -270,7 +270,7 @@ def build_delete_plan_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -305,7 +305,7 @@ def build_get_plan_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -340,7 +340,7 @@ def build_list_plans_by_resource_group_request( # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -370,7 +370,7 @@ def build_list_plans_by_subscription_request(subscription_id: str, **kwargs: Any _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -398,7 +398,7 @@ def build_list_associations_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -437,7 +437,7 @@ def build_get_association_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -482,7 +482,7 @@ def build_create_or_update_association_request( # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -530,7 +530,7 @@ def build_delete_association_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -603,7 +603,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CommitmentPlanListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -684,7 +684,7 @@ def get( :rtype: ~azure.mgmt.cognitiveservices.models.CommitmentPlan :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -816,7 +816,7 @@ def create_or_update( :rtype: ~azure.mgmt.cognitiveservices.models.CommitmentPlan :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -875,7 +875,7 @@ def create_or_update( def _delete_initial( self, resource_group_name: str, account_name: str, commitment_plan_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -990,7 +990,7 @@ def _create_or_update_plan_initial( commitment_plan: Union[_models.CommitmentPlan, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1188,7 +1188,7 @@ def _update_plan_initial( commitment_plan: Union[_models.PatchResourceTagsAndSku, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1387,7 +1387,7 @@ def get_long_running_output(pipeline_response): def _delete_plan_initial( self, resource_group_name: str, commitment_plan_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1509,7 +1509,7 @@ def get_plan(self, resource_group_name: str, commitment_plan_name: str, **kwargs :rtype: ~azure.mgmt.cognitiveservices.models.CommitmentPlan :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1571,7 +1571,7 @@ def list_plans_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CommitmentPlanListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1647,7 +1647,7 @@ def list_plans_by_subscription(self, **kwargs: Any) -> Iterable["_models.Commitm api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CommitmentPlanListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1732,7 +1732,7 @@ def list_associations( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CommitmentPlanAccountAssociationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1814,7 +1814,7 @@ def get_association( :rtype: ~azure.mgmt.cognitiveservices.models.CommitmentPlanAccountAssociation :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1866,7 +1866,7 @@ def _create_or_update_association_initial( association: Union[_models.CommitmentPlanAccountAssociation, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2078,7 +2078,7 @@ def get_long_running_output(pipeline_response): def _delete_association_initial( self, resource_group_name: str, commitment_plan_name: str, commitment_plan_association_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_commitment_tiers_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_commitment_tiers_operations.py index 250ff3bb6a0a..8dbcc1d4c176 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_commitment_tiers_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_commitment_tiers_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +42,7 @@ def build_list_request(location: str, subscription_id: str, **kwargs: Any) -> Ht _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -102,7 +101,7 @@ def list(self, location: str, **kwargs: Any) -> Iterable["_models.CommitmentTier api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CommitmentTierListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_defender_for_ai_settings_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_defender_for_ai_settings_operations.py index e70dbebd2b8f..bf17226a0252 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_defender_for_ai_settings_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_defender_for_ai_settings_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -32,7 +31,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +43,7 @@ def build_list_request(resource_group_name: str, account_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -79,7 +78,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -117,7 +116,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -158,7 +157,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -234,7 +233,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DefenderForAISettingResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -314,7 +313,7 @@ def get( :rtype: ~azure.mgmt.cognitiveservices.models.DefenderForAISetting :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -444,7 +443,7 @@ def create_or_update( :rtype: ~azure.mgmt.cognitiveservices.models.DefenderForAISetting :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -586,7 +585,7 @@ def update( :rtype: ~azure.mgmt.cognitiveservices.models.DefenderForAISetting :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_deleted_accounts_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_deleted_accounts_operations.py index 8537120f87da..e82f5634ca0d 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_deleted_accounts_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_deleted_accounts_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Iterator, Optional, Type, TypeVar, Union, cast +from typing import Any, Callable, Dict, Iterable, Iterator, Optional, TypeVar, Union, cast import urllib.parse from azure.core.exceptions import ( @@ -35,7 +34,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +48,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +84,7 @@ def build_purge_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -119,7 +118,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -175,7 +174,7 @@ def get(self, location: str, resource_group_name: str, account_name: str, **kwar :rtype: ~azure.mgmt.cognitiveservices.models.Account :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -222,7 +221,7 @@ def get(self, location: str, resource_group_name: str, account_name: str, **kwar def _purge_initial( self, location: str, resource_group_name: str, account_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -341,7 +340,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Account"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_deployments_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_deployments_operations.py index d9f8d0f197d6..e267fce73201 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_deployments_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_deployments_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -36,7 +36,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +48,7 @@ def build_list_request(resource_group_name: str, account_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -83,7 +83,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -119,7 +119,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -158,7 +158,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -197,7 +197,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -233,7 +233,7 @@ def build_list_skus_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -301,7 +301,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DeploymentListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -382,7 +382,7 @@ def get( :rtype: ~azure.mgmt.cognitiveservices.models.Deployment :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -434,7 +434,7 @@ def _create_or_update_initial( deployment: Union[_models.Deployment, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -641,7 +641,7 @@ def _update_initial( deployment: Union[_models.PatchResourceTagsAndSku, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -847,7 +847,7 @@ def get_long_running_output(pipeline_response): def _delete_initial( self, resource_group_name: str, account_name: str, deployment_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -979,7 +979,7 @@ def list_skus( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DeploymentSkuListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_encryption_scopes_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_encryption_scopes_operations.py index b9070fe47ada..17b1e63a950e 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_encryption_scopes_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_encryption_scopes_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -36,7 +35,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +47,7 @@ def build_list_request(resource_group_name: str, account_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -83,7 +82,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -121,7 +120,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -162,7 +161,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -232,7 +231,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EncryptionScopeListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -313,7 +312,7 @@ def get( :rtype: ~azure.mgmt.cognitiveservices.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -445,7 +444,7 @@ def create_or_update( :rtype: ~azure.mgmt.cognitiveservices.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -504,7 +503,7 @@ def create_or_update( def _delete_initial( self, resource_group_name: str, account_name: str, encryption_scope_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_location_based_model_capacities_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_location_based_model_capacities_operations.py index a15bd5a3df0c..bce7ad6547f2 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_location_based_model_capacities_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_location_based_model_capacities_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +44,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -121,7 +120,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ModelCapacityListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_model_capacities_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_model_capacities_operations.py index 08c80d5efe48..bfeae798bf4c 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_model_capacities_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_model_capacities_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +44,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -117,7 +116,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ModelCapacityListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_models_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_models_operations.py index ba67f2b389cf..df691c8bc1d0 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_models_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_models_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +42,7 @@ def build_list_request(location: str, subscription_id: str, **kwargs: Any) -> Ht _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -102,7 +101,7 @@ def list(self, location: str, **kwargs: Any) -> Iterable["_models.Model"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ModelListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_network_security_perimeter_configurations_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_network_security_perimeter_configurations_operations.py index f7b825b1d952..d6e225523703 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_network_security_perimeter_configurations_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_network_security_perimeter_configurations_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Iterator, Optional, Type, TypeVar, Union, cast +from typing import Any, Callable, Dict, Iterable, Iterator, Optional, TypeVar, Union, cast import urllib.parse from azure.core.exceptions import ( @@ -35,7 +34,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +46,7 @@ def build_list_request(resource_group_name: str, account_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +81,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -120,7 +119,7 @@ def build_reconcile_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -194,7 +193,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.NetworkSecurityPerimeterConfigurationList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -274,7 +273,7 @@ def get( :rtype: ~azure.mgmt.cognitiveservices.models.NetworkSecurityPerimeterConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -321,7 +320,7 @@ def get( def _reconcile_initial( self, resource_group_name: str, account_name: str, nsp_configuration_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_operations.py index 498d2fae7a7d..4cd49e1e4a82 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +42,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91,7 +90,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_private_endpoint_connections_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_private_endpoint_connections_operations.py index d61ee9109250..d66027484b40 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_private_endpoint_connections_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_private_endpoint_connections_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterator, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -34,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +45,7 @@ def build_list_request(resource_group_name: str, account_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +84,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -127,7 +126,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -172,7 +171,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -238,7 +237,7 @@ def list( :rtype: ~azure.mgmt.cognitiveservices.models.PrivateEndpointConnectionListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -299,7 +298,7 @@ def get( :rtype: ~azure.mgmt.cognitiveservices.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -351,7 +350,7 @@ def _create_or_update_initial( properties: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -560,7 +559,7 @@ def get_long_running_output(pipeline_response): def _delete_initial( self, resource_group_name: str, account_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_private_link_resources_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_private_link_resources_operations.py index 3ee1d266a568..702b448f1b51 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_private_link_resources_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_private_link_resources_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,7 +28,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +40,7 @@ def build_list_request(resource_group_name: str, account_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -102,7 +101,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.cognitiveservices.models.PrivateLinkResourceListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_project_capability_hosts_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_project_capability_hosts_operations.py new file mode 100644 index 000000000000..682fa72b1822 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_project_capability_hosts_operations.py @@ -0,0 +1,633 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterator, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_delete_request( + resource_group_name: str, + account_name: str, + project_name: str, + capability_host_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/capabilityHosts/{capabilityHostName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "projectName": _SERIALIZER.url( + "project_name", project_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "capabilityHostName": _SERIALIZER.url( + "capability_host_name", capability_host_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + account_name: str, + project_name: str, + capability_host_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/capabilityHosts/{capabilityHostName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "projectName": _SERIALIZER.url( + "project_name", project_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "capabilityHostName": _SERIALIZER.url( + "capability_host_name", capability_host_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, + account_name: str, + project_name: str, + capability_host_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/capabilityHosts/{capabilityHostName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "projectName": _SERIALIZER.url( + "project_name", project_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "capabilityHostName": _SERIALIZER.url( + "capability_host_name", capability_host_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +class ProjectCapabilityHostsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s + :attr:`project_capability_hosts` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _delete_initial( + self, resource_group_name: str, account_name: str, project_name: str, capability_host_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + capability_host_name=capability_host_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, account_name: str, project_name: str, capability_host_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete project capabilityHost. + + Delete project capabilityHost. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param capability_host_name: The name of the capability host associated with the Cognitive + Services Resource. Required. + :type capability_host_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + capability_host_name=capability_host_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def get( + self, resource_group_name: str, account_name: str, project_name: str, capability_host_name: str, **kwargs: Any + ) -> _models.CapabilityHost: + """Get project capabilityHost. + + Get project capabilityHost. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param capability_host_name: The name of the capability host associated with the Cognitive + Services Resource. Required. + :type capability_host_name: str + :return: CapabilityHost or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.CapabilityHost + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CapabilityHost] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + capability_host_name=capability_host_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CapabilityHost", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + account_name: str, + project_name: str, + capability_host_name: str, + body: Union[_models.CapabilityHost, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "CapabilityHost") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + capability_host_name=capability_host_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + project_name: str, + capability_host_name: str, + body: _models.CapabilityHost, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CapabilityHost]: + """Create or update project capabilityHost. + + Create or update project capabilityHost. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param capability_host_name: The name of the capability host associated with the Cognitive + Services Resource. Required. + :type capability_host_name: str + :param body: CapabilityHost definition. Required. + :type body: ~azure.mgmt.cognitiveservices.models.CapabilityHost + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either CapabilityHost or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.CapabilityHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + project_name: str, + capability_host_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CapabilityHost]: + """Create or update project capabilityHost. + + Create or update project capabilityHost. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param capability_host_name: The name of the capability host associated with the Cognitive + Services Resource. Required. + :type capability_host_name: str + :param body: CapabilityHost definition. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either CapabilityHost or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.CapabilityHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + project_name: str, + capability_host_name: str, + body: Union[_models.CapabilityHost, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.CapabilityHost]: + """Create or update project capabilityHost. + + Create or update project capabilityHost. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param capability_host_name: The name of the capability host associated with the Cognitive + Services Resource. Required. + :type capability_host_name: str + :param body: CapabilityHost definition. Is either a CapabilityHost type or a IO[bytes] type. + Required. + :type body: ~azure.mgmt.cognitiveservices.models.CapabilityHost or IO[bytes] + :return: An instance of LROPoller that returns either CapabilityHost or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.CapabilityHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CapabilityHost] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + capability_host_name=capability_host_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CapabilityHost", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.CapabilityHost].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.CapabilityHost]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_project_connection_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_project_connection_operations.py new file mode 100644 index 000000000000..a828b61d3589 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_project_connection_operations.py @@ -0,0 +1,860 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_delete_request( + resource_group_name: str, + account_name: str, + project_name: str, + connection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/connections/{connectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "projectName": _SERIALIZER.url( + "project_name", project_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + account_name: str, + project_name: str, + connection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/connections/{connectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "projectName": _SERIALIZER.url( + "project_name", project_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, + account_name: str, + project_name: str, + connection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/connections/{connectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "projectName": _SERIALIZER.url( + "project_name", project_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_request( + resource_group_name: str, + account_name: str, + project_name: str, + connection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/connections/{connectionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "projectName": _SERIALIZER.url( + "project_name", project_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request( + resource_group_name: str, + account_name: str, + project_name: str, + subscription_id: str, + *, + target: Optional[str] = None, + category: Optional[str] = None, + include_all: bool = False, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/connections", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "projectName": _SERIALIZER.url( + "project_name", project_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if target is not None: + _params["target"] = _SERIALIZER.query("target", target, "str") + if category is not None: + _params["category"] = _SERIALIZER.query("category", category, "str") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if include_all is not None: + _params["includeAll"] = _SERIALIZER.query("include_all", include_all, "bool") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ProjectConnectionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s + :attr:`project_connection` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, account_name: str, project_name: str, connection_name: str, **kwargs: Any + ) -> None: + """Delete Cognitive Services project connection by name. + + Delete Cognitive Services project connection by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param connection_name: Friendly name of the connection. Required. + :type connection_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def get( + self, resource_group_name: str, account_name: str, project_name: str, connection_name: str, **kwargs: Any + ) -> _models.ConnectionPropertiesV2BasicResource: + """Lists Cognitive Services project connection by name. + + Lists Cognitive Services project connection by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param connection_name: Friendly name of the connection. Required. + :type connection_name: str + :return: ConnectionPropertiesV2BasicResource or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ConnectionPropertiesV2BasicResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ConnectionPropertiesV2BasicResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update( + self, + resource_group_name: str, + account_name: str, + project_name: str, + connection_name: str, + body: Optional[_models.ConnectionUpdateContent] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectionPropertiesV2BasicResource: + """Update Cognitive Services project connection under the specified project. + + Update Cognitive Services project connection under the specified project. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param connection_name: Friendly name of the connection. Required. + :type connection_name: str + :param body: Parameters for account connection update. Default value is None. + :type body: ~azure.mgmt.cognitiveservices.models.ConnectionUpdateContent + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ConnectionPropertiesV2BasicResource or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + account_name: str, + project_name: str, + connection_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectionPropertiesV2BasicResource: + """Update Cognitive Services project connection under the specified project. + + Update Cognitive Services project connection under the specified project. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param connection_name: Friendly name of the connection. Required. + :type connection_name: str + :param body: Parameters for account connection update. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ConnectionPropertiesV2BasicResource or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + account_name: str, + project_name: str, + connection_name: str, + body: Optional[Union[_models.ConnectionUpdateContent, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.ConnectionPropertiesV2BasicResource: + """Update Cognitive Services project connection under the specified project. + + Update Cognitive Services project connection under the specified project. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param connection_name: Friendly name of the connection. Required. + :type connection_name: str + :param body: Parameters for account connection update. Is either a ConnectionUpdateContent type + or a IO[bytes] type. Default value is None. + :type body: ~azure.mgmt.cognitiveservices.models.ConnectionUpdateContent or IO[bytes] + :return: ConnectionPropertiesV2BasicResource or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectionPropertiesV2BasicResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "ConnectionUpdateContent") + else: + _json = None + + _request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ConnectionPropertiesV2BasicResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create( + self, + resource_group_name: str, + account_name: str, + project_name: str, + connection_name: str, + body: Optional[_models.ConnectionPropertiesV2BasicResource] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectionPropertiesV2BasicResource: + """Create or update Cognitive Services project connection under the specified project. + + Create or update Cognitive Services project connection under the specified project. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param connection_name: Friendly name of the connection. Required. + :type connection_name: str + :param body: The object for creating or updating a new account connection. Default value is + None. + :type body: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ConnectionPropertiesV2BasicResource or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + account_name: str, + project_name: str, + connection_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectionPropertiesV2BasicResource: + """Create or update Cognitive Services project connection under the specified project. + + Create or update Cognitive Services project connection under the specified project. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param connection_name: Friendly name of the connection. Required. + :type connection_name: str + :param body: The object for creating or updating a new account connection. Default value is + None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ConnectionPropertiesV2BasicResource or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create( + self, + resource_group_name: str, + account_name: str, + project_name: str, + connection_name: str, + body: Optional[Union[_models.ConnectionPropertiesV2BasicResource, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.ConnectionPropertiesV2BasicResource: + """Create or update Cognitive Services project connection under the specified project. + + Create or update Cognitive Services project connection under the specified project. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param connection_name: Friendly name of the connection. Required. + :type connection_name: str + :param body: The object for creating or updating a new account connection. Is either a + ConnectionPropertiesV2BasicResource type or a IO[bytes] type. Default value is None. + :type body: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource or + IO[bytes] + :return: ConnectionPropertiesV2BasicResource or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectionPropertiesV2BasicResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "ConnectionPropertiesV2BasicResource") + else: + _json = None + + _request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ConnectionPropertiesV2BasicResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + account_name: str, + project_name: str, + target: Optional[str] = None, + category: Optional[str] = None, + include_all: bool = False, + **kwargs: Any + ) -> Iterable["_models.ConnectionPropertiesV2BasicResource"]: + """Lists all the available Cognitive Services project connections under the specified project. + + Lists all the available Cognitive Services project connections under the specified project. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param target: Target of the connection. Default value is None. + :type target: str + :param category: Category of the connection. Default value is None. + :type category: str + :param include_all: query parameter that indicates if get connection call should return both + connections and datastores. Default value is False. + :type include_all: bool + :return: An iterator like instance of either ConnectionPropertiesV2BasicResource or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ConnectionPropertiesV2BasicResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + subscription_id=self._config.subscription_id, + target=target, + category=category, + include_all=include_all, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ConnectionPropertiesV2BasicResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_projects_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_projects_operations.py new file mode 100644 index 000000000000..76a18da15f03 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_projects_operations.py @@ -0,0 +1,912 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_create_request( + resource_group_name: str, account_name: str, project_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "projectName": _SERIALIZER.url( + "project_name", project_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, account_name: str, project_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "projectName": _SERIALIZER.url( + "project_name", project_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, account_name: str, project_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "projectName": _SERIALIZER.url( + "project_name", project_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, account_name: str, project_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "projectName": _SERIALIZER.url( + "project_name", project_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request(resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ProjectsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s + :attr:`projects` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _create_initial( + self, + resource_group_name: str, + account_name: str, + project_name: str, + project: Union[_models.Project, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(project, (IOBase, bytes)): + _content = project + else: + _json = self._serialize.body(project, "Project") + + _request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create( + self, + resource_group_name: str, + account_name: str, + project_name: str, + project: _models.Project, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Project]: + """Create Cognitive Services Account's Project. Project is a sub-resource of an account which give + AI developer it's individual container to work on. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param project: The parameters to provide for the created project. Required. + :type project: ~azure.mgmt.cognitiveservices.models.Project + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either Project or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Project] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + account_name: str, + project_name: str, + project: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Project]: + """Create Cognitive Services Account's Project. Project is a sub-resource of an account which give + AI developer it's individual container to work on. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param project: The parameters to provide for the created project. Required. + :type project: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either Project or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Project] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + account_name: str, + project_name: str, + project: Union[_models.Project, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.Project]: + """Create Cognitive Services Account's Project. Project is a sub-resource of an account which give + AI developer it's individual container to work on. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param project: The parameters to provide for the created project. Is either a Project type or + a IO[bytes] type. Required. + :type project: ~azure.mgmt.cognitiveservices.models.Project or IO[bytes] + :return: An instance of LROPoller that returns either Project or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Project] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Project] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + project=project, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Project", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.Project].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Project]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + account_name: str, + project_name: str, + project: Union[_models.Project, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(project, (IOBase, bytes)): + _content = project + else: + _json = self._serialize.body(project, "Project") + + _request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + account_name: str, + project_name: str, + project: _models.Project, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Project]: + """Updates a Cognitive Services Project. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param project: The parameters to provide for the created project. Required. + :type project: ~azure.mgmt.cognitiveservices.models.Project + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either Project or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Project] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + account_name: str, + project_name: str, + project: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Project]: + """Updates a Cognitive Services Project. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param project: The parameters to provide for the created project. Required. + :type project: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either Project or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Project] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + account_name: str, + project_name: str, + project: Union[_models.Project, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.Project]: + """Updates a Cognitive Services Project. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :param project: The parameters to provide for the created project. Is either a Project type or + a IO[bytes] type. Required. + :type project: ~azure.mgmt.cognitiveservices.models.Project or IO[bytes] + :return: An instance of LROPoller that returns either Project or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Project] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Project] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + project=project, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Project", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.Project].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Project]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, account_name: str, project_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, account_name: str, project_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes a Cognitive Services project from the resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def get(self, resource_group_name: str, account_name: str, project_name: str, **kwargs: Any) -> _models.Project: + """Returns a Cognitive Services project specified by the parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :param project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :return: Project or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.Project + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Project] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Project", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> Iterable["_models.Project"]: + """Returns all the projects in a Cognitive Services account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. Required. + :type account_name: str + :return: An iterator like instance of either Project or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.Project] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ProjectListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ProjectListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_rai_blocklist_items_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_rai_blocklist_items_operations.py index 23b61f3156a0..6668bca133e5 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_rai_blocklist_items_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_rai_blocklist_items_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -36,7 +35,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +50,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -94,7 +93,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -140,7 +139,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -189,7 +188,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -230,7 +229,7 @@ def build_batch_add_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -277,7 +276,7 @@ def build_batch_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -355,7 +354,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RaiBlockListItemsResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -445,7 +444,7 @@ def get( :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklistItem :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -590,7 +589,7 @@ def create_or_update( :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklistItem :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -655,7 +654,7 @@ def _delete_initial( rai_blocklist_item_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -869,7 +868,7 @@ def batch_add( :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklist :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -950,7 +949,7 @@ def batch_delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_rai_blocklists_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_rai_blocklists_operations.py index 65f36bc9dbc5..65c585e1287f 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_rai_blocklists_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_rai_blocklists_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -36,7 +35,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +47,7 @@ def build_list_request(resource_group_name: str, account_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -83,7 +82,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -121,7 +120,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -162,7 +161,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -232,7 +231,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RaiBlockListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -313,7 +312,7 @@ def get( :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklist :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -445,7 +444,7 @@ def create_or_update( :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklist :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -504,7 +503,7 @@ def create_or_update( def _delete_initial( self, resource_group_name: str, account_name: str, rai_blocklist_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_rai_content_filters_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_rai_content_filters_operations.py index 5b762d57fc27..38e84ecba2fa 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_rai_content_filters_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_rai_content_filters_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +42,7 @@ def build_list_request(location: str, subscription_id: str, **kwargs: Any) -> Ht _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -71,7 +70,7 @@ def build_get_request(location: str, filter_name: str, subscription_id: str, **k _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -131,7 +130,7 @@ def list(self, location: str, **kwargs: Any) -> Iterable["_models.RaiContentFilt api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RaiContentFilterListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -205,7 +204,7 @@ def get(self, location: str, filter_name: str, **kwargs: Any) -> _models.RaiCont :rtype: ~azure.mgmt.cognitiveservices.models.RaiContentFilter :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_rai_policies_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_rai_policies_operations.py index 30c660614d87..7229e8d6cc25 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_rai_policies_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_rai_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -36,7 +35,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +47,7 @@ def build_list_request(resource_group_name: str, account_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -83,7 +82,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -121,7 +120,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -162,7 +161,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -232,7 +231,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RaiPolicyListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -313,7 +312,7 @@ def get( :rtype: ~azure.mgmt.cognitiveservices.models.RaiPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -445,7 +444,7 @@ def create_or_update( :rtype: ~azure.mgmt.cognitiveservices.models.RaiPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -504,7 +503,7 @@ def create_or_update( def _delete_initial( self, resource_group_name: str, account_name: str, rai_policy_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_resource_skus_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_resource_skus_operations.py index 54248937d0f1..3b92ab703467 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_resource_skus_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_resource_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +42,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96,7 +95,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.ResourceSku"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ResourceSkuListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_usages_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_usages_operations.py index 742bbd2ef2cb..df2a079a9c16 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_usages_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_usages_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +44,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -110,7 +109,7 @@ def list(self, location: str, filter: Optional[str] = None, **kwargs: Any) -> It api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_capability_host/create_or_update.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_capability_host/create_or_update.py new file mode 100644 index 000000000000..f3cf6278c86e --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_capability_host/create_or_update.py @@ -0,0 +1,48 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.account_capability_hosts.begin_create_or_update( + resource_group_name="test-rg", + account_name="account-1", + capability_host_name="capabilityHostName", + body={ + "properties": { + "customerSubnet": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myResourceGroups/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet" + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/AccountCapabilityHost/createOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_capability_host/delete.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_capability_host/delete.py new file mode 100644 index 000000000000..b7830dbe68ca --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_capability_host/delete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + client.account_capability_hosts.begin_delete( + resource_group_name="test-rg", + account_name="account-1", + capability_host_name="capabilityHostName", + ).result() + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/AccountCapabilityHost/delete.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_capability_host/get.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_capability_host/get.py new file mode 100644 index 000000000000..7e05032ad10c --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_capability_host/get.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.account_capability_hosts.get( + resource_group_name="test-rg", + account_name="account-1", + capability_host_name="capabilityHostName", + ) + print(response) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/AccountCapabilityHost/get.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_connection/create.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_connection/create.py new file mode 100644 index 000000000000..e3801c95f746 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_connection/create.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.account_connection.create( + resource_group_name="resourceGroup-1", + account_name="account-1", + connection_name="connection-1", + ) + print(response) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/AccountConnection/create.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_connection/delete.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_connection/delete.py new file mode 100644 index 000000000000..89367afc8ff5 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_connection/delete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + client.account_connection.delete( + resource_group_name="resourceGroup-1", + account_name="account-1", + connection_name="connection-1", + ) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/AccountConnection/delete.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_connection/get.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_connection/get.py new file mode 100644 index 000000000000..b3472bedee76 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_connection/get.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.account_connection.get( + resource_group_name="resourceGroup-1", + account_name="account-1", + connection_name="connection-1", + ) + print(response) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/AccountConnection/get.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_connection/list.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_connection/list.py new file mode 100644 index 000000000000..41a99f82e6f4 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_connection/list.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.account_connection.list( + resource_group_name="resourceGroup-1", + account_name="account-1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/AccountConnection/list.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_connection/update.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_connection/update.py new file mode 100644 index 000000000000..83c9e1d9e9be --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_connection/update.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.account_connection.update( + resource_group_name="test-rg", + account_name="account-1", + connection_name="connection-1", + ) + print(response) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/AccountConnection/update.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/add_rai_blocklist_items.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/add_rai_blocklist_items.py index 6c104e916adf..1fecd5bed105 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/add_rai_blocklist_items.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/add_rai_blocklist_items.py @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/AddRaiBlocklistItems.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/AddRaiBlocklistItems.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/calculate_model_capacity.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/calculate_model_capacity.py index 8347b83e5028..b8c287aa4e4e 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/calculate_model_capacity.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/calculate_model_capacity.py @@ -27,13 +27,13 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.calculate_model_capacity() print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/CalculateModelCapacity.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/CalculateModelCapacity.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_account.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_account.py index 2a1c559e7847..12f9ced3dcdc 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_account.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_account.py @@ -27,7 +27,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.accounts.begin_create( @@ -48,7 +48,7 @@ def main(): }, "userOwnedStorage": [ { - "resourceId": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount" + "resourceId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount" } ], }, @@ -58,6 +58,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/CreateAccount.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/CreateAccount.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_account_min.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_account_min.py index f2d26bd1dc40..75bb19bbcc57 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_account_min.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_account_min.py @@ -27,7 +27,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.accounts.begin_create( @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/CreateAccountMin.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/CreateAccountMin.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_project.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_project.py new file mode 100644 index 000000000000..b83c659c5246 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_project.py @@ -0,0 +1,48 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python create_project.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.projects.begin_create( + resource_group_name="myResourceGroup", + account_name="testCreate1", + project_name="testProject1", + project={ + "identity": {"type": "SystemAssigned"}, + "location": "West US", + "properties": {"description": "Description of this project", "displayName": "p1"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/CreateProject.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_project_min.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_project_min.py new file mode 100644 index 000000000000..9b30509d2dbd --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_project_min.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python create_project_min.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.projects.begin_create( + resource_group_name="myResourceGroup", + account_name="testCreate1", + project_name="testProject1", + project={"identity": {"type": "SystemAssigned"}, "location": "West US", "properties": {}}, + ).result() + print(response) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/CreateProjectMin.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_shared_commitment_plan.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_shared_commitment_plan.py index 04d2dd4e75ef..44b37d3fa12f 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_shared_commitment_plan.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_shared_commitment_plan.py @@ -27,7 +27,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.commitment_plans.begin_create_or_update_plan( @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/CreateSharedCommitmentPlan.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/CreateSharedCommitmentPlan.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_shared_commitment_plan_association.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_shared_commitment_plan_association.py index d11ac9afe703..0e4c174101ad 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_shared_commitment_plan_association.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_shared_commitment_plan_association.py @@ -27,7 +27,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.commitment_plans.begin_create_or_update_association( @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/CreateSharedCommitmentPlanAssociation.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/CreateSharedCommitmentPlanAssociation.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_account.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_account.py index 2d16752e4c32..5a87fb08f715 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_account.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_account.py @@ -27,7 +27,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + subscription_id="00000000-1111-2222-3333-444444444444", ) client.accounts.begin_delete( @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/DeleteAccount.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/DeleteAccount.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_commitment_plan.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_commitment_plan.py index 19d717a8217f..9108d7e85779 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_commitment_plan.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_commitment_plan.py @@ -27,7 +27,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="subscriptionId", + subscription_id="00000000-1111-2222-3333-444444444444", ) client.commitment_plans.begin_delete( @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/DeleteCommitmentPlan.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/DeleteCommitmentPlan.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_deployment.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_deployment.py index 65f919209721..f009fda0e6a7 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_deployment.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_deployment.py @@ -27,7 +27,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="subscriptionId", + subscription_id="00000000-1111-2222-3333-444444444444", ) client.deployments.begin_delete( @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/DeleteDeployment.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/DeleteDeployment.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_encryption_scope.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_encryption_scope.py index 192358b28d9d..3ff16522986b 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_encryption_scope.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_encryption_scope.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/DeleteEncryptionScope.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/DeleteEncryptionScope.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_private_endpoint_connection.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_private_endpoint_connection.py index 8bea51f398d5..12f2ab5b6ebc 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_private_endpoint_connection.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_private_endpoint_connection.py @@ -27,7 +27,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", + subscription_id="00000000-1111-2222-3333-444444444444", ) client.private_endpoint_connections.begin_delete( @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/DeletePrivateEndpointConnection.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/DeletePrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_project.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_project.py new file mode 100644 index 000000000000..4c12e49d7c41 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_project.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python delete_project.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + client.projects.begin_delete( + resource_group_name="myResourceGroup", + account_name="PropTest01", + project_name="myProject", + ).result() + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/DeleteProject.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_blocklist.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_blocklist.py index 6a5892bcf431..cddaa352e289 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_blocklist.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_blocklist.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/DeleteRaiBlocklist.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/DeleteRaiBlocklist.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_blocklist_item.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_blocklist_item.py index c14a28aab878..bacc6a57a089 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_blocklist_item.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_blocklist_item.py @@ -38,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/DeleteRaiBlocklistItem.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/DeleteRaiBlocklistItem.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_blocklist_items.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_blocklist_items.py index 0d1028f5aa1d..445bae88f860 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_blocklist_items.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_blocklist_items.py @@ -38,6 +38,6 @@ def main(): ) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/DeleteRaiBlocklistItems.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/DeleteRaiBlocklistItems.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_policy.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_policy.py index e266c03dc601..f4636e9f09ee 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_policy.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_rai_policy.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/DeleteRaiPolicy.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/DeleteRaiPolicy.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_shared_commitment_plan.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_shared_commitment_plan.py index 1791873f304a..44c512538c91 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_shared_commitment_plan.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_shared_commitment_plan.py @@ -27,7 +27,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + subscription_id="00000000-1111-2222-3333-444444444444", ) client.commitment_plans.begin_delete_plan( @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/DeleteSharedCommitmentPlan.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/DeleteSharedCommitmentPlan.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_shared_commitment_plan_association.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_shared_commitment_plan_association.py index c9a67163869d..b5701a8a3998 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_shared_commitment_plan_association.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_shared_commitment_plan_association.py @@ -27,7 +27,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + subscription_id="00000000-1111-2222-3333-444444444444", ) client.commitment_plans.begin_delete_association( @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/DeleteSharedCommitmentPlanAssociation.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/DeleteSharedCommitmentPlanAssociation.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_account.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_account.py index 1881b8c46079..a96104c6e982 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_account.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_account.py @@ -27,7 +27,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.accounts.get( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetAccount.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/GetAccount.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_commitment_plan.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_commitment_plan.py index 3598174a6875..01a727209fb3 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_commitment_plan.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_commitment_plan.py @@ -27,7 +27,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="subscriptionId", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.commitment_plans.get( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetCommitmentPlan.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/GetCommitmentPlan.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_defender_for_ai_setting.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_defender_for_ai_setting.py index 35a84b8457e9..11ea96892b98 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_defender_for_ai_setting.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_defender_for_ai_setting.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetDefenderForAISetting.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/GetDefenderForAISetting.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_deleted_account.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_deleted_account.py index 40dda72c3f7c..f73fb822d233 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_deleted_account.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_deleted_account.py @@ -27,7 +27,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.deleted_accounts.get( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetDeletedAccount.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/GetDeletedAccount.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_deployment.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_deployment.py index a3a4d524f0e0..9f89d159d39a 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_deployment.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_deployment.py @@ -27,7 +27,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="subscriptionId", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.deployments.get( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetDeployment.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/GetDeployment.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_encryption_scope.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_encryption_scope.py index ba5cbf44a55f..754a1cb6acdd 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_encryption_scope.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_encryption_scope.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetEncryptionScope.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/GetEncryptionScope.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_network_security_perimeter_configurations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_network_security_perimeter_configurations.py index ae44c6e143d7..193d1cc1c0f6 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_network_security_perimeter_configurations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_network_security_perimeter_configurations.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetNetworkSecurityPerimeterConfigurations.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/GetNetworkSecurityPerimeterConfigurations.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_operations.py index 38776f9f83b7..69e1fae5b504 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_operations.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetOperations.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/GetOperations.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_private_endpoint_connection.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_private_endpoint_connection.py index 56da5166c4c4..71075df43628 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_private_endpoint_connection.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_private_endpoint_connection.py @@ -27,7 +27,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.private_endpoint_connections.get( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetPrivateEndpointConnection.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/GetPrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_project.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_project.py new file mode 100644 index 000000000000..3acb95a47613 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_project.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python get_project.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.projects.get( + resource_group_name="myResourceGroup", + account_name="myAccount", + project_name="myProject", + ) + print(response) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/GetProject.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_blocklist.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_blocklist.py index 2d5a3213df05..62fb521f12bd 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_blocklist.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_blocklist.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetRaiBlocklist.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/GetRaiBlocklist.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_blocklist_item.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_blocklist_item.py index e951859c73b3..079e58f2664c 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_blocklist_item.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_blocklist_item.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetRaiBlocklistItem.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/GetRaiBlocklistItem.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_content_filter.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_content_filter.py index e1d7147b2306..100e8fa7d1a0 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_content_filter.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_content_filter.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetRaiContentFilter.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/GetRaiContentFilter.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_policy.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_policy.py index 8e883ce4f930..1d9ce9d35d52 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_policy.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_rai_policy.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetRaiPolicy.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/GetRaiPolicy.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_shared_commitment_plan.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_shared_commitment_plan.py index 1a6c21d1cf62..90dbd42587a7 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_shared_commitment_plan.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_shared_commitment_plan.py @@ -27,7 +27,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.commitment_plans.get_plan( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetSharedCommitmentPlan.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/GetSharedCommitmentPlan.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_shared_commitment_plan_association.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_shared_commitment_plan_association.py index 69c381e8f0a7..b8cf44ded93a 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_shared_commitment_plan_association.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_shared_commitment_plan_association.py @@ -27,7 +27,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.commitment_plans.get_association( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetSharedCommitmentPlanAssociation.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/GetSharedCommitmentPlanAssociation.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_skus.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_skus.py index 786ea31485ab..a8006e4c5b3b 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_skus.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_skus.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetSkus.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/GetSkus.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_usages.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_usages.py index 88803a4c6b24..2765c0881cda 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_usages.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_usages.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetUsages.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/GetUsages.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_account_models.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_account_models.py index aa9af113805c..23e8596cf700 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_account_models.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_account_models.py @@ -27,7 +27,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="subscriptionId", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.accounts.list_models( @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListAccountModels.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/ListAccountModels.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_accounts_by_resource_group.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_accounts_by_resource_group.py index 9d5062752922..a45ce99035ba 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_accounts_by_resource_group.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_accounts_by_resource_group.py @@ -27,7 +27,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.accounts.list_by_resource_group( @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListAccountsByResourceGroup.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/ListAccountsByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_accounts_by_subscription.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_accounts_by_subscription.py index 7bcf5a77e871..b54d26bf3b2a 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_accounts_by_subscription.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_accounts_by_subscription.py @@ -27,7 +27,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.accounts.list() @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListAccountsBySubscription.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/ListAccountsBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_blocklist_items.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_blocklist_items.py index 016217162532..74891ff9b7e0 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_blocklist_items.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_blocklist_items.py @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListBlocklistItems.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/ListBlocklistItems.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_blocklists.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_blocklists.py index a37dbdc54020..dd427fc32b4b 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_blocklists.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_blocklists.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListBlocklists.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/ListBlocklists.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_commitment_plans.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_commitment_plans.py index 30cf8daaf9fb..a9e256cb1809 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_commitment_plans.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_commitment_plans.py @@ -27,7 +27,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="subscriptionId", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.commitment_plans.list( @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListCommitmentPlans.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/ListCommitmentPlans.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_commitment_tiers.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_commitment_tiers.py index 12d2fbde7bb1..6b2343d830a8 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_commitment_tiers.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_commitment_tiers.py @@ -27,7 +27,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="subscriptionId", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.commitment_tiers.list( @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListCommitmentTiers.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/ListCommitmentTiers.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_defender_for_ai_setting.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_defender_for_ai_setting.py index a7bea7f61470..57cd57679c59 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_defender_for_ai_setting.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_defender_for_ai_setting.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListDefenderForAISetting.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/ListDefenderForAISetting.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_deleted_accounts_by_subscription.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_deleted_accounts_by_subscription.py index 78a21f185710..e8a0c4f651dd 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_deleted_accounts_by_subscription.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_deleted_accounts_by_subscription.py @@ -27,7 +27,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.deleted_accounts.list() @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListDeletedAccountsBySubscription.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/ListDeletedAccountsBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_deployment_skus.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_deployment_skus.py index 00f91265d17c..748dcc690112 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_deployment_skus.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_deployment_skus.py @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListDeploymentSkus.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/ListDeploymentSkus.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_deployments.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_deployments.py index e151c56a572c..f66954f24411 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_deployments.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_deployments.py @@ -27,7 +27,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="subscriptionId", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.deployments.list( @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListDeployments.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/ListDeployments.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_encryption_scopes.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_encryption_scopes.py index 55765b0380b2..b853b1125f96 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_encryption_scopes.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_encryption_scopes.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListEncryptionScopes.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/ListEncryptionScopes.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_keys.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_keys.py index 26c026caa943..6e1b3414c75e 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_keys.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_keys.py @@ -27,7 +27,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.accounts.list_keys( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListKeys.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/ListKeys.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_location_based_model_capacities.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_location_based_model_capacities.py index 1ac614c9d699..0b4335663e0a 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_location_based_model_capacities.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_location_based_model_capacities.py @@ -40,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListLocationBasedModelCapacities.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/ListLocationBasedModelCapacities.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_location_models.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_location_models.py index b584ac9a6ca9..2d3e6e540d1d 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_location_models.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_location_models.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListLocationModels.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/ListLocationModels.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_model_capacities.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_model_capacities.py index 947290881e47..f99d5672575b 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_model_capacities.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_model_capacities.py @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListModelCapacities.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/ListModelCapacities.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_network_security_perimeter_configurations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_network_security_perimeter_configurations.py index f0c188ba01be..8e55e8055cf6 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_network_security_perimeter_configurations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_network_security_perimeter_configurations.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListNetworkSecurityPerimeterConfigurations.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/ListNetworkSecurityPerimeterConfigurations.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_private_endpoint_connections.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_private_endpoint_connections.py index f4eab22e979f..239c213ae1d7 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_private_endpoint_connections.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_private_endpoint_connections.py @@ -27,7 +27,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.private_endpoint_connections.list( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListPrivateEndpointConnections.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/ListPrivateEndpointConnections.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_private_link_resources.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_private_link_resources.py index f7f386bd2ce6..0616ff30f1ab 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_private_link_resources.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_private_link_resources.py @@ -27,7 +27,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.private_link_resources.list( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListPrivateLinkResources.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/ListPrivateLinkResources.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_projects.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_projects.py new file mode 100644 index 000000000000..df801e2c8f79 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_projects.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python list_projects.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.projects.list( + resource_group_name="myResourceGroup", + account_name="myAccount", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/ListProjects.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_rai_content_filters.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_rai_content_filters.py index dee5fd639f8d..28a37b0d543f 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_rai_content_filters.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_rai_content_filters.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListRaiContentFilters.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/ListRaiContentFilters.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_rai_policies.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_rai_policies.py index 86dffa7fb150..99c0c4eb26c7 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_rai_policies.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_rai_policies.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListRaiPolicies.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/ListRaiPolicies.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_shared_commitment_plan_associations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_shared_commitment_plan_associations.py index e15d1716d255..6a7a34ad70ec 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_shared_commitment_plan_associations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_shared_commitment_plan_associations.py @@ -27,7 +27,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.commitment_plans.list_associations( @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListSharedCommitmentPlanAssociations.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/ListSharedCommitmentPlanAssociations.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_shared_commitment_plans_by_resource_group.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_shared_commitment_plans_by_resource_group.py index 59c13a21ed0f..ddcc488310d1 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_shared_commitment_plans_by_resource_group.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_shared_commitment_plans_by_resource_group.py @@ -27,7 +27,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.commitment_plans.list_plans_by_resource_group( @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListSharedCommitmentPlansByResourceGroup.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/ListSharedCommitmentPlansByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_shared_commitment_plans_by_subscription.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_shared_commitment_plans_by_subscription.py index 0e15ba4a3c4f..75ed3fa62157 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_shared_commitment_plans_by_subscription.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_shared_commitment_plans_by_subscription.py @@ -27,7 +27,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.commitment_plans.list_plans_by_subscription() @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListSharedCommitmentPlansBySubscription.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/ListSharedCommitmentPlansBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_skus.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_skus.py index 6cafafb8b3e3..56b4f074ad4a 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_skus.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_skus.py @@ -27,7 +27,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.accounts.list_skus( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListSkus.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/ListSkus.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_usages.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_usages.py index 3a488eb0a34a..19e8f5882300 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_usages.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_usages.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListUsages.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/ListUsages.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_capability_host/create_or_update.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_capability_host/create_or_update.py new file mode 100644 index 000000000000..30fa1f52f6cc --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_capability_host/create_or_update.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.project_capability_hosts.begin_create_or_update( + resource_group_name="test-rg", + account_name="account-1", + project_name="project-1", + capability_host_name="capabilityHostName", + body={ + "properties": { + "customerSubnet": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myResourceGroups/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet" + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/ProjectCapabilityHost/createOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_capability_host/delete.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_capability_host/delete.py new file mode 100644 index 000000000000..65b66b1dfc4b --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_capability_host/delete.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + client.project_capability_hosts.begin_delete( + resource_group_name="test-rg", + account_name="account-1", + project_name="project-1", + capability_host_name="capabilityHostName", + ).result() + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/ProjectCapabilityHost/delete.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_capability_host/get.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_capability_host/get.py new file mode 100644 index 000000000000..dd06db22bb80 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_capability_host/get.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.project_capability_hosts.get( + resource_group_name="test-rg", + account_name="account-1", + project_name="project-1", + capability_host_name="capabilityHostName", + ) + print(response) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/ProjectCapabilityHost/get.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_connection/create.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_connection/create.py new file mode 100644 index 000000000000..19f5a43feed5 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_connection/create.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.project_connection.create( + resource_group_name="resourceGroup-1", + account_name="account-1", + project_name="project-1", + connection_name="connection-1", + ) + print(response) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/ProjectConnection/create.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_connection/delete.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_connection/delete.py new file mode 100644 index 000000000000..b8adb8cbf9ef --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_connection/delete.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + client.project_connection.delete( + resource_group_name="resourceGroup-1", + account_name="account-1", + project_name="project-1", + connection_name="connection-1", + ) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/ProjectConnection/delete.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_connection/get.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_connection/get.py new file mode 100644 index 000000000000..567342e59d4b --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_connection/get.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.project_connection.get( + resource_group_name="resourceGroup-1", + account_name="account-1", + project_name="project-1", + connection_name="connection-1", + ) + print(response) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/ProjectConnection/get.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_connection/list.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_connection/list.py new file mode 100644 index 000000000000..a878ceb1abce --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_connection/list.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.project_connection.list( + resource_group_name="resourceGroup-1", + account_name="account-1", + project_name="project-1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/ProjectConnection/list.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_connection/update.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_connection/update.py new file mode 100644 index 000000000000..d34001269bea --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_connection/update.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.project_connection.update( + resource_group_name="test-rg", + account_name="account-1", + project_name="project-1", + connection_name="connection-1", + ) + print(response) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/ProjectConnection/update.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/purge_deleted_account.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/purge_deleted_account.py index 3c4c92848dbd..9ace2e11e976 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/purge_deleted_account.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/purge_deleted_account.py @@ -27,7 +27,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + subscription_id="00000000-1111-2222-3333-444444444444", ) client.deleted_accounts.begin_purge( @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/PurgeDeletedAccount.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/PurgeDeletedAccount.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_commitment_plan.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_commitment_plan.py index 05f98b64c533..c46b43cacb0b 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_commitment_plan.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_commitment_plan.py @@ -27,7 +27,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="subscriptionId", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.commitment_plans.create_or_update( @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/PutCommitmentPlan.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/PutCommitmentPlan.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_deployment.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_deployment.py index a67329990383..35a13395fdfa 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_deployment.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_deployment.py @@ -27,7 +27,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="subscriptionId", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.deployments.begin_create_or_update( @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/PutDeployment.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/PutDeployment.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_encryption_scope.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_encryption_scope.py index cc44609256b0..750b8496d8ec 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_encryption_scope.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_encryption_scope.py @@ -50,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/PutEncryptionScope.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/PutEncryptionScope.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_private_endpoint_connection.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_private_endpoint_connection.py index efb30439e8c9..18c2d7a42587 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_private_endpoint_connection.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_private_endpoint_connection.py @@ -27,7 +27,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.private_endpoint_connections.begin_create_or_update( @@ -41,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/PutPrivateEndpointConnection.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/PutPrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_rai_blocklist.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_rai_blocklist.py index 108a5e7d6956..342090c938dc 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_rai_blocklist.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_rai_blocklist.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/PutRaiBlocklist.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/PutRaiBlocklist.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_rai_blocklist_item.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_rai_blocklist_item.py index f2f5d3fb7139..36979a9c391d 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_rai_blocklist_item.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_rai_blocklist_item.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/PutRaiBlocklistItem.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/PutRaiBlocklistItem.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_rai_policy.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_rai_policy.py index 683d5e7b1b86..afe8cdcb3bf5 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_rai_policy.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_rai_policy.py @@ -106,6 +106,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/PutRaiPolicy.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/PutRaiPolicy.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/reconcile_network_security_perimeter_configurations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/reconcile_network_security_perimeter_configurations.py index 67b0298f793e..323a95db6bf5 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/reconcile_network_security_perimeter_configurations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/reconcile_network_security_perimeter_configurations.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ReconcileNetworkSecurityPerimeterConfigurations.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/ReconcileNetworkSecurityPerimeterConfigurations.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_account.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_account.py index 48dfb3319564..fc0d4f4d43bf 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_account.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_account.py @@ -27,7 +27,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.accounts.begin_update( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/UpdateAccount.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/UpdateAccount.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_deployment.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_deployment.py index 2dd9f32d9d19..03f1f3675726 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_deployment.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_deployment.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/UpdateDeployment.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/UpdateDeployment.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_projects.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_projects.py new file mode 100644 index 000000000000..8e9c053c69a9 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_projects.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cognitiveservices +# USAGE + python update_projects.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CognitiveServicesManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.projects.begin_update( + resource_group_name="bvttest", + account_name="bingSearch", + project_name="projectName", + project={"location": "global", "properties": {"description": "new description."}}, + ).result() + print(response) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/UpdateProjects.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_shared_commitment_plan.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_shared_commitment_plan.py index 51b582128e7b..9c3c7595d4cd 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_shared_commitment_plan.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_shared_commitment_plan.py @@ -27,7 +27,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.commitment_plans.begin_update_plan( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/UpdateSharedCommitmentPlan.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/examples/UpdateSharedCommitmentPlan.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/conftest.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/conftest.py index de62be014178..14a373f0b945 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/conftest.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/conftest.py @@ -18,7 +18,7 @@ load_dotenv() -# aovid record sensitive identity information in recordings +# For security, please avoid record sensitive identity information in recordings @pytest.fixture(scope="session", autouse=True) def add_sanitizers(test_proxy): cognitiveservicesmanagement_subscription_id = os.environ.get( diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management.py index c22944f9a79a..b743ef2cbdf9 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management.py @@ -26,7 +26,7 @@ def test_check_sku_availability(self, resource_group): skus=["str"], kind="str", type="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -38,7 +38,7 @@ def test_check_domain_availability(self, resource_group): response = self.client.check_domain_availability( subdomain_name="str", type="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -48,7 +48,7 @@ def test_check_domain_availability(self, resource_group): @recorded_by_proxy def test_calculate_model_capacity(self, resource_group): response = self.client.calculate_model_capacity( - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_account_capability_hosts_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_account_capability_hosts_operations.py new file mode 100644 index 000000000000..bac105b741f7 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_account_capability_hosts_operations.py @@ -0,0 +1,74 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestCognitiveServicesManagementAccountCapabilityHostsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(CognitiveServicesManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_account_capability_hosts_begin_delete(self, resource_group): + response = self.client.account_capability_hosts.begin_delete( + resource_group_name=resource_group.name, + account_name="str", + capability_host_name="str", + api_version="2025-04-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_account_capability_hosts_get(self, resource_group): + response = self.client.account_capability_hosts.get( + resource_group_name=resource_group.name, + account_name="str", + capability_host_name="str", + api_version="2025-04-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_account_capability_hosts_begin_create_or_update(self, resource_group): + response = self.client.account_capability_hosts.begin_create_or_update( + resource_group_name=resource_group.name, + account_name="str", + capability_host_name="str", + body={ + "properties": { + "aiServicesConnections": ["str"], + "capabilityHostKind": "str", + "customerSubnet": "str", + "description": "str", + "provisioningState": "str", + "storageConnections": ["str"], + "tags": {"str": "str"}, + "threadStorageConnections": ["str"], + "vectorStoreConnections": ["str"], + }, + "id": "str", + "name": "str", + "type": "str", + }, + api_version="2025-04-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_account_capability_hosts_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_account_capability_hosts_operations_async.py new file mode 100644 index 000000000000..f41390012e4b --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_account_capability_hosts_operations_async.py @@ -0,0 +1,79 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.cognitiveservices.aio import CognitiveServicesManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestCognitiveServicesManagementAccountCapabilityHostsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(CognitiveServicesManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_account_capability_hosts_begin_delete(self, resource_group): + response = await ( + await self.client.account_capability_hosts.begin_delete( + resource_group_name=resource_group.name, + account_name="str", + capability_host_name="str", + api_version="2025-04-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_account_capability_hosts_get(self, resource_group): + response = await self.client.account_capability_hosts.get( + resource_group_name=resource_group.name, + account_name="str", + capability_host_name="str", + api_version="2025-04-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_account_capability_hosts_begin_create_or_update(self, resource_group): + response = await ( + await self.client.account_capability_hosts.begin_create_or_update( + resource_group_name=resource_group.name, + account_name="str", + capability_host_name="str", + body={ + "properties": { + "aiServicesConnections": ["str"], + "capabilityHostKind": "str", + "customerSubnet": "str", + "description": "str", + "provisioningState": "str", + "storageConnections": ["str"], + "tags": {"str": "str"}, + "threadStorageConnections": ["str"], + "vectorStoreConnections": ["str"], + }, + "id": "str", + "name": "str", + "type": "str", + }, + api_version="2025-04-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_account_connection_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_account_connection_operations.py new file mode 100644 index 000000000000..b75743da53b9 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_account_connection_operations.py @@ -0,0 +1,83 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestCognitiveServicesManagementAccountConnectionOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(CognitiveServicesManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_account_connection_delete(self, resource_group): + response = self.client.account_connection.delete( + resource_group_name=resource_group.name, + account_name="str", + connection_name="str", + api_version="2025-04-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_account_connection_get(self, resource_group): + response = self.client.account_connection.get( + resource_group_name=resource_group.name, + account_name="str", + connection_name="str", + api_version="2025-04-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_account_connection_update(self, resource_group): + response = self.client.account_connection.update( + resource_group_name=resource_group.name, + account_name="str", + connection_name="str", + api_version="2025-04-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_account_connection_create(self, resource_group): + response = self.client.account_connection.create( + resource_group_name=resource_group.name, + account_name="str", + connection_name="str", + api_version="2025-04-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_account_connection_list(self, resource_group): + response = self.client.account_connection.list( + resource_group_name=resource_group.name, + account_name="str", + api_version="2025-04-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_account_connection_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_account_connection_operations_async.py new file mode 100644 index 000000000000..2d6920e44c6f --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_account_connection_operations_async.py @@ -0,0 +1,84 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.cognitiveservices.aio import CognitiveServicesManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestCognitiveServicesManagementAccountConnectionOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(CognitiveServicesManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_account_connection_delete(self, resource_group): + response = await self.client.account_connection.delete( + resource_group_name=resource_group.name, + account_name="str", + connection_name="str", + api_version="2025-04-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_account_connection_get(self, resource_group): + response = await self.client.account_connection.get( + resource_group_name=resource_group.name, + account_name="str", + connection_name="str", + api_version="2025-04-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_account_connection_update(self, resource_group): + response = await self.client.account_connection.update( + resource_group_name=resource_group.name, + account_name="str", + connection_name="str", + api_version="2025-04-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_account_connection_create(self, resource_group): + response = await self.client.account_connection.create( + resource_group_name=resource_group.name, + account_name="str", + connection_name="str", + api_version="2025-04-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_account_connection_list(self, resource_group): + response = self.client.account_connection.list( + resource_group_name=resource_group.name, + account_name="str", + api_version="2025-04-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_accounts_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_accounts_operations.py index 167545e80b77..acca6a2a11fc 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_accounts_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_accounts_operations.py @@ -20,7 +20,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create(self, resource_group): + def test_accounts_begin_create(self, resource_group): response = self.client.accounts.begin_create( resource_group_name=resource_group.name, account_name="str", @@ -38,6 +38,7 @@ def test_begin_create(self, resource_group): "name": "str", "properties": { "abusePenalty": {"action": "str", "expiration": "2020-02-20 00:00:00", "rateLimitPercentage": 0.0}, + "allowProjectManagement": bool, "allowedFqdnList": ["str"], "amlWorkspace": {"identityClientId": "str", "resourceId": "str"}, "apiProperties": { @@ -52,6 +53,7 @@ def test_begin_create(self, resource_group): "superUser": "str", "websiteName": "str", }, + "associatedProjects": ["str"], "callRateLimit": { "count": 0.0, "renewalPeriod": 0.0, @@ -70,6 +72,7 @@ def test_begin_create(self, resource_group): "commitmentPlanAssociations": [{"commitmentPlanId": "str", "commitmentPlanLocation": "str"}], "customSubDomainName": "str", "dateCreated": "str", + "defaultProject": "str", "deletionDate": "str", "disableLocalAuth": bool, "dynamicThrottlingEnabled": bool, @@ -99,6 +102,7 @@ def test_begin_create(self, resource_group): {"id": "str", "ignoreMissingVnetServiceEndpoint": bool, "state": "str"} ], }, + "networkInjections": {"scenario": "str", "subnetArmId": "str", "useMicrosoftManagedNetwork": bool}, "privateEndpointConnections": [ { "etag": "str", @@ -165,7 +169,7 @@ def test_begin_create(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-10-01", + api_version="2025-04-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -173,7 +177,7 @@ def test_begin_create(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_update(self, resource_group): + def test_accounts_begin_update(self, resource_group): response = self.client.accounts.begin_update( resource_group_name=resource_group.name, account_name="str", @@ -191,6 +195,7 @@ def test_begin_update(self, resource_group): "name": "str", "properties": { "abusePenalty": {"action": "str", "expiration": "2020-02-20 00:00:00", "rateLimitPercentage": 0.0}, + "allowProjectManagement": bool, "allowedFqdnList": ["str"], "amlWorkspace": {"identityClientId": "str", "resourceId": "str"}, "apiProperties": { @@ -205,6 +210,7 @@ def test_begin_update(self, resource_group): "superUser": "str", "websiteName": "str", }, + "associatedProjects": ["str"], "callRateLimit": { "count": 0.0, "renewalPeriod": 0.0, @@ -223,6 +229,7 @@ def test_begin_update(self, resource_group): "commitmentPlanAssociations": [{"commitmentPlanId": "str", "commitmentPlanLocation": "str"}], "customSubDomainName": "str", "dateCreated": "str", + "defaultProject": "str", "deletionDate": "str", "disableLocalAuth": bool, "dynamicThrottlingEnabled": bool, @@ -252,6 +259,7 @@ def test_begin_update(self, resource_group): {"id": "str", "ignoreMissingVnetServiceEndpoint": bool, "state": "str"} ], }, + "networkInjections": {"scenario": "str", "subnetArmId": "str", "useMicrosoftManagedNetwork": bool}, "privateEndpointConnections": [ { "etag": "str", @@ -318,7 +326,7 @@ def test_begin_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-10-01", + api_version="2025-04-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -326,11 +334,11 @@ def test_begin_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete(self, resource_group): + def test_accounts_begin_delete(self, resource_group): response = self.client.accounts.begin_delete( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -338,11 +346,11 @@ def test_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_accounts_get(self, resource_group): response = self.client.accounts.get( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -350,10 +358,10 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_resource_group(self, resource_group): + def test_accounts_list_by_resource_group(self, resource_group): response = self.client.accounts.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-10-01", + api_version="2025-04-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -361,9 +369,9 @@ def test_list_by_resource_group(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_accounts_list(self, resource_group): response = self.client.accounts.list( - api_version="2024-10-01", + api_version="2025-04-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -371,11 +379,11 @@ def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_keys(self, resource_group): + def test_accounts_list_keys(self, resource_group): response = self.client.accounts.list_keys( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -383,12 +391,12 @@ def test_list_keys(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_regenerate_key(self, resource_group): + def test_accounts_regenerate_key(self, resource_group): response = self.client.accounts.regenerate_key( resource_group_name=resource_group.name, account_name="str", key_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -396,11 +404,11 @@ def test_regenerate_key(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_skus(self, resource_group): + def test_accounts_list_skus(self, resource_group): response = self.client.accounts.list_skus( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -408,11 +416,11 @@ def test_list_skus(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_usages(self, resource_group): + def test_accounts_list_usages(self, resource_group): response = self.client.accounts.list_usages( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -420,11 +428,11 @@ def test_list_usages(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_models(self, resource_group): + def test_accounts_list_models(self, resource_group): response = self.client.accounts.list_models( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_accounts_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_accounts_operations_async.py index 48231dfd55a2..133dc75fda46 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_accounts_operations_async.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_accounts_operations_async.py @@ -21,7 +21,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create(self, resource_group): + async def test_accounts_begin_create(self, resource_group): response = await ( await self.client.accounts.begin_create( resource_group_name=resource_group.name, @@ -44,6 +44,7 @@ async def test_begin_create(self, resource_group): "expiration": "2020-02-20 00:00:00", "rateLimitPercentage": 0.0, }, + "allowProjectManagement": bool, "allowedFqdnList": ["str"], "amlWorkspace": {"identityClientId": "str", "resourceId": "str"}, "apiProperties": { @@ -58,6 +59,7 @@ async def test_begin_create(self, resource_group): "superUser": "str", "websiteName": "str", }, + "associatedProjects": ["str"], "callRateLimit": { "count": 0.0, "renewalPeriod": 0.0, @@ -76,6 +78,7 @@ async def test_begin_create(self, resource_group): "commitmentPlanAssociations": [{"commitmentPlanId": "str", "commitmentPlanLocation": "str"}], "customSubDomainName": "str", "dateCreated": "str", + "defaultProject": "str", "deletionDate": "str", "disableLocalAuth": bool, "dynamicThrottlingEnabled": bool, @@ -105,6 +108,11 @@ async def test_begin_create(self, resource_group): {"id": "str", "ignoreMissingVnetServiceEndpoint": bool, "state": "str"} ], }, + "networkInjections": { + "scenario": "str", + "subnetArmId": "str", + "useMicrosoftManagedNetwork": bool, + }, "privateEndpointConnections": [ { "etag": "str", @@ -171,7 +179,7 @@ async def test_begin_create(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-10-01", + api_version="2025-04-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -180,7 +188,7 @@ async def test_begin_create(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_update(self, resource_group): + async def test_accounts_begin_update(self, resource_group): response = await ( await self.client.accounts.begin_update( resource_group_name=resource_group.name, @@ -203,6 +211,7 @@ async def test_begin_update(self, resource_group): "expiration": "2020-02-20 00:00:00", "rateLimitPercentage": 0.0, }, + "allowProjectManagement": bool, "allowedFqdnList": ["str"], "amlWorkspace": {"identityClientId": "str", "resourceId": "str"}, "apiProperties": { @@ -217,6 +226,7 @@ async def test_begin_update(self, resource_group): "superUser": "str", "websiteName": "str", }, + "associatedProjects": ["str"], "callRateLimit": { "count": 0.0, "renewalPeriod": 0.0, @@ -235,6 +245,7 @@ async def test_begin_update(self, resource_group): "commitmentPlanAssociations": [{"commitmentPlanId": "str", "commitmentPlanLocation": "str"}], "customSubDomainName": "str", "dateCreated": "str", + "defaultProject": "str", "deletionDate": "str", "disableLocalAuth": bool, "dynamicThrottlingEnabled": bool, @@ -264,6 +275,11 @@ async def test_begin_update(self, resource_group): {"id": "str", "ignoreMissingVnetServiceEndpoint": bool, "state": "str"} ], }, + "networkInjections": { + "scenario": "str", + "subnetArmId": "str", + "useMicrosoftManagedNetwork": bool, + }, "privateEndpointConnections": [ { "etag": "str", @@ -330,7 +346,7 @@ async def test_begin_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-10-01", + api_version="2025-04-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -339,12 +355,12 @@ async def test_begin_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete(self, resource_group): + async def test_accounts_begin_delete(self, resource_group): response = await ( await self.client.accounts.begin_delete( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -353,11 +369,11 @@ async def test_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_accounts_get(self, resource_group): response = await self.client.accounts.get( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -365,10 +381,10 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_resource_group(self, resource_group): + async def test_accounts_list_by_resource_group(self, resource_group): response = self.client.accounts.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-10-01", + api_version="2025-04-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -376,9 +392,9 @@ async def test_list_by_resource_group(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_accounts_list(self, resource_group): response = self.client.accounts.list( - api_version="2024-10-01", + api_version="2025-04-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -386,11 +402,11 @@ async def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_keys(self, resource_group): + async def test_accounts_list_keys(self, resource_group): response = await self.client.accounts.list_keys( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -398,12 +414,12 @@ async def test_list_keys(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_regenerate_key(self, resource_group): + async def test_accounts_regenerate_key(self, resource_group): response = await self.client.accounts.regenerate_key( resource_group_name=resource_group.name, account_name="str", key_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -411,11 +427,11 @@ async def test_regenerate_key(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_skus(self, resource_group): + async def test_accounts_list_skus(self, resource_group): response = await self.client.accounts.list_skus( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -423,11 +439,11 @@ async def test_list_skus(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_usages(self, resource_group): + async def test_accounts_list_usages(self, resource_group): response = await self.client.accounts.list_usages( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -435,11 +451,11 @@ async def test_list_usages(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_models(self, resource_group): + async def test_accounts_list_models(self, resource_group): response = self.client.accounts.list_models( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_async.py index b1a297fc3938..93dfb71282c4 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_async.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_async.py @@ -27,7 +27,7 @@ async def test_check_sku_availability(self, resource_group): skus=["str"], kind="str", type="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -39,7 +39,7 @@ async def test_check_domain_availability(self, resource_group): response = await self.client.check_domain_availability( subdomain_name="str", type="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -49,7 +49,7 @@ async def test_check_domain_availability(self, resource_group): @recorded_by_proxy_async async def test_calculate_model_capacity(self, resource_group): response = await self.client.calculate_model_capacity( - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_commitment_plans_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_commitment_plans_operations.py index 3ea44faf297b..cbe406b1f285 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_commitment_plans_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_commitment_plans_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_commitment_plans_list(self, resource_group): response = self.client.commitment_plans.list( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -32,12 +32,12 @@ def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_commitment_plans_get(self, resource_group): response = self.client.commitment_plans.get( resource_group_name=resource_group.name, account_name="str", commitment_plan_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -45,7 +45,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create_or_update(self, resource_group): + def test_commitment_plans_create_or_update(self, resource_group): response = self.client.commitment_plans.create_or_update( resource_group_name=resource_group.name, account_name="str", @@ -97,7 +97,7 @@ def test_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -105,12 +105,12 @@ def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete(self, resource_group): + def test_commitment_plans_begin_delete(self, resource_group): response = self.client.commitment_plans.begin_delete( resource_group_name=resource_group.name, account_name="str", commitment_plan_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -118,7 +118,7 @@ def test_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create_or_update_plan(self, resource_group): + def test_commitment_plans_begin_create_or_update_plan(self, resource_group): response = self.client.commitment_plans.begin_create_or_update_plan( resource_group_name=resource_group.name, commitment_plan_name="str", @@ -169,7 +169,7 @@ def test_begin_create_or_update_plan(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-10-01", + api_version="2025-04-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -177,7 +177,7 @@ def test_begin_create_or_update_plan(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_update_plan(self, resource_group): + def test_commitment_plans_begin_update_plan(self, resource_group): response = self.client.commitment_plans.begin_update_plan( resource_group_name=resource_group.name, commitment_plan_name="str", @@ -185,7 +185,7 @@ def test_begin_update_plan(self, resource_group): "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, "tags": {"str": "str"}, }, - api_version="2024-10-01", + api_version="2025-04-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -193,11 +193,11 @@ def test_begin_update_plan(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete_plan(self, resource_group): + def test_commitment_plans_begin_delete_plan(self, resource_group): response = self.client.commitment_plans.begin_delete_plan( resource_group_name=resource_group.name, commitment_plan_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -205,11 +205,11 @@ def test_begin_delete_plan(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_plan(self, resource_group): + def test_commitment_plans_get_plan(self, resource_group): response = self.client.commitment_plans.get_plan( resource_group_name=resource_group.name, commitment_plan_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -217,10 +217,10 @@ def test_get_plan(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_plans_by_resource_group(self, resource_group): + def test_commitment_plans_list_plans_by_resource_group(self, resource_group): response = self.client.commitment_plans.list_plans_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-10-01", + api_version="2025-04-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -228,9 +228,9 @@ def test_list_plans_by_resource_group(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_plans_by_subscription(self, resource_group): + def test_commitment_plans_list_plans_by_subscription(self, resource_group): response = self.client.commitment_plans.list_plans_by_subscription( - api_version="2024-10-01", + api_version="2025-04-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -238,11 +238,11 @@ def test_list_plans_by_subscription(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_associations(self, resource_group): + def test_commitment_plans_list_associations(self, resource_group): response = self.client.commitment_plans.list_associations( resource_group_name=resource_group.name, commitment_plan_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -250,12 +250,12 @@ def test_list_associations(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_association(self, resource_group): + def test_commitment_plans_get_association(self, resource_group): response = self.client.commitment_plans.get_association( resource_group_name=resource_group.name, commitment_plan_name="str", commitment_plan_association_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -263,7 +263,7 @@ def test_get_association(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create_or_update_association(self, resource_group): + def test_commitment_plans_begin_create_or_update_association(self, resource_group): response = self.client.commitment_plans.begin_create_or_update_association( resource_group_name=resource_group.name, commitment_plan_name="str", @@ -284,7 +284,7 @@ def test_begin_create_or_update_association(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-10-01", + api_version="2025-04-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -292,12 +292,12 @@ def test_begin_create_or_update_association(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete_association(self, resource_group): + def test_commitment_plans_begin_delete_association(self, resource_group): response = self.client.commitment_plans.begin_delete_association( resource_group_name=resource_group.name, commitment_plan_name="str", commitment_plan_association_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_commitment_plans_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_commitment_plans_operations_async.py index 64b0e522673a..a603ed9011a6 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_commitment_plans_operations_async.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_commitment_plans_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_commitment_plans_list(self, resource_group): response = self.client.commitment_plans.list( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -33,12 +33,12 @@ async def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_commitment_plans_get(self, resource_group): response = await self.client.commitment_plans.get( resource_group_name=resource_group.name, account_name="str", commitment_plan_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -46,7 +46,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create_or_update(self, resource_group): + async def test_commitment_plans_create_or_update(self, resource_group): response = await self.client.commitment_plans.create_or_update( resource_group_name=resource_group.name, account_name="str", @@ -98,7 +98,7 @@ async def test_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -106,13 +106,13 @@ async def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete(self, resource_group): + async def test_commitment_plans_begin_delete(self, resource_group): response = await ( await self.client.commitment_plans.begin_delete( resource_group_name=resource_group.name, account_name="str", commitment_plan_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -121,7 +121,7 @@ async def test_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create_or_update_plan(self, resource_group): + async def test_commitment_plans_begin_create_or_update_plan(self, resource_group): response = await ( await self.client.commitment_plans.begin_create_or_update_plan( resource_group_name=resource_group.name, @@ -173,7 +173,7 @@ async def test_begin_create_or_update_plan(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-10-01", + api_version="2025-04-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -182,7 +182,7 @@ async def test_begin_create_or_update_plan(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_update_plan(self, resource_group): + async def test_commitment_plans_begin_update_plan(self, resource_group): response = await ( await self.client.commitment_plans.begin_update_plan( resource_group_name=resource_group.name, @@ -191,7 +191,7 @@ async def test_begin_update_plan(self, resource_group): "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, "tags": {"str": "str"}, }, - api_version="2024-10-01", + api_version="2025-04-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -200,12 +200,12 @@ async def test_begin_update_plan(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete_plan(self, resource_group): + async def test_commitment_plans_begin_delete_plan(self, resource_group): response = await ( await self.client.commitment_plans.begin_delete_plan( resource_group_name=resource_group.name, commitment_plan_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -214,11 +214,11 @@ async def test_begin_delete_plan(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_plan(self, resource_group): + async def test_commitment_plans_get_plan(self, resource_group): response = await self.client.commitment_plans.get_plan( resource_group_name=resource_group.name, commitment_plan_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -226,10 +226,10 @@ async def test_get_plan(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_plans_by_resource_group(self, resource_group): + async def test_commitment_plans_list_plans_by_resource_group(self, resource_group): response = self.client.commitment_plans.list_plans_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-10-01", + api_version="2025-04-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -237,9 +237,9 @@ async def test_list_plans_by_resource_group(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_plans_by_subscription(self, resource_group): + async def test_commitment_plans_list_plans_by_subscription(self, resource_group): response = self.client.commitment_plans.list_plans_by_subscription( - api_version="2024-10-01", + api_version="2025-04-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -247,11 +247,11 @@ async def test_list_plans_by_subscription(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_associations(self, resource_group): + async def test_commitment_plans_list_associations(self, resource_group): response = self.client.commitment_plans.list_associations( resource_group_name=resource_group.name, commitment_plan_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -259,12 +259,12 @@ async def test_list_associations(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_association(self, resource_group): + async def test_commitment_plans_get_association(self, resource_group): response = await self.client.commitment_plans.get_association( resource_group_name=resource_group.name, commitment_plan_name="str", commitment_plan_association_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -272,7 +272,7 @@ async def test_get_association(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create_or_update_association(self, resource_group): + async def test_commitment_plans_begin_create_or_update_association(self, resource_group): response = await ( await self.client.commitment_plans.begin_create_or_update_association( resource_group_name=resource_group.name, @@ -294,7 +294,7 @@ async def test_begin_create_or_update_association(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-10-01", + api_version="2025-04-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -303,13 +303,13 @@ async def test_begin_create_or_update_association(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete_association(self, resource_group): + async def test_commitment_plans_begin_delete_association(self, resource_group): response = await ( await self.client.commitment_plans.begin_delete_association( resource_group_name=resource_group.name, commitment_plan_name="str", commitment_plan_association_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_commitment_tiers_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_commitment_tiers_operations.py index 98c9d9791e30..c94dd34e7de5 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_commitment_tiers_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_commitment_tiers_operations.py @@ -20,10 +20,10 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_commitment_tiers_list(self, resource_group): response = self.client.commitment_tiers.list( location="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_commitment_tiers_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_commitment_tiers_operations_async.py index 70dca8f7cc01..6ee537e76a72 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_commitment_tiers_operations_async.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_commitment_tiers_operations_async.py @@ -21,10 +21,10 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_commitment_tiers_list(self, resource_group): response = self.client.commitment_tiers.list( location="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_defender_for_ai_settings_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_defender_for_ai_settings_operations.py index f25c9d9b8460..92f4808cfc8d 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_defender_for_ai_settings_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_defender_for_ai_settings_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_defender_for_ai_settings_list(self, resource_group): response = self.client.defender_for_ai_settings.list( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -32,12 +32,12 @@ def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_defender_for_ai_settings_get(self, resource_group): response = self.client.defender_for_ai_settings.get( resource_group_name=resource_group.name, account_name="str", defender_for_ai_setting_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -45,7 +45,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create_or_update(self, resource_group): + def test_defender_for_ai_settings_create_or_update(self, resource_group): response = self.client.defender_for_ai_settings.create_or_update( resource_group_name=resource_group.name, account_name="str", @@ -66,7 +66,7 @@ def test_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -74,7 +74,7 @@ def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_update(self, resource_group): + def test_defender_for_ai_settings_update(self, resource_group): response = self.client.defender_for_ai_settings.update( resource_group_name=resource_group.name, account_name="str", @@ -95,7 +95,7 @@ def test_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_defender_for_ai_settings_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_defender_for_ai_settings_operations_async.py index 68f2b58ee6cd..8abd00db5485 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_defender_for_ai_settings_operations_async.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_defender_for_ai_settings_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_defender_for_ai_settings_list(self, resource_group): response = self.client.defender_for_ai_settings.list( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -33,12 +33,12 @@ async def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_defender_for_ai_settings_get(self, resource_group): response = await self.client.defender_for_ai_settings.get( resource_group_name=resource_group.name, account_name="str", defender_for_ai_setting_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -46,7 +46,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create_or_update(self, resource_group): + async def test_defender_for_ai_settings_create_or_update(self, resource_group): response = await self.client.defender_for_ai_settings.create_or_update( resource_group_name=resource_group.name, account_name="str", @@ -67,7 +67,7 @@ async def test_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -75,7 +75,7 @@ async def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_update(self, resource_group): + async def test_defender_for_ai_settings_update(self, resource_group): response = await self.client.defender_for_ai_settings.update( resource_group_name=resource_group.name, account_name="str", @@ -96,7 +96,7 @@ async def test_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_deleted_accounts_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_deleted_accounts_operations.py index a74476dc88d1..501736ca807a 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_deleted_accounts_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_deleted_accounts_operations.py @@ -20,12 +20,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_deleted_accounts_get(self, resource_group): response = self.client.deleted_accounts.get( location="str", resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -33,12 +33,12 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_purge(self, resource_group): + def test_deleted_accounts_begin_purge(self, resource_group): response = self.client.deleted_accounts.begin_purge( location="str", resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -46,9 +46,9 @@ def test_begin_purge(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_deleted_accounts_list(self, resource_group): response = self.client.deleted_accounts.list( - api_version="2024-10-01", + api_version="2025-04-01-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_deleted_accounts_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_deleted_accounts_operations_async.py index a1d8b2241e32..6d726b0b95cf 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_deleted_accounts_operations_async.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_deleted_accounts_operations_async.py @@ -21,12 +21,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_deleted_accounts_get(self, resource_group): response = await self.client.deleted_accounts.get( location="str", resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -34,13 +34,13 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_purge(self, resource_group): + async def test_deleted_accounts_begin_purge(self, resource_group): response = await ( await self.client.deleted_accounts.begin_purge( location="str", resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -49,9 +49,9 @@ async def test_begin_purge(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_deleted_accounts_list(self, resource_group): response = self.client.deleted_accounts.list( - api_version="2024-10-01", + api_version="2025-04-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_deployments_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_deployments_operations.py index 15e401263208..9b46a5e884d7 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_deployments_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_deployments_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_deployments_list(self, resource_group): response = self.client.deployments.list( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -32,12 +32,12 @@ def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_deployments_get(self, resource_group): response = self.client.deployments.get( resource_group_name=resource_group.name, account_name="str", deployment_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -45,7 +45,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create_or_update(self, resource_group): + def test_deployments_begin_create_or_update(self, resource_group): response = self.client.deployments.begin_create_or_update( resource_group_name=resource_group.name, account_name="str", @@ -123,7 +123,7 @@ def test_begin_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-10-01", + api_version="2025-04-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -131,7 +131,7 @@ def test_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_update(self, resource_group): + def test_deployments_begin_update(self, resource_group): response = self.client.deployments.begin_update( resource_group_name=resource_group.name, account_name="str", @@ -140,7 +140,7 @@ def test_begin_update(self, resource_group): "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, "tags": {"str": "str"}, }, - api_version="2024-10-01", + api_version="2025-04-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -148,12 +148,12 @@ def test_begin_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete(self, resource_group): + def test_deployments_begin_delete(self, resource_group): response = self.client.deployments.begin_delete( resource_group_name=resource_group.name, account_name="str", deployment_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -161,12 +161,12 @@ def test_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_skus(self, resource_group): + def test_deployments_list_skus(self, resource_group): response = self.client.deployments.list_skus( resource_group_name=resource_group.name, account_name="str", deployment_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_deployments_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_deployments_operations_async.py index cacdffc9fe81..53fa6534a345 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_deployments_operations_async.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_deployments_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_deployments_list(self, resource_group): response = self.client.deployments.list( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -33,12 +33,12 @@ async def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_deployments_get(self, resource_group): response = await self.client.deployments.get( resource_group_name=resource_group.name, account_name="str", deployment_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -46,7 +46,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create_or_update(self, resource_group): + async def test_deployments_begin_create_or_update(self, resource_group): response = await ( await self.client.deployments.begin_create_or_update( resource_group_name=resource_group.name, @@ -125,7 +125,7 @@ async def test_begin_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-10-01", + api_version="2025-04-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -134,7 +134,7 @@ async def test_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_update(self, resource_group): + async def test_deployments_begin_update(self, resource_group): response = await ( await self.client.deployments.begin_update( resource_group_name=resource_group.name, @@ -144,7 +144,7 @@ async def test_begin_update(self, resource_group): "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, "tags": {"str": "str"}, }, - api_version="2024-10-01", + api_version="2025-04-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -153,13 +153,13 @@ async def test_begin_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete(self, resource_group): + async def test_deployments_begin_delete(self, resource_group): response = await ( await self.client.deployments.begin_delete( resource_group_name=resource_group.name, account_name="str", deployment_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -168,12 +168,12 @@ async def test_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_skus(self, resource_group): + async def test_deployments_list_skus(self, resource_group): response = self.client.deployments.list_skus( resource_group_name=resource_group.name, account_name="str", deployment_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_encryption_scopes_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_encryption_scopes_operations.py index d967c0ff45c4..8a3a0ff934d4 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_encryption_scopes_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_encryption_scopes_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_encryption_scopes_list(self, resource_group): response = self.client.encryption_scopes.list( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -32,12 +32,12 @@ def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_encryption_scopes_get(self, resource_group): response = self.client.encryption_scopes.get( resource_group_name=resource_group.name, account_name="str", encryption_scope_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -45,7 +45,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create_or_update(self, resource_group): + def test_encryption_scopes_create_or_update(self, resource_group): response = self.client.encryption_scopes.create_or_update( resource_group_name=resource_group.name, account_name="str", @@ -76,7 +76,7 @@ def test_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -84,12 +84,12 @@ def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete(self, resource_group): + def test_encryption_scopes_begin_delete(self, resource_group): response = self.client.encryption_scopes.begin_delete( resource_group_name=resource_group.name, account_name="str", encryption_scope_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_encryption_scopes_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_encryption_scopes_operations_async.py index 850573c72894..0f425bf2c382 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_encryption_scopes_operations_async.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_encryption_scopes_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_encryption_scopes_list(self, resource_group): response = self.client.encryption_scopes.list( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -33,12 +33,12 @@ async def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_encryption_scopes_get(self, resource_group): response = await self.client.encryption_scopes.get( resource_group_name=resource_group.name, account_name="str", encryption_scope_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -46,7 +46,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create_or_update(self, resource_group): + async def test_encryption_scopes_create_or_update(self, resource_group): response = await self.client.encryption_scopes.create_or_update( resource_group_name=resource_group.name, account_name="str", @@ -77,7 +77,7 @@ async def test_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -85,13 +85,13 @@ async def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete(self, resource_group): + async def test_encryption_scopes_begin_delete(self, resource_group): response = await ( await self.client.encryption_scopes.begin_delete( resource_group_name=resource_group.name, account_name="str", encryption_scope_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_location_based_model_capacities_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_location_based_model_capacities_operations.py index 4d0a27d8ec07..ca75370e3f81 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_location_based_model_capacities_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_location_based_model_capacities_operations.py @@ -20,13 +20,13 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_location_based_model_capacities_list(self, resource_group): response = self.client.location_based_model_capacities.list( location="str", model_format="str", model_name="str", model_version="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_location_based_model_capacities_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_location_based_model_capacities_operations_async.py index c6cacad33717..5ada4a3fb18f 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_location_based_model_capacities_operations_async.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_location_based_model_capacities_operations_async.py @@ -21,13 +21,13 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_location_based_model_capacities_list(self, resource_group): response = self.client.location_based_model_capacities.list( location="str", model_format="str", model_name="str", model_version="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_model_capacities_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_model_capacities_operations.py index c156fa2436d6..8fb47b49ac0a 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_model_capacities_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_model_capacities_operations.py @@ -20,12 +20,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_model_capacities_list(self, resource_group): response = self.client.model_capacities.list( model_format="str", model_name="str", model_version="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_model_capacities_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_model_capacities_operations_async.py index e95828958954..8972e5ca8f74 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_model_capacities_operations_async.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_model_capacities_operations_async.py @@ -21,12 +21,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_model_capacities_list(self, resource_group): response = self.client.model_capacities.list( model_format="str", model_name="str", model_version="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_models_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_models_operations.py index faea0ec9f7f8..3e817460a8f8 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_models_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_models_operations.py @@ -20,10 +20,10 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_models_list(self, resource_group): response = self.client.models.list( location="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_models_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_models_operations_async.py index ad64b9c72310..075e79515146 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_models_operations_async.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_models_operations_async.py @@ -21,10 +21,10 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_models_list(self, resource_group): response = self.client.models.list( location="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_network_security_perimeter_configurations_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_network_security_perimeter_configurations_operations.py index 7f07dcf36d59..f076d11fa598 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_network_security_perimeter_configurations_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_network_security_perimeter_configurations_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_network_security_perimeter_configurations_list(self, resource_group): response = self.client.network_security_perimeter_configurations.list( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -32,12 +32,12 @@ def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_network_security_perimeter_configurations_get(self, resource_group): response = self.client.network_security_perimeter_configurations.get( resource_group_name=resource_group.name, account_name="str", nsp_configuration_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -45,12 +45,12 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_reconcile(self, resource_group): + def test_network_security_perimeter_configurations_begin_reconcile(self, resource_group): response = self.client.network_security_perimeter_configurations.begin_reconcile( resource_group_name=resource_group.name, account_name="str", nsp_configuration_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_network_security_perimeter_configurations_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_network_security_perimeter_configurations_operations_async.py index 828da45f5710..b19695d4d313 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_network_security_perimeter_configurations_operations_async.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_network_security_perimeter_configurations_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_network_security_perimeter_configurations_list(self, resource_group): response = self.client.network_security_perimeter_configurations.list( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -33,12 +33,12 @@ async def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_network_security_perimeter_configurations_get(self, resource_group): response = await self.client.network_security_perimeter_configurations.get( resource_group_name=resource_group.name, account_name="str", nsp_configuration_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -46,13 +46,13 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_reconcile(self, resource_group): + async def test_network_security_perimeter_configurations_begin_reconcile(self, resource_group): response = await ( await self.client.network_security_perimeter_configurations.begin_reconcile( resource_group_name=resource_group.name, account_name="str", nsp_configuration_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_operations.py index c66de343c10a..3c3c908355b9 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_operations.py @@ -20,9 +20,9 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_operations_list(self, resource_group): response = self.client.operations.list( - api_version="2024-10-01", + api_version="2025-04-01-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_operations_async.py index 48ba34c38069..34d333a625c6 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_operations_async.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_operations_async.py @@ -21,9 +21,9 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_operations_list(self, resource_group): response = self.client.operations.list( - api_version="2024-10-01", + api_version="2025-04-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_private_endpoint_connections_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_private_endpoint_connections_operations.py index efd140ede911..a3d7456c75ed 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_private_endpoint_connections_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_private_endpoint_connections_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_private_endpoint_connections_list(self, resource_group): response = self.client.private_endpoint_connections.list( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -32,12 +32,12 @@ def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_private_endpoint_connections_get(self, resource_group): response = self.client.private_endpoint_connections.get( resource_group_name=resource_group.name, account_name="str", private_endpoint_connection_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -45,7 +45,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create_or_update(self, resource_group): + def test_private_endpoint_connections_begin_create_or_update(self, resource_group): response = self.client.private_endpoint_connections.begin_create_or_update( resource_group_name=resource_group.name, account_name="str", @@ -75,7 +75,7 @@ def test_begin_create_or_update(self, resource_group): }, "type": "str", }, - api_version="2024-10-01", + api_version="2025-04-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -83,12 +83,12 @@ def test_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete(self, resource_group): + def test_private_endpoint_connections_begin_delete(self, resource_group): response = self.client.private_endpoint_connections.begin_delete( resource_group_name=resource_group.name, account_name="str", private_endpoint_connection_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_private_endpoint_connections_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_private_endpoint_connections_operations_async.py index d4c54f0c819d..f8c521417f68 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_private_endpoint_connections_operations_async.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_private_endpoint_connections_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_private_endpoint_connections_list(self, resource_group): response = await self.client.private_endpoint_connections.list( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -33,12 +33,12 @@ async def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_private_endpoint_connections_get(self, resource_group): response = await self.client.private_endpoint_connections.get( resource_group_name=resource_group.name, account_name="str", private_endpoint_connection_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -46,7 +46,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create_or_update(self, resource_group): + async def test_private_endpoint_connections_begin_create_or_update(self, resource_group): response = await ( await self.client.private_endpoint_connections.begin_create_or_update( resource_group_name=resource_group.name, @@ -77,7 +77,7 @@ async def test_begin_create_or_update(self, resource_group): }, "type": "str", }, - api_version="2024-10-01", + api_version="2025-04-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -86,13 +86,13 @@ async def test_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete(self, resource_group): + async def test_private_endpoint_connections_begin_delete(self, resource_group): response = await ( await self.client.private_endpoint_connections.begin_delete( resource_group_name=resource_group.name, account_name="str", private_endpoint_connection_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_private_link_resources_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_private_link_resources_operations.py index 269f8ab124e2..f9de8417afd2 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_private_link_resources_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_private_link_resources_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_private_link_resources_list(self, resource_group): response = self.client.private_link_resources.list( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_private_link_resources_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_private_link_resources_operations_async.py index c0e569ca22da..ebad28cc82d3 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_private_link_resources_operations_async.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_private_link_resources_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_private_link_resources_list(self, resource_group): response = await self.client.private_link_resources.list( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_project_capability_hosts_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_project_capability_hosts_operations.py new file mode 100644 index 000000000000..dbfe4249792c --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_project_capability_hosts_operations.py @@ -0,0 +1,77 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestCognitiveServicesManagementProjectCapabilityHostsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(CognitiveServicesManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_project_capability_hosts_begin_delete(self, resource_group): + response = self.client.project_capability_hosts.begin_delete( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + capability_host_name="str", + api_version="2025-04-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_project_capability_hosts_get(self, resource_group): + response = self.client.project_capability_hosts.get( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + capability_host_name="str", + api_version="2025-04-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_project_capability_hosts_begin_create_or_update(self, resource_group): + response = self.client.project_capability_hosts.begin_create_or_update( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + capability_host_name="str", + body={ + "properties": { + "aiServicesConnections": ["str"], + "capabilityHostKind": "str", + "customerSubnet": "str", + "description": "str", + "provisioningState": "str", + "storageConnections": ["str"], + "tags": {"str": "str"}, + "threadStorageConnections": ["str"], + "vectorStoreConnections": ["str"], + }, + "id": "str", + "name": "str", + "type": "str", + }, + api_version="2025-04-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_project_capability_hosts_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_project_capability_hosts_operations_async.py new file mode 100644 index 000000000000..cbda9742e219 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_project_capability_hosts_operations_async.py @@ -0,0 +1,82 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.cognitiveservices.aio import CognitiveServicesManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestCognitiveServicesManagementProjectCapabilityHostsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(CognitiveServicesManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_project_capability_hosts_begin_delete(self, resource_group): + response = await ( + await self.client.project_capability_hosts.begin_delete( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + capability_host_name="str", + api_version="2025-04-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_project_capability_hosts_get(self, resource_group): + response = await self.client.project_capability_hosts.get( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + capability_host_name="str", + api_version="2025-04-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_project_capability_hosts_begin_create_or_update(self, resource_group): + response = await ( + await self.client.project_capability_hosts.begin_create_or_update( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + capability_host_name="str", + body={ + "properties": { + "aiServicesConnections": ["str"], + "capabilityHostKind": "str", + "customerSubnet": "str", + "description": "str", + "provisioningState": "str", + "storageConnections": ["str"], + "tags": {"str": "str"}, + "threadStorageConnections": ["str"], + "vectorStoreConnections": ["str"], + }, + "id": "str", + "name": "str", + "type": "str", + }, + api_version="2025-04-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_project_connection_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_project_connection_operations.py new file mode 100644 index 000000000000..400fdd94a900 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_project_connection_operations.py @@ -0,0 +1,88 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestCognitiveServicesManagementProjectConnectionOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(CognitiveServicesManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_project_connection_delete(self, resource_group): + response = self.client.project_connection.delete( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + connection_name="str", + api_version="2025-04-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_project_connection_get(self, resource_group): + response = self.client.project_connection.get( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + connection_name="str", + api_version="2025-04-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_project_connection_update(self, resource_group): + response = self.client.project_connection.update( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + connection_name="str", + api_version="2025-04-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_project_connection_create(self, resource_group): + response = self.client.project_connection.create( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + connection_name="str", + api_version="2025-04-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_project_connection_list(self, resource_group): + response = self.client.project_connection.list( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + api_version="2025-04-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_project_connection_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_project_connection_operations_async.py new file mode 100644 index 000000000000..f60619391556 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_project_connection_operations_async.py @@ -0,0 +1,89 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.cognitiveservices.aio import CognitiveServicesManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestCognitiveServicesManagementProjectConnectionOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(CognitiveServicesManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_project_connection_delete(self, resource_group): + response = await self.client.project_connection.delete( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + connection_name="str", + api_version="2025-04-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_project_connection_get(self, resource_group): + response = await self.client.project_connection.get( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + connection_name="str", + api_version="2025-04-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_project_connection_update(self, resource_group): + response = await self.client.project_connection.update( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + connection_name="str", + api_version="2025-04-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_project_connection_create(self, resource_group): + response = await self.client.project_connection.create( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + connection_name="str", + api_version="2025-04-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_project_connection_list(self, resource_group): + response = self.client.project_connection.list( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + api_version="2025-04-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_projects_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_projects_operations.py new file mode 100644 index 000000000000..1cfc06b2aff6 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_projects_operations.py @@ -0,0 +1,141 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestCognitiveServicesManagementProjectsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(CognitiveServicesManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_projects_begin_create(self, resource_group): + response = self.client.projects.begin_create( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + project={ + "etag": "str", + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "properties": { + "description": "str", + "displayName": "str", + "endpoints": {"str": "str"}, + "isDefault": bool, + "provisioningState": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2025-04-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_projects_begin_update(self, resource_group): + response = self.client.projects.begin_update( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + project={ + "etag": "str", + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "properties": { + "description": "str", + "displayName": "str", + "endpoints": {"str": "str"}, + "isDefault": bool, + "provisioningState": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2025-04-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_projects_begin_delete(self, resource_group): + response = self.client.projects.begin_delete( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + api_version="2025-04-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_projects_get(self, resource_group): + response = self.client.projects.get( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + api_version="2025-04-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_projects_list(self, resource_group): + response = self.client.projects.list( + resource_group_name=resource_group.name, + account_name="str", + api_version="2025-04-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_projects_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_projects_operations_async.py new file mode 100644 index 000000000000..6dc7acd08161 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_projects_operations_async.py @@ -0,0 +1,148 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.cognitiveservices.aio import CognitiveServicesManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestCognitiveServicesManagementProjectsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(CognitiveServicesManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_projects_begin_create(self, resource_group): + response = await ( + await self.client.projects.begin_create( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + project={ + "etag": "str", + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "properties": { + "description": "str", + "displayName": "str", + "endpoints": {"str": "str"}, + "isDefault": bool, + "provisioningState": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2025-04-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_projects_begin_update(self, resource_group): + response = await ( + await self.client.projects.begin_update( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + project={ + "etag": "str", + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "properties": { + "description": "str", + "displayName": "str", + "endpoints": {"str": "str"}, + "isDefault": bool, + "provisioningState": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2025-04-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_projects_begin_delete(self, resource_group): + response = await ( + await self.client.projects.begin_delete( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + api_version="2025-04-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_projects_get(self, resource_group): + response = await self.client.projects.get( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + api_version="2025-04-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_projects_list(self, resource_group): + response = self.client.projects.list( + resource_group_name=resource_group.name, + account_name="str", + api_version="2025-04-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_blocklist_items_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_blocklist_items_operations.py index 024fcc253dab..0dc8f0c9e64c 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_blocklist_items_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_blocklist_items_operations.py @@ -20,12 +20,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_rai_blocklist_items_list(self, resource_group): response = self.client.rai_blocklist_items.list( resource_group_name=resource_group.name, account_name="str", rai_blocklist_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -33,13 +33,13 @@ def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_rai_blocklist_items_get(self, resource_group): response = self.client.rai_blocklist_items.get( resource_group_name=resource_group.name, account_name="str", rai_blocklist_name="str", rai_blocklist_item_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -47,7 +47,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create_or_update(self, resource_group): + def test_rai_blocklist_items_create_or_update(self, resource_group): response = self.client.rai_blocklist_items.create_or_update( resource_group_name=resource_group.name, account_name="str", @@ -69,7 +69,7 @@ def test_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -77,13 +77,13 @@ def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete(self, resource_group): + def test_rai_blocklist_items_begin_delete(self, resource_group): response = self.client.rai_blocklist_items.begin_delete( resource_group_name=resource_group.name, account_name="str", rai_blocklist_name="str", rai_blocklist_item_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -91,13 +91,13 @@ def test_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_batch_add(self, resource_group): + def test_rai_blocklist_items_batch_add(self, resource_group): response = self.client.rai_blocklist_items.batch_add( resource_group_name=resource_group.name, account_name="str", rai_blocklist_name="str", rai_blocklist_items=[{"name": "str", "properties": {"isRegex": bool, "pattern": "str"}}], - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -105,13 +105,13 @@ def test_batch_add(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_batch_delete(self, resource_group): + def test_rai_blocklist_items_batch_delete(self, resource_group): response = self.client.rai_blocklist_items.batch_delete( resource_group_name=resource_group.name, account_name="str", rai_blocklist_name="str", rai_blocklist_items_names={}, - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_blocklist_items_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_blocklist_items_operations_async.py index d1fbf3a58f36..e6b28cf1887a 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_blocklist_items_operations_async.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_blocklist_items_operations_async.py @@ -21,12 +21,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_rai_blocklist_items_list(self, resource_group): response = self.client.rai_blocklist_items.list( resource_group_name=resource_group.name, account_name="str", rai_blocklist_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -34,13 +34,13 @@ async def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_rai_blocklist_items_get(self, resource_group): response = await self.client.rai_blocklist_items.get( resource_group_name=resource_group.name, account_name="str", rai_blocklist_name="str", rai_blocklist_item_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -48,7 +48,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create_or_update(self, resource_group): + async def test_rai_blocklist_items_create_or_update(self, resource_group): response = await self.client.rai_blocklist_items.create_or_update( resource_group_name=resource_group.name, account_name="str", @@ -70,7 +70,7 @@ async def test_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -78,14 +78,14 @@ async def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete(self, resource_group): + async def test_rai_blocklist_items_begin_delete(self, resource_group): response = await ( await self.client.rai_blocklist_items.begin_delete( resource_group_name=resource_group.name, account_name="str", rai_blocklist_name="str", rai_blocklist_item_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -94,13 +94,13 @@ async def test_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_batch_add(self, resource_group): + async def test_rai_blocklist_items_batch_add(self, resource_group): response = await self.client.rai_blocklist_items.batch_add( resource_group_name=resource_group.name, account_name="str", rai_blocklist_name="str", rai_blocklist_items=[{"name": "str", "properties": {"isRegex": bool, "pattern": "str"}}], - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -108,13 +108,13 @@ async def test_batch_add(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_batch_delete(self, resource_group): + async def test_rai_blocklist_items_batch_delete(self, resource_group): response = await self.client.rai_blocklist_items.batch_delete( resource_group_name=resource_group.name, account_name="str", rai_blocklist_name="str", rai_blocklist_items_names={}, - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_blocklists_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_blocklists_operations.py index 8e8560968797..785ada873c7e 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_blocklists_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_blocklists_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_rai_blocklists_list(self, resource_group): response = self.client.rai_blocklists.list( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -32,12 +32,12 @@ def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_rai_blocklists_get(self, resource_group): response = self.client.rai_blocklists.get( resource_group_name=resource_group.name, account_name="str", rai_blocklist_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -45,7 +45,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create_or_update(self, resource_group): + def test_rai_blocklists_create_or_update(self, resource_group): response = self.client.rai_blocklists.create_or_update( resource_group_name=resource_group.name, account_name="str", @@ -66,7 +66,7 @@ def test_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -74,12 +74,12 @@ def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete(self, resource_group): + def test_rai_blocklists_begin_delete(self, resource_group): response = self.client.rai_blocklists.begin_delete( resource_group_name=resource_group.name, account_name="str", rai_blocklist_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_blocklists_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_blocklists_operations_async.py index fb192a693373..09aeaa43e00d 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_blocklists_operations_async.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_blocklists_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_rai_blocklists_list(self, resource_group): response = self.client.rai_blocklists.list( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -33,12 +33,12 @@ async def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_rai_blocklists_get(self, resource_group): response = await self.client.rai_blocklists.get( resource_group_name=resource_group.name, account_name="str", rai_blocklist_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -46,7 +46,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create_or_update(self, resource_group): + async def test_rai_blocklists_create_or_update(self, resource_group): response = await self.client.rai_blocklists.create_or_update( resource_group_name=resource_group.name, account_name="str", @@ -67,7 +67,7 @@ async def test_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -75,13 +75,13 @@ async def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete(self, resource_group): + async def test_rai_blocklists_begin_delete(self, resource_group): response = await ( await self.client.rai_blocklists.begin_delete( resource_group_name=resource_group.name, account_name="str", rai_blocklist_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_content_filters_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_content_filters_operations.py index fa1c0083fc96..7d4f9d667f70 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_content_filters_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_content_filters_operations.py @@ -20,10 +20,10 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_rai_content_filters_list(self, resource_group): response = self.client.rai_content_filters.list( location="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -31,11 +31,11 @@ def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_rai_content_filters_get(self, resource_group): response = self.client.rai_content_filters.get( location="str", filter_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_content_filters_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_content_filters_operations_async.py index bfc8ec002236..5571d92c7a58 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_content_filters_operations_async.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_content_filters_operations_async.py @@ -21,10 +21,10 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_rai_content_filters_list(self, resource_group): response = self.client.rai_content_filters.list( location="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -32,11 +32,11 @@ async def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_rai_content_filters_get(self, resource_group): response = await self.client.rai_content_filters.get( location="str", filter_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_policies_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_policies_operations.py index 80308b75060b..d17d5e9653f0 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_policies_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_policies_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_rai_policies_list(self, resource_group): response = self.client.rai_policies.list( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -32,12 +32,12 @@ def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_rai_policies_get(self, resource_group): response = self.client.rai_policies.get( resource_group_name=resource_group.name, account_name="str", rai_policy_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -45,7 +45,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create_or_update(self, resource_group): + def test_rai_policies_create_or_update(self, resource_group): response = self.client.rai_policies.create_or_update( resource_group_name=resource_group.name, account_name="str", @@ -74,7 +74,7 @@ def test_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -82,12 +82,12 @@ def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete(self, resource_group): + def test_rai_policies_begin_delete(self, resource_group): response = self.client.rai_policies.begin_delete( resource_group_name=resource_group.name, account_name="str", rai_policy_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_policies_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_policies_operations_async.py index a74b7a510680..e76c3b34f0c9 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_policies_operations_async.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_policies_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_rai_policies_list(self, resource_group): response = self.client.rai_policies.list( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -33,12 +33,12 @@ async def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_rai_policies_get(self, resource_group): response = await self.client.rai_policies.get( resource_group_name=resource_group.name, account_name="str", rai_policy_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -46,7 +46,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create_or_update(self, resource_group): + async def test_rai_policies_create_or_update(self, resource_group): response = await self.client.rai_policies.create_or_update( resource_group_name=resource_group.name, account_name="str", @@ -75,7 +75,7 @@ async def test_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-10-01", + api_version="2025-04-01-preview", ) # please add some check logic here by yourself @@ -83,13 +83,13 @@ async def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete(self, resource_group): + async def test_rai_policies_begin_delete(self, resource_group): response = await ( await self.client.rai_policies.begin_delete( resource_group_name=resource_group.name, account_name="str", rai_policy_name="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_resource_skus_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_resource_skus_operations.py index 387f49b4e85f..2c4cd28c2aa4 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_resource_skus_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_resource_skus_operations.py @@ -20,9 +20,9 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_resource_skus_list(self, resource_group): response = self.client.resource_skus.list( - api_version="2024-10-01", + api_version="2025-04-01-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_resource_skus_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_resource_skus_operations_async.py index 0b68fd9d6db6..7676ee3bfd5e 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_resource_skus_operations_async.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_resource_skus_operations_async.py @@ -21,9 +21,9 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_resource_skus_list(self, resource_group): response = self.client.resource_skus.list( - api_version="2024-10-01", + api_version="2025-04-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_usages_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_usages_operations.py index 2dc319f5c8ad..73f5bc47a061 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_usages_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_usages_operations.py @@ -20,10 +20,10 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_usages_list(self, resource_group): response = self.client.usages.list( location="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_usages_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_usages_operations_async.py index fed20f87d97d..dd83fa27a383 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_usages_operations_async.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_usages_operations_async.py @@ -21,10 +21,10 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_usages_list(self, resource_group): response = self.client.usages.list( location="str", - api_version="2024-10-01", + api_version="2025-04-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/sdk_packaging.toml b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/sdk_packaging.toml index 63bc757e0c4f..dccebd3219b4 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/sdk_packaging.toml +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/sdk_packaging.toml @@ -3,7 +3,7 @@ package_name = "azure-mgmt-cognitiveservices" package_nspkg = "azure-mgmt-nspkg" package_pprint_name = "Cognitive Services Management" package_doc_id = "cognitive-services" -is_stable = true +is_stable = false is_arm = true sample_link = "" title = "CognitiveServicesManagementClient" diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/setup.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/setup.py index cc77219a7545..33ef7f4476fb 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/setup.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/setup.py @@ -22,11 +22,9 @@ # Version extraction inspired from 'requests' with open( - ( - os.path.join(package_folder_path, "version.py") - if os.path.exists(os.path.join(package_folder_path, "version.py")) - else os.path.join(package_folder_path, "_version.py") - ), + os.path.join(package_folder_path, "version.py") + if os.path.exists(os.path.join(package_folder_path, "version.py")) + else os.path.join(package_folder_path, "_version.py"), "r", ) as fd: version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) @@ -51,7 +49,7 @@ url="https://github.com/Azure/azure-sdk-for-python", keywords="azure, azure sdk", # update with search keywords relevant to the azure service / product classifiers=[ - "Development Status :: 5 - Production/Stable", + "Development Status :: 4 - Beta", "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3",