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 #2317

Merged
merged 4 commits into from
May 21, 2018
Merged
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
39 changes: 39 additions & 0 deletions azure-mgmt-cognitiveservices/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,45 @@
Release History
===============

3.0.0 (2018-05-21)
++++++++++++++++++

**General Breaking changes**

This version uses a next-generation code generator that *might* introduce breaking changes.

- Model signatures now use only keyword-argument syntax. All positional arguments must be re-written as keyword-arguments.
To keep auto-completion in most cases, models are now generated for Python 2 and Python 3. Python 3 uses the "*" syntax for keyword-only arguments.
- Enum types now use the "str" mixin (class AzureEnum(str, Enum)) to improve the behavior when unrecognized enum values are encountered.
While this is not a breaking change, the distinctions are important, and are documented here:
https://docs.python.org/3/library/enum.html#others
At a glance:

- "is" should not be used at all.
- "format" will return the string value, where "%s" string formatting will return `NameOfEnum.stringvalue`. Format syntax should be prefered.

- New Long Running Operation:

- Return type changes from `msrestazure.azure_operation.AzureOperationPoller` to `msrest.polling.LROPoller`. External API is the same.
- Return type is now **always** a `msrest.polling.LROPoller`, regardless of the optional parameters used.
- The behavior has changed when using `raw=True`. Instead of returning the initial call result as `ClientRawResponse`,
without polling, now this returns an LROPoller. After polling, the final resource will be returned as a `ClientRawResponse`.
- New `polling` parameter. The default behavior is `Polling=True` which will poll using ARM algorithm. When `Polling=False`,
the response of the initial call will be returned without polling.
- `polling` parameter accepts instances of subclasses of `msrest.polling.PollingMethod`.
- `add_done_callback` will no longer raise if called after polling is finished, but will instead execute the callback right away.

**Features**

- Add "resource_skus" operation group
- Update SKU list
- Add "accounts.get_usages" operation
- Client class can be used as a context manager to keep the underlying HTTP session open for performance

**Bugfixes**

- Compatibility of the sdist with wheel 0.31.0

2.0.0 (2017-10-26)
++++++++++++++++++

Expand Down
6 changes: 3 additions & 3 deletions azure-mgmt-cognitiveservices/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This is the Microsoft Azure Cognitive Services Management Client Library.
Azure Resource Manager (ARM) is the next generation of management APIs that
replace the old Azure Service Management (ASM).

This package has been tested with Python 2.7, 3.3, 3.4, 3.5 and 3.6.
This package has been tested with Python 2.7, 3.4, 3.5 and 3.6.

For the older Azure Service Management (ASM) libraries, see
`azure-servicemanagement-legacy <https://pypi.python.org/pypi/azure-servicemanagement-legacy>`__ library.
Expand Down Expand Up @@ -37,8 +37,8 @@ Usage
=====

For code examples, see `Cognitive Services Management
<https://azure-sdk-for-python.readthedocs.org/en/latest/sample_azure-mgmt-cognitiveservices.html>`__
on readthedocs.org.
<https://docs.microsoft.com/python/api/overview/azure/cognitive-services>`__
on docs.microsoft.com.


Provide Feedback
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
# regenerated.
# --------------------------------------------------------------------------

from msrest.service_client import ServiceClient
from msrest.service_client import SDKClient
from msrest import Serializer, Deserializer
from msrestazure import AzureConfiguration
from .version import VERSION
from .operations.accounts_operations import AccountsOperations
from .operations.resource_skus_operations import ResourceSkusOperations
from .operations.operations import Operations
from .operations.check_sku_availability_operations import CheckSkuAvailabilityOperations
from . import models
Expand Down Expand Up @@ -44,21 +45,23 @@ def __init__(

super(CognitiveServicesManagementClientConfiguration, self).__init__(base_url)

self.add_user_agent('cognitiveservicesmanagementclient/{}'.format(VERSION))
self.add_user_agent('azure-mgmt-cognitiveservices/{}'.format(VERSION))
self.add_user_agent('Azure-SDK-For-Python')

self.credentials = credentials
self.subscription_id = subscription_id


class CognitiveServicesManagementClient(object):
class CognitiveServicesManagementClient(SDKClient):
"""Cognitive Services Management Client

:ivar config: Configuration for client.
:vartype config: CognitiveServicesManagementClientConfiguration

:ivar accounts: Accounts operations
:vartype accounts: azure.mgmt.cognitiveservices.operations.AccountsOperations
:ivar resource_skus: ResourceSkus operations
:vartype resource_skus: azure.mgmt.cognitiveservices.operations.ResourceSkusOperations
:ivar operations: Operations operations
:vartype operations: azure.mgmt.cognitiveservices.operations.Operations
:ivar check_sku_availability: CheckSkuAvailability operations
Expand All @@ -76,7 +79,7 @@ def __init__(
self, credentials, subscription_id, base_url=None):

self.config = CognitiveServicesManagementClientConfiguration(credentials, subscription_id, base_url)
self._client = ServiceClient(self.config.credentials, self.config)
super(CognitiveServicesManagementClient, self).__init__(self.config.credentials, self.config)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self.api_version = '2017-04-18'
Expand All @@ -85,6 +88,8 @@ def __init__(

self.accounts = AccountsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.resource_skus = ResourceSkusOperations(
self._client, self.config, self._serialize, self._deserialize)
self.operations = Operations(
self._client, self.config, self._serialize, self._deserialize)
self.check_sku_availability = CheckSkuAvailabilityOperations(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,63 @@
# regenerated.
# --------------------------------------------------------------------------

from .sku import Sku
from .cognitive_services_account_create_parameters import CognitiveServicesAccountCreateParameters
from .cognitive_services_account_update_parameters import CognitiveServicesAccountUpdateParameters
from .cognitive_services_account import CognitiveServicesAccount
from .cognitive_services_account_keys import CognitiveServicesAccountKeys
from .regenerate_key_parameters import RegenerateKeyParameters
from .cognitive_services_resource_and_sku import CognitiveServicesResourceAndSku
from .cognitive_services_account_enumerate_skus_result import CognitiveServicesAccountEnumerateSkusResult
from .error_body import ErrorBody
from .error import Error, ErrorException
from .operation_display_info import OperationDisplayInfo
from .operation_entity import OperationEntity
from .check_sku_availability_parameter import CheckSkuAvailabilityParameter
from .check_sku_availability_result import CheckSkuAvailabilityResult
from .check_sku_availability_result_list import CheckSkuAvailabilityResultList
try:
from .sku_py3 import Sku
from .cognitive_services_account_create_parameters_py3 import CognitiveServicesAccountCreateParameters
from .cognitive_services_account_update_parameters_py3 import CognitiveServicesAccountUpdateParameters
from .cognitive_services_account_py3 import CognitiveServicesAccount
from .cognitive_services_account_keys_py3 import CognitiveServicesAccountKeys
from .regenerate_key_parameters_py3 import RegenerateKeyParameters
from .cognitive_services_resource_and_sku_py3 import CognitiveServicesResourceAndSku
from .cognitive_services_account_enumerate_skus_result_py3 import CognitiveServicesAccountEnumerateSkusResult
from .metric_name_py3 import MetricName
from .usage_py3 import Usage
from .usages_result_py3 import UsagesResult
from .error_body_py3 import ErrorBody
from .error_py3 import Error, ErrorException
from .operation_display_info_py3 import OperationDisplayInfo
from .operation_entity_py3 import OperationEntity
from .check_sku_availability_parameter_py3 import CheckSkuAvailabilityParameter
from .check_sku_availability_result_py3 import CheckSkuAvailabilityResult
from .check_sku_availability_result_list_py3 import CheckSkuAvailabilityResultList
from .resource_sku_restriction_info_py3 import ResourceSkuRestrictionInfo
from .resource_sku_restrictions_py3 import ResourceSkuRestrictions
from .resource_sku_py3 import ResourceSku
except (SyntaxError, ImportError):
from .sku import Sku
from .cognitive_services_account_create_parameters import CognitiveServicesAccountCreateParameters
from .cognitive_services_account_update_parameters import CognitiveServicesAccountUpdateParameters
from .cognitive_services_account import CognitiveServicesAccount
from .cognitive_services_account_keys import CognitiveServicesAccountKeys
from .regenerate_key_parameters import RegenerateKeyParameters
from .cognitive_services_resource_and_sku import CognitiveServicesResourceAndSku
from .cognitive_services_account_enumerate_skus_result import CognitiveServicesAccountEnumerateSkusResult
from .metric_name import MetricName
from .usage import Usage
from .usages_result import UsagesResult
from .error_body import ErrorBody
from .error import Error, ErrorException
from .operation_display_info import OperationDisplayInfo
from .operation_entity import OperationEntity
from .check_sku_availability_parameter import CheckSkuAvailabilityParameter
from .check_sku_availability_result import CheckSkuAvailabilityResult
from .check_sku_availability_result_list import CheckSkuAvailabilityResultList
from .resource_sku_restriction_info import ResourceSkuRestrictionInfo
from .resource_sku_restrictions import ResourceSkuRestrictions
from .resource_sku import ResourceSku
from .cognitive_services_account_paged import CognitiveServicesAccountPaged
from .resource_sku_paged import ResourceSkuPaged
from .operation_entity_paged import OperationEntityPaged
from .cognitive_services_management_client_enums import (
SkuName,
SkuTier,
Kind,
ProvisioningState,
KeyName,
UnitType,
QuotaUsageStatus,
ResourceSkuRestrictionsType,
ResourceSkuRestrictionsReasonCode,
)

__all__ = [
Expand All @@ -43,18 +77,29 @@
'RegenerateKeyParameters',
'CognitiveServicesResourceAndSku',
'CognitiveServicesAccountEnumerateSkusResult',
'MetricName',
'Usage',
'UsagesResult',
'ErrorBody',
'Error', 'ErrorException',
'OperationDisplayInfo',
'OperationEntity',
'CheckSkuAvailabilityParameter',
'CheckSkuAvailabilityResult',
'CheckSkuAvailabilityResultList',
'ResourceSkuRestrictionInfo',
'ResourceSkuRestrictions',
'ResourceSku',
'CognitiveServicesAccountPaged',
'ResourceSkuPaged',
'OperationEntityPaged',
'SkuName',
'SkuTier',
'Kind',
'ProvisioningState',
'KeyName',
'UnitType',
'QuotaUsageStatus',
'ResourceSkuRestrictionsType',
'ResourceSkuRestrictionsReasonCode',
]
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,18 @@
class CheckSkuAvailabilityParameter(Model):
"""Check SKU availability parameter.

:param skus: The SKU of the resource.
All required parameters must be populated in order to send to Azure.

:param skus: Required. The SKU of the resource.
:type skus: list[str or ~azure.mgmt.cognitiveservices.models.SkuName]
:param kind: The Kind of the resource. Possible values include:
'Academic', 'Bing.Autosuggest', 'Bing.Search', 'Bing.Speech',
'Bing.SpellCheck', 'ComputerVision', 'ContentModerator', 'CustomSpeech',
'Emotion', 'Face', 'LUIS', 'Recommendations', 'SpeakerRecognition',
'Speech', 'SpeechTranslation', 'TextAnalytics', 'TextTranslation', 'WebLM'
:param kind: Required. The Kind of the resource. Possible values include:
'Bing.Autosuggest.v7', 'Bing.CustomSearch', 'Bing.Search.v7',
'Bing.Speech', 'Bing.SpellCheck.v7', 'ComputerVision', 'ContentModerator',
'CustomSpeech', 'CustomVision.Prediction', 'CustomVision.Training',
'Emotion', 'Face', 'LUIS', 'QnAMaker', 'SpeakerRecognition',
'SpeechTranslation', 'TextAnalytics', 'TextTranslation', 'WebLM'
:type kind: str or ~azure.mgmt.cognitiveservices.models.Kind
:param type: The Type of the resource.
:param type: Required. The Type of the resource.
:type type: str
"""

Expand All @@ -39,7 +42,8 @@ class CheckSkuAvailabilityParameter(Model):
'type': {'key': 'type', 'type': 'str'},
}

def __init__(self, skus, kind, type):
self.skus = skus
self.kind = kind
self.type = type
def __init__(self, **kwargs):
super(CheckSkuAvailabilityParameter, self).__init__(**kwargs)
self.skus = kwargs.get('skus', None)
self.kind = kwargs.get('kind', None)
self.type = kwargs.get('type', None)
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class CheckSkuAvailabilityParameter(Model):
"""Check SKU availability parameter.

All required parameters must be populated in order to send to Azure.

:param skus: Required. The SKU of the resource.
:type skus: list[str or ~azure.mgmt.cognitiveservices.models.SkuName]
:param kind: Required. The Kind of the resource. Possible values include:
'Bing.Autosuggest.v7', 'Bing.CustomSearch', 'Bing.Search.v7',
'Bing.Speech', 'Bing.SpellCheck.v7', 'ComputerVision', 'ContentModerator',
'CustomSpeech', 'CustomVision.Prediction', 'CustomVision.Training',
'Emotion', 'Face', 'LUIS', 'QnAMaker', 'SpeakerRecognition',
'SpeechTranslation', 'TextAnalytics', 'TextTranslation', 'WebLM'
:type kind: str or ~azure.mgmt.cognitiveservices.models.Kind
:param type: Required. The Type of the resource.
:type type: str
"""

_validation = {
'skus': {'required': True},
'kind': {'required': True},
'type': {'required': True},
}

_attribute_map = {
'skus': {'key': 'skus', 'type': '[str]'},
'kind': {'key': 'kind', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
}

def __init__(self, *, skus, kind, type: str, **kwargs) -> None:
super(CheckSkuAvailabilityParameter, self).__init__(**kwargs)
self.skus = skus
self.kind = kind
self.type = type
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ class CheckSkuAvailabilityResult(Model):
"""Check SKU availability result.

:param kind: The Kind of the resource. Possible values include:
'Academic', 'Bing.Autosuggest', 'Bing.Search', 'Bing.Speech',
'Bing.SpellCheck', 'ComputerVision', 'ContentModerator', 'CustomSpeech',
'Emotion', 'Face', 'LUIS', 'Recommendations', 'SpeakerRecognition',
'Speech', 'SpeechTranslation', 'TextAnalytics', 'TextTranslation', 'WebLM'
'Bing.Autosuggest.v7', 'Bing.CustomSearch', 'Bing.Search.v7',
'Bing.Speech', 'Bing.SpellCheck.v7', 'ComputerVision', 'ContentModerator',
'CustomSpeech', 'CustomVision.Prediction', 'CustomVision.Training',
'Emotion', 'Face', 'LUIS', 'QnAMaker', 'SpeakerRecognition',
'SpeechTranslation', 'TextAnalytics', 'TextTranslation', 'WebLM'
:type kind: str or ~azure.mgmt.cognitiveservices.models.Kind
:param type: The Type of the resource.
:type type: str
Expand All @@ -43,10 +44,11 @@ class CheckSkuAvailabilityResult(Model):
'message': {'key': 'message', 'type': 'str'},
}

def __init__(self, kind=None, type=None, sku_name=None, sku_available=None, reason=None, message=None):
self.kind = kind
self.type = type
self.sku_name = sku_name
self.sku_available = sku_available
self.reason = reason
self.message = message
def __init__(self, **kwargs):
super(CheckSkuAvailabilityResult, self).__init__(**kwargs)
self.kind = kwargs.get('kind', None)
self.type = kwargs.get('type', None)
self.sku_name = kwargs.get('sku_name', None)
self.sku_available = kwargs.get('sku_available', None)
self.reason = kwargs.get('reason', None)
self.message = kwargs.get('message', None)
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ class CheckSkuAvailabilityResultList(Model):
'value': {'key': 'value', 'type': '[CheckSkuAvailabilityResult]'},
}

def __init__(self, value=None):
self.value = value
def __init__(self, **kwargs):
super(CheckSkuAvailabilityResultList, self).__init__(**kwargs)
self.value = kwargs.get('value', None)
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# 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 CheckSkuAvailabilityResultList(Model):
"""Check SKU availability result list.

:param value: Check SKU availability result list.
:type value:
list[~azure.mgmt.cognitiveservices.models.CheckSkuAvailabilityResult]
"""

_attribute_map = {
'value': {'key': 'value', 'type': '[CheckSkuAvailabilityResult]'},
}

def __init__(self, *, value=None, **kwargs) -> None:
super(CheckSkuAvailabilityResultList, self).__init__(**kwargs)
self.value = value
Loading