diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/MANIFEST.in b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/MANIFEST.in index a3cb07df8765..3a9b6517412b 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/MANIFEST.in +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/MANIFEST.in @@ -1,3 +1,4 @@ +include _meta.json recursive-include tests *.py *.yaml include *.md include azure/__init__.py diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/_meta.json b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/_meta.json new file mode 100644 index 000000000000..a70c7a62920d --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/_meta.json @@ -0,0 +1,11 @@ +{ + "autorest": "3.4.2", + "use": [ + "@autorest/python@5.8.0", + "@autorest/modelerfour@4.19.1" + ], + "commit": "b2034729e79d99e48f6a2e6b66c3592311b4c688", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/cognitiveservices/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.0 --use=@autorest/modelerfour@4.19.1 --version=3.4.2", + "readme": "specification/cognitiveservices/resource-manager/readme.md" +} \ No newline at end of file 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 6994035541fa..9a68671d3a77 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 @@ -16,9 +16,11 @@ from typing import Any, Optional from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse from ._configuration import CognitiveServicesManagementClientConfiguration from .operations import AccountsOperations +from .operations import DeletedAccountsOperations from .operations import ResourceSkusOperations from .operations import Operations from .operations import CognitiveServicesManagementClientOperationsMixin @@ -32,6 +34,8 @@ class CognitiveServicesManagementClient(CognitiveServicesManagementClientOperati :ivar accounts: AccountsOperations operations :vartype accounts: azure.mgmt.cognitiveservices.operations.AccountsOperations + :ivar deleted_accounts: DeletedAccountsOperations operations + :vartype deleted_accounts: azure.mgmt.cognitiveservices.operations.DeletedAccountsOperations :ivar resource_skus: ResourceSkusOperations operations :vartype resource_skus: azure.mgmt.cognitiveservices.operations.ResourceSkusOperations :ivar operations: Operations operations @@ -45,6 +49,7 @@ class CognitiveServicesManagementClient(CognitiveServicesManagementClientOperati :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( @@ -67,6 +72,8 @@ def __init__( self.accounts = AccountsOperations( self._client, self._config, self._serialize, self._deserialize) + self.deleted_accounts = DeletedAccountsOperations( + self._client, self._config, self._serialize, self._deserialize) self.resource_skus = ResourceSkusOperations( self._client, self._config, self._serialize, self._deserialize) self.operations = Operations( @@ -76,6 +83,24 @@ def __init__( self.private_link_resources = PrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize) + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + def close(self): # type: () -> None self._client.close() 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 60083a4bb46b..89d1d80d7d47 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_configuration.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_configuration.py @@ -48,7 +48,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2017-04-18" + self.api_version = "2021-04-30" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-cognitiveservices/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_metadata.json b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_metadata.json new file mode 100644 index 000000000000..7aae21649127 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_metadata.json @@ -0,0 +1,138 @@ +{ + "chosen_version": "2021-04-30", + "total_api_version_list": ["2021-04-30"], + "client": { + "name": "CognitiveServicesManagementClient", + "filename": "_cognitive_services_management_client", + "description": "Cognitive Services Management Client.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"CognitiveServicesManagementClientConfiguration\"], \"._operations_mixin\": [\"CognitiveServicesManagementClientOperationsMixin\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"CognitiveServicesManagementClientConfiguration\"], \"._operations_mixin\": [\"CognitiveServicesManagementClientOperationsMixin\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "The ID of the target subscription.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "accounts": "AccountsOperations", + "deleted_accounts": "DeletedAccountsOperations", + "resource_skus": "ResourceSkusOperations", + "operations": "Operations", + "private_endpoint_connections": "PrivateEndpointConnectionsOperations", + "private_link_resources": "PrivateLinkResourcesOperations" + }, + "operation_mixins": { + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"ClientAuthenticationError\", \"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.mgmt.core.exceptions\": [\"ARMErrorFormat\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"List\", \"Optional\", \"TypeVar\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"ClientAuthenticationError\", \"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.mgmt.core.exceptions\": [\"ARMErrorFormat\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"List\", \"Optional\", \"TypeVar\"]}}}", + "operations": { + "check_sku_availability" : { + "sync": { + "signature": "def check_sku_availability(\n self,\n location, # type: str\n skus, # type: List[str]\n kind, # type: str\n type, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Check available SKUs.\n\n:param location: Resource location.\n:type location: str\n:param skus: The SKU of the resource.\n:type skus: list[str]\n:param kind: The Kind of the resource.\n:type kind: str\n:param type: The Type of the resource.\n:type type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SkuAvailabilityListResult, or the result of cls(response)\n:rtype: ~azure.mgmt.cognitiveservices.models.SkuAvailabilityListResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def check_sku_availability(\n self,\n location: str,\n skus: List[str],\n kind: str,\n type: str,\n **kwargs: Any\n) -\u003e \"_models.SkuAvailabilityListResult\":\n", + "doc": "\"\"\"Check available SKUs.\n\n:param location: Resource location.\n:type location: str\n:param skus: The SKU of the resource.\n:type skus: list[str]\n:param kind: The Kind of the resource.\n:type kind: str\n:param type: The Type of the resource.\n:type type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SkuAvailabilityListResult, or the result of cls(response)\n:rtype: ~azure.mgmt.cognitiveservices.models.SkuAvailabilityListResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "location, skus, kind, type" + }, + "check_domain_availability" : { + "sync": { + "signature": "def check_domain_availability(\n self,\n subdomain_name, # type: str\n type, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Check whether a domain is available.\n\n:param subdomain_name: The subdomain name to use.\n:type subdomain_name: str\n:param type: The Type of the resource.\n:type type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DomainAvailability, or the result of cls(response)\n:rtype: ~azure.mgmt.cognitiveservices.models.DomainAvailability\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def check_domain_availability(\n self,\n subdomain_name: str,\n type: str,\n **kwargs: Any\n) -\u003e \"_models.DomainAvailability\":\n", + "doc": "\"\"\"Check whether a domain is available.\n\n:param subdomain_name: The subdomain name to use.\n:type subdomain_name: str\n:param type: The Type of the resource.\n:type type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DomainAvailability, or the result of cls(response)\n:rtype: ~azure.mgmt.cognitiveservices.models.DomainAvailability\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "subdomain_name, type" + } + } + } +} \ No newline at end of file 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 ae876c37f272..75a1436b862f 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 = "11.0.0" +VERSION = "11.0.0b1" 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 8a47f0f5a784..495505912230 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 @@ -8,6 +8,7 @@ from typing import Any, Optional, TYPE_CHECKING +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer @@ -17,6 +18,7 @@ from ._configuration import CognitiveServicesManagementClientConfiguration from .operations import AccountsOperations +from .operations import DeletedAccountsOperations from .operations import ResourceSkusOperations from .operations import Operations from .operations import CognitiveServicesManagementClientOperationsMixin @@ -30,6 +32,8 @@ class CognitiveServicesManagementClient(CognitiveServicesManagementClientOperati :ivar accounts: AccountsOperations operations :vartype accounts: azure.mgmt.cognitiveservices.aio.operations.AccountsOperations + :ivar deleted_accounts: DeletedAccountsOperations operations + :vartype deleted_accounts: azure.mgmt.cognitiveservices.aio.operations.DeletedAccountsOperations :ivar resource_skus: ResourceSkusOperations operations :vartype resource_skus: azure.mgmt.cognitiveservices.aio.operations.ResourceSkusOperations :ivar operations: Operations operations @@ -43,6 +47,7 @@ class CognitiveServicesManagementClient(CognitiveServicesManagementClientOperati :param subscription_id: The ID of the target subscription. :type subscription_id: str :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( @@ -64,6 +69,8 @@ def __init__( self.accounts = AccountsOperations( self._client, self._config, self._serialize, self._deserialize) + self.deleted_accounts = DeletedAccountsOperations( + self._client, self._config, self._serialize, self._deserialize) self.resource_skus = ResourceSkusOperations( self._client, self._config, self._serialize, self._deserialize) self.operations = Operations( @@ -73,6 +80,23 @@ def __init__( self.private_link_resources = PrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize) + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + async def close(self) -> None: await self._client.close() 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 056ffde75428..e28e3245efda 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 @@ -45,7 +45,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2017-04-18" + self.api_version = "2021-04-30" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-cognitiveservices/{}'.format(VERSION)) self._configure(**kwargs) 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 fee14b0688ba..79bc52d9dd8f 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from ._accounts_operations import AccountsOperations +from ._deleted_accounts_operations import DeletedAccountsOperations from ._resource_skus_operations import ResourceSkusOperations from ._operations import Operations from ._cognitive_services_management_client_operations import CognitiveServicesManagementClientOperationsMixin @@ -15,6 +16,7 @@ __all__ = [ 'AccountsOperations', + 'DeletedAccountsOperations', 'ResourceSkusOperations', 'Operations', 'CognitiveServicesManagementClientOperationsMixin', 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 4d7d4d8c654e..7ebc072a9db9 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 @@ -12,7 +12,9 @@ from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models @@ -41,38 +43,24 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - async def create( + async def _create_initial( self, resource_group_name: str, account_name: str, - account: "_models.CognitiveServicesAccount", - **kwargs - ) -> "_models.CognitiveServicesAccount": - """Create Cognitive Services Account. Accounts is a resource group wide resource type. It holds - the keys for developer to access intelligent APIs. It's also the resource type for billing. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: The name of Cognitive Services account. - :type account_name: str - :param account: The parameters to provide for the created account. - :type account: ~azure.mgmt.cognitiveservices.models.CognitiveServicesAccount - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CognitiveServicesAccount, or the result of cls(response) - :rtype: ~azure.mgmt.cognitiveservices.models.CognitiveServicesAccount - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CognitiveServicesAccount"] + account: "_models.Account", + **kwargs: Any + ) -> "_models.Account": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Account"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-18" + api_version = "2021-04-30" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL - url = self.create.metadata['url'] # type: ignore + url = self._create_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), @@ -90,7 +78,7 @@ async def create( header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(account, 'CognitiveServicesAccount') + body_content = self._serialize.body(account, 'Account') body_content_kwargs['content'] = body_content request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) @@ -98,55 +86,114 @@ async def create( if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('CognitiveServicesAccount', pipeline_response) + deserialized = self._deserialize('Account', pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('CognitiveServicesAccount', pipeline_response) + deserialized = self._deserialize('Account', pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('CognitiveServicesAccount', pipeline_response) + deserialized = self._deserialize('Account', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}'} # type: ignore + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}'} # type: ignore - async def update( + async def begin_create( self, resource_group_name: str, account_name: str, - account: "_models.CognitiveServicesAccount", - **kwargs - ) -> "_models.CognitiveServicesAccount": - """Updates a Cognitive Services account. + account: "_models.Account", + **kwargs: Any + ) -> AsyncLROPoller["_models.Account"]: + """Create Cognitive Services Account. Accounts is a resource group wide resource type. It holds + the keys for developer to access intelligent APIs. It's also the resource type for billing. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param account_name: The name of Cognitive Services account. :type account_name: str :param account: The parameters to provide for the created account. - :type account: ~azure.mgmt.cognitiveservices.models.CognitiveServicesAccount + :type account: ~azure.mgmt.cognitiveservices.models.Account :keyword callable cls: A custom type or function that will be passed the direct response - :return: CognitiveServicesAccount, or the result of cls(response) - :rtype: ~azure.mgmt.cognitiveservices.models.CognitiveServicesAccount - :raises: ~azure.core.exceptions.HttpResponseError + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Account or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.Account] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CognitiveServicesAccount"] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Account"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + account_name=account_name, + account=account, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Account', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + account_name: str, + account: "_models.Account", + **kwargs: Any + ) -> "_models.Account": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Account"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-18" + api_version = "2021-04-30" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL - url = self.update.metadata['url'] # type: ignore + url = self._update_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), @@ -164,7 +211,7 @@ async def update( header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(account, 'CognitiveServicesAccount') + body_content = self._serialize.body(account, 'Account') body_content_kwargs['content'] = body_content request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) @@ -172,48 +219,108 @@ async def update( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('CognitiveServicesAccount', pipeline_response) + deserialized = self._deserialize('Account', pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('CognitiveServicesAccount', pipeline_response) + deserialized = self._deserialize('Account', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}'} # type: ignore + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}'} # type: ignore - async def delete( + async def begin_update( self, resource_group_name: str, account_name: str, - **kwargs - ) -> None: - """Deletes a Cognitive Services account from the resource group. + account: "_models.Account", + **kwargs: Any + ) -> AsyncLROPoller["_models.Account"]: + """Updates a Cognitive Services account. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param account_name: The name of Cognitive Services account. :type account_name: str + :param account: The parameters to provide for the created account. + :type account: ~azure.mgmt.cognitiveservices.models.Account :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Account or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.Account] + :raises ~azure.core.exceptions.HttpResponseError: """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Account"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + account_name=account_name, + account=account, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Account', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-18" + api_version = "2021-04-30" accept = "application/json" # Construct URL - url = self.delete.metadata['url'] # type: ignore + url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), @@ -235,20 +342,84 @@ async def delete( if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}'} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a Cognitive Services account from the resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + account_name=account_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } - async def get_properties( + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}'} # type: ignore + + async def get( self, resource_group_name: str, account_name: str, - **kwargs - ) -> "_models.CognitiveServicesAccount": + **kwargs: Any + ) -> "_models.Account": """Returns a Cognitive Services account specified by the parameters. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -256,20 +427,20 @@ async def get_properties( :param account_name: The name of Cognitive Services account. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CognitiveServicesAccount, or the result of cls(response) - :rtype: ~azure.mgmt.cognitiveservices.models.CognitiveServicesAccount + :return: Account, or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.Account :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CognitiveServicesAccount"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Account"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-18" + api_version = "2021-04-30" accept = "application/json" # Construct URL - url = self.get_properties.metadata['url'] # type: ignore + url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), @@ -291,37 +462,37 @@ async def get_properties( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CognitiveServicesAccount', pipeline_response) + deserialized = self._deserialize('Account', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}'} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}'} # type: ignore def list_by_resource_group( self, resource_group_name: str, - **kwargs - ) -> AsyncIterable["_models.CognitiveServicesAccountListResult"]: + **kwargs: Any + ) -> AsyncIterable["_models.AccountListResult"]: """Returns all the resources of a particular type belonging to a resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CognitiveServicesAccountListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cognitiveservices.models.CognitiveServicesAccountListResult] + :return: An iterator like instance of either AccountListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cognitiveservices.models.AccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CognitiveServicesAccountListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccountListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-18" + api_version = "2021-04-30" accept = "application/json" def prepare_request(next_link=None): @@ -349,7 +520,7 @@ def prepare_request(next_link=None): return request async def extract_data(pipeline_response): - deserialized = self._deserialize('CognitiveServicesAccountListResult', pipeline_response) + deserialized = self._deserialize('AccountListResult', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -362,7 +533,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -375,21 +546,21 @@ async def get_next(next_link=None): def list( self, - **kwargs - ) -> AsyncIterable["_models.CognitiveServicesAccountListResult"]: + **kwargs: Any + ) -> AsyncIterable["_models.AccountListResult"]: """Returns all the resources of a particular type belonging to a subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CognitiveServicesAccountListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cognitiveservices.models.CognitiveServicesAccountListResult] + :return: An iterator like instance of either AccountListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cognitiveservices.models.AccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CognitiveServicesAccountListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccountListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-18" + api_version = "2021-04-30" accept = "application/json" def prepare_request(next_link=None): @@ -416,7 +587,7 @@ def prepare_request(next_link=None): return request async def extract_data(pipeline_response): - deserialized = self._deserialize('CognitiveServicesAccountListResult', pipeline_response) + deserialized = self._deserialize('AccountListResult', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -429,7 +600,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -444,8 +615,8 @@ async def list_keys( self, resource_group_name: str, account_name: str, - **kwargs - ) -> "_models.CognitiveServicesAccountKeys": + **kwargs: Any + ) -> "_models.ApiKeys": """Lists the account keys for the specified Cognitive Services account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -453,16 +624,16 @@ async def list_keys( :param account_name: The name of Cognitive Services account. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CognitiveServicesAccountKeys, or the result of cls(response) - :rtype: ~azure.mgmt.cognitiveservices.models.CognitiveServicesAccountKeys + :return: ApiKeys, or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.ApiKeys :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CognitiveServicesAccountKeys"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiKeys"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-18" + api_version = "2021-04-30" accept = "application/json" # Construct URL @@ -488,10 +659,10 @@ async def list_keys( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CognitiveServicesAccountKeys', pipeline_response) + deserialized = self._deserialize('ApiKeys', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -504,8 +675,8 @@ async def regenerate_key( resource_group_name: str, account_name: str, key_name: Union[str, "_models.KeyName"], - **kwargs - ) -> "_models.CognitiveServicesAccountKeys": + **kwargs: Any + ) -> "_models.ApiKeys": """Regenerates the specified account key for the specified Cognitive Services account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -515,18 +686,18 @@ async def regenerate_key( :param key_name: key name to generate (Key1|Key2). :type key_name: str or ~azure.mgmt.cognitiveservices.models.KeyName :keyword callable cls: A custom type or function that will be passed the direct response - :return: CognitiveServicesAccountKeys, or the result of cls(response) - :rtype: ~azure.mgmt.cognitiveservices.models.CognitiveServicesAccountKeys + :return: ApiKeys, or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.ApiKeys :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CognitiveServicesAccountKeys"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiKeys"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) _parameters = _models.RegenerateKeyParameters(key_name=key_name) - api_version = "2017-04-18" + api_version = "2021-04-30" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -557,10 +728,10 @@ async def regenerate_key( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CognitiveServicesAccountKeys', pipeline_response) + deserialized = self._deserialize('ApiKeys', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -572,8 +743,8 @@ async def list_skus( self, resource_group_name: str, account_name: str, - **kwargs - ) -> "_models.CognitiveServicesAccountEnumerateSkusResult": + **kwargs: Any + ) -> "_models.AccountSkuListResult": """List available SKUs for the requested Cognitive Services account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -581,16 +752,16 @@ async def list_skus( :param account_name: The name of Cognitive Services account. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CognitiveServicesAccountEnumerateSkusResult, or the result of cls(response) - :rtype: ~azure.mgmt.cognitiveservices.models.CognitiveServicesAccountEnumerateSkusResult + :return: AccountSkuListResult, or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.AccountSkuListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CognitiveServicesAccountEnumerateSkusResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccountSkuListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-18" + api_version = "2021-04-30" accept = "application/json" # Construct URL @@ -616,10 +787,10 @@ async def list_skus( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CognitiveServicesAccountEnumerateSkusResult', pipeline_response) + deserialized = self._deserialize('AccountSkuListResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -627,13 +798,13 @@ async def list_skus( return deserialized list_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/skus'} # type: ignore - async def get_usages( + async def list_usages( self, resource_group_name: str, account_name: str, filter: Optional[str] = None, - **kwargs - ) -> "_models.UsagesResult": + **kwargs: Any + ) -> "_models.UsageListResult": """Get usages for the requested Cognitive Services account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -644,20 +815,20 @@ async def get_usages( supported parameter is name.value (name of the metric, can have an or of multiple names). :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: UsagesResult, or the result of cls(response) - :rtype: ~azure.mgmt.cognitiveservices.models.UsagesResult + :return: UsageListResult, or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.UsageListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.UsagesResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.UsageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-18" + api_version = "2021-04-30" accept = "application/json" # Construct URL - url = self.get_usages.metadata['url'] # type: ignore + url = self.list_usages.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), @@ -681,13 +852,13 @@ async def get_usages( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('UsagesResult', pipeline_response) + deserialized = self._deserialize('UsageListResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/usages'} # type: ignore + list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/usages'} # type: ignore 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 f76c497bc428..b75a2192f278 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 @@ -26,8 +26,8 @@ async def check_sku_availability( skus: List[str], kind: str, type: str, - **kwargs - ) -> "_models.CheckSkuAvailabilityResultList": + **kwargs: Any + ) -> "_models.SkuAvailabilityListResult": """Check available SKUs. :param location: Resource location. @@ -39,18 +39,18 @@ async def check_sku_availability( :param type: The Type of the resource. :type type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckSkuAvailabilityResultList, or the result of cls(response) - :rtype: ~azure.mgmt.cognitiveservices.models.CheckSkuAvailabilityResultList + :return: SkuAvailabilityListResult, or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.SkuAvailabilityListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckSkuAvailabilityResultList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SkuAvailabilityListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) _parameters = _models.CheckSkuAvailabilityParameter(skus=skus, kind=kind, type=type) - api_version = "2017-04-18" + api_version = "2021-04-30" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -80,9 +80,10 @@ async def check_sku_availability( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CheckSkuAvailabilityResultList', pipeline_response) + deserialized = self._deserialize('SkuAvailabilityListResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -94,8 +95,8 @@ async def check_domain_availability( self, subdomain_name: str, type: str, - **kwargs - ) -> "_models.CheckDomainAvailabilityResult": + **kwargs: Any + ) -> "_models.DomainAvailability": """Check whether a domain is available. :param subdomain_name: The subdomain name to use. @@ -103,18 +104,18 @@ async def check_domain_availability( :param type: The Type of the resource. :type type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckDomainAvailabilityResult, or the result of cls(response) - :rtype: ~azure.mgmt.cognitiveservices.models.CheckDomainAvailabilityResult + :return: DomainAvailability, or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.DomainAvailability :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckDomainAvailabilityResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DomainAvailability"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) _parameters = _models.CheckDomainAvailabilityParameter(subdomain_name=subdomain_name, type=type) - api_version = "2017-04-18" + api_version = "2021-04-30" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -143,9 +144,10 @@ async def check_domain_availability( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CheckDomainAvailabilityResult', pipeline_response) + deserialized = self._deserialize('DomainAvailability', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) 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 new file mode 100644 index 000000000000..6bbfe2fb3909 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_deleted_accounts_operations.py @@ -0,0 +1,290 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DeletedAccountsOperations: + """DeletedAccountsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.cognitiveservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + location: str, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.Account": + """Returns a Cognitive Services account specified by the parameters. + + :param location: Resource location. + :type location: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Account, or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.Account + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Account"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-30" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Account', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/resourceGroups/{resourceGroupName}/deletedAccounts/{accountName}'} # type: ignore + + async def _purge_initial( + self, + location: str, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-30" + accept = "application/json" + + # Construct URL + url = self._purge_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _purge_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/resourceGroups/{resourceGroupName}/deletedAccounts/{accountName}'} # type: ignore + + async def begin_purge( + self, + location: str, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a Cognitive Services account from the resource group. + + :param location: Resource location. + :type location: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._purge_initial( + location=location, + resource_group_name=resource_group_name, + account_name=account_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_purge.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/resourceGroups/{resourceGroupName}/deletedAccounts/{accountName}'} # type: ignore + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.AccountListResult"]: + """Returns all the resources of a particular type belonging to a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AccountListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cognitiveservices.models.AccountListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccountListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-30" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('AccountListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/deletedAccounts'} # type: ignore 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 335c1015c618..a9e6772820d9 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 @@ -43,21 +43,21 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, - **kwargs - ) -> AsyncIterable["_models.OperationEntityListResult"]: + **kwargs: Any + ) -> AsyncIterable["_models.OperationListResult"]: """Lists all the available Cognitive Services account operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationEntityListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cognitiveservices.models.OperationEntityListResult] + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cognitiveservices.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationEntityListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-18" + api_version = "2021-04-30" accept = "application/json" def prepare_request(next_link=None): @@ -80,7 +80,7 @@ def prepare_request(next_link=None): return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationEntityListResult', pipeline_response) + deserialized = self._deserialize('OperationListResult', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -93,8 +93,9 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response 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 a9a55d3fe3e5..ce2aa844860a 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 @@ -5,13 +5,15 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models @@ -44,7 +46,7 @@ async def list( self, resource_group_name: str, account_name: str, - **kwargs + **kwargs: Any ) -> "_models.PrivateEndpointConnectionListResult": """Gets the private endpoint connections associated with the Cognitive Services account. @@ -62,7 +64,7 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-18" + api_version = "2021-04-30" accept = "application/json" # Construct URL @@ -88,7 +90,7 @@ async def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) @@ -104,7 +106,7 @@ async def get( resource_group_name: str, account_name: str, private_endpoint_connection_name: str, - **kwargs + **kwargs: Any ) -> "_models.PrivateEndpointConnection": """Gets the specified private endpoint connection associated with the Cognitive Services account. @@ -125,7 +127,7 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-18" + api_version = "2021-04-30" accept = "application/json" # Construct URL @@ -152,7 +154,8 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -162,42 +165,25 @@ async def get( return deserialized get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore - async def create_or_update( + async def _create_or_update_initial( self, resource_group_name: str, account_name: str, private_endpoint_connection_name: str, properties: "_models.PrivateEndpointConnection", - **kwargs + **kwargs: Any ) -> "_models.PrivateEndpointConnection": - """Update the state of specified private endpoint connection associated with the Cognitive - Services account. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: The name of Cognitive Services account. - :type account_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the Cognitive Services Account. - :type private_endpoint_connection_name: str - :param properties: The private endpoint connection properties. - :type properties: ~azure.mgmt.cognitiveservices.models.PrivateEndpointConnection - :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) - :rtype: ~azure.mgmt.cognitiveservices.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError - """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-18" + api_version = "2021-04-30" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), @@ -222,27 +208,33 @@ async def create_or_update( pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore - async def delete( + async def begin_create_or_update( self, resource_group_name: str, account_name: str, private_endpoint_connection_name: str, - **kwargs - ) -> None: - """Deletes the specified private endpoint connection associated with the Cognitive Services - account. + properties: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> AsyncLROPoller["_models.PrivateEndpointConnection"]: + """Update the state of specified private endpoint connection associated with the Cognitive + Services account. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str @@ -251,20 +243,83 @@ async def delete( :param private_endpoint_connection_name: The name of the private endpoint connection associated with the Cognitive Services Account. :type private_endpoint_connection_name: str + :param properties: The private endpoint connection properties. + :type properties: ~azure.mgmt.cognitiveservices.models.PrivateEndpointConnection :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + account_name=account_name, + private_endpoint_connection_name=private_endpoint_connection_name, + properties=properties, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-18" + api_version = "2021-04-30" + accept = "application/json" # Construct URL - url = self.delete.metadata['url'] # type: ignore + url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), @@ -279,16 +334,89 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified private endpoint connection associated with the Cognitive Services + account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. + :type account_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Cognitive Services Account. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + account_name=account_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore 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 c95d964fa27f..dd712d390ad4 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 @@ -44,7 +44,7 @@ async def list( self, resource_group_name: str, account_name: str, - **kwargs + **kwargs: Any ) -> "_models.PrivateLinkResourceListResult": """Gets the private link resources that need to be created for a Cognitive Services account. @@ -62,7 +62,7 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-18" + api_version = "2021-04-30" accept = "application/json" # Construct URL @@ -88,7 +88,8 @@ async def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response) 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 bb072ad8604e..cc022df3d1ec 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 @@ -43,21 +43,21 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, - **kwargs - ) -> AsyncIterable["_models.ResourceSkusResult"]: + **kwargs: Any + ) -> AsyncIterable["_models.ResourceSkuListResult"]: """Gets the list of Microsoft.CognitiveServices SKUs available for your Subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceSkusResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cognitiveservices.models.ResourceSkusResult] + :return: An iterator like instance of either ResourceSkuListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cognitiveservices.models.ResourceSkuListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkusResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkuListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-18" + api_version = "2021-04-30" accept = "application/json" def prepare_request(next_link=None): @@ -84,7 +84,7 @@ def prepare_request(next_link=None): return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceSkusResult', pipeline_response) + deserialized = self._deserialize('ResourceSkuListResult', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -97,8 +97,9 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response 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 5e4aa53adfd3..15893aa225d2 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 @@ -7,29 +7,30 @@ # -------------------------------------------------------------------------- try: + from ._models_py3 import Account + from ._models_py3 import AccountListResult + 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 CallRateLimit from ._models_py3 import CheckDomainAvailabilityParameter - from ._models_py3 import CheckDomainAvailabilityResult from ._models_py3 import CheckSkuAvailabilityParameter - from ._models_py3 import CheckSkuAvailabilityResult - from ._models_py3 import CheckSkuAvailabilityResultList - from ._models_py3 import CognitiveServicesAccount - from ._models_py3 import CognitiveServicesAccountApiProperties - from ._models_py3 import CognitiveServicesAccountEnumerateSkusResult - from ._models_py3 import CognitiveServicesAccountKeys - from ._models_py3 import CognitiveServicesAccountListResult - from ._models_py3 import CognitiveServicesAccountProperties - from ._models_py3 import CognitiveServicesResourceAndSku + from ._models_py3 import DomainAvailability from ._models_py3 import Encryption - from ._models_py3 import Error - from ._models_py3 import ErrorBody + 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 NetworkRuleSet - from ._models_py3 import OperationDisplayInfo - from ._models_py3 import OperationEntity - from ._models_py3 import OperationEntityListResult + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationListResult from ._models_py3 import PrivateEndpoint from ._models_py3 import PrivateEndpointConnection from ._models_py3 import PrivateEndpointConnectionListResult @@ -38,43 +39,51 @@ from ._models_py3 import PrivateLinkResourceListResult from ._models_py3 import PrivateLinkResourceProperties from ._models_py3 import PrivateLinkServiceConnectionState + from ._models_py3 import QuotaLimit from ._models_py3 import RegenerateKeyParameters + 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 ResourceSkusResult 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 SystemData + from ._models_py3 import ThrottlingRule from ._models_py3 import Usage - from ._models_py3 import UsagesResult + from ._models_py3 import UsageListResult from ._models_py3 import UserAssignedIdentity from ._models_py3 import UserOwnedStorage from ._models_py3 import VirtualNetworkRule except (SyntaxError, ImportError): + from ._models import Account # type: ignore + from ._models import AccountListResult # type: ignore + from ._models import AccountProperties # type: ignore + from ._models import AccountSku # type: ignore + from ._models import AccountSkuListResult # type: ignore + from ._models import ApiKeys # type: ignore + from ._models import ApiProperties # type: ignore + from ._models import AzureEntityResource # type: ignore + from ._models import CallRateLimit # type: ignore from ._models import CheckDomainAvailabilityParameter # type: ignore - from ._models import CheckDomainAvailabilityResult # type: ignore from ._models import CheckSkuAvailabilityParameter # type: ignore - from ._models import CheckSkuAvailabilityResult # type: ignore - from ._models import CheckSkuAvailabilityResultList # type: ignore - from ._models import CognitiveServicesAccount # type: ignore - from ._models import CognitiveServicesAccountApiProperties # type: ignore - from ._models import CognitiveServicesAccountEnumerateSkusResult # type: ignore - from ._models import CognitiveServicesAccountKeys # type: ignore - from ._models import CognitiveServicesAccountListResult # type: ignore - from ._models import CognitiveServicesAccountProperties # type: ignore - from ._models import CognitiveServicesResourceAndSku # type: ignore + from ._models import DomainAvailability # type: ignore from ._models import Encryption # type: ignore - from ._models import Error # type: ignore - from ._models import ErrorBody # type: ignore + from ._models import ErrorAdditionalInfo # type: ignore + from ._models import ErrorDetail # type: ignore + from ._models import ErrorResponse # type: ignore from ._models import Identity # type: ignore from ._models import IpRule # type: ignore from ._models import KeyVaultProperties # type: ignore from ._models import MetricName # type: ignore from ._models import NetworkRuleSet # type: ignore - from ._models import OperationDisplayInfo # type: ignore - from ._models import OperationEntity # type: ignore - from ._models import OperationEntityListResult # type: ignore + from ._models import Operation # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationListResult # type: ignore from ._models import PrivateEndpoint # type: ignore from ._models import PrivateEndpointConnection # type: ignore from ._models import PrivateEndpointConnectionListResult # type: ignore @@ -83,29 +92,40 @@ from ._models import PrivateLinkResourceListResult # type: ignore from ._models import PrivateLinkResourceProperties # type: ignore from ._models import PrivateLinkServiceConnectionState # type: ignore + from ._models import QuotaLimit # type: ignore from ._models import RegenerateKeyParameters # type: ignore + from ._models import RequestMatchPattern # type: ignore from ._models import Resource # type: ignore from ._models import ResourceSku # type: ignore + from ._models import ResourceSkuListResult # type: ignore from ._models import ResourceSkuRestrictionInfo # type: ignore from ._models import ResourceSkuRestrictions # type: ignore - from ._models import ResourceSkusResult # type: ignore from ._models import Sku # type: ignore + from ._models import SkuAvailability # type: ignore + from ._models import SkuAvailabilityListResult # type: ignore from ._models import SkuCapability # type: ignore + from ._models import SkuChangeInfo # type: ignore + from ._models import SystemData # type: ignore + from ._models import ThrottlingRule # type: ignore from ._models import Usage # type: ignore - from ._models import UsagesResult # type: ignore + from ._models import UsageListResult # type: ignore from ._models import UserAssignedIdentity # type: ignore from ._models import UserOwnedStorage # type: ignore from ._models import VirtualNetworkRule # type: ignore from ._cognitive_services_management_client_enums import ( - IdentityType, + ActionType, + CreatedByType, KeyName, KeySource, NetworkRuleAction, + Origin, + PrivateEndpointConnectionProvisioningState, PrivateEndpointServiceConnectionStatus, ProvisioningState, PublicNetworkAccess, QuotaUsageStatus, + ResourceIdentityType, ResourceSkuRestrictionsReasonCode, ResourceSkuRestrictionsType, SkuTier, @@ -113,29 +133,30 @@ ) __all__ = [ + 'Account', + 'AccountListResult', + 'AccountProperties', + 'AccountSku', + 'AccountSkuListResult', + 'ApiKeys', + 'ApiProperties', + 'AzureEntityResource', + 'CallRateLimit', 'CheckDomainAvailabilityParameter', - 'CheckDomainAvailabilityResult', 'CheckSkuAvailabilityParameter', - 'CheckSkuAvailabilityResult', - 'CheckSkuAvailabilityResultList', - 'CognitiveServicesAccount', - 'CognitiveServicesAccountApiProperties', - 'CognitiveServicesAccountEnumerateSkusResult', - 'CognitiveServicesAccountKeys', - 'CognitiveServicesAccountListResult', - 'CognitiveServicesAccountProperties', - 'CognitiveServicesResourceAndSku', + 'DomainAvailability', 'Encryption', - 'Error', - 'ErrorBody', + 'ErrorAdditionalInfo', + 'ErrorDetail', + 'ErrorResponse', 'Identity', 'IpRule', 'KeyVaultProperties', 'MetricName', 'NetworkRuleSet', - 'OperationDisplayInfo', - 'OperationEntity', - 'OperationEntityListResult', + 'Operation', + 'OperationDisplay', + 'OperationListResult', 'PrivateEndpoint', 'PrivateEndpointConnection', 'PrivateEndpointConnectionListResult', @@ -144,27 +165,38 @@ 'PrivateLinkResourceListResult', 'PrivateLinkResourceProperties', 'PrivateLinkServiceConnectionState', + 'QuotaLimit', 'RegenerateKeyParameters', + 'RequestMatchPattern', 'Resource', 'ResourceSku', + 'ResourceSkuListResult', 'ResourceSkuRestrictionInfo', 'ResourceSkuRestrictions', - 'ResourceSkusResult', 'Sku', + 'SkuAvailability', + 'SkuAvailabilityListResult', 'SkuCapability', + 'SkuChangeInfo', + 'SystemData', + 'ThrottlingRule', 'Usage', - 'UsagesResult', + 'UsageListResult', 'UserAssignedIdentity', 'UserOwnedStorage', 'VirtualNetworkRule', - 'IdentityType', + 'ActionType', + 'CreatedByType', 'KeyName', 'KeySource', 'NetworkRuleAction', + 'Origin', + 'PrivateEndpointConnectionProvisioningState', 'PrivateEndpointServiceConnectionStatus', 'ProvisioningState', 'PublicNetworkAccess', 'QuotaUsageStatus', + 'ResourceIdentityType', 'ResourceSkuRestrictionsReasonCode', 'ResourceSkuRestrictionsType', 'SkuTier', 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 9653b1197702..a8370363caee 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 @@ -26,13 +26,20 @@ def __getattr__(cls, name): raise AttributeError(name) -class IdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Type of managed service identity. +class ActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. """ - NONE = "None" - SYSTEM_ASSIGNED = "SystemAssigned" - USER_ASSIGNED = "UserAssigned" + INTERNAL = "Internal" + +class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that created the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" class KeyName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """key name to generate (Key1|Key2) @@ -56,6 +63,24 @@ class NetworkRuleAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ALLOW = "Allow" DENY = "Deny" +class Origin(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit + logs UX. Default value is "user,system" + """ + + USER = "user" + SYSTEM = "system" + USER_SYSTEM = "user,system" + +class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The current provisioning state. + """ + + SUCCEEDED = "Succeeded" + CREATING = "Creating" + DELETING = "Deleting" + FAILED = "Failed" + class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The private endpoint connection status. """ @@ -63,18 +88,18 @@ class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnum PENDING = "Pending" APPROVED = "Approved" REJECTED = "Rejected" - DISCONNECTED = "Disconnected" class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Gets the status of the cognitive services account at the time the operation was called. """ + ACCEPTED = "Accepted" CREATING = "Creating" - RESOLVING_DNS = "ResolvingDNS" - MOVING = "Moving" DELETING = "Deleting" - SUCCEEDED = "Succeeded" + MOVING = "Moving" FAILED = "Failed" + SUCCEEDED = "Succeeded" + RESOLVING_DNS = "ResolvingDNS" class PublicNetworkAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Whether or not public endpoint access is allowed for this account. Value is optional but if @@ -93,6 +118,15 @@ class QuotaUsageStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): IN_OVERAGE = "InOverage" UNKNOWN = "Unknown" +class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The identity type. + """ + + NONE = "None" + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" + class ResourceSkuRestrictionsReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The reason for restriction. """ @@ -108,10 +142,12 @@ class ResourceSkuRestrictionsType(with_metaclass(_CaseInsensitiveEnumMeta, str, ZONE = "Zone" class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Gets the sku tier. This is based on the SKU name. + """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. """ FREE = "Free" + BASIC = "Basic" STANDARD = "Standard" PREMIUM = "Premium" ENTERPRISE = "Enterprise" diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_models.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_models.py index 0440154a08e7..82966d05638f 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_models.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_models.py @@ -10,24 +10,30 @@ import msrest.serialization -class CheckDomainAvailabilityParameter(msrest.serialization.Model): - """Check Domain availability parameter. +class Resource(msrest.serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :param subdomain_name: Required. The subdomain name to use. - :type subdomain_name: str - :param type: Required. The Type of the resource. - :type type: str + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :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 """ _validation = { - 'subdomain_name': {'required': True}, - 'type': {'required': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, } _attribute_map = { - 'subdomain_name': {'key': 'subdomainName', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, } @@ -35,207 +41,353 @@ def __init__( self, **kwargs ): - super(CheckDomainAvailabilityParameter, self).__init__(**kwargs) - self.subdomain_name = kwargs['subdomain_name'] - self.type = kwargs['type'] + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None -class CheckDomainAvailabilityResult(msrest.serialization.Model): - """Check Domain availability result. +class AzureEntityResource(Resource): + """The resource model definition for an Azure Resource Manager resource with an etag. - :param is_subdomain_available: Indicates the given SKU is available or not. - :type is_subdomain_available: bool - :param reason: Reason why the SKU is not available. - :type reason: str - :param subdomain_name: The subdomain name to use. - :type subdomain_name: str - :param type: The Type of the resource. - :type type: str + 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}. + :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 """ + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + } + _attribute_map = { - 'is_subdomain_available': {'key': 'isSubdomainAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'subdomain_name': {'key': 'subdomainName', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, } def __init__( self, **kwargs ): - super(CheckDomainAvailabilityResult, self).__init__(**kwargs) - self.is_subdomain_available = kwargs.get('is_subdomain_available', None) - self.reason = kwargs.get('reason', None) - self.subdomain_name = kwargs.get('subdomain_name', None) - self.type = kwargs.get('type', None) + super(AzureEntityResource, self).__init__(**kwargs) + self.etag = None -class CheckSkuAvailabilityParameter(msrest.serialization.Model): - """Check SKU availability parameter. +class Account(AzureEntityResource): + """Cognitive Services account is an Azure resource representing the provisioned account, it's type, location and SKU. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :param skus: Required. The SKU of the resource. - :type skus: list[str] - :param kind: Required. The Kind of the resource. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :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 + :param kind: The Kind of the resource. :type kind: str - :param type: Required. The Type of the resource. - :type type: str + :param sku: The resource model definition representing SKU. + :type sku: ~azure.mgmt.cognitiveservices.models.Sku + :param identity: Identity for the resource. + :type 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 + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: The geo-location where the resource lives. + :type location: str + :param properties: Properties of Cognitive Services account. + :type properties: ~azure.mgmt.cognitiveservices.models.AccountProperties """ _validation = { - 'skus': {'required': True}, - 'kind': {'required': True}, - 'type': {'required': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + 'system_data': {'readonly': True}, } _attribute_map = { - 'skus': {'key': 'skus', 'type': '[str]'}, - 'kind': {'key': 'kind', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + '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': 'AccountProperties'}, } def __init__( self, **kwargs ): - super(CheckSkuAvailabilityParameter, self).__init__(**kwargs) - self.skus = kwargs['skus'] - self.kind = kwargs['kind'] - self.type = kwargs['type'] + super(Account, self).__init__(**kwargs) + self.kind = kwargs.get('kind', None) + self.sku = kwargs.get('sku', None) + self.identity = kwargs.get('identity', None) + self.system_data = None + self.tags = kwargs.get('tags', None) + self.location = kwargs.get('location', None) + self.properties = kwargs.get('properties', None) -class CheckSkuAvailabilityResult(msrest.serialization.Model): - """Check SKU availability result. +class AccountListResult(msrest.serialization.Model): + """The list of cognitive services accounts operation response. - :param kind: The Kind of the resource. - :type kind: str - :param type: The Type of the resource. - :type type: str - :param sku_name: The SKU of Cognitive Services account. - :type sku_name: str - :param sku_available: Indicates the given SKU is available or not. - :type sku_available: bool - :param reason: Reason why the SKU is not available. - :type reason: str - :param message: Additional error message. - :type message: str + Variables are only populated by the server, and will be ignored when sending a request. + + :param next_link: The link used to get the next page of accounts. + :type next_link: str + :ivar value: Gets the list of Cognitive Services accounts and their properties. + :vartype value: list[~azure.mgmt.cognitiveservices.models.Account] """ + _validation = { + 'value': {'readonly': True}, + } + _attribute_map = { - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'sku_name': {'key': 'skuName', 'type': 'str'}, - 'sku_available': {'key': 'skuAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[Account]'}, } def __init__( self, **kwargs ): - super(CheckSkuAvailabilityResult, self).__init__(**kwargs) - self.kind = kwargs.get('kind', None) - self.type = kwargs.get('type', None) - self.sku_name = kwargs.get('sku_name', None) - self.sku_available = kwargs.get('sku_available', None) - self.reason = kwargs.get('reason', None) - self.message = kwargs.get('message', None) + super(AccountListResult, self).__init__(**kwargs) + self.next_link = kwargs.get('next_link', None) + self.value = None -class CheckSkuAvailabilityResultList(msrest.serialization.Model): - """Check SKU availability result list. +class AccountProperties(msrest.serialization.Model): + """Properties of Cognitive Services account. - :param value: Check SKU availability result list. - :type value: list[~azure.mgmt.cognitiveservices.models.CheckSkuAvailabilityResult] + 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. Possible values include: "Accepted", "Creating", "Deleting", "Moving", + "Failed", "Succeeded", "ResolvingDNS". + :vartype provisioning_state: str or ~azure.mgmt.cognitiveservices.models.ProvisioningState + :ivar endpoint: Endpoint of the created account. + :vartype endpoint: str + :ivar internal_id: The internal identifier (deprecated, do not use this property). + :vartype internal_id: str + :ivar capabilities: Gets the capabilities of the cognitive services account. Each item + indicates the capability of a specific feature. The values are read-only and for reference + only. + :vartype capabilities: list[~azure.mgmt.cognitiveservices.models.SkuCapability] + :ivar is_migrated: If the resource is migrated from an existing key. + :vartype is_migrated: bool + :param migration_token: Resource migration token. + :type migration_token: str + :ivar sku_change_info: Sku change info of account. + :vartype sku_change_info: ~azure.mgmt.cognitiveservices.models.SkuChangeInfo + :param custom_sub_domain_name: Optional subdomain name used for token-based authentication. + :type custom_sub_domain_name: str + :param network_acls: A collection of rules governing the accessibility from specific network + locations. + :type network_acls: ~azure.mgmt.cognitiveservices.models.NetworkRuleSet + :param encryption: The encryption properties for this resource. + :type encryption: ~azure.mgmt.cognitiveservices.models.Encryption + :param user_owned_storage: The storage accounts for this resource. + :type user_owned_storage: list[~azure.mgmt.cognitiveservices.models.UserOwnedStorage] + :ivar private_endpoint_connections: The private endpoint connection associated with the + Cognitive Services account. + :vartype private_endpoint_connections: + list[~azure.mgmt.cognitiveservices.models.PrivateEndpointConnection] + :param public_network_access: Whether or not public endpoint access is allowed for this + account. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values + include: "Enabled", "Disabled". + :type public_network_access: str or ~azure.mgmt.cognitiveservices.models.PublicNetworkAccess + :param api_properties: The api properties for special APIs. + :type api_properties: ~azure.mgmt.cognitiveservices.models.ApiProperties + :ivar date_created: Gets the date of cognitive services account creation. + :vartype date_created: str + :ivar call_rate_limit: The call rate limit Cognitive Services account. + :vartype call_rate_limit: ~azure.mgmt.cognitiveservices.models.CallRateLimit + :ivar quota_limit: + :vartype quota_limit: ~azure.mgmt.cognitiveservices.models.QuotaLimit + :param restrict_outbound_network_access: + :type restrict_outbound_network_access: bool + :param allowed_fqdn_list: + :type allowed_fqdn_list: list[str] + :param disable_local_auth: + :type disable_local_auth: bool + :ivar endpoints: Dictionary of :code:``. + :vartype endpoints: dict[str, str] + :param restore: + :type restore: bool """ + _validation = { + 'provisioning_state': {'readonly': True}, + 'endpoint': {'readonly': True}, + 'internal_id': {'readonly': True}, + 'capabilities': {'readonly': True}, + 'is_migrated': {'readonly': True}, + 'sku_change_info': {'readonly': True}, + 'private_endpoint_connections': {'readonly': True}, + 'date_created': {'readonly': True}, + 'call_rate_limit': {'readonly': True}, + 'quota_limit': {'readonly': True}, + 'endpoints': {'readonly': True}, + } + _attribute_map = { - 'value': {'key': 'value', 'type': '[CheckSkuAvailabilityResult]'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'endpoint': {'key': 'endpoint', 'type': 'str'}, + 'internal_id': {'key': 'internalId', 'type': 'str'}, + 'capabilities': {'key': 'capabilities', 'type': '[SkuCapability]'}, + 'is_migrated': {'key': 'isMigrated', 'type': 'bool'}, + 'migration_token': {'key': 'migrationToken', 'type': 'str'}, + 'sku_change_info': {'key': 'skuChangeInfo', 'type': 'SkuChangeInfo'}, + 'custom_sub_domain_name': {'key': 'customSubDomainName', 'type': 'str'}, + 'network_acls': {'key': 'networkAcls', 'type': 'NetworkRuleSet'}, + 'encryption': {'key': 'encryption', 'type': 'Encryption'}, + 'user_owned_storage': {'key': 'userOwnedStorage', 'type': '[UserOwnedStorage]'}, + 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, + 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, + 'api_properties': {'key': 'apiProperties', 'type': 'ApiProperties'}, + 'date_created': {'key': 'dateCreated', 'type': 'str'}, + 'call_rate_limit': {'key': 'callRateLimit', 'type': 'CallRateLimit'}, + 'quota_limit': {'key': 'quotaLimit', 'type': 'QuotaLimit'}, + 'restrict_outbound_network_access': {'key': 'restrictOutboundNetworkAccess', 'type': 'bool'}, + 'allowed_fqdn_list': {'key': 'allowedFqdnList', 'type': '[str]'}, + 'disable_local_auth': {'key': 'disableLocalAuth', 'type': 'bool'}, + 'endpoints': {'key': 'endpoints', 'type': '{str}'}, + 'restore': {'key': 'restore', 'type': 'bool'}, } def __init__( self, **kwargs ): - super(CheckSkuAvailabilityResultList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - + super(AccountProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.endpoint = None + self.internal_id = None + self.capabilities = None + self.is_migrated = None + self.migration_token = kwargs.get('migration_token', None) + self.sku_change_info = None + self.custom_sub_domain_name = kwargs.get('custom_sub_domain_name', None) + self.network_acls = kwargs.get('network_acls', None) + self.encryption = kwargs.get('encryption', None) + self.user_owned_storage = kwargs.get('user_owned_storage', None) + self.private_endpoint_connections = None + self.public_network_access = kwargs.get('public_network_access', None) + self.api_properties = kwargs.get('api_properties', None) + self.date_created = None + self.call_rate_limit = None + self.quota_limit = None + self.restrict_outbound_network_access = kwargs.get('restrict_outbound_network_access', None) + self.allowed_fqdn_list = kwargs.get('allowed_fqdn_list', None) + self.disable_local_auth = kwargs.get('disable_local_auth', None) + self.endpoints = None + self.restore = kwargs.get('restore', None) -class CognitiveServicesAccount(msrest.serialization.Model): - """Cognitive Services Account is an Azure resource representing the provisioned account, its type, location and SKU. - Variables are only populated by the server, and will be ignored when sending a request. +class AccountSku(msrest.serialization.Model): + """Cognitive Services resource type and SKU. - :ivar etag: Entity Tag. - :vartype etag: str - :ivar id: The id of the created account. - :vartype id: str - :param kind: The Kind of the resource. - :type kind: str - :param location: The location of the resource. - :type location: str - :ivar name: The name of the created account. - :vartype name: str - :param properties: Properties of Cognitive Services account. - :type properties: ~azure.mgmt.cognitiveservices.models.CognitiveServicesAccountProperties + :param resource_type: Resource Namespace and Type. + :type resource_type: str :param sku: The SKU of Cognitive Services account. :type sku: ~azure.mgmt.cognitiveservices.models.Sku - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. - These tags can be used in viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 - characters and value no greater than 256 characters. - :type tags: dict[str, str] - :ivar type: Resource type. - :vartype type: str - :param identity: The identity of Cognitive Services account. - :type identity: ~azure.mgmt.cognitiveservices.models.Identity """ - _validation = { - 'etag': {'readonly': True}, - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + } + + def __init__( + self, + **kwargs + ): + super(AccountSku, self).__init__(**kwargs) + self.resource_type = kwargs.get('resource_type', None) + self.sku = kwargs.get('sku', None) + + +class AccountSkuListResult(msrest.serialization.Model): + """The list of cognitive services accounts operation response. + + :param value: Gets the list of Cognitive Services accounts and their properties. + :type value: list[~azure.mgmt.cognitiveservices.models.AccountSku] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AccountSku]'}, + } + + def __init__( + self, + **kwargs + ): + super(AccountSkuListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class ApiKeys(msrest.serialization.Model): + """The access keys for the cognitive services account. + + :param key1: Gets the value of key 1. + :type key1: str + :param key2: Gets the value of key 2. + :type key2: str + """ _attribute_map = { - 'etag': {'key': 'etag', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'CognitiveServicesAccountProperties'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'type': {'key': 'type', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, + 'key1': {'key': 'key1', 'type': 'str'}, + 'key2': {'key': 'key2', 'type': 'str'}, } def __init__( self, **kwargs ): - super(CognitiveServicesAccount, self).__init__(**kwargs) - self.etag = None - self.id = None - self.kind = kwargs.get('kind', None) - self.location = kwargs.get('location', None) - self.name = None - self.properties = kwargs.get('properties', None) - self.sku = kwargs.get('sku', None) - self.tags = kwargs.get('tags', None) - self.type = None - self.identity = kwargs.get('identity', None) + super(ApiKeys, self).__init__(**kwargs) + self.key1 = kwargs.get('key1', None) + self.key2 = kwargs.get('key2', None) -class CognitiveServicesAccountApiProperties(msrest.serialization.Model): +class ApiProperties(msrest.serialization.Model): """The api properties for special APIs. + :param additional_properties: Unmatched properties from the message are deserialized to this + collection. + :type additional_properties: dict[str, any] :param qna_runtime_endpoint: (QnAMaker Only) The runtime endpoint of QnAMaker. :type qna_runtime_endpoint: str + :param qna_azure_search_endpoint_key: (QnAMaker Only) The Azure Search endpoint key of + QnAMaker. + :type qna_azure_search_endpoint_key: str + :param qna_azure_search_endpoint_id: (QnAMaker Only) The Azure Search endpoint id of QnAMaker. + :type qna_azure_search_endpoint_id: str :param statistics_enabled: (Bing Search Only) The flag to enable statistics of Bing Search. :type statistics_enabled: bool :param event_hub_connection_string: (Personalization Only) The flag to enable statistics of @@ -264,7 +416,10 @@ class CognitiveServicesAccountApiProperties(msrest.serialization.Model): } _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, 'qna_runtime_endpoint': {'key': 'qnaRuntimeEndpoint', 'type': 'str'}, + 'qna_azure_search_endpoint_key': {'key': 'qnaAzureSearchEndpointKey', 'type': 'str'}, + 'qna_azure_search_endpoint_id': {'key': 'qnaAzureSearchEndpointId', 'type': 'str'}, 'statistics_enabled': {'key': 'statisticsEnabled', 'type': 'bool'}, 'event_hub_connection_string': {'key': 'eventHubConnectionString', 'type': 'str'}, 'storage_account_connection_string': {'key': 'storageAccountConnectionString', 'type': 'str'}, @@ -278,8 +433,11 @@ def __init__( self, **kwargs ): - super(CognitiveServicesAccountApiProperties, self).__init__(**kwargs) + super(ApiProperties, self).__init__(**kwargs) + self.additional_properties = kwargs.get('additional_properties', None) self.qna_runtime_endpoint = kwargs.get('qna_runtime_endpoint', None) + self.qna_azure_search_endpoint_key = kwargs.get('qna_azure_search_endpoint_key', None) + self.qna_azure_search_endpoint_id = kwargs.get('qna_azure_search_endpoint_id', None) self.statistics_enabled = kwargs.get('statistics_enabled', None) self.event_hub_connection_string = kwargs.get('event_hub_connection_string', None) self.storage_account_connection_string = kwargs.get('storage_account_connection_string', None) @@ -289,187 +447,127 @@ def __init__( self.website_name = kwargs.get('website_name', None) -class CognitiveServicesAccountEnumerateSkusResult(msrest.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 value: Gets the list of Cognitive Services accounts and their properties. - :vartype value: list[~azure.mgmt.cognitiveservices.models.CognitiveServicesResourceAndSku] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[CognitiveServicesResourceAndSku]'}, - } - - def __init__( - self, - **kwargs - ): - super(CognitiveServicesAccountEnumerateSkusResult, self).__init__(**kwargs) - self.value = None - - -class CognitiveServicesAccountKeys(msrest.serialization.Model): - """The access keys for the cognitive services account. +class CallRateLimit(msrest.serialization.Model): + """The call rate limit Cognitive Services account. - :param key1: Gets the value of key 1. - :type key1: str - :param key2: Gets the value of key 2. - :type key2: str + :param count: The count value of Call Rate Limit. + :type count: float + :param renewal_period: The renewal period in seconds of Call Rate Limit. + :type renewal_period: float + :param rules: + :type rules: list[~azure.mgmt.cognitiveservices.models.ThrottlingRule] """ _attribute_map = { - 'key1': {'key': 'key1', 'type': 'str'}, - 'key2': {'key': 'key2', 'type': 'str'}, + 'count': {'key': 'count', 'type': 'float'}, + 'renewal_period': {'key': 'renewalPeriod', 'type': 'float'}, + 'rules': {'key': 'rules', 'type': '[ThrottlingRule]'}, } def __init__( self, **kwargs ): - super(CognitiveServicesAccountKeys, self).__init__(**kwargs) - self.key1 = kwargs.get('key1', None) - self.key2 = kwargs.get('key2', None) + super(CallRateLimit, self).__init__(**kwargs) + self.count = kwargs.get('count', None) + self.renewal_period = kwargs.get('renewal_period', None) + self.rules = kwargs.get('rules', None) -class CognitiveServicesAccountListResult(msrest.serialization.Model): - """The list of cognitive services accounts operation response. +class CheckDomainAvailabilityParameter(msrest.serialization.Model): + """Check Domain availability parameter. - 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 Azure. - :param next_link: The link used to get the next page of accounts. - :type next_link: str - :ivar value: Gets the list of Cognitive Services accounts and their properties. - :vartype value: list[~azure.mgmt.cognitiveservices.models.CognitiveServicesAccount] + :param subdomain_name: Required. The subdomain name to use. + :type subdomain_name: str + :param type: Required. The Type of the resource. + :type type: str """ _validation = { - 'value': {'readonly': True}, + 'subdomain_name': {'required': True}, + 'type': {'required': True}, } _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[CognitiveServicesAccount]'}, + 'subdomain_name': {'key': 'subdomainName', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, } def __init__( self, **kwargs ): - super(CognitiveServicesAccountListResult, self).__init__(**kwargs) - self.next_link = kwargs.get('next_link', None) - self.value = None + super(CheckDomainAvailabilityParameter, self).__init__(**kwargs) + self.subdomain_name = kwargs['subdomain_name'] + self.type = kwargs['type'] -class CognitiveServicesAccountProperties(msrest.serialization.Model): - """Properties of Cognitive Services account. +class CheckSkuAvailabilityParameter(msrest.serialization.Model): + """Check SKU availability parameter. - 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 Azure. - :ivar provisioning_state: Gets the status of the cognitive services account at the time the - operation was called. Possible values include: "Creating", "ResolvingDNS", "Moving", - "Deleting", "Succeeded", "Failed". - :vartype provisioning_state: str or ~azure.mgmt.cognitiveservices.models.ProvisioningState - :ivar endpoint: Endpoint of the created account. - :vartype endpoint: str - :ivar internal_id: The internal identifier. - :vartype internal_id: str - :ivar capabilities: Gets the capabilities of the cognitive services account. Each item - indicates the capability of a specific feature. The values are read-only and for reference - only. - :vartype capabilities: list[~azure.mgmt.cognitiveservices.models.SkuCapability] - :param custom_sub_domain_name: Optional subdomain name used for token-based authentication. - :type custom_sub_domain_name: str - :param network_acls: A collection of rules governing the accessibility from specific network - locations. - :type network_acls: ~azure.mgmt.cognitiveservices.models.NetworkRuleSet - :param encryption: The encryption properties for this resource. - :type encryption: ~azure.mgmt.cognitiveservices.models.Encryption - :param user_owned_storage: The storage accounts for this resource. - :type user_owned_storage: list[~azure.mgmt.cognitiveservices.models.UserOwnedStorage] - :param private_endpoint_connections: The private endpoint connection associated with the - Cognitive Services account. - :type private_endpoint_connections: - list[~azure.mgmt.cognitiveservices.models.PrivateEndpointConnection] - :param public_network_access: Whether or not public endpoint access is allowed for this - account. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values - include: "Enabled", "Disabled". - :type public_network_access: str or ~azure.mgmt.cognitiveservices.models.PublicNetworkAccess - :param api_properties: The api properties for special APIs. - :type api_properties: - ~azure.mgmt.cognitiveservices.models.CognitiveServicesAccountApiProperties - :ivar date_created: Gets the date of cognitive services account creation. - :vartype date_created: str + :param skus: Required. The SKU of the resource. + :type skus: list[str] + :param kind: Required. The Kind of the resource. + :type kind: str + :param type: Required. The Type of the resource. + :type type: str """ _validation = { - 'provisioning_state': {'readonly': True}, - 'endpoint': {'readonly': True}, - 'internal_id': {'readonly': True}, - 'capabilities': {'readonly': True}, - 'date_created': {'readonly': True}, + 'skus': {'required': True}, + 'kind': {'required': True}, + 'type': {'required': True}, } _attribute_map = { - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'endpoint': {'key': 'endpoint', 'type': 'str'}, - 'internal_id': {'key': 'internalId', 'type': 'str'}, - 'capabilities': {'key': 'capabilities', 'type': '[SkuCapability]'}, - 'custom_sub_domain_name': {'key': 'customSubDomainName', 'type': 'str'}, - 'network_acls': {'key': 'networkAcls', 'type': 'NetworkRuleSet'}, - 'encryption': {'key': 'encryption', 'type': 'Encryption'}, - 'user_owned_storage': {'key': 'userOwnedStorage', 'type': '[UserOwnedStorage]'}, - 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, - 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, - 'api_properties': {'key': 'apiProperties', 'type': 'CognitiveServicesAccountApiProperties'}, - 'date_created': {'key': 'dateCreated', 'type': 'str'}, + 'skus': {'key': 'skus', 'type': '[str]'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, } def __init__( self, **kwargs ): - super(CognitiveServicesAccountProperties, self).__init__(**kwargs) - self.provisioning_state = None - self.endpoint = None - self.internal_id = None - self.capabilities = None - self.custom_sub_domain_name = kwargs.get('custom_sub_domain_name', None) - self.network_acls = kwargs.get('network_acls', None) - self.encryption = kwargs.get('encryption', None) - self.user_owned_storage = kwargs.get('user_owned_storage', None) - self.private_endpoint_connections = kwargs.get('private_endpoint_connections', None) - self.public_network_access = kwargs.get('public_network_access', None) - self.api_properties = kwargs.get('api_properties', None) - self.date_created = None + super(CheckSkuAvailabilityParameter, self).__init__(**kwargs) + self.skus = kwargs['skus'] + self.kind = kwargs['kind'] + self.type = kwargs['type'] -class CognitiveServicesResourceAndSku(msrest.serialization.Model): - """Cognitive Services resource type and SKU. +class DomainAvailability(msrest.serialization.Model): + """Domain availability. - :param resource_type: Resource Namespace and Type. - :type resource_type: str - :param sku: The SKU of Cognitive Services account. - :type sku: ~azure.mgmt.cognitiveservices.models.Sku + :param is_subdomain_available: Indicates the given SKU is available or not. + :type is_subdomain_available: bool + :param reason: Reason why the SKU is not available. + :type reason: str + :param subdomain_name: The subdomain name to use. + :type subdomain_name: str + :param type: The Type of the resource. + :type type: str """ _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, + 'is_subdomain_available': {'key': 'isSubdomainAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'subdomain_name': {'key': 'subdomainName', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, } def __init__( self, **kwargs ): - super(CognitiveServicesResourceAndSku, self).__init__(**kwargs) - self.resource_type = kwargs.get('resource_type', None) - self.sku = kwargs.get('sku', None) + super(DomainAvailability, self).__init__(**kwargs) + self.is_subdomain_available = kwargs.get('is_subdomain_available', None) + self.reason = kwargs.get('reason', None) + self.subdomain_name = kwargs.get('subdomain_name', None) + self.type = kwargs.get('type', None) class Encryption(msrest.serialization.Model): @@ -497,66 +595,111 @@ def __init__( self.key_source = kwargs.get('key_source', "Microsoft.KeyVault") -class Error(msrest.serialization.Model): - """Cognitive Services error object. +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. - :param error: The error body. - :type error: ~azure.mgmt.cognitiveservices.models.ErrorBody + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any """ + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorBody'}, + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, } def __init__( self, **kwargs ): - super(Error, self).__init__(**kwargs) - self.error = kwargs.get('error', None) + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None -class ErrorBody(msrest.serialization.Model): - """Cognitive Services error body. +class ErrorDetail(msrest.serialization.Model): + """The error detail. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :param code: Required. error code. - :type code: str - :param message: Required. error message. - :type message: str + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.cognitiveservices.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.cognitiveservices.models.ErrorAdditionalInfo] """ _validation = { - 'code': {'required': True}, - 'message': {'required': True}, + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, } _attribute_map = { 'code': {'key': 'code', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + :param error: The error object. + :type error: ~azure.mgmt.cognitiveservices.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, } def __init__( self, **kwargs ): - super(ErrorBody, self).__init__(**kwargs) - self.code = kwargs['code'] - self.message = kwargs['message'] + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) class Identity(msrest.serialization.Model): - """Managed service identity. + """Identity for the resource. Variables are only populated by the server, and will be ignored when sending a request. - :param type: Type of managed service identity. Possible values include: "None", - "SystemAssigned", "UserAssigned". - :type type: str or ~azure.mgmt.cognitiveservices.models.IdentityType - :ivar tenant_id: Tenant of managed service identity. + :param type: The identity type. Possible values include: "None", "SystemAssigned", + "UserAssigned", "SystemAssigned, UserAssigned". + :type type: str or ~azure.mgmt.cognitiveservices.models.ResourceIdentityType + :ivar tenant_id: The tenant ID of resource. :vartype tenant_id: str - :ivar principal_id: Principal Id of managed service identity. + :ivar principal_id: The principal ID of resource identity. :vartype principal_id: str :param user_assigned_identities: The list of user assigned identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: @@ -623,12 +766,15 @@ class KeyVaultProperties(msrest.serialization.Model): :type key_version: str :param key_vault_uri: Uri of KeyVault. :type key_vault_uri: str + :param identity_client_id: + :type identity_client_id: str """ _attribute_map = { 'key_name': {'key': 'keyName', 'type': 'str'}, 'key_version': {'key': 'keyVersion', 'type': 'str'}, 'key_vault_uri': {'key': 'keyVaultUri', 'type': 'str'}, + 'identity_client_id': {'key': 'identityClientId', 'type': 'str'}, } def __init__( @@ -639,24 +785,18 @@ def __init__( self.key_name = kwargs.get('key_name', None) self.key_version = kwargs.get('key_version', None) self.key_vault_uri = kwargs.get('key_vault_uri', None) + self.identity_client_id = kwargs.get('identity_client_id', None) class MetricName(msrest.serialization.Model): """A metric name. - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The name of the metric. - :vartype value: str - :ivar localized_value: The friendly name of the metric. - :vartype localized_value: str + :param value: The name of the metric. + :type value: str + :param localized_value: The friendly name of the metric. + :type localized_value: str """ - _validation = { - 'value': {'readonly': True}, - 'localized_value': {'readonly': True}, - } - _attribute_map = { 'value': {'key': 'value', 'type': 'str'}, 'localized_value': {'key': 'localizedValue', 'type': 'str'}, @@ -667,8 +807,8 @@ def __init__( **kwargs ): super(MetricName, self).__init__(**kwargs) - self.value = None - self.localized_value = None + self.value = kwargs.get('value', None) + self.localized_value = kwargs.get('localized_value', None) class NetworkRuleSet(msrest.serialization.Model): @@ -700,154 +840,155 @@ def __init__( self.virtual_network_rules = kwargs.get('virtual_network_rules', None) -class OperationDisplayInfo(msrest.serialization.Model): - """The operation supported by Cognitive Services. +class Operation(msrest.serialization.Model): + """Details of a REST API operation, returned from the Resource Provider Operations API. - :param description: The description of the operation. - :type description: str - :param operation: The action that users can perform, based on their permission level. - :type operation: str - :param provider: Service provider: Microsoft Cognitive Services. - :type provider: str - :param resource: Resource on which the operation is performed. - :type resource: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + :vartype name: str + :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for + data-plane operations and "false" for ARM/control-plane operations. + :vartype is_data_action: bool + :param display: Localized display information for this particular operation. + :type display: ~azure.mgmt.cognitiveservices.models.OperationDisplay + :ivar origin: The intended executor of the operation; as in Resource Based Access Control + (RBAC) and audit logs UX. Default value is "user,system". Possible values include: "user", + "system", "user,system". + :vartype origin: str or ~azure.mgmt.cognitiveservices.models.Origin + :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for + internal only APIs. Possible values include: "Internal". + :vartype action_type: str or ~azure.mgmt.cognitiveservices.models.ActionType """ - _attribute_map = { - 'description': {'key': 'description', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, + _validation = { + 'name': {'readonly': True}, + 'is_data_action': {'readonly': True}, + 'origin': {'readonly': True}, + 'action_type': {'readonly': True}, } - def __init__( - self, - **kwargs - ): - super(OperationDisplayInfo, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.operation = kwargs.get('operation', None) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - - -class OperationEntity(msrest.serialization.Model): - """The operation supported by Cognitive Services. - - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: The operation supported by Cognitive Services. - :type display: ~azure.mgmt.cognitiveservices.models.OperationDisplayInfo - :param origin: The origin of the operation. - :type origin: str - :param properties: Additional properties. - :type properties: object - """ - _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplayInfo'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, 'origin': {'key': 'origin', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'object'}, + 'action_type': {'key': 'actionType', 'type': 'str'}, } def __init__( self, **kwargs ): - super(OperationEntity, self).__init__(**kwargs) - self.name = kwargs.get('name', None) + super(Operation, self).__init__(**kwargs) + self.name = None + self.is_data_action = None self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - self.properties = kwargs.get('properties', None) + self.origin = None + self.action_type = None -class OperationEntityListResult(msrest.serialization.Model): - """The list of cognitive services accounts operation response. +class OperationDisplay(msrest.serialization.Model): + """Localized display information for this particular operation. - :param next_link: The link used to get the next page of operations. - :type next_link: str - :param value: The list of operations. - :type value: list[~azure.mgmt.cognitiveservices.models.OperationEntity] + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft + Monitoring Insights" or "Microsoft Compute". + :vartype provider: str + :ivar resource: The localized friendly name of the resource type related to this operation. + E.g. "Virtual Machines" or "Job Schedule Collections". + :vartype resource: str + :ivar operation: The concise, localized friendly name for the operation; suitable for + dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + :vartype operation: str + :ivar description: The short, localized friendly description of the operation; suitable for + tool tips and detailed views. + :vartype description: str """ + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + 'description': {'readonly': True}, + } + _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[OperationEntity]'}, + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, } def __init__( self, **kwargs ): - super(OperationEntityListResult, self).__init__(**kwargs) - self.next_link = kwargs.get('next_link', None) - self.value = kwargs.get('value', None) + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None -class PrivateEndpoint(msrest.serialization.Model): - """The Private Endpoint resource. +class OperationListResult(msrest.serialization.Model): + """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The ARM identifier for Private Endpoint. - :vartype id: str + :ivar value: List of operations supported by the resource provider. + :vartype value: list[~azure.mgmt.cognitiveservices.models.Operation] + :ivar next_link: URL to get the next set of operation list results (if there are any). + :vartype next_link: str """ _validation = { - 'id': {'readonly': True}, + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): - super(PrivateEndpoint, self).__init__(**kwargs) - self.id = None + super(OperationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None -class Resource(msrest.serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. +class PrivateEndpoint(msrest.serialization.Model): + """The Private Endpoint resource. 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}. + :ivar id: The ARM identifier for Private Endpoint. :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 """ _validation = { 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, } def __init__( self, **kwargs ): - super(Resource, self).__init__(**kwargs) + super(PrivateEndpoint, self).__init__(**kwargs) self.id = None - self.name = None - self.type = None -class PrivateEndpointConnection(Resource): +class PrivateEndpointConnection(AzureEntityResource): """The Private Endpoint Connection resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -860,21 +1001,32 @@ class PrivateEndpointConnection(Resource): :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 :param properties: Resource properties. :type properties: ~azure.mgmt.cognitiveservices.models.PrivateEndpointConnectionProperties + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.cognitiveservices.models.SystemData + :param location: The location of the private endpoint connection. + :type location: str """ _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'}, 'properties': {'key': 'properties', 'type': 'PrivateEndpointConnectionProperties'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'location': {'key': 'location', 'type': 'str'}, } def __init__( @@ -883,6 +1035,8 @@ def __init__( ): super(PrivateEndpointConnection, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) + self.system_data = None + self.location = kwargs.get('location', None) class PrivateEndpointConnectionListResult(msrest.serialization.Model): @@ -907,6 +1061,8 @@ def __init__( class PrivateEndpointConnectionProperties(msrest.serialization.Model): """Properties of the PrivateEndpointConnectProperties. + 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 Azure. :param private_endpoint: The resource of private end point. @@ -915,17 +1071,23 @@ class PrivateEndpointConnectionProperties(msrest.serialization.Model): state of the connection between service consumer and provider. :type private_link_service_connection_state: ~azure.mgmt.cognitiveservices.models.PrivateLinkServiceConnectionState + :ivar provisioning_state: The provisioning state of the private endpoint connection resource. + Possible values include: "Succeeded", "Creating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.cognitiveservices.models.PrivateEndpointConnectionProvisioningState :param group_ids: The private link resource group ids. :type group_ids: list[str] """ _validation = { 'private_link_service_connection_state': {'required': True}, + 'provisioning_state': {'readonly': True}, } _attribute_map = { 'private_endpoint': {'key': 'privateEndpoint', 'type': 'PrivateEndpoint'}, 'private_link_service_connection_state': {'key': 'privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, 'group_ids': {'key': 'groupIds', 'type': '[str]'}, } @@ -936,6 +1098,7 @@ def __init__( super(PrivateEndpointConnectionProperties, self).__init__(**kwargs) self.private_endpoint = kwargs.get('private_endpoint', None) self.private_link_service_connection_state = kwargs['private_link_service_connection_state'] + self.provisioning_state = None self.group_ids = kwargs.get('group_ids', None) @@ -1003,25 +1166,25 @@ class PrivateLinkResourceProperties(msrest.serialization.Model): :ivar group_id: The private link resource group id. :vartype group_id: str - :ivar display_name: The private link resource display name. - :vartype display_name: str :ivar required_members: The private link resource required member names. :vartype required_members: list[str] :param required_zone_names: The private link resource Private link DNS zone name. :type required_zone_names: list[str] + :ivar display_name: The private link resource display name. + :vartype display_name: str """ _validation = { 'group_id': {'readonly': True}, - 'display_name': {'readonly': True}, 'required_members': {'readonly': True}, + 'display_name': {'readonly': True}, } _attribute_map = { 'group_id': {'key': 'groupId', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, 'required_members': {'key': 'requiredMembers', 'type': '[str]'}, 'required_zone_names': {'key': 'requiredZoneNames', 'type': '[str]'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, } def __init__( @@ -1030,29 +1193,29 @@ def __init__( ): super(PrivateLinkResourceProperties, self).__init__(**kwargs) self.group_id = None - self.display_name = None self.required_members = None self.required_zone_names = kwargs.get('required_zone_names', None) + self.display_name = None class PrivateLinkServiceConnectionState(msrest.serialization.Model): """A collection of information about the state of the connection between service consumer and provider. :param status: Indicates whether the connection has been Approved/Rejected/Removed by the owner - of the service. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". + of the service. Possible values include: "Pending", "Approved", "Rejected". :type status: str or ~azure.mgmt.cognitiveservices.models.PrivateEndpointServiceConnectionStatus :param description: The reason for approval/rejection of the connection. :type description: str - :param action_required: A message indicating if changes on the service provider require any + :param actions_required: A message indicating if changes on the service provider require any updates on the consumer. - :type action_required: str + :type actions_required: str """ _attribute_map = { 'status': {'key': 'status', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, - 'action_required': {'key': 'actionRequired', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, } def __init__( @@ -1062,7 +1225,34 @@ def __init__( super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = kwargs.get('status', None) self.description = kwargs.get('description', None) - self.action_required = kwargs.get('action_required', None) + self.actions_required = kwargs.get('actions_required', None) + + +class QuotaLimit(msrest.serialization.Model): + """QuotaLimit. + + :param count: + :type count: float + :param renewal_period: + :type renewal_period: float + :param rules: + :type rules: list[~azure.mgmt.cognitiveservices.models.ThrottlingRule] + """ + + _attribute_map = { + 'count': {'key': 'count', 'type': 'float'}, + 'renewal_period': {'key': 'renewalPeriod', 'type': 'float'}, + 'rules': {'key': 'rules', 'type': '[ThrottlingRule]'}, + } + + def __init__( + self, + **kwargs + ): + super(QuotaLimit, self).__init__(**kwargs) + self.count = kwargs.get('count', None) + self.renewal_period = kwargs.get('renewal_period', None) + self.rules = kwargs.get('rules', None) class RegenerateKeyParameters(msrest.serialization.Model): @@ -1091,35 +1281,47 @@ def __init__( self.key_name = kwargs['key_name'] +class RequestMatchPattern(msrest.serialization.Model): + """RequestMatchPattern. + + :param path: + :type path: str + :param method: + :type method: str + """ + + _attribute_map = { + 'path': {'key': 'path', 'type': 'str'}, + 'method': {'key': 'method', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RequestMatchPattern, self).__init__(**kwargs) + self.path = kwargs.get('path', None) + self.method = kwargs.get('method', None) + + class ResourceSku(msrest.serialization.Model): """Describes an available Cognitive Services SKU. - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar resource_type: The type of resource the SKU applies to. - :vartype resource_type: str - :ivar name: The name of SKU. - :vartype name: str - :ivar tier: Specifies the tier of Cognitive Services account. - :vartype tier: str - :ivar kind: The Kind of resources that are supported in this SKU. - :vartype kind: str - :ivar locations: The set of locations that the SKU is available. - :vartype locations: list[str] - :ivar restrictions: The restrictions because of which SKU cannot be used. This is empty if + :param resource_type: The type of resource the SKU applies to. + :type resource_type: str + :param name: The name of SKU. + :type name: str + :param tier: Specifies the tier of Cognitive Services account. + :type tier: str + :param kind: The Kind of resources that are supported in this SKU. + :type kind: str + :param locations: The set of locations that the SKU is available. + :type locations: list[str] + :param restrictions: The restrictions because of which SKU cannot be used. This is empty if there are no restrictions. - :vartype restrictions: list[~azure.mgmt.cognitiveservices.models.ResourceSkuRestrictions] + :type restrictions: list[~azure.mgmt.cognitiveservices.models.ResourceSkuRestrictions] """ - _validation = { - 'resource_type': {'readonly': True}, - 'name': {'readonly': True}, - 'tier': {'readonly': True}, - 'kind': {'readonly': True}, - 'locations': {'readonly': True}, - 'restrictions': {'readonly': True}, - } - _attribute_map = { 'resource_type': {'key': 'resourceType', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, @@ -1134,30 +1336,52 @@ def __init__( **kwargs ): super(ResourceSku, self).__init__(**kwargs) - self.resource_type = None - self.name = None - self.tier = None - self.kind = None - self.locations = None - self.restrictions = None + self.resource_type = kwargs.get('resource_type', None) + self.name = kwargs.get('name', None) + self.tier = kwargs.get('tier', None) + self.kind = kwargs.get('kind', None) + self.locations = kwargs.get('locations', None) + self.restrictions = kwargs.get('restrictions', None) -class ResourceSkuRestrictionInfo(msrest.serialization.Model): - """ResourceSkuRestrictionInfo. +class ResourceSkuListResult(msrest.serialization.Model): + """The Get Skus operation response. - 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 Azure. - :ivar locations: Locations where the SKU is restricted. - :vartype locations: list[str] - :ivar zones: List of availability zones where the SKU is restricted. - :vartype zones: list[str] + :param value: Required. The list of skus available for the subscription. + :type value: list[~azure.mgmt.cognitiveservices.models.ResourceSku] + :param next_link: The uri to fetch the next page of Skus. + :type next_link: str """ _validation = { - 'locations': {'readonly': True}, - 'zones': {'readonly': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceSku]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } + def __init__( + self, + **kwargs + ): + super(ResourceSkuListResult, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = kwargs.get('next_link', None) + + +class ResourceSkuRestrictionInfo(msrest.serialization.Model): + """ResourceSkuRestrictionInfo. + + :param locations: Locations where the SKU is restricted. + :type locations: list[str] + :param zones: List of availability zones where the SKU is restricted. + :type zones: list[str] + """ + _attribute_map = { 'locations': {'key': 'locations', 'type': '[str]'}, 'zones': {'key': 'zones', 'type': '[str]'}, @@ -1168,35 +1392,26 @@ def __init__( **kwargs ): super(ResourceSkuRestrictionInfo, self).__init__(**kwargs) - self.locations = None - self.zones = None + self.locations = kwargs.get('locations', None) + self.zones = kwargs.get('zones', None) class ResourceSkuRestrictions(msrest.serialization.Model): """Describes restrictions of a SKU. - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The type of restrictions. Possible values include: "Location", "Zone". - :vartype type: str or ~azure.mgmt.cognitiveservices.models.ResourceSkuRestrictionsType - :ivar values: The value of restrictions. If the restriction type is set to location. This would - be different locations where the SKU is restricted. - :vartype values: list[str] - :ivar restriction_info: The information about the restriction where the SKU cannot be used. - :vartype restriction_info: ~azure.mgmt.cognitiveservices.models.ResourceSkuRestrictionInfo - :ivar reason_code: The reason for restriction. Possible values include: "QuotaId", + :param type: The type of restrictions. Possible values include: "Location", "Zone". + :type type: str or ~azure.mgmt.cognitiveservices.models.ResourceSkuRestrictionsType + :param values: The value of restrictions. If the restriction type is set to location. This + would be different locations where the SKU is restricted. + :type values: list[str] + :param restriction_info: The information about the restriction where the SKU cannot be used. + :type restriction_info: ~azure.mgmt.cognitiveservices.models.ResourceSkuRestrictionInfo + :param reason_code: The reason for restriction. Possible values include: "QuotaId", "NotAvailableForSubscription". - :vartype reason_code: str or + :type reason_code: str or ~azure.mgmt.cognitiveservices.models.ResourceSkuRestrictionsReasonCode """ - _validation = { - 'type': {'readonly': True}, - 'values': {'readonly': True}, - 'restriction_info': {'readonly': True}, - 'reason_code': {'readonly': True}, - } - _attribute_map = { 'type': {'key': 'type', 'type': 'str'}, 'values': {'key': 'values', 'type': '[str]'}, @@ -1209,73 +1424,114 @@ def __init__( **kwargs ): super(ResourceSkuRestrictions, self).__init__(**kwargs) - self.type = None - self.values = None - self.restriction_info = None - self.reason_code = None + self.type = kwargs.get('type', None) + self.values = kwargs.get('values', None) + self.restriction_info = kwargs.get('restriction_info', None) + self.reason_code = kwargs.get('reason_code', None) -class ResourceSkusResult(msrest.serialization.Model): - """The Get Skus operation response. +class Sku(msrest.serialization.Model): + """The resource model definition representing SKU. All required parameters must be populated in order to send to Azure. - :param value: Required. The list of skus available for the subscription. - :type value: list[~azure.mgmt.cognitiveservices.models.ResourceSku] - :param next_link: The uri to fetch the next page of Skus. - :type next_link: str + :param name: Required. The name of the SKU. Ex - P3. It is typically a letter+number code. + :type name: str + :param tier: 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. Possible values include: "Free", "Basic", + "Standard", "Premium", "Enterprise". + :type tier: str or ~azure.mgmt.cognitiveservices.models.SkuTier + :param size: The SKU size. When the name field is the combination of tier and some other value, + this would be the standalone code. + :type size: str + :param family: If the service has different generations of hardware, for the same SKU, then + that can be captured here. + :type family: str + :param capacity: If the SKU supports scale out/in then the capacity integer should be included. + If scale out/in is not possible for the resource this may be omitted. + :type capacity: int """ _validation = { - 'value': {'required': True}, + 'name': {'required': True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ResourceSku]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'size': {'key': 'size', 'type': 'str'}, + 'family': {'key': 'family', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, } def __init__( self, **kwargs ): - super(ResourceSkusResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class Sku(msrest.serialization.Model): - """The SKU of the cognitive services account. + super(Sku, self).__init__(**kwargs) + self.name = kwargs['name'] + self.tier = kwargs.get('tier', None) + self.size = kwargs.get('size', None) + self.family = kwargs.get('family', None) + self.capacity = kwargs.get('capacity', None) - 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 Azure. +class SkuAvailability(msrest.serialization.Model): + """SKU availability. - :param name: Required. Gets or sets the sku name. Required for account creation, optional for - update. - :type name: str - :ivar tier: Gets the sku tier. This is based on the SKU name. Possible values include: "Free", - "Standard", "Premium", "Enterprise". - :vartype tier: str or ~azure.mgmt.cognitiveservices.models.SkuTier + :param kind: The Kind of the resource. + :type kind: str + :param type: The Type of the resource. + :type type: str + :param sku_name: The SKU of Cognitive Services account. + :type sku_name: str + :param sku_available: Indicates the given SKU is available or not. + :type sku_available: bool + :param reason: Reason why the SKU is not available. + :type reason: str + :param message: Additional error message. + :type message: str """ - _validation = { - 'name': {'required': True}, - 'tier': {'readonly': True}, + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'sku_name': {'key': 'skuName', 'type': 'str'}, + 'sku_available': {'key': 'skuAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, } + def __init__( + self, + **kwargs + ): + super(SkuAvailability, self).__init__(**kwargs) + self.kind = kwargs.get('kind', None) + self.type = kwargs.get('type', None) + self.sku_name = kwargs.get('sku_name', None) + self.sku_available = kwargs.get('sku_available', None) + self.reason = kwargs.get('reason', None) + self.message = kwargs.get('message', None) + + +class SkuAvailabilityListResult(msrest.serialization.Model): + """Check SKU availability result list. + + :param value: Check SKU availability result list. + :type value: list[~azure.mgmt.cognitiveservices.models.SkuAvailability] + """ + _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[SkuAvailability]'}, } def __init__( self, **kwargs ): - super(Sku, self).__init__(**kwargs) - self.name = kwargs['name'] - self.tier = None + super(SkuAvailabilityListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) class SkuCapability(msrest.serialization.Model): @@ -1301,38 +1557,134 @@ def __init__( self.value = kwargs.get('value', None) +class SkuChangeInfo(msrest.serialization.Model): + """Sku change info of account. + + :param count_of_downgrades: Gets the count of downgrades. + :type count_of_downgrades: float + :param count_of_upgrades_after_downgrades: Gets the count of upgrades after downgrades. + :type count_of_upgrades_after_downgrades: float + :param last_change_date: Gets the last change date. + :type last_change_date: str + """ + + _attribute_map = { + 'count_of_downgrades': {'key': 'countOfDowngrades', 'type': 'float'}, + 'count_of_upgrades_after_downgrades': {'key': 'countOfUpgradesAfterDowngrades', 'type': 'float'}, + 'last_change_date': {'key': 'lastChangeDate', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SkuChangeInfo, self).__init__(**kwargs) + self.count_of_downgrades = kwargs.get('count_of_downgrades', None) + self.count_of_upgrades_after_downgrades = kwargs.get('count_of_upgrades_after_downgrades', None) + self.last_change_date = kwargs.get('last_change_date', None) + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~azure.mgmt.cognitiveservices.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or ~azure.mgmt.cognitiveservices.models.CreatedByType + :param last_modified_at: The timestamp of resource last modification (UTC). + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = kwargs.get('created_by', None) + self.created_by_type = kwargs.get('created_by_type', None) + self.created_at = kwargs.get('created_at', None) + self.last_modified_by = kwargs.get('last_modified_by', None) + self.last_modified_by_type = kwargs.get('last_modified_by_type', None) + self.last_modified_at = kwargs.get('last_modified_at', None) + + +class ThrottlingRule(msrest.serialization.Model): + """ThrottlingRule. + + :param key: + :type key: str + :param renewal_period: + :type renewal_period: float + :param count: + :type count: float + :param min_count: + :type min_count: float + :param dynamic_throttling_enabled: + :type dynamic_throttling_enabled: bool + :param match_patterns: + :type match_patterns: list[~azure.mgmt.cognitiveservices.models.RequestMatchPattern] + """ + + _attribute_map = { + 'key': {'key': 'key', 'type': 'str'}, + 'renewal_period': {'key': 'renewalPeriod', 'type': 'float'}, + 'count': {'key': 'count', 'type': 'float'}, + 'min_count': {'key': 'minCount', 'type': 'float'}, + 'dynamic_throttling_enabled': {'key': 'dynamicThrottlingEnabled', 'type': 'bool'}, + 'match_patterns': {'key': 'matchPatterns', 'type': '[RequestMatchPattern]'}, + } + + def __init__( + self, + **kwargs + ): + super(ThrottlingRule, self).__init__(**kwargs) + self.key = kwargs.get('key', None) + self.renewal_period = kwargs.get('renewal_period', None) + self.count = kwargs.get('count', None) + self.min_count = kwargs.get('min_count', None) + self.dynamic_throttling_enabled = kwargs.get('dynamic_throttling_enabled', None) + self.match_patterns = kwargs.get('match_patterns', None) + + class Usage(msrest.serialization.Model): """The usage data for a usage request. - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar unit: The unit of the metric. Possible values include: "Count", "Bytes", "Seconds", + :param unit: The unit of the metric. Possible values include: "Count", "Bytes", "Seconds", "Percent", "CountPerSecond", "BytesPerSecond", "Milliseconds". - :vartype unit: str or ~azure.mgmt.cognitiveservices.models.UnitType - :ivar name: The name information for the metric. - :vartype name: ~azure.mgmt.cognitiveservices.models.MetricName - :ivar quota_period: The quota period used to summarize the usage values. - :vartype quota_period: str - :ivar limit: Maximum value for this metric. - :vartype limit: float - :ivar current_value: Current value for this metric. - :vartype current_value: float - :ivar next_reset_time: Next reset time for current quota. - :vartype next_reset_time: str + :type unit: str or ~azure.mgmt.cognitiveservices.models.UnitType + :param name: The name information for the metric. + :type name: ~azure.mgmt.cognitiveservices.models.MetricName + :param quota_period: The quota period used to summarize the usage values. + :type quota_period: str + :param limit: Maximum value for this metric. + :type limit: float + :param current_value: Current value for this metric. + :type current_value: float + :param next_reset_time: Next reset time for current quota. + :type next_reset_time: str :param status: Cognitive Services account quota usage status. Possible values include: "Included", "Blocked", "InOverage", "Unknown". :type status: str or ~azure.mgmt.cognitiveservices.models.QuotaUsageStatus """ - _validation = { - 'unit': {'readonly': True}, - 'name': {'readonly': True}, - 'quota_period': {'readonly': True}, - 'limit': {'readonly': True}, - 'current_value': {'readonly': True}, - 'next_reset_time': {'readonly': True}, - } - _attribute_map = { 'unit': {'key': 'unit', 'type': 'str'}, 'name': {'key': 'name', 'type': 'MetricName'}, @@ -1348,28 +1700,22 @@ def __init__( **kwargs ): super(Usage, self).__init__(**kwargs) - self.unit = None - self.name = None - self.quota_period = None - self.limit = None - self.current_value = None - self.next_reset_time = None + self.unit = kwargs.get('unit', None) + self.name = kwargs.get('name', None) + self.quota_period = kwargs.get('quota_period', None) + self.limit = kwargs.get('limit', None) + self.current_value = kwargs.get('current_value', None) + self.next_reset_time = kwargs.get('next_reset_time', None) self.status = kwargs.get('status', None) -class UsagesResult(msrest.serialization.Model): +class UsageListResult(msrest.serialization.Model): """The response to a list usage request. - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of usages for Cognitive Service account. - :vartype value: list[~azure.mgmt.cognitiveservices.models.Usage] + :param value: The list of usages for Cognitive Service account. + :type value: list[~azure.mgmt.cognitiveservices.models.Usage] """ - _validation = { - 'value': {'readonly': True}, - } - _attribute_map = { 'value': {'key': 'value', 'type': '[Usage]'}, } @@ -1378,19 +1724,26 @@ def __init__( self, **kwargs ): - super(UsagesResult, self).__init__(**kwargs) - self.value = None + super(UsageListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) class UserAssignedIdentity(msrest.serialization.Model): """User-assigned managed identity. - :param principal_id: Azure Active Directory principal ID associated with this Identity. - :type principal_id: str - :param client_id: Client App Id associated with this identity. - :type client_id: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: Azure Active Directory principal ID associated with this Identity. + :vartype principal_id: str + :ivar client_id: Client App Id associated with this identity. + :vartype client_id: str """ + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + _attribute_map = { 'principal_id': {'key': 'principalId', 'type': 'str'}, 'client_id': {'key': 'clientId', 'type': 'str'}, @@ -1401,8 +1754,8 @@ def __init__( **kwargs ): super(UserAssignedIdentity, self).__init__(**kwargs) - self.principal_id = kwargs.get('principal_id', None) - self.client_id = kwargs.get('client_id', None) + self.principal_id = None + self.client_id = None class UserOwnedStorage(msrest.serialization.Model): @@ -1410,10 +1763,13 @@ class UserOwnedStorage(msrest.serialization.Model): :param resource_id: Full resource id of a Microsoft.Storage resource. :type resource_id: str + :param identity_client_id: + :type identity_client_id: str """ _attribute_map = { 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'identity_client_id': {'key': 'identityClientId', 'type': 'str'}, } def __init__( @@ -1422,6 +1778,7 @@ def __init__( ): super(UserOwnedStorage, self).__init__(**kwargs) self.resource_id = kwargs.get('resource_id', None) + self.identity_client_id = kwargs.get('identity_client_id', None) class VirtualNetworkRule(msrest.serialization.Model): @@ -1430,8 +1787,7 @@ class VirtualNetworkRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param id: Required. Full resource id of a vnet subnet, such as - '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test- - vnet/subnets/subnet1'. + '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. :type id: str :param state: Gets the state of virtual network rule. :type state: str 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 80f870b01702..30f9907ba7c1 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 @@ -6,7 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Dict, List, Optional, Union +import datetime +from typing import Any, Dict, List, Optional, Union from azure.core.exceptions import HttpResponseError import msrest.serialization @@ -14,260 +15,413 @@ from ._cognitive_services_management_client_enums import * -class CheckDomainAvailabilityParameter(msrest.serialization.Model): - """Check Domain availability parameter. +class Resource(msrest.serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :param subdomain_name: Required. The subdomain name to use. - :type subdomain_name: str - :param type: Required. The Type of the resource. - :type type: str + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :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 """ _validation = { - 'subdomain_name': {'required': True}, - 'type': {'required': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, } _attribute_map = { - 'subdomain_name': {'key': 'subdomainName', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, } def __init__( self, - *, - subdomain_name: str, - type: str, **kwargs ): - super(CheckDomainAvailabilityParameter, self).__init__(**kwargs) - self.subdomain_name = subdomain_name - self.type = type + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None -class CheckDomainAvailabilityResult(msrest.serialization.Model): - """Check Domain availability result. +class AzureEntityResource(Resource): + """The resource model definition for an Azure Resource Manager resource with an etag. - :param is_subdomain_available: Indicates the given SKU is available or not. - :type is_subdomain_available: bool - :param reason: Reason why the SKU is not available. - :type reason: str - :param subdomain_name: The subdomain name to use. - :type subdomain_name: str - :param type: The Type of the resource. - :type type: str + 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}. + :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 """ + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + } + _attribute_map = { - 'is_subdomain_available': {'key': 'isSubdomainAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'subdomain_name': {'key': 'subdomainName', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, } def __init__( self, - *, - is_subdomain_available: Optional[bool] = None, - reason: Optional[str] = None, - subdomain_name: Optional[str] = None, - type: Optional[str] = None, **kwargs ): - super(CheckDomainAvailabilityResult, self).__init__(**kwargs) - self.is_subdomain_available = is_subdomain_available - self.reason = reason - self.subdomain_name = subdomain_name - self.type = type + super(AzureEntityResource, self).__init__(**kwargs) + self.etag = None -class CheckSkuAvailabilityParameter(msrest.serialization.Model): - """Check SKU availability parameter. +class Account(AzureEntityResource): + """Cognitive Services account is an Azure resource representing the provisioned account, it's type, location and SKU. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :param skus: Required. The SKU of the resource. - :type skus: list[str] - :param kind: Required. The Kind of the resource. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :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 + :param kind: The Kind of the resource. :type kind: str - :param type: Required. The Type of the resource. - :type type: str + :param sku: The resource model definition representing SKU. + :type sku: ~azure.mgmt.cognitiveservices.models.Sku + :param identity: Identity for the resource. + :type 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 + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: The geo-location where the resource lives. + :type location: str + :param properties: Properties of Cognitive Services account. + :type properties: ~azure.mgmt.cognitiveservices.models.AccountProperties """ _validation = { - 'skus': {'required': True}, - 'kind': {'required': True}, - 'type': {'required': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + 'system_data': {'readonly': True}, } _attribute_map = { - 'skus': {'key': 'skus', 'type': '[str]'}, - 'kind': {'key': 'kind', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + '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': 'AccountProperties'}, } def __init__( self, *, - skus: List[str], - kind: str, - type: str, + kind: Optional[str] = None, + sku: Optional["Sku"] = None, + identity: Optional["Identity"] = None, + tags: Optional[Dict[str, str]] = None, + location: Optional[str] = None, + properties: Optional["AccountProperties"] = None, **kwargs ): - super(CheckSkuAvailabilityParameter, self).__init__(**kwargs) - self.skus = skus + super(Account, self).__init__(**kwargs) self.kind = kind - self.type = type + self.sku = sku + self.identity = identity + self.system_data = None + self.tags = tags + self.location = location + self.properties = properties + +class AccountListResult(msrest.serialization.Model): + """The list of cognitive services accounts operation response. -class CheckSkuAvailabilityResult(msrest.serialization.Model): - """Check SKU availability result. + Variables are only populated by the server, and will be ignored when sending a request. - :param kind: The Kind of the resource. - :type kind: str - :param type: The Type of the resource. - :type type: str - :param sku_name: The SKU of Cognitive Services account. - :type sku_name: str - :param sku_available: Indicates the given SKU is available or not. - :type sku_available: bool - :param reason: Reason why the SKU is not available. - :type reason: str - :param message: Additional error message. - :type message: str + :param next_link: The link used to get the next page of accounts. + :type next_link: str + :ivar value: Gets the list of Cognitive Services accounts and their properties. + :vartype value: list[~azure.mgmt.cognitiveservices.models.Account] """ + _validation = { + 'value': {'readonly': True}, + } + _attribute_map = { - 'kind': {'key': 'kind', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'sku_name': {'key': 'skuName', 'type': 'str'}, - 'sku_available': {'key': 'skuAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[Account]'}, } def __init__( self, *, - kind: Optional[str] = None, - type: Optional[str] = None, - sku_name: Optional[str] = None, - sku_available: Optional[bool] = None, - reason: Optional[str] = None, - message: Optional[str] = None, + next_link: Optional[str] = None, **kwargs ): - super(CheckSkuAvailabilityResult, self).__init__(**kwargs) - self.kind = kind - self.type = type - self.sku_name = sku_name - self.sku_available = sku_available - self.reason = reason - self.message = message + super(AccountListResult, self).__init__(**kwargs) + self.next_link = next_link + self.value = None -class CheckSkuAvailabilityResultList(msrest.serialization.Model): - """Check SKU availability result list. +class AccountProperties(msrest.serialization.Model): + """Properties of Cognitive Services account. - :param value: Check SKU availability result list. - :type value: list[~azure.mgmt.cognitiveservices.models.CheckSkuAvailabilityResult] + 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. Possible values include: "Accepted", "Creating", "Deleting", "Moving", + "Failed", "Succeeded", "ResolvingDNS". + :vartype provisioning_state: str or ~azure.mgmt.cognitiveservices.models.ProvisioningState + :ivar endpoint: Endpoint of the created account. + :vartype endpoint: str + :ivar internal_id: The internal identifier (deprecated, do not use this property). + :vartype internal_id: str + :ivar capabilities: Gets the capabilities of the cognitive services account. Each item + indicates the capability of a specific feature. The values are read-only and for reference + only. + :vartype capabilities: list[~azure.mgmt.cognitiveservices.models.SkuCapability] + :ivar is_migrated: If the resource is migrated from an existing key. + :vartype is_migrated: bool + :param migration_token: Resource migration token. + :type migration_token: str + :ivar sku_change_info: Sku change info of account. + :vartype sku_change_info: ~azure.mgmt.cognitiveservices.models.SkuChangeInfo + :param custom_sub_domain_name: Optional subdomain name used for token-based authentication. + :type custom_sub_domain_name: str + :param network_acls: A collection of rules governing the accessibility from specific network + locations. + :type network_acls: ~azure.mgmt.cognitiveservices.models.NetworkRuleSet + :param encryption: The encryption properties for this resource. + :type encryption: ~azure.mgmt.cognitiveservices.models.Encryption + :param user_owned_storage: The storage accounts for this resource. + :type user_owned_storage: list[~azure.mgmt.cognitiveservices.models.UserOwnedStorage] + :ivar private_endpoint_connections: The private endpoint connection associated with the + Cognitive Services account. + :vartype private_endpoint_connections: + list[~azure.mgmt.cognitiveservices.models.PrivateEndpointConnection] + :param public_network_access: Whether or not public endpoint access is allowed for this + account. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values + include: "Enabled", "Disabled". + :type public_network_access: str or ~azure.mgmt.cognitiveservices.models.PublicNetworkAccess + :param api_properties: The api properties for special APIs. + :type api_properties: ~azure.mgmt.cognitiveservices.models.ApiProperties + :ivar date_created: Gets the date of cognitive services account creation. + :vartype date_created: str + :ivar call_rate_limit: The call rate limit Cognitive Services account. + :vartype call_rate_limit: ~azure.mgmt.cognitiveservices.models.CallRateLimit + :ivar quota_limit: + :vartype quota_limit: ~azure.mgmt.cognitiveservices.models.QuotaLimit + :param restrict_outbound_network_access: + :type restrict_outbound_network_access: bool + :param allowed_fqdn_list: + :type allowed_fqdn_list: list[str] + :param disable_local_auth: + :type disable_local_auth: bool + :ivar endpoints: Dictionary of :code:``. + :vartype endpoints: dict[str, str] + :param restore: + :type restore: bool """ + _validation = { + 'provisioning_state': {'readonly': True}, + 'endpoint': {'readonly': True}, + 'internal_id': {'readonly': True}, + 'capabilities': {'readonly': True}, + 'is_migrated': {'readonly': True}, + 'sku_change_info': {'readonly': True}, + 'private_endpoint_connections': {'readonly': True}, + 'date_created': {'readonly': True}, + 'call_rate_limit': {'readonly': True}, + 'quota_limit': {'readonly': True}, + 'endpoints': {'readonly': True}, + } + _attribute_map = { - 'value': {'key': 'value', 'type': '[CheckSkuAvailabilityResult]'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'endpoint': {'key': 'endpoint', 'type': 'str'}, + 'internal_id': {'key': 'internalId', 'type': 'str'}, + 'capabilities': {'key': 'capabilities', 'type': '[SkuCapability]'}, + 'is_migrated': {'key': 'isMigrated', 'type': 'bool'}, + 'migration_token': {'key': 'migrationToken', 'type': 'str'}, + 'sku_change_info': {'key': 'skuChangeInfo', 'type': 'SkuChangeInfo'}, + 'custom_sub_domain_name': {'key': 'customSubDomainName', 'type': 'str'}, + 'network_acls': {'key': 'networkAcls', 'type': 'NetworkRuleSet'}, + 'encryption': {'key': 'encryption', 'type': 'Encryption'}, + 'user_owned_storage': {'key': 'userOwnedStorage', 'type': '[UserOwnedStorage]'}, + 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, + 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, + 'api_properties': {'key': 'apiProperties', 'type': 'ApiProperties'}, + 'date_created': {'key': 'dateCreated', 'type': 'str'}, + 'call_rate_limit': {'key': 'callRateLimit', 'type': 'CallRateLimit'}, + 'quota_limit': {'key': 'quotaLimit', 'type': 'QuotaLimit'}, + 'restrict_outbound_network_access': {'key': 'restrictOutboundNetworkAccess', 'type': 'bool'}, + 'allowed_fqdn_list': {'key': 'allowedFqdnList', 'type': '[str]'}, + 'disable_local_auth': {'key': 'disableLocalAuth', 'type': 'bool'}, + 'endpoints': {'key': 'endpoints', 'type': '{str}'}, + 'restore': {'key': 'restore', 'type': 'bool'}, } def __init__( self, *, - value: Optional[List["CheckSkuAvailabilityResult"]] = None, + migration_token: Optional[str] = None, + custom_sub_domain_name: Optional[str] = None, + network_acls: Optional["NetworkRuleSet"] = None, + encryption: Optional["Encryption"] = None, + user_owned_storage: Optional[List["UserOwnedStorage"]] = None, + public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, + api_properties: Optional["ApiProperties"] = None, + restrict_outbound_network_access: Optional[bool] = None, + allowed_fqdn_list: Optional[List[str]] = None, + disable_local_auth: Optional[bool] = None, + restore: Optional[bool] = None, **kwargs ): - super(CheckSkuAvailabilityResultList, self).__init__(**kwargs) - self.value = value - + super(AccountProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.endpoint = None + self.internal_id = None + self.capabilities = None + self.is_migrated = None + self.migration_token = migration_token + self.sku_change_info = None + self.custom_sub_domain_name = custom_sub_domain_name + self.network_acls = network_acls + self.encryption = encryption + self.user_owned_storage = user_owned_storage + self.private_endpoint_connections = None + self.public_network_access = public_network_access + self.api_properties = api_properties + self.date_created = None + self.call_rate_limit = None + self.quota_limit = None + self.restrict_outbound_network_access = restrict_outbound_network_access + self.allowed_fqdn_list = allowed_fqdn_list + self.disable_local_auth = disable_local_auth + self.endpoints = None + self.restore = restore -class CognitiveServicesAccount(msrest.serialization.Model): - """Cognitive Services Account is an Azure resource representing the provisioned account, its type, location and SKU. - Variables are only populated by the server, and will be ignored when sending a request. +class AccountSku(msrest.serialization.Model): + """Cognitive Services resource type and SKU. - :ivar etag: Entity Tag. - :vartype etag: str - :ivar id: The id of the created account. - :vartype id: str - :param kind: The Kind of the resource. - :type kind: str - :param location: The location of the resource. - :type location: str - :ivar name: The name of the created account. - :vartype name: str - :param properties: Properties of Cognitive Services account. - :type properties: ~azure.mgmt.cognitiveservices.models.CognitiveServicesAccountProperties + :param resource_type: Resource Namespace and Type. + :type resource_type: str :param sku: The SKU of Cognitive Services account. :type sku: ~azure.mgmt.cognitiveservices.models.Sku - :param tags: A set of tags. Gets or sets a list of key value pairs that describe the resource. - These tags can be used in viewing and grouping this resource (across resource groups). A - maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 - characters and value no greater than 256 characters. - :type tags: dict[str, str] - :ivar type: Resource type. - :vartype type: str - :param identity: The identity of Cognitive Services account. - :type identity: ~azure.mgmt.cognitiveservices.models.Identity """ - _validation = { - 'etag': {'readonly': True}, - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - _attribute_map = { - 'etag': {'key': 'etag', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'CognitiveServicesAccountProperties'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, 'sku': {'key': 'sku', 'type': 'Sku'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'type': {'key': 'type', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, } def __init__( self, *, - kind: Optional[str] = None, - location: Optional[str] = None, - properties: Optional["CognitiveServicesAccountProperties"] = None, + resource_type: Optional[str] = None, sku: Optional["Sku"] = None, - tags: Optional[Dict[str, str]] = None, - identity: Optional["Identity"] = None, **kwargs ): - super(CognitiveServicesAccount, self).__init__(**kwargs) - self.etag = None - self.id = None - self.kind = kind - self.location = location - self.name = None - self.properties = properties + super(AccountSku, self).__init__(**kwargs) + self.resource_type = resource_type self.sku = sku - self.tags = tags - self.type = None - self.identity = identity -class CognitiveServicesAccountApiProperties(msrest.serialization.Model): +class AccountSkuListResult(msrest.serialization.Model): + """The list of cognitive services accounts operation response. + + :param value: Gets the list of Cognitive Services accounts and their properties. + :type value: list[~azure.mgmt.cognitiveservices.models.AccountSku] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AccountSku]'}, + } + + def __init__( + self, + *, + value: Optional[List["AccountSku"]] = None, + **kwargs + ): + super(AccountSkuListResult, self).__init__(**kwargs) + self.value = value + + +class ApiKeys(msrest.serialization.Model): + """The access keys for the cognitive services account. + + :param key1: Gets the value of key 1. + :type key1: str + :param key2: Gets the value of key 2. + :type key2: str + """ + + _attribute_map = { + 'key1': {'key': 'key1', 'type': 'str'}, + 'key2': {'key': 'key2', 'type': 'str'}, + } + + def __init__( + self, + *, + key1: Optional[str] = None, + key2: Optional[str] = None, + **kwargs + ): + super(ApiKeys, self).__init__(**kwargs) + self.key1 = key1 + self.key2 = key2 + + +class ApiProperties(msrest.serialization.Model): """The api properties for special APIs. + :param additional_properties: Unmatched properties from the message are deserialized to this + collection. + :type additional_properties: dict[str, any] :param qna_runtime_endpoint: (QnAMaker Only) The runtime endpoint of QnAMaker. :type qna_runtime_endpoint: str + :param qna_azure_search_endpoint_key: (QnAMaker Only) The Azure Search endpoint key of + QnAMaker. + :type qna_azure_search_endpoint_key: str + :param qna_azure_search_endpoint_id: (QnAMaker Only) The Azure Search endpoint id of QnAMaker. + :type qna_azure_search_endpoint_id: str :param statistics_enabled: (Bing Search Only) The flag to enable statistics of Bing Search. :type statistics_enabled: bool :param event_hub_connection_string: (Personalization Only) The flag to enable statistics of @@ -296,7 +450,10 @@ class CognitiveServicesAccountApiProperties(msrest.serialization.Model): } _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, 'qna_runtime_endpoint': {'key': 'qnaRuntimeEndpoint', 'type': 'str'}, + 'qna_azure_search_endpoint_key': {'key': 'qnaAzureSearchEndpointKey', 'type': 'str'}, + 'qna_azure_search_endpoint_id': {'key': 'qnaAzureSearchEndpointId', 'type': 'str'}, 'statistics_enabled': {'key': 'statisticsEnabled', 'type': 'bool'}, 'event_hub_connection_string': {'key': 'eventHubConnectionString', 'type': 'str'}, 'storage_account_connection_string': {'key': 'storageAccountConnectionString', 'type': 'str'}, @@ -309,7 +466,10 @@ class CognitiveServicesAccountApiProperties(msrest.serialization.Model): def __init__( self, *, + additional_properties: Optional[Dict[str, Any]] = None, qna_runtime_endpoint: Optional[str] = None, + qna_azure_search_endpoint_key: Optional[str] = None, + qna_azure_search_endpoint_id: Optional[str] = None, statistics_enabled: Optional[bool] = None, event_hub_connection_string: Optional[str] = None, storage_account_connection_string: Optional[str] = None, @@ -319,8 +479,11 @@ def __init__( website_name: Optional[str] = None, **kwargs ): - super(CognitiveServicesAccountApiProperties, self).__init__(**kwargs) + super(ApiProperties, self).__init__(**kwargs) + self.additional_properties = additional_properties self.qna_runtime_endpoint = qna_runtime_endpoint + self.qna_azure_search_endpoint_key = qna_azure_search_endpoint_key + self.qna_azure_search_endpoint_id = qna_azure_search_endpoint_id self.statistics_enabled = statistics_enabled self.event_hub_connection_string = event_hub_connection_string self.storage_account_connection_string = storage_account_connection_string @@ -328,205 +491,145 @@ def __init__( self.aad_tenant_id = aad_tenant_id self.super_user = super_user self.website_name = website_name - - -class CognitiveServicesAccountEnumerateSkusResult(msrest.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 value: Gets the list of Cognitive Services accounts and their properties. - :vartype value: list[~azure.mgmt.cognitiveservices.models.CognitiveServicesResourceAndSku] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[CognitiveServicesResourceAndSku]'}, - } - - def __init__( - self, - **kwargs - ): - super(CognitiveServicesAccountEnumerateSkusResult, self).__init__(**kwargs) - self.value = None - - -class CognitiveServicesAccountKeys(msrest.serialization.Model): - """The access keys for the cognitive services account. - - :param key1: Gets the value of key 1. - :type key1: str - :param key2: Gets the value of key 2. - :type key2: str + + +class CallRateLimit(msrest.serialization.Model): + """The call rate limit Cognitive Services account. + + :param count: The count value of Call Rate Limit. + :type count: float + :param renewal_period: The renewal period in seconds of Call Rate Limit. + :type renewal_period: float + :param rules: + :type rules: list[~azure.mgmt.cognitiveservices.models.ThrottlingRule] """ _attribute_map = { - 'key1': {'key': 'key1', 'type': 'str'}, - 'key2': {'key': 'key2', 'type': 'str'}, + 'count': {'key': 'count', 'type': 'float'}, + 'renewal_period': {'key': 'renewalPeriod', 'type': 'float'}, + 'rules': {'key': 'rules', 'type': '[ThrottlingRule]'}, } def __init__( self, *, - key1: Optional[str] = None, - key2: Optional[str] = None, + count: Optional[float] = None, + renewal_period: Optional[float] = None, + rules: Optional[List["ThrottlingRule"]] = None, **kwargs ): - super(CognitiveServicesAccountKeys, self).__init__(**kwargs) - self.key1 = key1 - self.key2 = key2 + super(CallRateLimit, self).__init__(**kwargs) + self.count = count + self.renewal_period = renewal_period + self.rules = rules -class CognitiveServicesAccountListResult(msrest.serialization.Model): - """The list of cognitive services accounts operation response. +class CheckDomainAvailabilityParameter(msrest.serialization.Model): + """Check Domain availability parameter. - 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 Azure. - :param next_link: The link used to get the next page of accounts. - :type next_link: str - :ivar value: Gets the list of Cognitive Services accounts and their properties. - :vartype value: list[~azure.mgmt.cognitiveservices.models.CognitiveServicesAccount] + :param subdomain_name: Required. The subdomain name to use. + :type subdomain_name: str + :param type: Required. The Type of the resource. + :type type: str """ _validation = { - 'value': {'readonly': True}, + 'subdomain_name': {'required': True}, + 'type': {'required': True}, } _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[CognitiveServicesAccount]'}, + 'subdomain_name': {'key': 'subdomainName', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, } def __init__( self, *, - next_link: Optional[str] = None, + subdomain_name: str, + type: str, **kwargs ): - super(CognitiveServicesAccountListResult, self).__init__(**kwargs) - self.next_link = next_link - self.value = None + super(CheckDomainAvailabilityParameter, self).__init__(**kwargs) + self.subdomain_name = subdomain_name + self.type = type -class CognitiveServicesAccountProperties(msrest.serialization.Model): - """Properties of Cognitive Services account. +class CheckSkuAvailabilityParameter(msrest.serialization.Model): + """Check SKU availability parameter. - 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 Azure. - :ivar provisioning_state: Gets the status of the cognitive services account at the time the - operation was called. Possible values include: "Creating", "ResolvingDNS", "Moving", - "Deleting", "Succeeded", "Failed". - :vartype provisioning_state: str or ~azure.mgmt.cognitiveservices.models.ProvisioningState - :ivar endpoint: Endpoint of the created account. - :vartype endpoint: str - :ivar internal_id: The internal identifier. - :vartype internal_id: str - :ivar capabilities: Gets the capabilities of the cognitive services account. Each item - indicates the capability of a specific feature. The values are read-only and for reference - only. - :vartype capabilities: list[~azure.mgmt.cognitiveservices.models.SkuCapability] - :param custom_sub_domain_name: Optional subdomain name used for token-based authentication. - :type custom_sub_domain_name: str - :param network_acls: A collection of rules governing the accessibility from specific network - locations. - :type network_acls: ~azure.mgmt.cognitiveservices.models.NetworkRuleSet - :param encryption: The encryption properties for this resource. - :type encryption: ~azure.mgmt.cognitiveservices.models.Encryption - :param user_owned_storage: The storage accounts for this resource. - :type user_owned_storage: list[~azure.mgmt.cognitiveservices.models.UserOwnedStorage] - :param private_endpoint_connections: The private endpoint connection associated with the - Cognitive Services account. - :type private_endpoint_connections: - list[~azure.mgmt.cognitiveservices.models.PrivateEndpointConnection] - :param public_network_access: Whether or not public endpoint access is allowed for this - account. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values - include: "Enabled", "Disabled". - :type public_network_access: str or ~azure.mgmt.cognitiveservices.models.PublicNetworkAccess - :param api_properties: The api properties for special APIs. - :type api_properties: - ~azure.mgmt.cognitiveservices.models.CognitiveServicesAccountApiProperties - :ivar date_created: Gets the date of cognitive services account creation. - :vartype date_created: str + :param skus: Required. The SKU of the resource. + :type skus: list[str] + :param kind: Required. The Kind of the resource. + :type kind: str + :param type: Required. The Type of the resource. + :type type: str """ _validation = { - 'provisioning_state': {'readonly': True}, - 'endpoint': {'readonly': True}, - 'internal_id': {'readonly': True}, - 'capabilities': {'readonly': True}, - 'date_created': {'readonly': True}, + 'skus': {'required': True}, + 'kind': {'required': True}, + 'type': {'required': True}, } _attribute_map = { - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'endpoint': {'key': 'endpoint', 'type': 'str'}, - 'internal_id': {'key': 'internalId', 'type': 'str'}, - 'capabilities': {'key': 'capabilities', 'type': '[SkuCapability]'}, - 'custom_sub_domain_name': {'key': 'customSubDomainName', 'type': 'str'}, - 'network_acls': {'key': 'networkAcls', 'type': 'NetworkRuleSet'}, - 'encryption': {'key': 'encryption', 'type': 'Encryption'}, - 'user_owned_storage': {'key': 'userOwnedStorage', 'type': '[UserOwnedStorage]'}, - 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, - 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, - 'api_properties': {'key': 'apiProperties', 'type': 'CognitiveServicesAccountApiProperties'}, - 'date_created': {'key': 'dateCreated', 'type': 'str'}, + 'skus': {'key': 'skus', 'type': '[str]'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, } def __init__( self, *, - custom_sub_domain_name: Optional[str] = None, - network_acls: Optional["NetworkRuleSet"] = None, - encryption: Optional["Encryption"] = None, - user_owned_storage: Optional[List["UserOwnedStorage"]] = None, - private_endpoint_connections: Optional[List["PrivateEndpointConnection"]] = None, - public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, - api_properties: Optional["CognitiveServicesAccountApiProperties"] = None, + skus: List[str], + kind: str, + type: str, **kwargs ): - super(CognitiveServicesAccountProperties, self).__init__(**kwargs) - self.provisioning_state = None - self.endpoint = None - self.internal_id = None - self.capabilities = None - self.custom_sub_domain_name = custom_sub_domain_name - self.network_acls = network_acls - self.encryption = encryption - self.user_owned_storage = user_owned_storage - self.private_endpoint_connections = private_endpoint_connections - self.public_network_access = public_network_access - self.api_properties = api_properties - self.date_created = None + super(CheckSkuAvailabilityParameter, self).__init__(**kwargs) + self.skus = skus + self.kind = kind + self.type = type -class CognitiveServicesResourceAndSku(msrest.serialization.Model): - """Cognitive Services resource type and SKU. +class DomainAvailability(msrest.serialization.Model): + """Domain availability. - :param resource_type: Resource Namespace and Type. - :type resource_type: str - :param sku: The SKU of Cognitive Services account. - :type sku: ~azure.mgmt.cognitiveservices.models.Sku + :param is_subdomain_available: Indicates the given SKU is available or not. + :type is_subdomain_available: bool + :param reason: Reason why the SKU is not available. + :type reason: str + :param subdomain_name: The subdomain name to use. + :type subdomain_name: str + :param type: The Type of the resource. + :type type: str """ _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, + 'is_subdomain_available': {'key': 'isSubdomainAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'subdomain_name': {'key': 'subdomainName', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, } def __init__( self, *, - resource_type: Optional[str] = None, - sku: Optional["Sku"] = None, + is_subdomain_available: Optional[bool] = None, + reason: Optional[str] = None, + subdomain_name: Optional[str] = None, + type: Optional[str] = None, **kwargs ): - super(CognitiveServicesResourceAndSku, self).__init__(**kwargs) - self.resource_type = resource_type - self.sku = sku + super(DomainAvailability, self).__init__(**kwargs) + self.is_subdomain_available = is_subdomain_available + self.reason = reason + self.subdomain_name = subdomain_name + self.type = type class Encryption(msrest.serialization.Model): @@ -557,71 +660,113 @@ def __init__( self.key_source = key_source -class Error(msrest.serialization.Model): - """Cognitive Services error object. +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. - :param error: The error body. - :type error: ~azure.mgmt.cognitiveservices.models.ErrorBody + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any """ + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorBody'}, + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, } def __init__( self, - *, - error: Optional["ErrorBody"] = None, **kwargs ): - super(Error, self).__init__(**kwargs) - self.error = error + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None -class ErrorBody(msrest.serialization.Model): - """Cognitive Services error body. +class ErrorDetail(msrest.serialization.Model): + """The error detail. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :param code: Required. error code. - :type code: str - :param message: Required. error message. - :type message: str + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.cognitiveservices.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.cognitiveservices.models.ErrorAdditionalInfo] """ _validation = { - 'code': {'required': True}, - 'message': {'required': True}, + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, } _attribute_map = { 'code': {'key': 'code', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + :param error: The error object. + :type error: ~azure.mgmt.cognitiveservices.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, } def __init__( self, *, - code: str, - message: str, + error: Optional["ErrorDetail"] = None, **kwargs ): - super(ErrorBody, self).__init__(**kwargs) - self.code = code - self.message = message + super(ErrorResponse, self).__init__(**kwargs) + self.error = error class Identity(msrest.serialization.Model): - """Managed service identity. + """Identity for the resource. Variables are only populated by the server, and will be ignored when sending a request. - :param type: Type of managed service identity. Possible values include: "None", - "SystemAssigned", "UserAssigned". - :type type: str or ~azure.mgmt.cognitiveservices.models.IdentityType - :ivar tenant_id: Tenant of managed service identity. + :param type: The identity type. Possible values include: "None", "SystemAssigned", + "UserAssigned", "SystemAssigned, UserAssigned". + :type type: str or ~azure.mgmt.cognitiveservices.models.ResourceIdentityType + :ivar tenant_id: The tenant ID of resource. :vartype tenant_id: str - :ivar principal_id: Principal Id of managed service identity. + :ivar principal_id: The principal ID of resource identity. :vartype principal_id: str :param user_assigned_identities: The list of user assigned identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: @@ -645,7 +790,7 @@ class Identity(msrest.serialization.Model): def __init__( self, *, - type: Optional[Union[str, "IdentityType"]] = None, + type: Optional[Union[str, "ResourceIdentityType"]] = None, user_assigned_identities: Optional[Dict[str, "UserAssignedIdentity"]] = None, **kwargs ): @@ -693,12 +838,15 @@ class KeyVaultProperties(msrest.serialization.Model): :type key_version: str :param key_vault_uri: Uri of KeyVault. :type key_vault_uri: str + :param identity_client_id: + :type identity_client_id: str """ _attribute_map = { 'key_name': {'key': 'keyName', 'type': 'str'}, 'key_version': {'key': 'keyVersion', 'type': 'str'}, 'key_vault_uri': {'key': 'keyVaultUri', 'type': 'str'}, + 'identity_client_id': {'key': 'identityClientId', 'type': 'str'}, } def __init__( @@ -707,30 +855,25 @@ def __init__( key_name: Optional[str] = None, key_version: Optional[str] = None, key_vault_uri: Optional[str] = None, + identity_client_id: Optional[str] = None, **kwargs ): super(KeyVaultProperties, self).__init__(**kwargs) self.key_name = key_name self.key_version = key_version self.key_vault_uri = key_vault_uri + self.identity_client_id = identity_client_id class MetricName(msrest.serialization.Model): """A metric name. - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The name of the metric. - :vartype value: str - :ivar localized_value: The friendly name of the metric. - :vartype localized_value: str + :param value: The name of the metric. + :type value: str + :param localized_value: The friendly name of the metric. + :type localized_value: str """ - _validation = { - 'value': {'readonly': True}, - 'localized_value': {'readonly': True}, - } - _attribute_map = { 'value': {'key': 'value', 'type': 'str'}, 'localized_value': {'key': 'localizedValue', 'type': 'str'}, @@ -738,11 +881,14 @@ class MetricName(msrest.serialization.Model): def __init__( self, + *, + value: Optional[str] = None, + localized_value: Optional[str] = None, **kwargs ): super(MetricName, self).__init__(**kwargs) - self.value = None - self.localized_value = None + self.value = value + self.localized_value = localized_value class NetworkRuleSet(msrest.serialization.Model): @@ -778,167 +924,157 @@ def __init__( self.virtual_network_rules = virtual_network_rules -class OperationDisplayInfo(msrest.serialization.Model): - """The operation supported by Cognitive Services. +class Operation(msrest.serialization.Model): + """Details of a REST API operation, returned from the Resource Provider Operations API. - :param description: The description of the operation. - :type description: str - :param operation: The action that users can perform, based on their permission level. - :type operation: str - :param provider: Service provider: Microsoft Cognitive Services. - :type provider: str - :param resource: Resource on which the operation is performed. - :type resource: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + :vartype name: str + :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for + data-plane operations and "false" for ARM/control-plane operations. + :vartype is_data_action: bool + :param display: Localized display information for this particular operation. + :type display: ~azure.mgmt.cognitiveservices.models.OperationDisplay + :ivar origin: The intended executor of the operation; as in Resource Based Access Control + (RBAC) and audit logs UX. Default value is "user,system". Possible values include: "user", + "system", "user,system". + :vartype origin: str or ~azure.mgmt.cognitiveservices.models.Origin + :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for + internal only APIs. Possible values include: "Internal". + :vartype action_type: str or ~azure.mgmt.cognitiveservices.models.ActionType """ - _attribute_map = { - 'description': {'key': 'description', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, + _validation = { + 'name': {'readonly': True}, + 'is_data_action': {'readonly': True}, + 'origin': {'readonly': True}, + 'action_type': {'readonly': True}, } - def __init__( - self, - *, - description: Optional[str] = None, - operation: Optional[str] = None, - provider: Optional[str] = None, - resource: Optional[str] = None, - **kwargs - ): - super(OperationDisplayInfo, self).__init__(**kwargs) - self.description = description - self.operation = operation - self.provider = provider - self.resource = resource - - -class OperationEntity(msrest.serialization.Model): - """The operation supported by Cognitive Services. - - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: The operation supported by Cognitive Services. - :type display: ~azure.mgmt.cognitiveservices.models.OperationDisplayInfo - :param origin: The origin of the operation. - :type origin: str - :param properties: Additional properties. - :type properties: object - """ - _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplayInfo'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, 'origin': {'key': 'origin', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'object'}, + 'action_type': {'key': 'actionType', 'type': 'str'}, } def __init__( self, *, - name: Optional[str] = None, - display: Optional["OperationDisplayInfo"] = None, - origin: Optional[str] = None, - properties: Optional[object] = None, + display: Optional["OperationDisplay"] = None, **kwargs ): - super(OperationEntity, self).__init__(**kwargs) - self.name = name + super(Operation, self).__init__(**kwargs) + self.name = None + self.is_data_action = None self.display = display - self.origin = origin - self.properties = properties + self.origin = None + self.action_type = None -class OperationEntityListResult(msrest.serialization.Model): - """The list of cognitive services accounts operation response. +class OperationDisplay(msrest.serialization.Model): + """Localized display information for this particular operation. - :param next_link: The link used to get the next page of operations. - :type next_link: str - :param value: The list of operations. - :type value: list[~azure.mgmt.cognitiveservices.models.OperationEntity] + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft + Monitoring Insights" or "Microsoft Compute". + :vartype provider: str + :ivar resource: The localized friendly name of the resource type related to this operation. + E.g. "Virtual Machines" or "Job Schedule Collections". + :vartype resource: str + :ivar operation: The concise, localized friendly name for the operation; suitable for + dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + :vartype operation: str + :ivar description: The short, localized friendly description of the operation; suitable for + tool tips and detailed views. + :vartype description: str """ + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + 'description': {'readonly': True}, + } + _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[OperationEntity]'}, + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, } def __init__( self, - *, - next_link: Optional[str] = None, - value: Optional[List["OperationEntity"]] = None, **kwargs ): - super(OperationEntityListResult, self).__init__(**kwargs) - self.next_link = next_link - self.value = value + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None -class PrivateEndpoint(msrest.serialization.Model): - """The Private Endpoint resource. +class OperationListResult(msrest.serialization.Model): + """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The ARM identifier for Private Endpoint. - :vartype id: str + :ivar value: List of operations supported by the resource provider. + :vartype value: list[~azure.mgmt.cognitiveservices.models.Operation] + :ivar next_link: URL to get the next set of operation list results (if there are any). + :vartype next_link: str """ _validation = { - 'id': {'readonly': True}, + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): - super(PrivateEndpoint, self).__init__(**kwargs) - self.id = None + super(OperationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None -class Resource(msrest.serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. +class PrivateEndpoint(msrest.serialization.Model): + """The Private Endpoint resource. 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}. - :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 id: The ARM identifier for Private Endpoint. + :vartype id: str """ _validation = { 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, } def __init__( self, **kwargs ): - super(Resource, self).__init__(**kwargs) + super(PrivateEndpoint, self).__init__(**kwargs) self.id = None - self.name = None - self.type = None -class PrivateEndpointConnection(Resource): +class PrivateEndpointConnection(AzureEntityResource): """The Private Endpoint Connection resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -951,31 +1087,45 @@ class PrivateEndpointConnection(Resource): :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 :param properties: Resource properties. :type properties: ~azure.mgmt.cognitiveservices.models.PrivateEndpointConnectionProperties + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.cognitiveservices.models.SystemData + :param location: The location of the private endpoint connection. + :type location: str """ _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'}, 'properties': {'key': 'properties', 'type': 'PrivateEndpointConnectionProperties'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'location': {'key': 'location', 'type': 'str'}, } def __init__( self, *, properties: Optional["PrivateEndpointConnectionProperties"] = None, + location: Optional[str] = None, **kwargs ): super(PrivateEndpointConnection, self).__init__(**kwargs) self.properties = properties + self.system_data = None + self.location = location class PrivateEndpointConnectionListResult(msrest.serialization.Model): @@ -1002,6 +1152,8 @@ def __init__( class PrivateEndpointConnectionProperties(msrest.serialization.Model): """Properties of the PrivateEndpointConnectProperties. + 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 Azure. :param private_endpoint: The resource of private end point. @@ -1010,17 +1162,23 @@ class PrivateEndpointConnectionProperties(msrest.serialization.Model): state of the connection between service consumer and provider. :type private_link_service_connection_state: ~azure.mgmt.cognitiveservices.models.PrivateLinkServiceConnectionState + :ivar provisioning_state: The provisioning state of the private endpoint connection resource. + Possible values include: "Succeeded", "Creating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.cognitiveservices.models.PrivateEndpointConnectionProvisioningState :param group_ids: The private link resource group ids. :type group_ids: list[str] """ _validation = { 'private_link_service_connection_state': {'required': True}, + 'provisioning_state': {'readonly': True}, } _attribute_map = { 'private_endpoint': {'key': 'privateEndpoint', 'type': 'PrivateEndpoint'}, 'private_link_service_connection_state': {'key': 'privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, 'group_ids': {'key': 'groupIds', 'type': '[str]'}, } @@ -1035,6 +1193,7 @@ def __init__( super(PrivateEndpointConnectionProperties, self).__init__(**kwargs) self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state + self.provisioning_state = None self.group_ids = group_ids @@ -1106,25 +1265,25 @@ class PrivateLinkResourceProperties(msrest.serialization.Model): :ivar group_id: The private link resource group id. :vartype group_id: str - :ivar display_name: The private link resource display name. - :vartype display_name: str :ivar required_members: The private link resource required member names. :vartype required_members: list[str] :param required_zone_names: The private link resource Private link DNS zone name. :type required_zone_names: list[str] + :ivar display_name: The private link resource display name. + :vartype display_name: str """ _validation = { 'group_id': {'readonly': True}, - 'display_name': {'readonly': True}, 'required_members': {'readonly': True}, + 'display_name': {'readonly': True}, } _attribute_map = { 'group_id': {'key': 'groupId', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, 'required_members': {'key': 'requiredMembers', 'type': '[str]'}, 'required_zone_names': {'key': 'requiredZoneNames', 'type': '[str]'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, } def __init__( @@ -1135,29 +1294,29 @@ def __init__( ): super(PrivateLinkResourceProperties, self).__init__(**kwargs) self.group_id = None - self.display_name = None self.required_members = None self.required_zone_names = required_zone_names + self.display_name = None class PrivateLinkServiceConnectionState(msrest.serialization.Model): """A collection of information about the state of the connection between service consumer and provider. :param status: Indicates whether the connection has been Approved/Rejected/Removed by the owner - of the service. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". + of the service. Possible values include: "Pending", "Approved", "Rejected". :type status: str or ~azure.mgmt.cognitiveservices.models.PrivateEndpointServiceConnectionStatus :param description: The reason for approval/rejection of the connection. :type description: str - :param action_required: A message indicating if changes on the service provider require any + :param actions_required: A message indicating if changes on the service provider require any updates on the consumer. - :type action_required: str + :type actions_required: str """ _attribute_map = { 'status': {'key': 'status', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, - 'action_required': {'key': 'actionRequired', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, } def __init__( @@ -1165,13 +1324,44 @@ def __init__( *, status: Optional[Union[str, "PrivateEndpointServiceConnectionStatus"]] = None, description: Optional[str] = None, - action_required: Optional[str] = None, + actions_required: Optional[str] = None, **kwargs ): super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = status self.description = description - self.action_required = action_required + self.actions_required = actions_required + + +class QuotaLimit(msrest.serialization.Model): + """QuotaLimit. + + :param count: + :type count: float + :param renewal_period: + :type renewal_period: float + :param rules: + :type rules: list[~azure.mgmt.cognitiveservices.models.ThrottlingRule] + """ + + _attribute_map = { + 'count': {'key': 'count', 'type': 'float'}, + 'renewal_period': {'key': 'renewalPeriod', 'type': 'float'}, + 'rules': {'key': 'rules', 'type': '[ThrottlingRule]'}, + } + + def __init__( + self, + *, + count: Optional[float] = None, + renewal_period: Optional[float] = None, + rules: Optional[List["ThrottlingRule"]] = None, + **kwargs + ): + super(QuotaLimit, self).__init__(**kwargs) + self.count = count + self.renewal_period = renewal_period + self.rules = rules class RegenerateKeyParameters(msrest.serialization.Model): @@ -1202,35 +1392,50 @@ def __init__( self.key_name = key_name +class RequestMatchPattern(msrest.serialization.Model): + """RequestMatchPattern. + + :param path: + :type path: str + :param method: + :type method: str + """ + + _attribute_map = { + 'path': {'key': 'path', 'type': 'str'}, + 'method': {'key': 'method', 'type': 'str'}, + } + + def __init__( + self, + *, + path: Optional[str] = None, + method: Optional[str] = None, + **kwargs + ): + super(RequestMatchPattern, self).__init__(**kwargs) + self.path = path + self.method = method + + class ResourceSku(msrest.serialization.Model): """Describes an available Cognitive Services SKU. - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar resource_type: The type of resource the SKU applies to. - :vartype resource_type: str - :ivar name: The name of SKU. - :vartype name: str - :ivar tier: Specifies the tier of Cognitive Services account. - :vartype tier: str - :ivar kind: The Kind of resources that are supported in this SKU. - :vartype kind: str - :ivar locations: The set of locations that the SKU is available. - :vartype locations: list[str] - :ivar restrictions: The restrictions because of which SKU cannot be used. This is empty if + :param resource_type: The type of resource the SKU applies to. + :type resource_type: str + :param name: The name of SKU. + :type name: str + :param tier: Specifies the tier of Cognitive Services account. + :type tier: str + :param kind: The Kind of resources that are supported in this SKU. + :type kind: str + :param locations: The set of locations that the SKU is available. + :type locations: list[str] + :param restrictions: The restrictions because of which SKU cannot be used. This is empty if there are no restrictions. - :vartype restrictions: list[~azure.mgmt.cognitiveservices.models.ResourceSkuRestrictions] + :type restrictions: list[~azure.mgmt.cognitiveservices.models.ResourceSkuRestrictions] """ - _validation = { - 'resource_type': {'readonly': True}, - 'name': {'readonly': True}, - 'tier': {'readonly': True}, - 'kind': {'readonly': True}, - 'locations': {'readonly': True}, - 'restrictions': {'readonly': True}, - } - _attribute_map = { 'resource_type': {'key': 'resourceType', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, @@ -1242,33 +1447,65 @@ class ResourceSku(msrest.serialization.Model): def __init__( self, + *, + resource_type: Optional[str] = None, + name: Optional[str] = None, + tier: Optional[str] = None, + kind: Optional[str] = None, + locations: Optional[List[str]] = None, + restrictions: Optional[List["ResourceSkuRestrictions"]] = None, **kwargs ): super(ResourceSku, self).__init__(**kwargs) - self.resource_type = None - self.name = None - self.tier = None - self.kind = None - self.locations = None - self.restrictions = None + self.resource_type = resource_type + self.name = name + self.tier = tier + self.kind = kind + self.locations = locations + self.restrictions = restrictions -class ResourceSkuRestrictionInfo(msrest.serialization.Model): - """ResourceSkuRestrictionInfo. +class ResourceSkuListResult(msrest.serialization.Model): + """The Get Skus operation response. - 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 Azure. - :ivar locations: Locations where the SKU is restricted. - :vartype locations: list[str] - :ivar zones: List of availability zones where the SKU is restricted. - :vartype zones: list[str] + :param value: Required. The list of skus available for the subscription. + :type value: list[~azure.mgmt.cognitiveservices.models.ResourceSku] + :param next_link: The uri to fetch the next page of Skus. + :type next_link: str """ _validation = { - 'locations': {'readonly': True}, - 'zones': {'readonly': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceSku]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } + def __init__( + self, + *, + value: List["ResourceSku"], + next_link: Optional[str] = None, + **kwargs + ): + super(ResourceSkuListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ResourceSkuRestrictionInfo(msrest.serialization.Model): + """ResourceSkuRestrictionInfo. + + :param locations: Locations where the SKU is restricted. + :type locations: list[str] + :param zones: List of availability zones where the SKU is restricted. + :type zones: list[str] + """ + _attribute_map = { 'locations': {'key': 'locations', 'type': '[str]'}, 'zones': {'key': 'zones', 'type': '[str]'}, @@ -1276,38 +1513,32 @@ class ResourceSkuRestrictionInfo(msrest.serialization.Model): def __init__( self, + *, + locations: Optional[List[str]] = None, + zones: Optional[List[str]] = None, **kwargs ): super(ResourceSkuRestrictionInfo, self).__init__(**kwargs) - self.locations = None - self.zones = None + self.locations = locations + self.zones = zones class ResourceSkuRestrictions(msrest.serialization.Model): """Describes restrictions of a SKU. - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The type of restrictions. Possible values include: "Location", "Zone". - :vartype type: str or ~azure.mgmt.cognitiveservices.models.ResourceSkuRestrictionsType - :ivar values: The value of restrictions. If the restriction type is set to location. This would - be different locations where the SKU is restricted. - :vartype values: list[str] - :ivar restriction_info: The information about the restriction where the SKU cannot be used. - :vartype restriction_info: ~azure.mgmt.cognitiveservices.models.ResourceSkuRestrictionInfo - :ivar reason_code: The reason for restriction. Possible values include: "QuotaId", + :param type: The type of restrictions. Possible values include: "Location", "Zone". + :type type: str or ~azure.mgmt.cognitiveservices.models.ResourceSkuRestrictionsType + :param values: The value of restrictions. If the restriction type is set to location. This + would be different locations where the SKU is restricted. + :type values: list[str] + :param restriction_info: The information about the restriction where the SKU cannot be used. + :type restriction_info: ~azure.mgmt.cognitiveservices.models.ResourceSkuRestrictionInfo + :param reason_code: The reason for restriction. Possible values include: "QuotaId", "NotAvailableForSubscription". - :vartype reason_code: str or + :type reason_code: str or ~azure.mgmt.cognitiveservices.models.ResourceSkuRestrictionsReasonCode """ - _validation = { - 'type': {'readonly': True}, - 'values': {'readonly': True}, - 'restriction_info': {'readonly': True}, - 'reason_code': {'readonly': True}, - } - _attribute_map = { 'type': {'key': 'type', 'type': 'str'}, 'values': {'key': 'values', 'type': '[str]'}, @@ -1317,81 +1548,137 @@ class ResourceSkuRestrictions(msrest.serialization.Model): def __init__( self, + *, + type: Optional[Union[str, "ResourceSkuRestrictionsType"]] = None, + values: Optional[List[str]] = None, + restriction_info: Optional["ResourceSkuRestrictionInfo"] = None, + reason_code: Optional[Union[str, "ResourceSkuRestrictionsReasonCode"]] = None, **kwargs ): super(ResourceSkuRestrictions, self).__init__(**kwargs) - self.type = None - self.values = None - self.restriction_info = None - self.reason_code = None + self.type = type + self.values = values + self.restriction_info = restriction_info + self.reason_code = reason_code -class ResourceSkusResult(msrest.serialization.Model): - """The Get Skus operation response. +class Sku(msrest.serialization.Model): + """The resource model definition representing SKU. All required parameters must be populated in order to send to Azure. - :param value: Required. The list of skus available for the subscription. - :type value: list[~azure.mgmt.cognitiveservices.models.ResourceSku] - :param next_link: The uri to fetch the next page of Skus. - :type next_link: str + :param name: Required. The name of the SKU. Ex - P3. It is typically a letter+number code. + :type name: str + :param tier: 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. Possible values include: "Free", "Basic", + "Standard", "Premium", "Enterprise". + :type tier: str or ~azure.mgmt.cognitiveservices.models.SkuTier + :param size: The SKU size. When the name field is the combination of tier and some other value, + this would be the standalone code. + :type size: str + :param family: If the service has different generations of hardware, for the same SKU, then + that can be captured here. + :type family: str + :param capacity: If the SKU supports scale out/in then the capacity integer should be included. + If scale out/in is not possible for the resource this may be omitted. + :type capacity: int """ _validation = { - 'value': {'required': True}, + 'name': {'required': True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ResourceSku]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'size': {'key': 'size', 'type': 'str'}, + 'family': {'key': 'family', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, } def __init__( self, *, - value: List["ResourceSku"], - next_link: Optional[str] = None, + name: str, + tier: Optional[Union[str, "SkuTier"]] = None, + size: Optional[str] = None, + family: Optional[str] = None, + capacity: Optional[int] = None, **kwargs ): - super(ResourceSkusResult, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class Sku(msrest.serialization.Model): - """The SKU of the cognitive services account. + super(Sku, self).__init__(**kwargs) + self.name = name + self.tier = tier + self.size = size + self.family = family + self.capacity = capacity - 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 Azure. +class SkuAvailability(msrest.serialization.Model): + """SKU availability. - :param name: Required. Gets or sets the sku name. Required for account creation, optional for - update. - :type name: str - :ivar tier: Gets the sku tier. This is based on the SKU name. Possible values include: "Free", - "Standard", "Premium", "Enterprise". - :vartype tier: str or ~azure.mgmt.cognitiveservices.models.SkuTier + :param kind: The Kind of the resource. + :type kind: str + :param type: The Type of the resource. + :type type: str + :param sku_name: The SKU of Cognitive Services account. + :type sku_name: str + :param sku_available: Indicates the given SKU is available or not. + :type sku_available: bool + :param reason: Reason why the SKU is not available. + :type reason: str + :param message: Additional error message. + :type message: str """ - _validation = { - 'name': {'required': True}, - 'tier': {'readonly': True}, + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'sku_name': {'key': 'skuName', 'type': 'str'}, + 'sku_available': {'key': 'skuAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, } + def __init__( + self, + *, + kind: Optional[str] = None, + type: Optional[str] = None, + sku_name: Optional[str] = None, + sku_available: Optional[bool] = None, + reason: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): + super(SkuAvailability, self).__init__(**kwargs) + self.kind = kind + self.type = type + self.sku_name = sku_name + self.sku_available = sku_available + self.reason = reason + self.message = message + + +class SkuAvailabilityListResult(msrest.serialization.Model): + """Check SKU availability result list. + + :param value: Check SKU availability result list. + :type value: list[~azure.mgmt.cognitiveservices.models.SkuAvailability] + """ + _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[SkuAvailability]'}, } def __init__( self, *, - name: str, + value: Optional[List["SkuAvailability"]] = None, **kwargs ): - super(Sku, self).__init__(**kwargs) - self.name = name - self.tier = None + super(SkuAvailabilityListResult, self).__init__(**kwargs) + self.value = value class SkuCapability(msrest.serialization.Model): @@ -1420,38 +1707,152 @@ def __init__( self.value = value +class SkuChangeInfo(msrest.serialization.Model): + """Sku change info of account. + + :param count_of_downgrades: Gets the count of downgrades. + :type count_of_downgrades: float + :param count_of_upgrades_after_downgrades: Gets the count of upgrades after downgrades. + :type count_of_upgrades_after_downgrades: float + :param last_change_date: Gets the last change date. + :type last_change_date: str + """ + + _attribute_map = { + 'count_of_downgrades': {'key': 'countOfDowngrades', 'type': 'float'}, + 'count_of_upgrades_after_downgrades': {'key': 'countOfUpgradesAfterDowngrades', 'type': 'float'}, + 'last_change_date': {'key': 'lastChangeDate', 'type': 'str'}, + } + + def __init__( + self, + *, + count_of_downgrades: Optional[float] = None, + count_of_upgrades_after_downgrades: Optional[float] = None, + last_change_date: Optional[str] = None, + **kwargs + ): + super(SkuChangeInfo, self).__init__(**kwargs) + self.count_of_downgrades = count_of_downgrades + self.count_of_upgrades_after_downgrades = count_of_upgrades_after_downgrades + self.last_change_date = last_change_date + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~azure.mgmt.cognitiveservices.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or ~azure.mgmt.cognitiveservices.models.CreatedByType + :param last_modified_at: The timestamp of resource last modification (UTC). + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class ThrottlingRule(msrest.serialization.Model): + """ThrottlingRule. + + :param key: + :type key: str + :param renewal_period: + :type renewal_period: float + :param count: + :type count: float + :param min_count: + :type min_count: float + :param dynamic_throttling_enabled: + :type dynamic_throttling_enabled: bool + :param match_patterns: + :type match_patterns: list[~azure.mgmt.cognitiveservices.models.RequestMatchPattern] + """ + + _attribute_map = { + 'key': {'key': 'key', 'type': 'str'}, + 'renewal_period': {'key': 'renewalPeriod', 'type': 'float'}, + 'count': {'key': 'count', 'type': 'float'}, + 'min_count': {'key': 'minCount', 'type': 'float'}, + 'dynamic_throttling_enabled': {'key': 'dynamicThrottlingEnabled', 'type': 'bool'}, + 'match_patterns': {'key': 'matchPatterns', 'type': '[RequestMatchPattern]'}, + } + + def __init__( + self, + *, + key: Optional[str] = None, + renewal_period: Optional[float] = None, + count: Optional[float] = None, + min_count: Optional[float] = None, + dynamic_throttling_enabled: Optional[bool] = None, + match_patterns: Optional[List["RequestMatchPattern"]] = None, + **kwargs + ): + super(ThrottlingRule, self).__init__(**kwargs) + self.key = key + self.renewal_period = renewal_period + self.count = count + self.min_count = min_count + self.dynamic_throttling_enabled = dynamic_throttling_enabled + self.match_patterns = match_patterns + + class Usage(msrest.serialization.Model): """The usage data for a usage request. - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar unit: The unit of the metric. Possible values include: "Count", "Bytes", "Seconds", + :param unit: The unit of the metric. Possible values include: "Count", "Bytes", "Seconds", "Percent", "CountPerSecond", "BytesPerSecond", "Milliseconds". - :vartype unit: str or ~azure.mgmt.cognitiveservices.models.UnitType - :ivar name: The name information for the metric. - :vartype name: ~azure.mgmt.cognitiveservices.models.MetricName - :ivar quota_period: The quota period used to summarize the usage values. - :vartype quota_period: str - :ivar limit: Maximum value for this metric. - :vartype limit: float - :ivar current_value: Current value for this metric. - :vartype current_value: float - :ivar next_reset_time: Next reset time for current quota. - :vartype next_reset_time: str + :type unit: str or ~azure.mgmt.cognitiveservices.models.UnitType + :param name: The name information for the metric. + :type name: ~azure.mgmt.cognitiveservices.models.MetricName + :param quota_period: The quota period used to summarize the usage values. + :type quota_period: str + :param limit: Maximum value for this metric. + :type limit: float + :param current_value: Current value for this metric. + :type current_value: float + :param next_reset_time: Next reset time for current quota. + :type next_reset_time: str :param status: Cognitive Services account quota usage status. Possible values include: "Included", "Blocked", "InOverage", "Unknown". :type status: str or ~azure.mgmt.cognitiveservices.models.QuotaUsageStatus """ - _validation = { - 'unit': {'readonly': True}, - 'name': {'readonly': True}, - 'quota_period': {'readonly': True}, - 'limit': {'readonly': True}, - 'current_value': {'readonly': True}, - 'next_reset_time': {'readonly': True}, - } - _attribute_map = { 'unit': {'key': 'unit', 'type': 'str'}, 'name': {'key': 'name', 'type': 'MetricName'}, @@ -1465,53 +1866,62 @@ class Usage(msrest.serialization.Model): def __init__( self, *, + unit: Optional[Union[str, "UnitType"]] = None, + name: Optional["MetricName"] = None, + quota_period: Optional[str] = None, + limit: Optional[float] = None, + current_value: Optional[float] = None, + next_reset_time: Optional[str] = None, status: Optional[Union[str, "QuotaUsageStatus"]] = None, **kwargs ): super(Usage, self).__init__(**kwargs) - self.unit = None - self.name = None - self.quota_period = None - self.limit = None - self.current_value = None - self.next_reset_time = None + self.unit = unit + self.name = name + self.quota_period = quota_period + self.limit = limit + self.current_value = current_value + self.next_reset_time = next_reset_time self.status = status -class UsagesResult(msrest.serialization.Model): +class UsageListResult(msrest.serialization.Model): """The response to a list usage request. - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of usages for Cognitive Service account. - :vartype value: list[~azure.mgmt.cognitiveservices.models.Usage] + :param value: The list of usages for Cognitive Service account. + :type value: list[~azure.mgmt.cognitiveservices.models.Usage] """ - _validation = { - 'value': {'readonly': True}, - } - _attribute_map = { 'value': {'key': 'value', 'type': '[Usage]'}, } def __init__( self, + *, + value: Optional[List["Usage"]] = None, **kwargs ): - super(UsagesResult, self).__init__(**kwargs) - self.value = None + super(UsageListResult, self).__init__(**kwargs) + self.value = value class UserAssignedIdentity(msrest.serialization.Model): """User-assigned managed identity. - :param principal_id: Azure Active Directory principal ID associated with this Identity. - :type principal_id: str - :param client_id: Client App Id associated with this identity. - :type client_id: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: Azure Active Directory principal ID associated with this Identity. + :vartype principal_id: str + :ivar client_id: Client App Id associated with this identity. + :vartype client_id: str """ + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + _attribute_map = { 'principal_id': {'key': 'principalId', 'type': 'str'}, 'client_id': {'key': 'clientId', 'type': 'str'}, @@ -1519,14 +1929,11 @@ class UserAssignedIdentity(msrest.serialization.Model): def __init__( self, - *, - principal_id: Optional[str] = None, - client_id: Optional[str] = None, **kwargs ): super(UserAssignedIdentity, self).__init__(**kwargs) - self.principal_id = principal_id - self.client_id = client_id + self.principal_id = None + self.client_id = None class UserOwnedStorage(msrest.serialization.Model): @@ -1534,20 +1941,25 @@ class UserOwnedStorage(msrest.serialization.Model): :param resource_id: Full resource id of a Microsoft.Storage resource. :type resource_id: str + :param identity_client_id: + :type identity_client_id: str """ _attribute_map = { 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'identity_client_id': {'key': 'identityClientId', 'type': 'str'}, } def __init__( self, *, resource_id: Optional[str] = None, + identity_client_id: Optional[str] = None, **kwargs ): super(UserOwnedStorage, self).__init__(**kwargs) self.resource_id = resource_id + self.identity_client_id = identity_client_id class VirtualNetworkRule(msrest.serialization.Model): @@ -1556,8 +1968,7 @@ class VirtualNetworkRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :param id: Required. Full resource id of a vnet subnet, such as - '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test- - vnet/subnets/subnet1'. + '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. :type id: str :param state: Gets the state of virtual network rule. :type state: str 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 fee14b0688ba..79bc52d9dd8f 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from ._accounts_operations import AccountsOperations +from ._deleted_accounts_operations import DeletedAccountsOperations from ._resource_skus_operations import ResourceSkusOperations from ._operations import Operations from ._cognitive_services_management_client_operations import CognitiveServicesManagementClientOperationsMixin @@ -15,6 +16,7 @@ __all__ = [ 'AccountsOperations', + 'DeletedAccountsOperations', 'ResourceSkusOperations', 'Operations', 'CognitiveServicesManagementClientOperationsMixin', 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 4532d9495840..7ce476259722 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 @@ -12,7 +12,9 @@ from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models @@ -45,39 +47,25 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - def create( + def _create_initial( self, resource_group_name, # type: str account_name, # type: str - account, # type: "_models.CognitiveServicesAccount" + account, # type: "_models.Account" **kwargs # type: Any ): - # type: (...) -> "_models.CognitiveServicesAccount" - """Create Cognitive Services Account. Accounts is a resource group wide resource type. It holds - the keys for developer to access intelligent APIs. It's also the resource type for billing. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: The name of Cognitive Services account. - :type account_name: str - :param account: The parameters to provide for the created account. - :type account: ~azure.mgmt.cognitiveservices.models.CognitiveServicesAccount - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CognitiveServicesAccount, or the result of cls(response) - :rtype: ~azure.mgmt.cognitiveservices.models.CognitiveServicesAccount - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CognitiveServicesAccount"] + # type: (...) -> "_models.Account" + cls = kwargs.pop('cls', None) # type: ClsType["_models.Account"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-18" + api_version = "2021-04-30" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL - url = self.create.metadata['url'] # type: ignore + url = self._create_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), @@ -95,7 +83,7 @@ def create( header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(account, 'CognitiveServicesAccount') + body_content = self._serialize.body(account, 'Account') body_content_kwargs['content'] = body_content request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) @@ -103,56 +91,116 @@ def create( if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('CognitiveServicesAccount', pipeline_response) + deserialized = self._deserialize('Account', pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('CognitiveServicesAccount', pipeline_response) + deserialized = self._deserialize('Account', pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('CognitiveServicesAccount', pipeline_response) + deserialized = self._deserialize('Account', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}'} # type: ignore + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}'} # type: ignore - def update( + def begin_create( self, resource_group_name, # type: str account_name, # type: str - account, # type: "_models.CognitiveServicesAccount" + account, # type: "_models.Account" **kwargs # type: Any ): - # type: (...) -> "_models.CognitiveServicesAccount" - """Updates a Cognitive Services account. + # type: (...) -> LROPoller["_models.Account"] + """Create Cognitive Services Account. Accounts is a resource group wide resource type. It holds + the keys for developer to access intelligent APIs. It's also the resource type for billing. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param account_name: The name of Cognitive Services account. :type account_name: str :param account: The parameters to provide for the created account. - :type account: ~azure.mgmt.cognitiveservices.models.CognitiveServicesAccount + :type account: ~azure.mgmt.cognitiveservices.models.Account :keyword callable cls: A custom type or function that will be passed the direct response - :return: CognitiveServicesAccount, or the result of cls(response) - :rtype: ~azure.mgmt.cognitiveservices.models.CognitiveServicesAccount - :raises: ~azure.core.exceptions.HttpResponseError + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either Account or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Account] + :raises ~azure.core.exceptions.HttpResponseError: """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CognitiveServicesAccount"] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Account"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + account_name=account_name, + account=account, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Account', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + account_name, # type: str + account, # type: "_models.Account" + **kwargs # type: Any + ): + # type: (...) -> "_models.Account" + cls = kwargs.pop('cls', None) # type: ClsType["_models.Account"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-18" + api_version = "2021-04-30" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL - url = self.update.metadata['url'] # type: ignore + url = self._update_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), @@ -170,7 +218,7 @@ def update( header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(account, 'CognitiveServicesAccount') + body_content = self._serialize.body(account, 'Account') body_content_kwargs['content'] = body_content request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) @@ -178,49 +226,110 @@ def update( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('CognitiveServicesAccount', pipeline_response) + deserialized = self._deserialize('Account', pipeline_response) if response.status_code == 202: - deserialized = self._deserialize('CognitiveServicesAccount', pipeline_response) + deserialized = self._deserialize('Account', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}'} # type: ignore + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}'} # type: ignore - def delete( + def begin_update( self, resource_group_name, # type: str account_name, # type: str + account, # type: "_models.Account" **kwargs # type: Any ): - # type: (...) -> None - """Deletes a Cognitive Services account from the resource group. + # type: (...) -> LROPoller["_models.Account"] + """Updates a Cognitive Services account. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param account_name: The name of Cognitive Services account. :type account_name: str + :param account: The parameters to provide for the created account. + :type account: ~azure.mgmt.cognitiveservices.models.Account :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either Account or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Account] + :raises ~azure.core.exceptions.HttpResponseError: """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Account"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + account_name=account_name, + account=account, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Account', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-18" + api_version = "2021-04-30" accept = "application/json" # Construct URL - url = self.delete.metadata['url'] # type: ignore + url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), @@ -242,21 +351,86 @@ def delete( if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}'} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a Cognitive Services account from the resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + account_name=account_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } - def get_properties( + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}'} # type: ignore + + def get( self, resource_group_name, # type: str account_name, # type: str **kwargs # type: Any ): - # type: (...) -> "_models.CognitiveServicesAccount" + # type: (...) -> "_models.Account" """Returns a Cognitive Services account specified by the parameters. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -264,20 +438,20 @@ def get_properties( :param account_name: The name of Cognitive Services account. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CognitiveServicesAccount, or the result of cls(response) - :rtype: ~azure.mgmt.cognitiveservices.models.CognitiveServicesAccount + :return: Account, or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.Account :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CognitiveServicesAccount"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Account"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-18" + api_version = "2021-04-30" accept = "application/json" # Construct URL - url = self.get_properties.metadata['url'] # type: ignore + url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), @@ -299,38 +473,38 @@ def get_properties( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CognitiveServicesAccount', pipeline_response) + deserialized = self._deserialize('Account', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}'} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}'} # type: ignore def list_by_resource_group( self, resource_group_name, # type: str **kwargs # type: Any ): - # type: (...) -> Iterable["_models.CognitiveServicesAccountListResult"] + # type: (...) -> Iterable["_models.AccountListResult"] """Returns all the resources of a particular type belonging to a resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CognitiveServicesAccountListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.CognitiveServicesAccountListResult] + :return: An iterator like instance of either AccountListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.AccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CognitiveServicesAccountListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccountListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-18" + api_version = "2021-04-30" accept = "application/json" def prepare_request(next_link=None): @@ -358,7 +532,7 @@ def prepare_request(next_link=None): return request def extract_data(pipeline_response): - deserialized = self._deserialize('CognitiveServicesAccountListResult', pipeline_response) + deserialized = self._deserialize('AccountListResult', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -371,7 +545,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -386,20 +560,20 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["_models.CognitiveServicesAccountListResult"] + # type: (...) -> Iterable["_models.AccountListResult"] """Returns all the resources of a particular type belonging to a subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CognitiveServicesAccountListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.CognitiveServicesAccountListResult] + :return: An iterator like instance of either AccountListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.AccountListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CognitiveServicesAccountListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccountListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-18" + api_version = "2021-04-30" accept = "application/json" def prepare_request(next_link=None): @@ -426,7 +600,7 @@ def prepare_request(next_link=None): return request def extract_data(pipeline_response): - deserialized = self._deserialize('CognitiveServicesAccountListResult', pipeline_response) + deserialized = self._deserialize('AccountListResult', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -439,7 +613,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -456,7 +630,7 @@ def list_keys( account_name, # type: str **kwargs # type: Any ): - # type: (...) -> "_models.CognitiveServicesAccountKeys" + # type: (...) -> "_models.ApiKeys" """Lists the account keys for the specified Cognitive Services account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -464,16 +638,16 @@ def list_keys( :param account_name: The name of Cognitive Services account. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CognitiveServicesAccountKeys, or the result of cls(response) - :rtype: ~azure.mgmt.cognitiveservices.models.CognitiveServicesAccountKeys + :return: ApiKeys, or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.ApiKeys :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CognitiveServicesAccountKeys"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiKeys"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-18" + api_version = "2021-04-30" accept = "application/json" # Construct URL @@ -499,10 +673,10 @@ def list_keys( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CognitiveServicesAccountKeys', pipeline_response) + deserialized = self._deserialize('ApiKeys', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -517,7 +691,7 @@ def regenerate_key( key_name, # type: Union[str, "_models.KeyName"] **kwargs # type: Any ): - # type: (...) -> "_models.CognitiveServicesAccountKeys" + # type: (...) -> "_models.ApiKeys" """Regenerates the specified account key for the specified Cognitive Services account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -527,18 +701,18 @@ def regenerate_key( :param key_name: key name to generate (Key1|Key2). :type key_name: str or ~azure.mgmt.cognitiveservices.models.KeyName :keyword callable cls: A custom type or function that will be passed the direct response - :return: CognitiveServicesAccountKeys, or the result of cls(response) - :rtype: ~azure.mgmt.cognitiveservices.models.CognitiveServicesAccountKeys + :return: ApiKeys, or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.ApiKeys :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CognitiveServicesAccountKeys"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiKeys"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) _parameters = _models.RegenerateKeyParameters(key_name=key_name) - api_version = "2017-04-18" + api_version = "2021-04-30" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -569,10 +743,10 @@ def regenerate_key( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CognitiveServicesAccountKeys', pipeline_response) + deserialized = self._deserialize('ApiKeys', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -586,7 +760,7 @@ def list_skus( account_name, # type: str **kwargs # type: Any ): - # type: (...) -> "_models.CognitiveServicesAccountEnumerateSkusResult" + # type: (...) -> "_models.AccountSkuListResult" """List available SKUs for the requested Cognitive Services account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -594,16 +768,16 @@ def list_skus( :param account_name: The name of Cognitive Services account. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CognitiveServicesAccountEnumerateSkusResult, or the result of cls(response) - :rtype: ~azure.mgmt.cognitiveservices.models.CognitiveServicesAccountEnumerateSkusResult + :return: AccountSkuListResult, or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.AccountSkuListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CognitiveServicesAccountEnumerateSkusResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccountSkuListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-18" + api_version = "2021-04-30" accept = "application/json" # Construct URL @@ -629,10 +803,10 @@ def list_skus( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CognitiveServicesAccountEnumerateSkusResult', pipeline_response) + deserialized = self._deserialize('AccountSkuListResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -640,14 +814,14 @@ def list_skus( return deserialized list_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/skus'} # type: ignore - def get_usages( + def list_usages( self, resource_group_name, # type: str account_name, # type: str filter=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> "_models.UsagesResult" + # type: (...) -> "_models.UsageListResult" """Get usages for the requested Cognitive Services account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -658,20 +832,20 @@ def get_usages( supported parameter is name.value (name of the metric, can have an or of multiple names). :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: UsagesResult, or the result of cls(response) - :rtype: ~azure.mgmt.cognitiveservices.models.UsagesResult + :return: UsageListResult, or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.UsageListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.UsagesResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.UsageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-18" + api_version = "2021-04-30" accept = "application/json" # Construct URL - url = self.get_usages.metadata['url'] # type: ignore + url = self.list_usages.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), @@ -695,13 +869,13 @@ def get_usages( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('UsagesResult', pipeline_response) + deserialized = self._deserialize('UsageListResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/usages'} # type: ignore + list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/usages'} # type: ignore 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 df6b2b3c9940..a42311dda574 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 @@ -32,7 +32,7 @@ def check_sku_availability( type, # type: str **kwargs # type: Any ): - # type: (...) -> "_models.CheckSkuAvailabilityResultList" + # type: (...) -> "_models.SkuAvailabilityListResult" """Check available SKUs. :param location: Resource location. @@ -44,18 +44,18 @@ def check_sku_availability( :param type: The Type of the resource. :type type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckSkuAvailabilityResultList, or the result of cls(response) - :rtype: ~azure.mgmt.cognitiveservices.models.CheckSkuAvailabilityResultList + :return: SkuAvailabilityListResult, or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.SkuAvailabilityListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckSkuAvailabilityResultList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SkuAvailabilityListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) _parameters = _models.CheckSkuAvailabilityParameter(skus=skus, kind=kind, type=type) - api_version = "2017-04-18" + api_version = "2021-04-30" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -85,9 +85,10 @@ def check_sku_availability( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CheckSkuAvailabilityResultList', pipeline_response) + deserialized = self._deserialize('SkuAvailabilityListResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -101,7 +102,7 @@ def check_domain_availability( type, # type: str **kwargs # type: Any ): - # type: (...) -> "_models.CheckDomainAvailabilityResult" + # type: (...) -> "_models.DomainAvailability" """Check whether a domain is available. :param subdomain_name: The subdomain name to use. @@ -109,18 +110,18 @@ def check_domain_availability( :param type: The Type of the resource. :type type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckDomainAvailabilityResult, or the result of cls(response) - :rtype: ~azure.mgmt.cognitiveservices.models.CheckDomainAvailabilityResult + :return: DomainAvailability, or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.DomainAvailability :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckDomainAvailabilityResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DomainAvailability"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) _parameters = _models.CheckDomainAvailabilityParameter(subdomain_name=subdomain_name, type=type) - api_version = "2017-04-18" + api_version = "2021-04-30" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -149,9 +150,10 @@ def check_domain_availability( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('CheckDomainAvailabilityResult', pipeline_response) + deserialized = self._deserialize('DomainAvailability', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) 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 new file mode 100644 index 000000000000..72caa9730757 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_deleted_accounts_operations.py @@ -0,0 +1,298 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class DeletedAccountsOperations(object): + """DeletedAccountsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.cognitiveservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + location, # type: str + resource_group_name, # type: str + account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Account" + """Returns a Cognitive Services account specified by the parameters. + + :param location: Resource location. + :type location: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Account, or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.Account + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Account"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-30" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **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, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Account', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/resourceGroups/{resourceGroupName}/deletedAccounts/{accountName}'} # type: ignore + + def _purge_initial( + self, + location, # type: str + resource_group_name, # type: str + account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-30" + accept = "application/json" + + # Construct URL + url = self._purge_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _purge_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/resourceGroups/{resourceGroupName}/deletedAccounts/{accountName}'} # type: ignore + + def begin_purge( + self, + location, # type: str + resource_group_name, # type: str + account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a Cognitive Services account from the resource group. + + :param location: Resource location. + :type location: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._purge_initial( + location=location, + resource_group_name=resource_group_name, + account_name=account_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_purge.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/resourceGroups/{resourceGroupName}/deletedAccounts/{accountName}'} # type: ignore + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.AccountListResult"] + """Returns all the resources of a particular type belonging to a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AccountListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.AccountListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AccountListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-04-30" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('AccountListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/deletedAccounts'} # type: ignore 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 91efa313a246..34d6f91f6743 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 @@ -49,20 +49,20 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["_models.OperationEntityListResult"] + # type: (...) -> Iterable["_models.OperationListResult"] """Lists all the available Cognitive Services account operations. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OperationEntityListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.OperationEntityListResult] + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationEntityListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-18" + api_version = "2021-04-30" accept = "application/json" def prepare_request(next_link=None): @@ -85,7 +85,7 @@ def prepare_request(next_link=None): return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationEntityListResult', pipeline_response) + deserialized = self._deserialize('OperationListResult', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,8 +98,9 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response 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 1641ef3f241a..5cf9df2709d6 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 @@ -11,13 +11,15 @@ from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -67,7 +69,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-18" + api_version = "2021-04-30" accept = "application/json" # Construct URL @@ -93,7 +95,7 @@ def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.Error, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) @@ -131,7 +133,7 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-18" + api_version = "2021-04-30" accept = "application/json" # Construct URL @@ -158,7 +160,8 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -168,7 +171,7 @@ def get( return deserialized get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore - def create_or_update( + def _create_or_update_initial( self, resource_group_name, # type: str account_name, # type: str @@ -177,34 +180,17 @@ def create_or_update( **kwargs # type: Any ): # type: (...) -> "_models.PrivateEndpointConnection" - """Update the state of specified private endpoint connection associated with the Cognitive - Services account. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param account_name: The name of Cognitive Services account. - :type account_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the Cognitive Services Account. - :type private_endpoint_connection_name: str - :param properties: The private endpoint connection properties. - :type properties: ~azure.mgmt.cognitiveservices.models.PrivateEndpointConnection - :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection, or the result of cls(response) - :rtype: ~azure.mgmt.cognitiveservices.models.PrivateEndpointConnection - :raises: ~azure.core.exceptions.HttpResponseError - """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-18" + api_version = "2021-04-30" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), @@ -229,28 +215,34 @@ def create_or_update( pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore - def delete( + def begin_create_or_update( self, resource_group_name, # type: str account_name, # type: str private_endpoint_connection_name, # type: str + properties, # type: "_models.PrivateEndpointConnection" **kwargs # type: Any ): - # type: (...) -> None - """Deletes the specified private endpoint connection associated with the Cognitive Services - account. + # type: (...) -> LROPoller["_models.PrivateEndpointConnection"] + """Update the state of specified private endpoint connection associated with the Cognitive + Services account. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str @@ -259,20 +251,84 @@ def delete( :param private_endpoint_connection_name: The name of the private endpoint connection associated with the Cognitive Services Account. :type private_endpoint_connection_name: str + :param properties: The private endpoint connection properties. + :type properties: ~azure.mgmt.cognitiveservices.models.PrivateEndpointConnection :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + account_name=account_name, + private_endpoint_connection_name=private_endpoint_connection_name, + properties=properties, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + account_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-18" + api_version = "2021-04-30" + accept = "application/json" # Construct URL - url = self.delete.metadata['url'] # type: ignore + url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), @@ -287,16 +343,90 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + account_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes the specified private endpoint connection associated with the Cognitive Services + account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: The name of Cognitive Services account. + :type account_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Cognitive Services Account. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + account_name=account_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=64, min_length=2, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore 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 bc262def8469..5a133ef4b58b 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 @@ -67,7 +67,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-18" + api_version = "2021-04-30" accept = "application/json" # Construct URL @@ -93,7 +93,8 @@ def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response) 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 4a358f4323ff..336783d45fd6 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 @@ -49,20 +49,20 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["_models.ResourceSkusResult"] + # type: (...) -> Iterable["_models.ResourceSkuListResult"] """Gets the list of Microsoft.CognitiveServices SKUs available for your Subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceSkusResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.ResourceSkusResult] + :return: An iterator like instance of either ResourceSkuListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.ResourceSkuListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkusResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkuListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2017-04-18" + api_version = "2021-04-30" accept = "application/json" def prepare_request(next_link=None): @@ -89,7 +89,7 @@ def prepare_request(next_link=None): return request def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceSkusResult', pipeline_response) + deserialized = self._deserialize('ResourceSkuListResult', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -102,8 +102,9 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response