diff --git a/azure-mgmt-cognitiveservices/MANIFEST.in b/azure-mgmt-cognitiveservices/MANIFEST.in index 6ceb27f7a96e..e4884efef41b 100644 --- a/azure-mgmt-cognitiveservices/MANIFEST.in +++ b/azure-mgmt-cognitiveservices/MANIFEST.in @@ -1,3 +1,4 @@ +recursive-include tests *.py *.yaml include *.rst include azure/__init__.py include azure/mgmt/__init__.py diff --git a/azure-mgmt-cognitiveservices/README.rst b/azure-mgmt-cognitiveservices/README.rst index 70de0c6a776f..be54b05df719 100644 --- a/azure-mgmt-cognitiveservices/README.rst +++ b/azure-mgmt-cognitiveservices/README.rst @@ -14,25 +14,6 @@ For the older Azure Service Management (ASM) libraries, see For a more complete set of Azure libraries, see the `azure `__ bundle package. -Compatibility -============= - -**IMPORTANT**: If you have an earlier version of the azure package -(version < 1.0), you should uninstall it before installing this package. - -You can check the version using pip: - -.. code:: shell - - pip freeze - -If you see azure==0.11.0 (or any version below 1.0), uninstall it first: - -.. code:: shell - - pip uninstall azure - - Usage ===== @@ -47,3 +28,6 @@ Provide Feedback If you encounter any bugs or have suggestions, please file an issue in the `Issues `__ section of the project. + + +.. image:: https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-cognitiveservices%2FREADME.png diff --git a/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/cognitive_services_management_client.py b/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/cognitive_services_management_client.py index e2c25cc61bb5..23fe452dcb7d 100644 --- a/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/cognitive_services_management_client.py +++ b/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/cognitive_services_management_client.py @@ -17,6 +17,7 @@ from .operations.resource_skus_operations import ResourceSkusOperations from .operations.operations import Operations from .operations.check_sku_availability_operations import CheckSkuAvailabilityOperations +from .operations.locations_operations import LocationsOperations from . import models @@ -66,6 +67,8 @@ class CognitiveServicesManagementClient(SDKClient): :vartype operations: azure.mgmt.cognitiveservices.operations.Operations :ivar check_sku_availability: CheckSkuAvailability operations :vartype check_sku_availability: azure.mgmt.cognitiveservices.operations.CheckSkuAvailabilityOperations + :ivar locations: Locations operations + :vartype locations: azure.mgmt.cognitiveservices.operations.LocationsOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -94,3 +97,5 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.check_sku_availability = CheckSkuAvailabilityOperations( self._client, self.config, self._serialize, self._deserialize) + self.locations = LocationsOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/__init__.py b/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/__init__.py index 2468499507fa..b6865fe51db7 100644 --- a/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/__init__.py +++ b/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/__init__.py @@ -26,8 +26,10 @@ from .operation_display_info_py3 import OperationDisplayInfo from .operation_entity_py3 import OperationEntity from .check_sku_availability_parameter_py3 import CheckSkuAvailabilityParameter + from .check_domain_availability_parameter_py3 import CheckDomainAvailabilityParameter from .check_sku_availability_result_py3 import CheckSkuAvailabilityResult from .check_sku_availability_result_list_py3 import CheckSkuAvailabilityResultList + from .check_domain_availability_result_py3 import CheckDomainAvailabilityResult from .resource_sku_restriction_info_py3 import ResourceSkuRestrictionInfo from .resource_sku_restrictions_py3 import ResourceSkuRestrictions from .resource_sku_py3 import ResourceSku @@ -48,8 +50,10 @@ from .operation_display_info import OperationDisplayInfo from .operation_entity import OperationEntity from .check_sku_availability_parameter import CheckSkuAvailabilityParameter + from .check_domain_availability_parameter import CheckDomainAvailabilityParameter from .check_sku_availability_result import CheckSkuAvailabilityResult from .check_sku_availability_result_list import CheckSkuAvailabilityResultList + from .check_domain_availability_result import CheckDomainAvailabilityResult from .resource_sku_restriction_info import ResourceSkuRestrictionInfo from .resource_sku_restrictions import ResourceSkuRestrictions from .resource_sku import ResourceSku @@ -83,8 +87,10 @@ 'OperationDisplayInfo', 'OperationEntity', 'CheckSkuAvailabilityParameter', + 'CheckDomainAvailabilityParameter', 'CheckSkuAvailabilityResult', 'CheckSkuAvailabilityResultList', + 'CheckDomainAvailabilityResult', 'ResourceSkuRestrictionInfo', 'ResourceSkuRestrictions', 'ResourceSku', diff --git a/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/check_domain_availability_parameter.py b/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/check_domain_availability_parameter.py new file mode 100644 index 000000000000..bba2be6ea410 --- /dev/null +++ b/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/check_domain_availability_parameter.py @@ -0,0 +1,39 @@ +# 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 msrest.serialization import Model + + +class CheckDomainAvailabilityParameter(Model): + """Check Domain availability parameter. + + All required parameters must be populated in order to send to Azure. + + :param subdomain_name: Required. The subdomain name to use. + :type subdomain_name: str + :param type: Required. The Type of the resource. + :type type: str + """ + + _validation = { + 'subdomain_name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'subdomain_name': {'key': 'subdomainName', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(CheckDomainAvailabilityParameter, self).__init__(**kwargs) + self.subdomain_name = kwargs.get('subdomain_name', None) + self.type = kwargs.get('type', None) diff --git a/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/check_domain_availability_parameter_py3.py b/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/check_domain_availability_parameter_py3.py new file mode 100644 index 000000000000..169ae09b66fd --- /dev/null +++ b/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/check_domain_availability_parameter_py3.py @@ -0,0 +1,39 @@ +# 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 msrest.serialization import Model + + +class CheckDomainAvailabilityParameter(Model): + """Check Domain availability parameter. + + All required parameters must be populated in order to send to Azure. + + :param subdomain_name: Required. The subdomain name to use. + :type subdomain_name: str + :param type: Required. The Type of the resource. + :type type: str + """ + + _validation = { + 'subdomain_name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'subdomain_name': {'key': 'subdomainName', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, *, subdomain_name: str, type: str, **kwargs) -> None: + super(CheckDomainAvailabilityParameter, self).__init__(**kwargs) + self.subdomain_name = subdomain_name + self.type = type diff --git a/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/check_domain_availability_result.py b/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/check_domain_availability_result.py new file mode 100644 index 000000000000..68e118ea25b0 --- /dev/null +++ b/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/check_domain_availability_result.py @@ -0,0 +1,41 @@ +# 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 msrest.serialization import Model + + +class CheckDomainAvailabilityResult(Model): + """Check Domain availability result. + + :param is_subdomain_available: Indicates the given SKU is available or + not. + :type is_subdomain_available: bool + :param reason: Reason why the SKU is not available. + :type reason: str + :param subdomain_name: The subdomain name to use. + :type subdomain_name: str + :param type: The Type of the resource. + :type type: str + """ + + _attribute_map = { + 'is_subdomain_available': {'key': 'isSubdomainAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'subdomain_name': {'key': 'subdomainName', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(CheckDomainAvailabilityResult, self).__init__(**kwargs) + self.is_subdomain_available = kwargs.get('is_subdomain_available', None) + self.reason = kwargs.get('reason', None) + self.subdomain_name = kwargs.get('subdomain_name', None) + self.type = kwargs.get('type', None) diff --git a/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/check_domain_availability_result_py3.py b/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/check_domain_availability_result_py3.py new file mode 100644 index 000000000000..c3549a327152 --- /dev/null +++ b/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/check_domain_availability_result_py3.py @@ -0,0 +1,41 @@ +# 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 msrest.serialization import Model + + +class CheckDomainAvailabilityResult(Model): + """Check Domain availability result. + + :param is_subdomain_available: Indicates the given SKU is available or + not. + :type is_subdomain_available: bool + :param reason: Reason why the SKU is not available. + :type reason: str + :param subdomain_name: The subdomain name to use. + :type subdomain_name: str + :param type: The Type of the resource. + :type type: str + """ + + _attribute_map = { + 'is_subdomain_available': {'key': 'isSubdomainAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'subdomain_name': {'key': 'subdomainName', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, *, is_subdomain_available: bool=None, reason: str=None, subdomain_name: str=None, type: str=None, **kwargs) -> None: + super(CheckDomainAvailabilityResult, self).__init__(**kwargs) + self.is_subdomain_available = is_subdomain_available + self.reason = reason + self.subdomain_name = subdomain_name + self.type = type diff --git a/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/__init__.py b/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/__init__.py index 3596470cf0ad..de7780ca1e04 100644 --- a/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/__init__.py +++ b/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/__init__.py @@ -13,10 +13,12 @@ from .resource_skus_operations import ResourceSkusOperations from .operations import Operations from .check_sku_availability_operations import CheckSkuAvailabilityOperations +from .locations_operations import LocationsOperations __all__ = [ 'AccountsOperations', 'ResourceSkusOperations', 'Operations', 'CheckSkuAvailabilityOperations', + 'LocationsOperations', ] diff --git a/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/locations_operations.py b/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/locations_operations.py new file mode 100644 index 000000000000..ea27b311bd37 --- /dev/null +++ b/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/locations_operations.py @@ -0,0 +1,109 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class LocationsOperations(object): + """LocationsOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Version of the API to be used with the client request. Current version is 2017-04-18. Constant value: "2017-04-18". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-04-18" + + self.config = config + + def check_domain_availability_post( + self, location, subdomain_name, type, custom_headers=None, raw=False, **operation_config): + """Check available SKUs. + + :param location: Resource location. + :type location: str + :param subdomain_name: The subdomain name to use. + :type subdomain_name: str + :param type: The Type of the resource. + :type type: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: CheckDomainAvailabilityResult or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.cognitiveservices.models.CheckDomainAvailabilityResult or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + parameters = models.CheckDomainAvailabilityParameter(subdomain_name=subdomain_name, type=type) + + # Construct URL + url = self.check_domain_availability_post.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'location': self._serialize.url("location", location, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'CheckDomainAvailabilityParameter') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('CheckDomainAvailabilityResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + check_domain_availability_post.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/checkDomainAvailability'}