From 6341dc07b2a81b16a403714ba34eaf17a2ae6ebb Mon Sep 17 00:00:00 2001 From: Azure CLI Bot Date: Mon, 15 Nov 2021 09:50:08 +0800 Subject: [PATCH] [AutoRelease] t2-cognitiveservices-2021-11-03-56855 (#21556) * CodeGen from PR 16418 in Azure/azure-rest-api-specs Cognitive Services Resource Provider API Version 2021-10-01 (#16418) * Adds base for updating Microsoft.CognitiveServices from version stable/2021-04-30 to version 2021-10-01 * Updates readme * Updates API version in new specs and examples * Changes for 2021-10-01 * Use 201 instead of 202 for Put, Add x-ms-pageable for List. * address comments * version,CHANGELOG * Update CHANGELOG.md Co-authored-by: SDKAuto Co-authored-by: PythonSdkPipelines Co-authored-by: Jiefeng Chen <51037443+BigCat20196@users.noreply.github.com> --- .../azure-mgmt-cognitiveservices/CHANGELOG.md | 14 + .../azure-mgmt-cognitiveservices/_meta.json | 8 +- .../_cognitive_services_management_client.py | 15 + .../mgmt/cognitiveservices/_configuration.py | 2 +- .../mgmt/cognitiveservices/_metadata.json | 19 +- .../azure/mgmt/cognitiveservices/_version.py | 2 +- .../_cognitive_services_management_client.py | 15 + .../cognitiveservices/aio/_configuration.py | 2 +- .../aio/operations/__init__.py | 6 + .../aio/operations/_accounts_operations.py | 44 +- ...e_services_management_client_operations.py | 9 +- .../_commitment_plans_operations.py | 376 ++++++++++++ .../_commitment_tiers_operations.py | 113 ++++ .../_deleted_accounts_operations.py | 12 +- .../aio/operations/_deployments_operations.py | 437 ++++++++++++++ .../aio/operations/_operations.py | 2 +- ...private_endpoint_connections_operations.py | 20 +- .../_private_link_resources_operations.py | 4 +- .../operations/_resource_skus_operations.py | 2 +- .../mgmt/cognitiveservices/models/__init__.py | 48 ++ ...nitive_services_management_client_enums.py | 25 + .../mgmt/cognitiveservices/models/_models.py | 493 ++++++++++++++++ .../cognitiveservices/models/_models_py3.py | 539 ++++++++++++++++++ .../cognitiveservices/operations/__init__.py | 6 + .../operations/_accounts_operations.py | 44 +- ...e_services_management_client_operations.py | 9 +- .../_commitment_plans_operations.py | 385 +++++++++++++ .../_commitment_tiers_operations.py | 118 ++++ .../_deleted_accounts_operations.py | 12 +- .../operations/_deployments_operations.py | 447 +++++++++++++++ .../operations/_operations.py | 2 +- ...private_endpoint_connections_operations.py | 20 +- .../_private_link_resources_operations.py | 4 +- .../operations/_resource_skus_operations.py | 2 +- 34 files changed, 3151 insertions(+), 105 deletions(-) create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_commitment_plans_operations.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_commitment_tiers_operations.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_deployments_operations.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_commitment_plans_operations.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_commitment_tiers_operations.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_deployments_operations.py diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/CHANGELOG.md b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/CHANGELOG.md index 44de57bc5189..6aa97e38fd03 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/CHANGELOG.md +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/CHANGELOG.md @@ -1,5 +1,19 @@ # Release History +## 13.0.0 (2021-11-15) + +**Features** + + - Model DomainAvailability has a new parameter kind + - Model CheckDomainAvailabilityParameter has a new parameter kind + - Added operation group CommitmentPlansOperations + - Added operation group CommitmentTiersOperations + - Added operation group DeploymentsOperations + +**Breaking changes** + + - Operation CognitiveServicesManagementClientOperationsMixin.check_domain_availability has a new signature + ## 12.0.0 (2021-06-03) **Features** diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/_meta.json b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/_meta.json index 0873b38bc9e2..9dd1cbc422ff 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/_meta.json +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.4.2", + "autorest": "3.4.5", "use": [ - "@autorest/python@5.8.0", + "@autorest/python@5.8.4", "@autorest/modelerfour@4.19.2" ], - "commit": "d3a5ab585146ee8ee09f43eb0948c45daacd36f7", + "commit": "e0b5060d30138df66bd64bf0ca6b2010be18717f", "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.2 --version=3.4.2", + "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.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5", "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 9a68671d3a77..72eb985c6bad 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 @@ -24,8 +24,11 @@ from .operations import ResourceSkusOperations from .operations import Operations from .operations import CognitiveServicesManagementClientOperationsMixin +from .operations import CommitmentTiersOperations from .operations import PrivateEndpointConnectionsOperations from .operations import PrivateLinkResourcesOperations +from .operations import DeploymentsOperations +from .operations import CommitmentPlansOperations from . import models @@ -40,10 +43,16 @@ class CognitiveServicesManagementClient(CognitiveServicesManagementClientOperati :vartype resource_skus: azure.mgmt.cognitiveservices.operations.ResourceSkusOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.cognitiveservices.operations.Operations + :ivar commitment_tiers: CommitmentTiersOperations operations + :vartype commitment_tiers: azure.mgmt.cognitiveservices.operations.CommitmentTiersOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations :vartype private_endpoint_connections: azure.mgmt.cognitiveservices.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations :vartype private_link_resources: azure.mgmt.cognitiveservices.operations.PrivateLinkResourcesOperations + :ivar deployments: DeploymentsOperations operations + :vartype deployments: azure.mgmt.cognitiveservices.operations.DeploymentsOperations + :ivar commitment_plans: CommitmentPlansOperations operations + :vartype commitment_plans: azure.mgmt.cognitiveservices.operations.CommitmentPlansOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. @@ -78,10 +87,16 @@ def __init__( self._client, self._config, self._serialize, self._deserialize) self.operations = Operations( self._client, self._config, self._serialize, self._deserialize) + self.commitment_tiers = CommitmentTiersOperations( + self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize) self.private_link_resources = PrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize) + self.deployments = DeploymentsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.commitment_plans = CommitmentPlansOperations( + self._client, self._config, self._serialize, self._deserialize) def _send_request(self, http_request, **kwargs): # type: (HttpRequest, Any) -> HttpResponse 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 89d1d80d7d47..db9063efc41f 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 = "2021-04-30" + self.api_version = "2021-10-01" 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 index 7aae21649127..d1ac26bb7b0d 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_metadata.json +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_metadata.json @@ -1,6 +1,6 @@ { - "chosen_version": "2021-04-30", - "total_api_version_list": ["2021-04-30"], + "chosen_version": "2021-10-01", + "total_api_version_list": ["2021-10-01"], "client": { "name": "CognitiveServicesManagementClient", "filename": "_cognitive_services_management_client", @@ -102,8 +102,11 @@ "deleted_accounts": "DeletedAccountsOperations", "resource_skus": "ResourceSkusOperations", "operations": "Operations", + "commitment_tiers": "CommitmentTiersOperations", "private_endpoint_connections": "PrivateEndpointConnectionsOperations", - "private_link_resources": "PrivateLinkResourcesOperations" + "private_link_resources": "PrivateLinkResourcesOperations", + "deployments": "DeploymentsOperations", + "commitment_plans": "CommitmentPlansOperations" }, "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\"]}}}", @@ -123,15 +126,15 @@ }, "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\"\"\"" + "signature": "def check_domain_availability(\n self,\n subdomain_name, # type: str\n type, # type: str\n kind=None, # type: Optional[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:param kind: The Kind of the resource.\n:type kind: 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\"\"\"" + "signature": "async def check_domain_availability(\n self,\n subdomain_name: str,\n type: str,\n kind: Optional[str] = None,\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:param kind: The Kind of the resource.\n:type kind: 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" + "call": "subdomain_name, type, kind" } } } 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 c047f879b92f..fa8e008c199f 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 = "12.0.0" +VERSION = "13.0.0" 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 495505912230..b0e16cb0c4fe 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 @@ -22,8 +22,11 @@ from .operations import ResourceSkusOperations from .operations import Operations from .operations import CognitiveServicesManagementClientOperationsMixin +from .operations import CommitmentTiersOperations from .operations import PrivateEndpointConnectionsOperations from .operations import PrivateLinkResourcesOperations +from .operations import DeploymentsOperations +from .operations import CommitmentPlansOperations from .. import models @@ -38,10 +41,16 @@ class CognitiveServicesManagementClient(CognitiveServicesManagementClientOperati :vartype resource_skus: azure.mgmt.cognitiveservices.aio.operations.ResourceSkusOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.cognitiveservices.aio.operations.Operations + :ivar commitment_tiers: CommitmentTiersOperations operations + :vartype commitment_tiers: azure.mgmt.cognitiveservices.aio.operations.CommitmentTiersOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations :vartype private_endpoint_connections: azure.mgmt.cognitiveservices.aio.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations :vartype private_link_resources: azure.mgmt.cognitiveservices.aio.operations.PrivateLinkResourcesOperations + :ivar deployments: DeploymentsOperations operations + :vartype deployments: azure.mgmt.cognitiveservices.aio.operations.DeploymentsOperations + :ivar commitment_plans: CommitmentPlansOperations operations + :vartype commitment_plans: azure.mgmt.cognitiveservices.aio.operations.CommitmentPlansOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. @@ -75,10 +84,16 @@ def __init__( self._client, self._config, self._serialize, self._deserialize) self.operations = Operations( self._client, self._config, self._serialize, self._deserialize) + self.commitment_tiers = CommitmentTiersOperations( + self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize) self.private_link_resources = PrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize) + self.deployments = DeploymentsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.commitment_plans = CommitmentPlansOperations( + 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. 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 e28e3245efda..868d790b9a59 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 = "2021-04-30" + self.api_version = "2021-10-01" 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 79bc52d9dd8f..b2de36c75c14 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 @@ -11,8 +11,11 @@ from ._resource_skus_operations import ResourceSkusOperations from ._operations import Operations from ._cognitive_services_management_client_operations import CognitiveServicesManagementClientOperationsMixin +from ._commitment_tiers_operations import CommitmentTiersOperations from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._deployments_operations import DeploymentsOperations +from ._commitment_plans_operations import CommitmentPlansOperations __all__ = [ 'AccountsOperations', @@ -20,6 +23,9 @@ 'ResourceSkusOperations', 'Operations', 'CognitiveServicesManagementClientOperationsMixin', + 'CommitmentTiersOperations', 'PrivateEndpointConnectionsOperations', 'PrivateLinkResourcesOperations', + 'DeploymentsOperations', + 'CommitmentPlansOperations', ] 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 7ebc072a9db9..062574dafb7a 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 @@ -55,14 +55,14 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-30" + api_version = "2021-10-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL 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\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), '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), } @@ -157,7 +157,7 @@ def get_long_running_output(pipeline_response): 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\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), '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), } @@ -188,14 +188,14 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-30" + api_version = "2021-10-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL 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\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), '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), } @@ -286,7 +286,7 @@ def get_long_running_output(pipeline_response): 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\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), '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), } @@ -316,13 +316,13 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-30" + api_version = "2021-10-01" accept = "application/json" # Construct URL 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\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), '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), } @@ -395,7 +395,7 @@ def get_long_running_output(pipeline_response): 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\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), '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), } @@ -436,13 +436,13 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-30" + api_version = "2021-10-01" accept = "application/json" # Construct URL 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\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), '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), } @@ -492,7 +492,7 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-30" + api_version = "2021-10-01" accept = "application/json" def prepare_request(next_link=None): @@ -504,7 +504,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_resource_group.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\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), '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) @@ -560,7 +560,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-30" + api_version = "2021-10-01" accept = "application/json" def prepare_request(next_link=None): @@ -633,13 +633,13 @@ async def list_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-30" + api_version = "2021-10-01" accept = "application/json" # Construct URL url = self.list_keys.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\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), '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), } @@ -697,14 +697,14 @@ async def regenerate_key( error_map.update(kwargs.pop('error_map', {})) _parameters = _models.RegenerateKeyParameters(key_name=key_name) - api_version = "2021-04-30" + api_version = "2021-10-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL url = self.regenerate_key.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\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), '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), } @@ -761,13 +761,13 @@ async def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-30" + api_version = "2021-10-01" accept = "application/json" # Construct URL url = self.list_skus.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\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), '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), } @@ -824,13 +824,13 @@ async def list_usages( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-30" + api_version = "2021-10-01" accept = "application/json" # Construct URL 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\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), '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), } 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 b75a2192f278..1f3166c485a8 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 @@ -50,7 +50,7 @@ async def check_sku_availability( error_map.update(kwargs.pop('error_map', {})) _parameters = _models.CheckSkuAvailabilityParameter(skus=skus, kind=kind, type=type) - api_version = "2021-04-30" + api_version = "2021-10-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -95,6 +95,7 @@ async def check_domain_availability( self, subdomain_name: str, type: str, + kind: Optional[str] = None, **kwargs: Any ) -> "_models.DomainAvailability": """Check whether a domain is available. @@ -103,6 +104,8 @@ async def check_domain_availability( :type subdomain_name: str :param type: The Type of the resource. :type type: str + :param kind: The Kind of the resource. + :type kind: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DomainAvailability, or the result of cls(response) :rtype: ~azure.mgmt.cognitiveservices.models.DomainAvailability @@ -114,8 +117,8 @@ async def check_domain_availability( } error_map.update(kwargs.pop('error_map', {})) - _parameters = _models.CheckDomainAvailabilityParameter(subdomain_name=subdomain_name, type=type) - api_version = "2021-04-30" + _parameters = _models.CheckDomainAvailabilityParameter(subdomain_name=subdomain_name, type=type, kind=kind) + api_version = "2021-10-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_commitment_plans_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_commitment_plans_operations.py new file mode 100644 index 000000000000..7a1135bcaa92 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_commitment_plans_operations.py @@ -0,0 +1,376 @@ +# 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 CommitmentPlansOperations: + """CommitmentPlansOperations 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 + + def list( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.CommitmentPlanListResult"]: + """Gets the commitmentPlans 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CommitmentPlanListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cognitiveservices.models.CommitmentPlanListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CommitmentPlanListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-10-01" + 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 = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + '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') + + 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('CommitmentPlanListResult', 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/commitmentPlans'} # type: ignore + + async def get( + self, + resource_group_name: str, + account_name: str, + commitment_plan_name: str, + **kwargs: Any + ) -> "_models.CommitmentPlan": + """Gets the specified commitmentPlans 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 commitment_plan_name: The name of the commitmentPlan associated with the Cognitive + Services Account. + :type commitment_plan_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CommitmentPlan, or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.CommitmentPlan + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CommitmentPlan"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-10-01" + accept = "application/json" + + # Construct URL + 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), + '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), + 'commitmentPlanName': self._serialize.url("commitment_plan_name", commitment_plan_name, 'str'), + } + 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('CommitmentPlan', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/commitmentPlans/{commitmentPlanName}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + account_name: str, + commitment_plan_name: str, + commitment_plan: "_models.CommitmentPlan", + **kwargs: Any + ) -> "_models.CommitmentPlan": + """Update the state of specified commitmentPlans 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 commitment_plan_name: The name of the commitmentPlan associated with the Cognitive + Services Account. + :type commitment_plan_name: str + :param commitment_plan: The commitmentPlan properties. + :type commitment_plan: ~azure.mgmt.cognitiveservices.models.CommitmentPlan + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CommitmentPlan, or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.CommitmentPlan + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CommitmentPlan"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + '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), + 'commitmentPlanName': self._serialize.url("commitment_plan_name", commitment_plan_name, 'str'), + } + 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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(commitment_plan, 'CommitmentPlan') + 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) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + 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 response.status_code == 200: + deserialized = self._deserialize('CommitmentPlan', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('CommitmentPlan', 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}/commitmentPlans/{commitmentPlanName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + account_name: str, + commitment_plan_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-10-01" + accept = "application/json" + + # Construct URL + 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), + '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), + 'commitmentPlanName': self._serialize.url("commitment_plan_name", commitment_plan_name, 'str'), + } + 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, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/commitmentPlans/{commitmentPlanName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + account_name: str, + commitment_plan_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified commitmentPlan 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 commitment_plan_name: The name of the commitmentPlan associated with the Cognitive + Services Account. + :type commitment_plan_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, + commitment_plan_name=commitment_plan_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), + '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), + 'commitmentPlanName': self._serialize.url("commitment_plan_name", commitment_plan_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}/commitmentPlans/{commitmentPlanName}'} # type: ignore diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_commitment_tiers_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_commitment_tiers_operations.py new file mode 100644 index 000000000000..60324826dd91 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_commitment_tiers_operations.py @@ -0,0 +1,113 @@ +# 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 +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.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class CommitmentTiersOperations: + """CommitmentTiersOperations 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 + + def list( + self, + location: str, + **kwargs: Any + ) -> AsyncIterable["_models.CommitmentTierListResult"]: + """List Commitment Tiers. + + :param location: Resource location. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CommitmentTierListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cognitiveservices.models.CommitmentTierListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CommitmentTierListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-10-01" + 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), + 'location': self._serialize.url("location", location, 'str'), + } + 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('CommitmentTierListResult', 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/locations/{location}/commitmentTiers'} # type: ignore diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_deleted_accounts_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_deleted_accounts_operations.py index 6bbfe2fb3909..cff22f7543df 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_deleted_accounts_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_deleted_accounts_operations.py @@ -68,14 +68,14 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-30" + api_version = "2021-10-01" 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\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), '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), } @@ -118,14 +118,14 @@ async def _purge_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-30" + api_version = "2021-10-01" 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\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), '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), } @@ -203,7 +203,7 @@ def get_long_running_output(pipeline_response): 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\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), '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), } @@ -238,7 +238,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-30" + api_version = "2021-10-01" accept = "application/json" def prepare_request(next_link=None): diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_deployments_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_deployments_operations.py new file mode 100644 index 000000000000..08654d34f3ee --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_deployments_operations.py @@ -0,0 +1,437 @@ +# 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 DeploymentsOperations: + """DeploymentsOperations 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 + + def list( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.DeploymentListResult"]: + """Gets the deployments 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cognitiveservices.models.DeploymentListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-10-01" + 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 = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + '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') + + 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('DeploymentListResult', 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/deployments'} # type: ignore + + async def get( + self, + resource_group_name: str, + account_name: str, + deployment_name: str, + **kwargs: Any + ) -> "_models.Deployment": + """Gets the specified deployments 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 deployment_name: The name of the deployment associated with the Cognitive Services + Account. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Deployment, or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.Deployment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Deployment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-10-01" + accept = "application/json" + + # Construct URL + 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), + '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), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + 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('Deployment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/deployments/{deploymentName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + account_name: str, + deployment_name: str, + deployment: "_models.Deployment", + **kwargs: Any + ) -> "_models.Deployment": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Deployment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + 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), + '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), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + 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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(deployment, 'Deployment') + 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) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + 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 response.status_code == 200: + deserialized = self._deserialize('Deployment', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Deployment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/deployments/{deploymentName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + deployment_name: str, + deployment: "_models.Deployment", + **kwargs: Any + ) -> AsyncLROPoller["_models.Deployment"]: + """Update the state of specified deployments 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 deployment_name: The name of the deployment associated with the Cognitive Services + Account. + :type deployment_name: str + :param deployment: The deployment properties. + :type deployment: ~azure.mgmt.cognitiveservices.models.Deployment + :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 Deployment or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.Deployment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Deployment"] + 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, + deployment_name=deployment_name, + deployment=deployment, + 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('Deployment', 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), + '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), + 'deploymentName': self._serialize.url("deployment_name", deployment_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}/deployments/{deploymentName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + account_name: str, + deployment_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-10-01" + accept = "application/json" + + # Construct URL + 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), + '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), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + 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, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/deployments/{deploymentName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + account_name: str, + deployment_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified deployment 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 deployment_name: The name of the deployment associated with the Cognitive Services + Account. + :type deployment_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, + deployment_name=deployment_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), + '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), + 'deploymentName': self._serialize.url("deployment_name", deployment_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}/deployments/{deploymentName}'} # 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 a9e6772820d9..52dd882fb983 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 @@ -57,7 +57,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-30" + api_version = "2021-10-01" accept = "application/json" def prepare_request(next_link=None): 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 ce2aa844860a..1799f2b946ae 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 @@ -64,13 +64,13 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-30" + api_version = "2021-10-01" accept = "application/json" # Construct URL url = self.list.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\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), '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), } @@ -127,13 +127,13 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-30" + api_version = "2021-10-01" accept = "application/json" # Construct URL 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\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), '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'), @@ -178,14 +178,14 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-30" + api_version = "2021-10-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL 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\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), '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'), @@ -283,7 +283,7 @@ def get_long_running_output(pipeline_response): 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\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), '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'), @@ -315,13 +315,13 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-30" + api_version = "2021-10-01" accept = "application/json" # Construct URL 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\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), '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'), @@ -401,7 +401,7 @@ def get_long_running_output(pipeline_response): 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\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), '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'), 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 dd712d390ad4..967fd1b13c1b 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 @@ -62,13 +62,13 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-30" + api_version = "2021-10-01" accept = "application/json" # Construct URL url = self.list.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\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), '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), } 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 cc022df3d1ec..ddff419a1436 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 @@ -57,7 +57,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-30" + api_version = "2021-10-01" accept = "application/json" def prepare_request(next_link=None): 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 15893aa225d2..88e33579c793 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 @@ -18,6 +18,19 @@ from ._models_py3 import CallRateLimit from ._models_py3 import CheckDomainAvailabilityParameter from ._models_py3 import CheckSkuAvailabilityParameter + from ._models_py3 import CommitmentCost + from ._models_py3 import CommitmentPeriod + from ._models_py3 import CommitmentPlan + from ._models_py3 import CommitmentPlanListResult + from ._models_py3 import CommitmentPlanProperties + from ._models_py3 import CommitmentQuota + from ._models_py3 import CommitmentTier + from ._models_py3 import CommitmentTierListResult + from ._models_py3 import Deployment + from ._models_py3 import DeploymentListResult + from ._models_py3 import DeploymentModel + from ._models_py3 import DeploymentProperties + from ._models_py3 import DeploymentScaleSettings from ._models_py3 import DomainAvailability from ._models_py3 import Encryption from ._models_py3 import ErrorAdditionalInfo @@ -39,6 +52,7 @@ from ._models_py3 import PrivateLinkResourceListResult from ._models_py3 import PrivateLinkResourceProperties from ._models_py3 import PrivateLinkServiceConnectionState + from ._models_py3 import ProxyResource from ._models_py3 import QuotaLimit from ._models_py3 import RegenerateKeyParameters from ._models_py3 import RequestMatchPattern @@ -71,6 +85,19 @@ from ._models import CallRateLimit # type: ignore from ._models import CheckDomainAvailabilityParameter # type: ignore from ._models import CheckSkuAvailabilityParameter # type: ignore + from ._models import CommitmentCost # type: ignore + from ._models import CommitmentPeriod # type: ignore + from ._models import CommitmentPlan # type: ignore + from ._models import CommitmentPlanListResult # type: ignore + from ._models import CommitmentPlanProperties # type: ignore + from ._models import CommitmentQuota # type: ignore + from ._models import CommitmentTier # type: ignore + from ._models import CommitmentTierListResult # type: ignore + from ._models import Deployment # type: ignore + from ._models import DeploymentListResult # type: ignore + from ._models import DeploymentModel # type: ignore + from ._models import DeploymentProperties # type: ignore + from ._models import DeploymentScaleSettings # type: ignore from ._models import DomainAvailability # type: ignore from ._models import Encryption # type: ignore from ._models import ErrorAdditionalInfo # type: ignore @@ -92,6 +119,7 @@ from ._models import PrivateLinkResourceListResult # type: ignore from ._models import PrivateLinkResourceProperties # type: ignore from ._models import PrivateLinkServiceConnectionState # type: ignore + from ._models import ProxyResource # type: ignore from ._models import QuotaLimit # type: ignore from ._models import RegenerateKeyParameters # type: ignore from ._models import RequestMatchPattern # type: ignore @@ -116,6 +144,9 @@ from ._cognitive_services_management_client_enums import ( ActionType, CreatedByType, + DeploymentProvisioningState, + DeploymentScaleType, + HostingModel, KeyName, KeySource, NetworkRuleAction, @@ -144,6 +175,19 @@ 'CallRateLimit', 'CheckDomainAvailabilityParameter', 'CheckSkuAvailabilityParameter', + 'CommitmentCost', + 'CommitmentPeriod', + 'CommitmentPlan', + 'CommitmentPlanListResult', + 'CommitmentPlanProperties', + 'CommitmentQuota', + 'CommitmentTier', + 'CommitmentTierListResult', + 'Deployment', + 'DeploymentListResult', + 'DeploymentModel', + 'DeploymentProperties', + 'DeploymentScaleSettings', 'DomainAvailability', 'Encryption', 'ErrorAdditionalInfo', @@ -165,6 +209,7 @@ 'PrivateLinkResourceListResult', 'PrivateLinkResourceProperties', 'PrivateLinkServiceConnectionState', + 'ProxyResource', 'QuotaLimit', 'RegenerateKeyParameters', 'RequestMatchPattern', @@ -187,6 +232,9 @@ 'VirtualNetworkRule', 'ActionType', 'CreatedByType', + 'DeploymentProvisioningState', + 'DeploymentScaleType', + 'HostingModel', 'KeyName', 'KeySource', 'NetworkRuleAction', 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 a8370363caee..79c6d0be3be2 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 @@ -41,6 +41,31 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" +class DeploymentProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Gets the status of the resource at the time the operation was called. + """ + + ACCEPTED = "Accepted" + CREATING = "Creating" + DELETING = "Deleting" + MOVING = "Moving" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + +class DeploymentScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Deployment scale type. + """ + + MANUAL = "Manual" + +class HostingModel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Account hosting model. + """ + + WEB = "Web" + CONNECTED_CONTAINER = "ConnectedContainer" + DISCONNECTED_CONTAINER = "DisconnectedContainer" + class KeyName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """key name to generate (Key1|Key2) """ 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 82966d05638f..3add4d32205a 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 @@ -483,6 +483,8 @@ class CheckDomainAvailabilityParameter(msrest.serialization.Model): :type subdomain_name: str :param type: Required. The Type of the resource. :type type: str + :param kind: The Kind of the resource. + :type kind: str """ _validation = { @@ -493,6 +495,7 @@ class CheckDomainAvailabilityParameter(msrest.serialization.Model): _attribute_map = { 'subdomain_name': {'key': 'subdomainName', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, } def __init__( @@ -502,6 +505,7 @@ def __init__( super(CheckDomainAvailabilityParameter, self).__init__(**kwargs) self.subdomain_name = kwargs['subdomain_name'] self.type = kwargs['type'] + self.kind = kwargs.get('kind', None) class CheckSkuAvailabilityParameter(msrest.serialization.Model): @@ -539,6 +543,491 @@ def __init__( self.type = kwargs['type'] +class CommitmentCost(msrest.serialization.Model): + """Cognitive Services account commitment cost. + + :param commitment_meter_id: Commitment meter Id. + :type commitment_meter_id: str + :param overage_meter_id: Overage meter Id. + :type overage_meter_id: str + """ + + _attribute_map = { + 'commitment_meter_id': {'key': 'commitmentMeterId', 'type': 'str'}, + 'overage_meter_id': {'key': 'overageMeterId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CommitmentCost, self).__init__(**kwargs) + self.commitment_meter_id = kwargs.get('commitment_meter_id', None) + self.overage_meter_id = kwargs.get('overage_meter_id', None) + + +class CommitmentPeriod(msrest.serialization.Model): + """Cognitive Services account commitment period. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param tier: Commitment period commitment tier. + :type tier: str + :param count: Commitment period commitment count. + :type count: int + :ivar quota: Cognitive Services account commitment quota. + :vartype quota: ~azure.mgmt.cognitiveservices.models.CommitmentQuota + :ivar start_date: Commitment period start date. + :vartype start_date: str + :ivar end_date: Commitment period end date. + :vartype end_date: str + """ + + _validation = { + 'quota': {'readonly': True}, + 'start_date': {'readonly': True}, + 'end_date': {'readonly': True}, + } + + _attribute_map = { + 'tier': {'key': 'tier', 'type': 'str'}, + 'count': {'key': 'count', 'type': 'int'}, + 'quota': {'key': 'quota', 'type': 'CommitmentQuota'}, + 'start_date': {'key': 'startDate', 'type': 'str'}, + 'end_date': {'key': 'endDate', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CommitmentPeriod, self).__init__(**kwargs) + self.tier = kwargs.get('tier', None) + self.count = kwargs.get('count', None) + self.quota = None + self.start_date = None + self.end_date = None + + +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :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(ProxyResource, self).__init__(**kwargs) + + +class CommitmentPlan(ProxyResource): + """Cognitive Services account commitment plan. + + 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 system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.cognitiveservices.models.SystemData + :ivar etag: Resource Etag. + :vartype etag: str + :param properties: Properties of Cognitive Services account commitment plan. + :type properties: ~azure.mgmt.cognitiveservices.models.CommitmentPlanProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'CommitmentPlanProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(CommitmentPlan, self).__init__(**kwargs) + self.system_data = None + self.etag = None + self.properties = kwargs.get('properties', None) + + +class CommitmentPlanListResult(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. + + :param next_link: The link used to get the next page of CommitmentPlan. + :type next_link: str + :ivar value: Gets the list of Cognitive Services accounts CommitmentPlan and their properties. + :vartype value: list[~azure.mgmt.cognitiveservices.models.CommitmentPlan] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[CommitmentPlan]'}, + } + + def __init__( + self, + **kwargs + ): + super(CommitmentPlanListResult, self).__init__(**kwargs) + self.next_link = kwargs.get('next_link', None) + self.value = None + + +class CommitmentPlanProperties(msrest.serialization.Model): + """Properties of Cognitive Services account commitment plan. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param hosting_model: Account hosting model. Possible values include: "Web", + "ConnectedContainer", "DisconnectedContainer". + :type hosting_model: str or ~azure.mgmt.cognitiveservices.models.HostingModel + :param plan_type: Commitment plan type. + :type plan_type: str + :param current: Cognitive Services account commitment period. + :type current: ~azure.mgmt.cognitiveservices.models.CommitmentPeriod + :param auto_renew: AutoRenew commitment plan. + :type auto_renew: bool + :param next: Cognitive Services account commitment period. + :type next: ~azure.mgmt.cognitiveservices.models.CommitmentPeriod + :ivar last: Cognitive Services account commitment period. + :vartype last: ~azure.mgmt.cognitiveservices.models.CommitmentPeriod + """ + + _validation = { + 'last': {'readonly': True}, + } + + _attribute_map = { + 'hosting_model': {'key': 'hostingModel', 'type': 'str'}, + 'plan_type': {'key': 'planType', 'type': 'str'}, + 'current': {'key': 'current', 'type': 'CommitmentPeriod'}, + 'auto_renew': {'key': 'autoRenew', 'type': 'bool'}, + 'next': {'key': 'next', 'type': 'CommitmentPeriod'}, + 'last': {'key': 'last', 'type': 'CommitmentPeriod'}, + } + + def __init__( + self, + **kwargs + ): + super(CommitmentPlanProperties, self).__init__(**kwargs) + self.hosting_model = kwargs.get('hosting_model', None) + self.plan_type = kwargs.get('plan_type', None) + self.current = kwargs.get('current', None) + self.auto_renew = kwargs.get('auto_renew', None) + self.next = kwargs.get('next', None) + self.last = None + + +class CommitmentQuota(msrest.serialization.Model): + """Cognitive Services account commitment quota. + + :param quantity: Commitment quota quantity. + :type quantity: long + :param unit: Commitment quota unit. + :type unit: str + """ + + _attribute_map = { + 'quantity': {'key': 'quantity', 'type': 'long'}, + 'unit': {'key': 'unit', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CommitmentQuota, self).__init__(**kwargs) + self.quantity = kwargs.get('quantity', None) + self.unit = kwargs.get('unit', None) + + +class CommitmentTier(msrest.serialization.Model): + """Cognitive Services account commitment tier. + + :param kind: The Kind of the resource. + :type kind: str + :param sku_name: The name of the SKU. Ex - P3. It is typically a letter+number code. + :type sku_name: str + :param hosting_model: Account hosting model. Possible values include: "Web", + "ConnectedContainer", "DisconnectedContainer". + :type hosting_model: str or ~azure.mgmt.cognitiveservices.models.HostingModel + :param plan_type: Commitment plan type. + :type plan_type: str + :param tier: Commitment period commitment tier. + :type tier: str + :param max_count: Commitment period commitment max count. + :type max_count: int + :param quota: Cognitive Services account commitment quota. + :type quota: ~azure.mgmt.cognitiveservices.models.CommitmentQuota + :param cost: Cognitive Services account commitment cost. + :type cost: ~azure.mgmt.cognitiveservices.models.CommitmentCost + """ + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'sku_name': {'key': 'skuName', 'type': 'str'}, + 'hosting_model': {'key': 'hostingModel', 'type': 'str'}, + 'plan_type': {'key': 'planType', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'max_count': {'key': 'maxCount', 'type': 'int'}, + 'quota': {'key': 'quota', 'type': 'CommitmentQuota'}, + 'cost': {'key': 'cost', 'type': 'CommitmentCost'}, + } + + def __init__( + self, + **kwargs + ): + super(CommitmentTier, self).__init__(**kwargs) + self.kind = kwargs.get('kind', None) + self.sku_name = kwargs.get('sku_name', None) + self.hosting_model = kwargs.get('hosting_model', None) + self.plan_type = kwargs.get('plan_type', None) + self.tier = kwargs.get('tier', None) + self.max_count = kwargs.get('max_count', None) + self.quota = kwargs.get('quota', None) + self.cost = kwargs.get('cost', None) + + +class CommitmentTierListResult(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. + + :param next_link: The link used to get the next page of CommitmentTier. + :type next_link: str + :ivar value: Gets the list of Cognitive Services accounts CommitmentTier and their properties. + :vartype value: list[~azure.mgmt.cognitiveservices.models.CommitmentTier] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[CommitmentTier]'}, + } + + def __init__( + self, + **kwargs + ): + super(CommitmentTierListResult, self).__init__(**kwargs) + self.next_link = kwargs.get('next_link', None) + self.value = None + + +class Deployment(ProxyResource): + """Cognitive Services account deployment. + + 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 system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.cognitiveservices.models.SystemData + :ivar etag: Resource Etag. + :vartype etag: str + :param properties: Properties of Cognitive Services account deployment. + :type properties: ~azure.mgmt.cognitiveservices.models.DeploymentProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeploymentProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(Deployment, self).__init__(**kwargs) + self.system_data = None + self.etag = None + self.properties = kwargs.get('properties', None) + + +class DeploymentListResult(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. + + :param next_link: The link used to get the next page of Deployment. + :type next_link: str + :ivar value: Gets the list of Cognitive Services accounts Deployment and their properties. + :vartype value: list[~azure.mgmt.cognitiveservices.models.Deployment] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[Deployment]'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentListResult, self).__init__(**kwargs) + self.next_link = kwargs.get('next_link', None) + self.value = None + + +class DeploymentModel(msrest.serialization.Model): + """Properties of Cognitive Services account deployment model. + + :param format: Deployment model format. + :type format: str + :param name: Deployment model name. + :type name: str + :param version: Deployment model version. + :type version: str + """ + + _attribute_map = { + 'format': {'key': 'format', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentModel, self).__init__(**kwargs) + self.format = kwargs.get('format', None) + self.name = kwargs.get('name', None) + self.version = kwargs.get('version', None) + + +class DeploymentProperties(msrest.serialization.Model): + """Properties of Cognitive Services account deployment. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: Gets the status of the resource at the time the operation was called. + Possible values include: "Accepted", "Creating", "Deleting", "Moving", "Failed", "Succeeded". + :vartype provisioning_state: str or + ~azure.mgmt.cognitiveservices.models.DeploymentProvisioningState + :param model: Properties of Cognitive Services account deployment model. + :type model: ~azure.mgmt.cognitiveservices.models.DeploymentModel + :param scale_settings: Properties of Cognitive Services account deployment model. + :type scale_settings: ~azure.mgmt.cognitiveservices.models.DeploymentScaleSettings + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'model': {'key': 'model', 'type': 'DeploymentModel'}, + 'scale_settings': {'key': 'scaleSettings', 'type': 'DeploymentScaleSettings'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.model = kwargs.get('model', None) + self.scale_settings = kwargs.get('scale_settings', None) + + +class DeploymentScaleSettings(msrest.serialization.Model): + """Properties of Cognitive Services account deployment model. + + :param scale_type: Deployment scale type. Possible values include: "Manual". + :type scale_type: str or ~azure.mgmt.cognitiveservices.models.DeploymentScaleType + :param capacity: Deployment capacity. + :type capacity: int + """ + + _attribute_map = { + 'scale_type': {'key': 'scaleType', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentScaleSettings, self).__init__(**kwargs) + self.scale_type = kwargs.get('scale_type', None) + self.capacity = kwargs.get('capacity', None) + + class DomainAvailability(msrest.serialization.Model): """Domain availability. @@ -550,6 +1039,8 @@ class DomainAvailability(msrest.serialization.Model): :type subdomain_name: str :param type: The Type of the resource. :type type: str + :param kind: The Kind of the resource. + :type kind: str """ _attribute_map = { @@ -557,6 +1048,7 @@ class DomainAvailability(msrest.serialization.Model): 'reason': {'key': 'reason', 'type': 'str'}, 'subdomain_name': {'key': 'subdomainName', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, } def __init__( @@ -568,6 +1060,7 @@ def __init__( self.reason = kwargs.get('reason', None) self.subdomain_name = kwargs.get('subdomain_name', None) self.type = kwargs.get('type', None) + self.kind = kwargs.get('kind', None) class Encryption(msrest.serialization.Model): 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 30f9907ba7c1..0090c012f4e5 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 @@ -533,6 +533,8 @@ class CheckDomainAvailabilityParameter(msrest.serialization.Model): :type subdomain_name: str :param type: Required. The Type of the resource. :type type: str + :param kind: The Kind of the resource. + :type kind: str """ _validation = { @@ -543,6 +545,7 @@ class CheckDomainAvailabilityParameter(msrest.serialization.Model): _attribute_map = { 'subdomain_name': {'key': 'subdomainName', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, } def __init__( @@ -550,11 +553,13 @@ def __init__( *, subdomain_name: str, type: str, + kind: Optional[str] = None, **kwargs ): super(CheckDomainAvailabilityParameter, self).__init__(**kwargs) self.subdomain_name = subdomain_name self.type = type + self.kind = kind class CheckSkuAvailabilityParameter(msrest.serialization.Model): @@ -596,6 +601,535 @@ def __init__( self.type = type +class CommitmentCost(msrest.serialization.Model): + """Cognitive Services account commitment cost. + + :param commitment_meter_id: Commitment meter Id. + :type commitment_meter_id: str + :param overage_meter_id: Overage meter Id. + :type overage_meter_id: str + """ + + _attribute_map = { + 'commitment_meter_id': {'key': 'commitmentMeterId', 'type': 'str'}, + 'overage_meter_id': {'key': 'overageMeterId', 'type': 'str'}, + } + + def __init__( + self, + *, + commitment_meter_id: Optional[str] = None, + overage_meter_id: Optional[str] = None, + **kwargs + ): + super(CommitmentCost, self).__init__(**kwargs) + self.commitment_meter_id = commitment_meter_id + self.overage_meter_id = overage_meter_id + + +class CommitmentPeriod(msrest.serialization.Model): + """Cognitive Services account commitment period. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param tier: Commitment period commitment tier. + :type tier: str + :param count: Commitment period commitment count. + :type count: int + :ivar quota: Cognitive Services account commitment quota. + :vartype quota: ~azure.mgmt.cognitiveservices.models.CommitmentQuota + :ivar start_date: Commitment period start date. + :vartype start_date: str + :ivar end_date: Commitment period end date. + :vartype end_date: str + """ + + _validation = { + 'quota': {'readonly': True}, + 'start_date': {'readonly': True}, + 'end_date': {'readonly': True}, + } + + _attribute_map = { + 'tier': {'key': 'tier', 'type': 'str'}, + 'count': {'key': 'count', 'type': 'int'}, + 'quota': {'key': 'quota', 'type': 'CommitmentQuota'}, + 'start_date': {'key': 'startDate', 'type': 'str'}, + 'end_date': {'key': 'endDate', 'type': 'str'}, + } + + def __init__( + self, + *, + tier: Optional[str] = None, + count: Optional[int] = None, + **kwargs + ): + super(CommitmentPeriod, self).__init__(**kwargs) + self.tier = tier + self.count = count + self.quota = None + self.start_date = None + self.end_date = None + + +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :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(ProxyResource, self).__init__(**kwargs) + + +class CommitmentPlan(ProxyResource): + """Cognitive Services account commitment plan. + + 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 system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.cognitiveservices.models.SystemData + :ivar etag: Resource Etag. + :vartype etag: str + :param properties: Properties of Cognitive Services account commitment plan. + :type properties: ~azure.mgmt.cognitiveservices.models.CommitmentPlanProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'CommitmentPlanProperties'}, + } + + def __init__( + self, + *, + properties: Optional["CommitmentPlanProperties"] = None, + **kwargs + ): + super(CommitmentPlan, self).__init__(**kwargs) + self.system_data = None + self.etag = None + self.properties = properties + + +class CommitmentPlanListResult(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. + + :param next_link: The link used to get the next page of CommitmentPlan. + :type next_link: str + :ivar value: Gets the list of Cognitive Services accounts CommitmentPlan and their properties. + :vartype value: list[~azure.mgmt.cognitiveservices.models.CommitmentPlan] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[CommitmentPlan]'}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + **kwargs + ): + super(CommitmentPlanListResult, self).__init__(**kwargs) + self.next_link = next_link + self.value = None + + +class CommitmentPlanProperties(msrest.serialization.Model): + """Properties of Cognitive Services account commitment plan. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param hosting_model: Account hosting model. Possible values include: "Web", + "ConnectedContainer", "DisconnectedContainer". + :type hosting_model: str or ~azure.mgmt.cognitiveservices.models.HostingModel + :param plan_type: Commitment plan type. + :type plan_type: str + :param current: Cognitive Services account commitment period. + :type current: ~azure.mgmt.cognitiveservices.models.CommitmentPeriod + :param auto_renew: AutoRenew commitment plan. + :type auto_renew: bool + :param next: Cognitive Services account commitment period. + :type next: ~azure.mgmt.cognitiveservices.models.CommitmentPeriod + :ivar last: Cognitive Services account commitment period. + :vartype last: ~azure.mgmt.cognitiveservices.models.CommitmentPeriod + """ + + _validation = { + 'last': {'readonly': True}, + } + + _attribute_map = { + 'hosting_model': {'key': 'hostingModel', 'type': 'str'}, + 'plan_type': {'key': 'planType', 'type': 'str'}, + 'current': {'key': 'current', 'type': 'CommitmentPeriod'}, + 'auto_renew': {'key': 'autoRenew', 'type': 'bool'}, + 'next': {'key': 'next', 'type': 'CommitmentPeriod'}, + 'last': {'key': 'last', 'type': 'CommitmentPeriod'}, + } + + def __init__( + self, + *, + hosting_model: Optional[Union[str, "HostingModel"]] = None, + plan_type: Optional[str] = None, + current: Optional["CommitmentPeriod"] = None, + auto_renew: Optional[bool] = None, + next: Optional["CommitmentPeriod"] = None, + **kwargs + ): + super(CommitmentPlanProperties, self).__init__(**kwargs) + self.hosting_model = hosting_model + self.plan_type = plan_type + self.current = current + self.auto_renew = auto_renew + self.next = next + self.last = None + + +class CommitmentQuota(msrest.serialization.Model): + """Cognitive Services account commitment quota. + + :param quantity: Commitment quota quantity. + :type quantity: long + :param unit: Commitment quota unit. + :type unit: str + """ + + _attribute_map = { + 'quantity': {'key': 'quantity', 'type': 'long'}, + 'unit': {'key': 'unit', 'type': 'str'}, + } + + def __init__( + self, + *, + quantity: Optional[int] = None, + unit: Optional[str] = None, + **kwargs + ): + super(CommitmentQuota, self).__init__(**kwargs) + self.quantity = quantity + self.unit = unit + + +class CommitmentTier(msrest.serialization.Model): + """Cognitive Services account commitment tier. + + :param kind: The Kind of the resource. + :type kind: str + :param sku_name: The name of the SKU. Ex - P3. It is typically a letter+number code. + :type sku_name: str + :param hosting_model: Account hosting model. Possible values include: "Web", + "ConnectedContainer", "DisconnectedContainer". + :type hosting_model: str or ~azure.mgmt.cognitiveservices.models.HostingModel + :param plan_type: Commitment plan type. + :type plan_type: str + :param tier: Commitment period commitment tier. + :type tier: str + :param max_count: Commitment period commitment max count. + :type max_count: int + :param quota: Cognitive Services account commitment quota. + :type quota: ~azure.mgmt.cognitiveservices.models.CommitmentQuota + :param cost: Cognitive Services account commitment cost. + :type cost: ~azure.mgmt.cognitiveservices.models.CommitmentCost + """ + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'sku_name': {'key': 'skuName', 'type': 'str'}, + 'hosting_model': {'key': 'hostingModel', 'type': 'str'}, + 'plan_type': {'key': 'planType', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'max_count': {'key': 'maxCount', 'type': 'int'}, + 'quota': {'key': 'quota', 'type': 'CommitmentQuota'}, + 'cost': {'key': 'cost', 'type': 'CommitmentCost'}, + } + + def __init__( + self, + *, + kind: Optional[str] = None, + sku_name: Optional[str] = None, + hosting_model: Optional[Union[str, "HostingModel"]] = None, + plan_type: Optional[str] = None, + tier: Optional[str] = None, + max_count: Optional[int] = None, + quota: Optional["CommitmentQuota"] = None, + cost: Optional["CommitmentCost"] = None, + **kwargs + ): + super(CommitmentTier, self).__init__(**kwargs) + self.kind = kind + self.sku_name = sku_name + self.hosting_model = hosting_model + self.plan_type = plan_type + self.tier = tier + self.max_count = max_count + self.quota = quota + self.cost = cost + + +class CommitmentTierListResult(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. + + :param next_link: The link used to get the next page of CommitmentTier. + :type next_link: str + :ivar value: Gets the list of Cognitive Services accounts CommitmentTier and their properties. + :vartype value: list[~azure.mgmt.cognitiveservices.models.CommitmentTier] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[CommitmentTier]'}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + **kwargs + ): + super(CommitmentTierListResult, self).__init__(**kwargs) + self.next_link = next_link + self.value = None + + +class Deployment(ProxyResource): + """Cognitive Services account deployment. + + 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 system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.cognitiveservices.models.SystemData + :ivar etag: Resource Etag. + :vartype etag: str + :param properties: Properties of Cognitive Services account deployment. + :type properties: ~azure.mgmt.cognitiveservices.models.DeploymentProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeploymentProperties'}, + } + + def __init__( + self, + *, + properties: Optional["DeploymentProperties"] = None, + **kwargs + ): + super(Deployment, self).__init__(**kwargs) + self.system_data = None + self.etag = None + self.properties = properties + + +class DeploymentListResult(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. + + :param next_link: The link used to get the next page of Deployment. + :type next_link: str + :ivar value: Gets the list of Cognitive Services accounts Deployment and their properties. + :vartype value: list[~azure.mgmt.cognitiveservices.models.Deployment] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[Deployment]'}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + **kwargs + ): + super(DeploymentListResult, self).__init__(**kwargs) + self.next_link = next_link + self.value = None + + +class DeploymentModel(msrest.serialization.Model): + """Properties of Cognitive Services account deployment model. + + :param format: Deployment model format. + :type format: str + :param name: Deployment model name. + :type name: str + :param version: Deployment model version. + :type version: str + """ + + _attribute_map = { + 'format': {'key': 'format', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + } + + def __init__( + self, + *, + format: Optional[str] = None, + name: Optional[str] = None, + version: Optional[str] = None, + **kwargs + ): + super(DeploymentModel, self).__init__(**kwargs) + self.format = format + self.name = name + self.version = version + + +class DeploymentProperties(msrest.serialization.Model): + """Properties of Cognitive Services account deployment. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: Gets the status of the resource at the time the operation was called. + Possible values include: "Accepted", "Creating", "Deleting", "Moving", "Failed", "Succeeded". + :vartype provisioning_state: str or + ~azure.mgmt.cognitiveservices.models.DeploymentProvisioningState + :param model: Properties of Cognitive Services account deployment model. + :type model: ~azure.mgmt.cognitiveservices.models.DeploymentModel + :param scale_settings: Properties of Cognitive Services account deployment model. + :type scale_settings: ~azure.mgmt.cognitiveservices.models.DeploymentScaleSettings + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'model': {'key': 'model', 'type': 'DeploymentModel'}, + 'scale_settings': {'key': 'scaleSettings', 'type': 'DeploymentScaleSettings'}, + } + + def __init__( + self, + *, + model: Optional["DeploymentModel"] = None, + scale_settings: Optional["DeploymentScaleSettings"] = None, + **kwargs + ): + super(DeploymentProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.model = model + self.scale_settings = scale_settings + + +class DeploymentScaleSettings(msrest.serialization.Model): + """Properties of Cognitive Services account deployment model. + + :param scale_type: Deployment scale type. Possible values include: "Manual". + :type scale_type: str or ~azure.mgmt.cognitiveservices.models.DeploymentScaleType + :param capacity: Deployment capacity. + :type capacity: int + """ + + _attribute_map = { + 'scale_type': {'key': 'scaleType', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + } + + def __init__( + self, + *, + scale_type: Optional[Union[str, "DeploymentScaleType"]] = None, + capacity: Optional[int] = None, + **kwargs + ): + super(DeploymentScaleSettings, self).__init__(**kwargs) + self.scale_type = scale_type + self.capacity = capacity + + class DomainAvailability(msrest.serialization.Model): """Domain availability. @@ -607,6 +1141,8 @@ class DomainAvailability(msrest.serialization.Model): :type subdomain_name: str :param type: The Type of the resource. :type type: str + :param kind: The Kind of the resource. + :type kind: str """ _attribute_map = { @@ -614,6 +1150,7 @@ class DomainAvailability(msrest.serialization.Model): 'reason': {'key': 'reason', 'type': 'str'}, 'subdomain_name': {'key': 'subdomainName', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, } def __init__( @@ -623,6 +1160,7 @@ def __init__( reason: Optional[str] = None, subdomain_name: Optional[str] = None, type: Optional[str] = None, + kind: Optional[str] = None, **kwargs ): super(DomainAvailability, self).__init__(**kwargs) @@ -630,6 +1168,7 @@ def __init__( self.reason = reason self.subdomain_name = subdomain_name self.type = type + self.kind = kind class Encryption(msrest.serialization.Model): 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 79bc52d9dd8f..b2de36c75c14 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 @@ -11,8 +11,11 @@ from ._resource_skus_operations import ResourceSkusOperations from ._operations import Operations from ._cognitive_services_management_client_operations import CognitiveServicesManagementClientOperationsMixin +from ._commitment_tiers_operations import CommitmentTiersOperations from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._deployments_operations import DeploymentsOperations +from ._commitment_plans_operations import CommitmentPlansOperations __all__ = [ 'AccountsOperations', @@ -20,6 +23,9 @@ 'ResourceSkusOperations', 'Operations', 'CognitiveServicesManagementClientOperationsMixin', + 'CommitmentTiersOperations', 'PrivateEndpointConnectionsOperations', 'PrivateLinkResourcesOperations', + 'DeploymentsOperations', + 'CommitmentPlansOperations', ] 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 7ce476259722..ff57f46a9642 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 @@ -60,14 +60,14 @@ def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-30" + api_version = "2021-10-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL 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\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), '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), } @@ -163,7 +163,7 @@ def get_long_running_output(pipeline_response): 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\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), '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), } @@ -195,14 +195,14 @@ def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-30" + api_version = "2021-10-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL 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\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), '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), } @@ -294,7 +294,7 @@ def get_long_running_output(pipeline_response): 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\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), '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), } @@ -325,13 +325,13 @@ def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-30" + api_version = "2021-10-01" accept = "application/json" # Construct URL 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\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), '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), } @@ -405,7 +405,7 @@ def get_long_running_output(pipeline_response): 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\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), '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), } @@ -447,13 +447,13 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-30" + api_version = "2021-10-01" accept = "application/json" # Construct URL 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\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), '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), } @@ -504,7 +504,7 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-30" + api_version = "2021-10-01" accept = "application/json" def prepare_request(next_link=None): @@ -516,7 +516,7 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_resource_group.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\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), '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) @@ -573,7 +573,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-30" + api_version = "2021-10-01" accept = "application/json" def prepare_request(next_link=None): @@ -647,13 +647,13 @@ def list_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-30" + api_version = "2021-10-01" accept = "application/json" # Construct URL url = self.list_keys.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\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), '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), } @@ -712,14 +712,14 @@ def regenerate_key( error_map.update(kwargs.pop('error_map', {})) _parameters = _models.RegenerateKeyParameters(key_name=key_name) - api_version = "2021-04-30" + api_version = "2021-10-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL url = self.regenerate_key.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\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), '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), } @@ -777,13 +777,13 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-30" + api_version = "2021-10-01" accept = "application/json" # Construct URL url = self.list_skus.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\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), '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), } @@ -841,13 +841,13 @@ def list_usages( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-30" + api_version = "2021-10-01" accept = "application/json" # Construct URL 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\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), '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), } 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 a42311dda574..ab3055670978 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 @@ -55,7 +55,7 @@ def check_sku_availability( error_map.update(kwargs.pop('error_map', {})) _parameters = _models.CheckSkuAvailabilityParameter(skus=skus, kind=kind, type=type) - api_version = "2021-04-30" + api_version = "2021-10-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -100,6 +100,7 @@ def check_domain_availability( self, subdomain_name, # type: str type, # type: str + kind=None, # type: Optional[str] **kwargs # type: Any ): # type: (...) -> "_models.DomainAvailability" @@ -109,6 +110,8 @@ def check_domain_availability( :type subdomain_name: str :param type: The Type of the resource. :type type: str + :param kind: The Kind of the resource. + :type kind: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DomainAvailability, or the result of cls(response) :rtype: ~azure.mgmt.cognitiveservices.models.DomainAvailability @@ -120,8 +123,8 @@ def check_domain_availability( } error_map.update(kwargs.pop('error_map', {})) - _parameters = _models.CheckDomainAvailabilityParameter(subdomain_name=subdomain_name, type=type) - api_version = "2021-04-30" + _parameters = _models.CheckDomainAvailabilityParameter(subdomain_name=subdomain_name, type=type, kind=kind) + api_version = "2021-10-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_commitment_plans_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_commitment_plans_operations.py new file mode 100644 index 000000000000..ac596be7642c --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_commitment_plans_operations.py @@ -0,0 +1,385 @@ +# 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 CommitmentPlansOperations(object): + """CommitmentPlansOperations 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 list( + self, + resource_group_name, # type: str + account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.CommitmentPlanListResult"] + """Gets the commitmentPlans 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CommitmentPlanListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.CommitmentPlanListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CommitmentPlanListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-10-01" + 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 = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + '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') + + 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('CommitmentPlanListResult', 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/commitmentPlans'} # type: ignore + + def get( + self, + resource_group_name, # type: str + account_name, # type: str + commitment_plan_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.CommitmentPlan" + """Gets the specified commitmentPlans 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 commitment_plan_name: The name of the commitmentPlan associated with the Cognitive + Services Account. + :type commitment_plan_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CommitmentPlan, or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.CommitmentPlan + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CommitmentPlan"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-10-01" + accept = "application/json" + + # Construct URL + 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), + '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), + 'commitmentPlanName': self._serialize.url("commitment_plan_name", commitment_plan_name, 'str'), + } + 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('CommitmentPlan', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/commitmentPlans/{commitmentPlanName}'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + account_name, # type: str + commitment_plan_name, # type: str + commitment_plan, # type: "_models.CommitmentPlan" + **kwargs # type: Any + ): + # type: (...) -> "_models.CommitmentPlan" + """Update the state of specified commitmentPlans 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 commitment_plan_name: The name of the commitmentPlan associated with the Cognitive + Services Account. + :type commitment_plan_name: str + :param commitment_plan: The commitmentPlan properties. + :type commitment_plan: ~azure.mgmt.cognitiveservices.models.CommitmentPlan + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CommitmentPlan, or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.CommitmentPlan + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CommitmentPlan"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + '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), + 'commitmentPlanName': self._serialize.url("commitment_plan_name", commitment_plan_name, 'str'), + } + 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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(commitment_plan, 'CommitmentPlan') + 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) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + 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 response.status_code == 200: + deserialized = self._deserialize('CommitmentPlan', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('CommitmentPlan', 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}/commitmentPlans/{commitmentPlanName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + account_name, # type: str + commitment_plan_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-10-01" + accept = "application/json" + + # Construct URL + 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), + '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), + 'commitmentPlanName': self._serialize.url("commitment_plan_name", commitment_plan_name, 'str'), + } + 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, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/commitmentPlans/{commitmentPlanName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + account_name, # type: str + commitment_plan_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes the specified commitmentPlan 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 commitment_plan_name: The name of the commitmentPlan associated with the Cognitive + Services Account. + :type commitment_plan_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, + commitment_plan_name=commitment_plan_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), + '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), + 'commitmentPlanName': self._serialize.url("commitment_plan_name", commitment_plan_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}/commitmentPlans/{commitmentPlanName}'} # type: ignore diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_commitment_tiers_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_commitment_tiers_operations.py new file mode 100644 index 000000000000..1113d4064c6b --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_commitment_tiers_operations.py @@ -0,0 +1,118 @@ +# 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.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class CommitmentTiersOperations(object): + """CommitmentTiersOperations 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 list( + self, + location, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.CommitmentTierListResult"] + """List Commitment Tiers. + + :param location: Resource location. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CommitmentTierListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.CommitmentTierListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CommitmentTierListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-10-01" + 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), + 'location': self._serialize.url("location", location, 'str'), + } + 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('CommitmentTierListResult', 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/locations/{location}/commitmentTiers'} # type: ignore diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_deleted_accounts_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_deleted_accounts_operations.py index 72caa9730757..6625616fa48e 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_deleted_accounts_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_deleted_accounts_operations.py @@ -73,14 +73,14 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-30" + api_version = "2021-10-01" 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\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), '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), } @@ -124,14 +124,14 @@ def _purge_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-30" + api_version = "2021-10-01" 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\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), '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), } @@ -210,7 +210,7 @@ def get_long_running_output(pipeline_response): 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\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), '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), } @@ -246,7 +246,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-30" + api_version = "2021-10-01" accept = "application/json" def prepare_request(next_link=None): diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_deployments_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_deployments_operations.py new file mode 100644 index 000000000000..41a60cd392ab --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_deployments_operations.py @@ -0,0 +1,447 @@ +# 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 DeploymentsOperations(object): + """DeploymentsOperations 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 list( + self, + resource_group_name, # type: str + account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DeploymentListResult"] + """Gets the deployments 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.DeploymentListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-10-01" + 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 = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + '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') + + 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('DeploymentListResult', 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/deployments'} # type: ignore + + def get( + self, + resource_group_name, # type: str + account_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Deployment" + """Gets the specified deployments 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 deployment_name: The name of the deployment associated with the Cognitive Services + Account. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Deployment, or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.Deployment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Deployment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-10-01" + accept = "application/json" + + # Construct URL + 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), + '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), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + 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('Deployment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/deployments/{deploymentName}'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + account_name, # type: str + deployment_name, # type: str + deployment, # type: "_models.Deployment" + **kwargs # type: Any + ): + # type: (...) -> "_models.Deployment" + cls = kwargs.pop('cls', None) # type: ClsType["_models.Deployment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + 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), + '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), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + 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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(deployment, 'Deployment') + 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) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + 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 response.status_code == 200: + deserialized = self._deserialize('Deployment', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Deployment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/deployments/{deploymentName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + account_name, # type: str + deployment_name, # type: str + deployment, # type: "_models.Deployment" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.Deployment"] + """Update the state of specified deployments 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 deployment_name: The name of the deployment associated with the Cognitive Services + Account. + :type deployment_name: str + :param deployment: The deployment properties. + :type deployment: ~azure.mgmt.cognitiveservices.models.Deployment + :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 Deployment or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Deployment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Deployment"] + 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, + deployment_name=deployment_name, + deployment=deployment, + 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('Deployment', 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), + '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), + 'deploymentName': self._serialize.url("deployment_name", deployment_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}/deployments/{deploymentName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + account_name, # type: str + deployment_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-10-01" + accept = "application/json" + + # Construct URL + 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), + '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), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + 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, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/deployments/{deploymentName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + account_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes the specified deployment 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 deployment_name: The name of the deployment associated with the Cognitive Services + Account. + :type deployment_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, + deployment_name=deployment_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), + '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), + 'deploymentName': self._serialize.url("deployment_name", deployment_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}/deployments/{deploymentName}'} # 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 34d6f91f6743..39286dbd94ce 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 @@ -62,7 +62,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-30" + api_version = "2021-10-01" accept = "application/json" def prepare_request(next_link=None): 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 5cf9df2709d6..a138e7b1de42 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 @@ -69,13 +69,13 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-30" + api_version = "2021-10-01" accept = "application/json" # Construct URL url = self.list.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\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), '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), } @@ -133,13 +133,13 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-30" + api_version = "2021-10-01" accept = "application/json" # Construct URL 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\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), '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'), @@ -185,14 +185,14 @@ def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-30" + api_version = "2021-10-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" # Construct URL 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\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), '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'), @@ -291,7 +291,7 @@ def get_long_running_output(pipeline_response): 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\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), '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'), @@ -324,13 +324,13 @@ def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-30" + api_version = "2021-10-01" accept = "application/json" # Construct URL 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\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), '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'), @@ -411,7 +411,7 @@ def get_long_running_output(pipeline_response): 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\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), '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'), 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 5a133ef4b58b..c485187b53fe 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,13 +67,13 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-30" + api_version = "2021-10-01" accept = "application/json" # Construct URL url = self.list.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\._\(\)]+$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), '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), } 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 336783d45fd6..8cf6c81c4a05 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 @@ -62,7 +62,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-30" + api_version = "2021-10-01" accept = "application/json" def prepare_request(next_link=None):