Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR cognitiveservices/resource-manager] [Hub Generated] Review request for Microsoft.CognitiveServices to add version 2017-04-18 #4604

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions azure-mgmt-cognitiveservices/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
recursive-include tests *.py *.yaml
include *.rst
include azure/__init__.py
include azure/mgmt/__init__.py
Expand Down
22 changes: 3 additions & 19 deletions azure-mgmt-cognitiveservices/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,6 @@ For the older Azure Service Management (ASM) libraries, see
For a more complete set of Azure libraries, see the `azure <https://pypi.python.org/pypi/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
=====

Expand All @@ -47,3 +28,6 @@ Provide Feedback
If you encounter any bugs or have suggestions, please file an issue in the
`Issues <https://github.com/Azure/azure-sdk-for-python/issues>`__
section of the project.


.. image:: https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-cognitiveservices%2FREADME.png
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -83,8 +87,10 @@
'OperationDisplayInfo',
'OperationEntity',
'CheckSkuAvailabilityParameter',
'CheckDomainAvailabilityParameter',
'CheckSkuAvailabilityResult',
'CheckSkuAvailabilityResultList',
'CheckDomainAvailabilityResult',
'ResourceSkuRestrictionInfo',
'ResourceSkuRestrictions',
'ResourceSku',
Expand Down
Original file line number Diff line number Diff line change
@@ -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)
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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)
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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',
]
Original file line number Diff line number Diff line change
@@ -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<msrest:optionsforoperations>`.
:return: CheckDomainAvailabilityResult or ClientRawResponse if
raw=true
:rtype:
~azure.mgmt.cognitiveservices.models.CheckDomainAvailabilityResult or
~msrest.pipeline.ClientRawResponse
:raises: :class:`CloudError<msrestazure.azure_exceptions.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'}