Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from .operations.train_operations import TrainOperations
from .operations.permissions_operations import PermissionsOperations
from .operations.pattern_operations import PatternOperations
from .operations.settings_operations import SettingsOperations
from . import models


Expand Down Expand Up @@ -76,6 +77,8 @@ class LUISAuthoringClient(SDKClient):
:vartype permissions: azure.cognitiveservices.language.luis.authoring.operations.PermissionsOperations
:ivar pattern: Pattern operations
:vartype pattern: azure.cognitiveservices.language.luis.authoring.operations.PatternOperations
:ivar settings: Settings operations
:vartype settings: azure.cognitiveservices.language.luis.authoring.operations.SettingsOperations

:param endpoint: Supported Cognitive Services endpoints (protocol and
hostname, for example: https://westus.api.cognitive.microsoft.com).
Expand Down Expand Up @@ -112,3 +115,5 @@ def __init__(
self._client, self.config, self._serialize, self._deserialize)
self.pattern = PatternOperations(
self._client, self.config, self._serialize, self._deserialize)
self.settings = SettingsOperations(
self._client, self.config, self._serialize, self._deserialize)
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
from .pattern_any_entity_extractor_py3 import PatternAnyEntityExtractor
from .pattern_rule_info_py3 import PatternRuleInfo
from .label_text_object_py3 import LabelTextObject
from .app_version_setting_object_py3 import AppVersionSettingObject
from .hierarchical_child_model_update_object_py3 import HierarchicalChildModelUpdateObject
from .hierarchical_child_model_create_object_py3 import HierarchicalChildModelCreateObject
from .composite_child_model_create_object_py3 import CompositeChildModelCreateObject
Expand Down Expand Up @@ -210,6 +211,7 @@
from .pattern_any_entity_extractor import PatternAnyEntityExtractor
from .pattern_rule_info import PatternRuleInfo
from .label_text_object import LabelTextObject
from .app_version_setting_object import AppVersionSettingObject
from .hierarchical_child_model_update_object import HierarchicalChildModelUpdateObject
from .hierarchical_child_model_create_object import HierarchicalChildModelCreateObject
from .composite_child_model_create_object import CompositeChildModelCreateObject
Expand Down Expand Up @@ -317,6 +319,7 @@
'PatternAnyEntityExtractor',
'PatternRuleInfo',
'LabelTextObject',
'AppVersionSettingObject',
'HierarchicalChildModelUpdateObject',
'HierarchicalChildModelCreateObject',
'CompositeChildModelCreateObject',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# 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 AppVersionSettingObject(Model):
"""Object model of an application version setting.

:param name: The application version setting name.
:type name: str
:param value: The application version setting value.
:type value: str
"""

_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'value': {'key': 'value', 'type': 'str'},
}

def __init__(self, **kwargs):
super(AppVersionSettingObject, self).__init__(**kwargs)
self.name = kwargs.get('name', None)
self.value = kwargs.get('value', None)
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# 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 AppVersionSettingObject(Model):
"""Object model of an application version setting.

:param name: The application version setting name.
:type name: str
:param value: The application version setting value.
:type value: str
"""

_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'value': {'key': 'value', 'type': 'str'},
}

def __init__(self, *, name: str=None, value: str=None, **kwargs) -> None:
super(AppVersionSettingObject, self).__init__(**kwargs)
self.name = name
self.value = value
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ class TrainingStatus(str, Enum):
class OperationStatusType(str, Enum):

failed = "Failed"
failed = "FAILED"
success = "Success"
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from .train_operations import TrainOperations
from .permissions_operations import PermissionsOperations
from .pattern_operations import PatternOperations
from .settings_operations import SettingsOperations

__all__ = [
'FeaturesOperations',
Expand All @@ -27,4 +28,5 @@
'TrainOperations',
'PermissionsOperations',
'PatternOperations',
'SettingsOperations',
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
# 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.pipeline import ClientRawResponse

from .. import models


class SettingsOperations(object):
"""SettingsOperations 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.
"""

models = models

def __init__(self, client, config, serializer, deserializer):

self._client = client
self._serialize = serializer
self._deserialize = deserializer

self.config = config

def list(
self, app_id, version_id, custom_headers=None, raw=False, **operation_config):
"""Gets the application version settings.

:param app_id: The application ID.
:type app_id: str
:param version_id: The version ID.
:type version_id: 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: list or ClientRawResponse if raw=true
:rtype:
list[~azure.cognitiveservices.language.luis.authoring.models.AppVersionSettingObject]
or ~msrest.pipeline.ClientRawResponse
:raises:
:class:`ErrorResponseException<azure.cognitiveservices.language.luis.authoring.models.ErrorResponseException>`
"""
# Construct URL
url = self.list.metadata['url']
path_format_arguments = {
'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True),
'appId': self._serialize.url("app_id", app_id, 'str'),
'versionId': self._serialize.url("version_id", version_id, 'str')
}
url = self._client.format_url(url, **path_format_arguments)

# Construct parameters
query_parameters = {}

# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
if custom_headers:
header_parameters.update(custom_headers)

# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)

if response.status_code not in [200]:
raise models.ErrorResponseException(self._deserialize, response)

deserialized = None

if response.status_code == 200:
deserialized = self._deserialize('[AppVersionSettingObject]', response)

if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response

return deserialized
list.metadata = {'url': '/apps/{appId}/versions/{versionId}/settings'}

def update(
self, app_id, version_id, name=None, value=None, custom_headers=None, raw=False, **operation_config):
"""Updates the application version settings.

:param app_id: The application ID.
:type app_id: str
:param version_id: The version ID.
:type version_id: str
:param name: The application version setting name.
:type name: str
:param value: The application version setting value.
:type value: 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: OperationStatus or ClientRawResponse if raw=true
:rtype:
~azure.cognitiveservices.language.luis.authoring.models.OperationStatus
or ~msrest.pipeline.ClientRawResponse
:raises:
:class:`ErrorResponseException<azure.cognitiveservices.language.luis.authoring.models.ErrorResponseException>`
"""
list_of_app_version_setting_object = models.AppVersionSettingObject(name=name, value=value)

# Construct URL
url = self.update.metadata['url']
path_format_arguments = {
'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True),
'appId': self._serialize.url("app_id", app_id, 'str'),
'versionId': self._serialize.url("version_id", version_id, 'str')
}
url = self._client.format_url(url, **path_format_arguments)

# Construct parameters
query_parameters = {}

# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if custom_headers:
header_parameters.update(custom_headers)

# Construct body
body_content = self._serialize.body(list_of_app_version_setting_object, 'AppVersionSettingObject')

# Construct and send request
request = self._client.put(url, query_parameters, header_parameters, body_content)
response = self._client.send(request, stream=False, **operation_config)

if response.status_code not in [200]:
raise models.ErrorResponseException(self._deserialize, response)

deserialized = None

if response.status_code == 200:
deserialized = self._deserialize('OperationStatus', response)

if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response

return deserialized
update.metadata = {'url': '/apps/{appId}/versions/{versionId}/settings'}
1 change: 1 addition & 0 deletions azure-cognitiveservices-language-luis/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
packages=find_packages(exclude=["tests"]),
install_requires=[
'msrest>=0.5.0',
'msrestazure>=0.4.32,<2.0.0',
'azure-common~=1.1',
],
cmdclass=cmdclass
Expand Down