diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 4c8b82de7a..e58a01a59a 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -18,4 +18,6 @@ /src/managementpartner/ @jeffrey-ace -/src/dns/ @muwaqar \ No newline at end of file +/src/dns/ @muwaqar + +/src/signalr/ @zackliu \ No newline at end of file diff --git a/src/index.json b/src/index.json index e5eb9faac7..abc99218f4 100644 --- a/src/index.json +++ b/src/index.json @@ -605,6 +605,53 @@ "version": "0.0.2" } } + ], + "signalr": [ + { + "filename": "signalr-0.1.0-py2.py3-none-any.whl", + "sha256Digest": "0cd98580aa10b660602c1b4496c9beef24cf9c8e15df8113b2642c75457772ee", + "downloadUrl": "https://azureclisignalr.blob.core.windows.net/cli-extensions/signalr-0.1.0-py2.py3-none-any.whl", + "metadata": { + "azext.minCliCoreVersion": "2.0.32.dev0", + "azext.isPreview": true, + "classifiers": [ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Intended Audience :: System Administrators", + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "License :: OSI Approved :: MIT License" + ], + "extensions": { + "python.details": { + "contacts": [ + { + "email": "vscsignalr@microsoft.com", + "name": "Visual Studio China SignalR Team", + "role": "author" + } + ], + "document_names": { + "description": "DESCRIPTION.rst" + }, + "project_urls": { + "Home": "https://github.com/Azure/azure-cli-extensions" + } + } + }, + "generator": "bdist_wheel (0.30.0)", + "license": "MIT", + "metadata_version": "2.0", + "name": "signalr", + "summary": "Support for signalr management preview.", + "version": "0.1.0" + } + } ] } } \ No newline at end of file diff --git a/src/signalr/azext_signalr/__init__.py b/src/signalr/azext_signalr/__init__.py new file mode 100644 index 0000000000..41a849c551 --- /dev/null +++ b/src/signalr/azext_signalr/__init__.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +from azure.cli.core import AzCommandsLoader + +import azext_signalr._help # pylint: disable=unused-import + + +class SignalRCommandsLoader(AzCommandsLoader): + + def __init__(self, cli_ctx=None): + super(SignalRCommandsLoader, self).__init__(cli_ctx=cli_ctx, + min_profile='2017-03-10-profile') + + def load_command_table(self, args): + from .commands import load_command_table + load_command_table(self, args) + return self.command_table + + def load_arguments(self, command): + from ._params import load_arguments + load_arguments(self, command) + + +COMMAND_LOADER_CLS = SignalRCommandsLoader diff --git a/src/signalr/azext_signalr/_client_factory.py b/src/signalr/azext_signalr/_client_factory.py new file mode 100644 index 0000000000..c6c587dc77 --- /dev/null +++ b/src/signalr/azext_signalr/_client_factory.py @@ -0,0 +1,14 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + + +def _signalr_client_factory(cli_ctx, *_): + from azext_signalr.signalr import SignalRManagementClient + from azure.cli.core.commands.client_factory import get_mgmt_service_client + return get_mgmt_service_client(cli_ctx, SignalRManagementClient) + + +def cf_signalr(cli_ctx, *_): + return _signalr_client_factory(cli_ctx).signal_r diff --git a/src/signalr/azext_signalr/_constants.py b/src/signalr/azext_signalr/_constants.py new file mode 100644 index 0000000000..eaa0d06b74 --- /dev/null +++ b/src/signalr/azext_signalr/_constants.py @@ -0,0 +1,9 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + + +SIGNALR_SKU = ['Basic_DS2'] +SIGNALR_RESOURCE_TYPE = 'Microsoft.SignalRService/SignalR' +SIGNALR_KEY_TYPE = ['primary', 'secondary'] diff --git a/src/signalr/azext_signalr/_help.py b/src/signalr/azext_signalr/_help.py new file mode 100644 index 0000000000..b916c4a273 --- /dev/null +++ b/src/signalr/azext_signalr/_help.py @@ -0,0 +1,74 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + + +from knack.help_files import helps + +helps['signalr'] = """ + type: group + short-summary: Manage Azure SignalR Service. + """ + +helps['signalr key'] = """ + type: group + short-summary: Manage keys for Azure SignalR Service. + """ + +helps['signalr list'] = """ + type: command + short-summary: Lists all the SignalR Service under the current subscription. + examples: + - name: List SignalR Service and show the results in a table. + text: > + az signalr list -o table + - name: List SignalR Service in a resource group and show the results in a table. + text: > + az signalr list -g MySignalR -o table +""" + +helps['signalr create'] = """ + type: command + short-summary: Creates a SignalR Service. + examples: + - name: Create a SignalR Service with the Basic SKU. + text: > + az signalr create -n MySignalR -g MyResourceGroup --sku Basic_DS2 --unit-count 1 +""" + +helps['signalr delete'] = """ + type: command + short-summary: Deletes a SignalR Service. + examples: + - name: Delete a SignalR Service. + text: > + az signalr delete -n MySignalR -g MyResourceGroup +""" + +helps['signalr show'] = """ + type: command + short-summary: Get the details of a SignalR Service. + examples: + - name: Get the sku for a SignalR Service. + text: > + az signalr show -n MySignalR -g MyResourceGroup --query sku +""" + +helps['signalr key list'] = """ + type: command + short-summary: List the access keys for a SignalR Service. + examples: + - name: Get the primary key for a SignalR Service. + text: > + az signalr key list -n MySignalR -g MyResourceGroup --query primaryKey -o tsv +""" + +helps['signalr key renew'] = """ + type: command + short-summary: Regenerate the access key for a SignalR Service. + examples: + - name: Renew the secondary key for a SignalR Service. + text: > + az signalr key renew -n MySignalR -g MyResourceGroup --key-type secondary +""" diff --git a/src/signalr/azext_signalr/_params.py b/src/signalr/azext_signalr/_params.py new file mode 100644 index 0000000000..46f9c958f4 --- /dev/null +++ b/src/signalr/azext_signalr/_params.py @@ -0,0 +1,45 @@ +# pylint: disable=line-too-long +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + + +from azure.cli.core.commands.validators import get_default_location_from_resource_group + +from knack.log import get_logger + +from azure.cli.core.commands.parameters import ( + resource_group_name_type, + get_location_type, + get_resource_name_completion_list, + tags_type +) + +from ._constants import ( + SIGNALR_SKU, + SIGNALR_RESOURCE_TYPE, + SIGNALR_KEY_TYPE +) + + +logger = get_logger(__name__) + + +def load_arguments(self, _): + with self.argument_context('signalr') as c: + c.argument('resource_group_name', arg_type=resource_group_name_type) + c.argument('location', + arg_type=get_location_type(self.cli_ctx), + validator=get_default_location_from_resource_group) + c.argument('signalr_name', options_list=['--name', '-n'], + completer=get_resource_name_completion_list(SIGNALR_RESOURCE_TYPE), + help='Name of signalr service.') + c.argument('tags', arg_type=tags_type) + + with self.argument_context('signalr create') as c: + c.argument('sku', help='The sku name of the signalr service', choices=SIGNALR_SKU) + c.argument('unit_count', help='The number of signalr service unit count', type=int) + + with self.argument_context('signalr key renew') as c: + c.argument('key_type', help='The name of access key to regenerate', choices=SIGNALR_KEY_TYPE) diff --git a/src/signalr/azext_signalr/azext_metadata.json b/src/signalr/azext_signalr/azext_metadata.json new file mode 100644 index 0000000000..3a32f9f753 --- /dev/null +++ b/src/signalr/azext_signalr/azext_metadata.json @@ -0,0 +1,4 @@ +{ + "azext.minCliCoreVersion": "2.0.32.dev0", + "azext.isPreview": true +} \ No newline at end of file diff --git a/src/signalr/azext_signalr/commands.py b/src/signalr/azext_signalr/commands.py new file mode 100644 index 0000000000..b250d2faa8 --- /dev/null +++ b/src/signalr/azext_signalr/commands.py @@ -0,0 +1,33 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + + +from azure.cli.core.commands import CliCommandType + +from ._client_factory import cf_signalr +from azure.cli.core.util import empty_on_404 + + +def load_command_table(self, _): + + signalr_custom_util = CliCommandType( + operations_tmpl='azext_signalr.custom#{}', + client_factory=cf_signalr + ) + + signalr_key_utils = CliCommandType( + operations_tmpl='azext_signalr.key#{}', + client_factory=cf_signalr + ) + + with self.command_group('signalr', signalr_custom_util) as g: + g.command('create', 'signalr_create') + g.command('delete', 'signalr_delete') + g.command('list', 'signalr_list') + g.command('show', 'signalr_show', exception_handler=empty_on_404) + + with self.command_group('signalr key', signalr_key_utils) as g: + g.command('list', 'signalr_key_list') + g.command('renew', 'signalr_key_renew') diff --git a/src/signalr/azext_signalr/custom.py b/src/signalr/azext_signalr/custom.py new file mode 100644 index 0000000000..5e854bde5b --- /dev/null +++ b/src/signalr/azext_signalr/custom.py @@ -0,0 +1,33 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + + +from azext_signalr.signalr.models import (ResourceSku, SignalRCreateOrUpdateProperties, SignalRCreateParameters) + + +def signalr_create(client, signalr_name, resource_group_name, sku, unit_count=1, location=None, tags=None): + sku = ResourceSku(name=sku, capacity=unit_count) + properties = SignalRCreateOrUpdateProperties(host_name_prefix=signalr_name) + + parameter = SignalRCreateParameters(tags=tags, + sku=sku, + properties=properties, + location=location) + + return client.create_or_update(resource_group_name, signalr_name, parameter) + + +def signalr_delete(client, signalr_name, resource_group_name): + return client.delete(resource_group_name, signalr_name) + + +def signalr_list(client, resource_group_name=None): + if not resource_group_name: + return client.list_by_subscription() + return client.list_by_resource_group(resource_group_name) + + +def signalr_show(client, signalr_name, resource_group_name): + return client.get(resource_group_name, signalr_name) diff --git a/src/signalr/azext_signalr/key.py b/src/signalr/azext_signalr/key.py new file mode 100644 index 0000000000..21dd1ecfcd --- /dev/null +++ b/src/signalr/azext_signalr/key.py @@ -0,0 +1,19 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + + +from azext_signalr.signalr.models import KeyType + + +def signalr_key_list(client, resource_group_name, signalr_name): + return client.list_keys(resource_group_name, signalr_name) + + +def signalr_key_renew(client, resource_group_name, signalr_name, key_type): + if key_type == 'primary': + key_type = KeyType.primary + else: + key_type = KeyType.secondary + return client.regenerate_key(resource_group_name, signalr_name, key_type, polling=False) diff --git a/src/signalr/azext_signalr/signalr/__init__.py b/src/signalr/azext_signalr/signalr/__init__.py new file mode 100644 index 0000000000..9a9b15f10c --- /dev/null +++ b/src/signalr/azext_signalr/signalr/__init__.py @@ -0,0 +1,18 @@ +# 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 .signal_rmanagement_client import SignalRManagementClient +from .version import VERSION + +__all__ = ['SignalRManagementClient'] + +__version__ = VERSION + diff --git a/src/signalr/azext_signalr/signalr/models/__init__.py b/src/signalr/azext_signalr/signalr/models/__init__.py new file mode 100644 index 0000000000..6605edb1e9 --- /dev/null +++ b/src/signalr/azext_signalr/signalr/models/__init__.py @@ -0,0 +1,76 @@ +# 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. +# -------------------------------------------------------------------------- + +try: + from .operation_display_py3 import OperationDisplay + from .metric_specification_py3 import MetricSpecification + from .service_specification_py3 import ServiceSpecification + from .operation_properties_py3 import OperationProperties + from .operation_py3 import Operation + from .name_availability_parameters_py3 import NameAvailabilityParameters + from .name_availability_py3 import NameAvailability + from .resource_sku_py3 import ResourceSku + from .signal_rresource_py3 import SignalRResource + from .tracked_resource_py3 import TrackedResource + from .resource_py3 import Resource + from .signal_rcreate_or_update_properties_py3 import SignalRCreateOrUpdateProperties + from .signal_rkeys_py3 import SignalRKeys + from .regenerate_key_parameters_py3 import RegenerateKeyParameters + from .signal_rcreate_parameters_py3 import SignalRCreateParameters + from .signal_rupdate_parameters_py3 import SignalRUpdateParameters +except (SyntaxError, ImportError): + from .operation_display import OperationDisplay + from .metric_specification import MetricSpecification + from .service_specification import ServiceSpecification + from .operation_properties import OperationProperties + from .operation import Operation + from .name_availability_parameters import NameAvailabilityParameters + from .name_availability import NameAvailability + from .resource_sku import ResourceSku + from .signal_rresource import SignalRResource + from .tracked_resource import TrackedResource + from .resource import Resource + from .signal_rcreate_or_update_properties import SignalRCreateOrUpdateProperties + from .signal_rkeys import SignalRKeys + from .regenerate_key_parameters import RegenerateKeyParameters + from .signal_rcreate_parameters import SignalRCreateParameters + from .signal_rupdate_parameters import SignalRUpdateParameters +from .operation_paged import OperationPaged +from .signal_rresource_paged import SignalRResourcePaged +from .signal_rmanagement_client_enums import ( + SignalRSkuTier, + ProvisioningState, + KeyType, +) + +__all__ = [ + 'OperationDisplay', + 'MetricSpecification', + 'ServiceSpecification', + 'OperationProperties', + 'Operation', + 'NameAvailabilityParameters', + 'NameAvailability', + 'ResourceSku', + 'SignalRResource', + 'TrackedResource', + 'Resource', + 'SignalRCreateOrUpdateProperties', + 'SignalRKeys', + 'RegenerateKeyParameters', + 'SignalRCreateParameters', + 'SignalRUpdateParameters', + 'OperationPaged', + 'SignalRResourcePaged', + 'SignalRSkuTier', + 'ProvisioningState', + 'KeyType', +] diff --git a/src/signalr/azext_signalr/signalr/models/metric_specification.py b/src/signalr/azext_signalr/signalr/models/metric_specification.py new file mode 100644 index 0000000000..c54739236a --- /dev/null +++ b/src/signalr/azext_signalr/signalr/models/metric_specification.py @@ -0,0 +1,59 @@ +# 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 MetricSpecification(Model): + """Specifications of the Metrics for Azure Monitoring. + + :param name: Name of the metric. + :type name: str + :param display_name: Localized friendly display name of the metric. + :type display_name: str + :param display_description: Localized friendly description of the metric. + :type display_description: str + :param unit: The unit that makes sense for the metric. + :type unit: str + :param aggregation_type: Only provide one value for this field. Valid + values: Average, Minimum, Maximum, Total, Count. + :type aggregation_type: str + :param fill_gap_with_zero: Optional. If set to true, then zero will be + returned for time duration where no metric is emitted/published. + Ex. a metric that returns the number of times a particular error code was + emitted. The error code may not appear + often, instead of the RP publishing 0, Shoebox can auto fill in 0s for + time periods where nothing was emitted. + :type fill_gap_with_zero: str + :param category: The name of the metric category that the metric belongs + to. A metric can only belong to a single category. + :type category: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, + 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(MetricSpecification, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display_name = kwargs.get('display_name', None) + self.display_description = kwargs.get('display_description', None) + self.unit = kwargs.get('unit', None) + self.aggregation_type = kwargs.get('aggregation_type', None) + self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) + self.category = kwargs.get('category', None) diff --git a/src/signalr/azext_signalr/signalr/models/metric_specification_py3.py b/src/signalr/azext_signalr/signalr/models/metric_specification_py3.py new file mode 100644 index 0000000000..21cc1d12a2 --- /dev/null +++ b/src/signalr/azext_signalr/signalr/models/metric_specification_py3.py @@ -0,0 +1,59 @@ +# 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 MetricSpecification(Model): + """Specifications of the Metrics for Azure Monitoring. + + :param name: Name of the metric. + :type name: str + :param display_name: Localized friendly display name of the metric. + :type display_name: str + :param display_description: Localized friendly description of the metric. + :type display_description: str + :param unit: The unit that makes sense for the metric. + :type unit: str + :param aggregation_type: Only provide one value for this field. Valid + values: Average, Minimum, Maximum, Total, Count. + :type aggregation_type: str + :param fill_gap_with_zero: Optional. If set to true, then zero will be + returned for time duration where no metric is emitted/published. + Ex. a metric that returns the number of times a particular error code was + emitted. The error code may not appear + often, instead of the RP publishing 0, Shoebox can auto fill in 0s for + time periods where nothing was emitted. + :type fill_gap_with_zero: str + :param category: The name of the metric category that the metric belongs + to. A metric can only belong to a single category. + :type category: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, + 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + } + + def __init__(self, *, name: str=None, display_name: str=None, display_description: str=None, unit: str=None, aggregation_type: str=None, fill_gap_with_zero: str=None, category: str=None, **kwargs) -> None: + super(MetricSpecification, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.display_description = display_description + self.unit = unit + self.aggregation_type = aggregation_type + self.fill_gap_with_zero = fill_gap_with_zero + self.category = category diff --git a/src/signalr/azext_signalr/signalr/models/name_availability.py b/src/signalr/azext_signalr/signalr/models/name_availability.py new file mode 100644 index 0000000000..7b56e67c67 --- /dev/null +++ b/src/signalr/azext_signalr/signalr/models/name_availability.py @@ -0,0 +1,38 @@ +# 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 NameAvailability(Model): + """Result of the request to check name availability. It contains a flag and + possible reason of failure. + + :param name_available: Indicates whether the name is available or not. + :type name_available: bool + :param reason: The reason of the availability. Required if name is not + available. + :type reason: str + :param message: The message of the operation. + :type message: str + """ + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(NameAvailability, self).__init__(**kwargs) + self.name_available = kwargs.get('name_available', None) + self.reason = kwargs.get('reason', None) + self.message = kwargs.get('message', None) diff --git a/src/signalr/azext_signalr/signalr/models/name_availability_parameters.py b/src/signalr/azext_signalr/signalr/models/name_availability_parameters.py new file mode 100644 index 0000000000..69d9617764 --- /dev/null +++ b/src/signalr/azext_signalr/signalr/models/name_availability_parameters.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 NameAvailabilityParameters(Model): + """Data POST-ed to the nameAvailability action. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. The resource type. Should be always + "Microsoft.SignalRService/SignalR". + :type type: str + :param name: Required. The SignalR service name to validate. + e.g."my-signalR-name-here" + :type name: str + """ + + _validation = { + 'type': {'required': True}, + 'name': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(NameAvailabilityParameters, self).__init__(**kwargs) + self.type = kwargs.get('type', None) + self.name = kwargs.get('name', None) diff --git a/src/signalr/azext_signalr/signalr/models/name_availability_parameters_py3.py b/src/signalr/azext_signalr/signalr/models/name_availability_parameters_py3.py new file mode 100644 index 0000000000..caefb77011 --- /dev/null +++ b/src/signalr/azext_signalr/signalr/models/name_availability_parameters_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 NameAvailabilityParameters(Model): + """Data POST-ed to the nameAvailability action. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. The resource type. Should be always + "Microsoft.SignalRService/SignalR". + :type type: str + :param name: Required. The SignalR service name to validate. + e.g."my-signalR-name-here" + :type name: str + """ + + _validation = { + 'type': {'required': True}, + 'name': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, *, type: str, name: str, **kwargs) -> None: + super(NameAvailabilityParameters, self).__init__(**kwargs) + self.type = type + self.name = name diff --git a/src/signalr/azext_signalr/signalr/models/name_availability_py3.py b/src/signalr/azext_signalr/signalr/models/name_availability_py3.py new file mode 100644 index 0000000000..9792b37659 --- /dev/null +++ b/src/signalr/azext_signalr/signalr/models/name_availability_py3.py @@ -0,0 +1,38 @@ +# 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 NameAvailability(Model): + """Result of the request to check name availability. It contains a flag and + possible reason of failure. + + :param name_available: Indicates whether the name is available or not. + :type name_available: bool + :param reason: The reason of the availability. Required if name is not + available. + :type reason: str + :param message: The message of the operation. + :type message: str + """ + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, *, name_available: bool=None, reason: str=None, message: str=None, **kwargs) -> None: + super(NameAvailability, self).__init__(**kwargs) + self.name_available = name_available + self.reason = reason + self.message = message diff --git a/src/signalr/azext_signalr/signalr/models/operation.py b/src/signalr/azext_signalr/signalr/models/operation.py new file mode 100644 index 0000000000..77f115a4d2 --- /dev/null +++ b/src/signalr/azext_signalr/signalr/models/operation.py @@ -0,0 +1,42 @@ +# 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 Operation(Model): + """REST API operation supported by SignalR resource provider. + + :param name: Name of the operation with format: + {provider}/{resource}/{operation} + :type name: str + :param display: The object that describes the operation. + :type display: ~azure.mgmt.signalr.models.OperationDisplay + :param origin: Optional. The intended executor of the operation; governs + the display of the operation in the RBAC UX and the audit logs UX. + :type origin: str + :param properties: Extra properties for the operation. + :type properties: ~azure.mgmt.signalr.models.OperationProperties + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'OperationProperties'}, + } + + def __init__(self, **kwargs): + super(Operation, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display = kwargs.get('display', None) + self.origin = kwargs.get('origin', None) + self.properties = kwargs.get('properties', None) diff --git a/src/signalr/azext_signalr/signalr/models/operation_display.py b/src/signalr/azext_signalr/signalr/models/operation_display.py new file mode 100644 index 0000000000..d368ed731f --- /dev/null +++ b/src/signalr/azext_signalr/signalr/models/operation_display.py @@ -0,0 +1,40 @@ +# 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 OperationDisplay(Model): + """The object that describes a operation. + + :param provider: Friendly name of the resource provider + :type provider: str + :param resource: Resource type on which the operation is performed. + :type resource: str + :param operation: The localized friendly name for the operation. + :type operation: str + :param description: The localized friendly description for the operation + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = kwargs.get('provider', None) + self.resource = kwargs.get('resource', None) + self.operation = kwargs.get('operation', None) + self.description = kwargs.get('description', None) diff --git a/src/signalr/azext_signalr/signalr/models/operation_display_py3.py b/src/signalr/azext_signalr/signalr/models/operation_display_py3.py new file mode 100644 index 0000000000..6e8283000f --- /dev/null +++ b/src/signalr/azext_signalr/signalr/models/operation_display_py3.py @@ -0,0 +1,40 @@ +# 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 OperationDisplay(Model): + """The object that describes a operation. + + :param provider: Friendly name of the resource provider + :type provider: str + :param resource: Resource type on which the operation is performed. + :type resource: str + :param operation: The localized friendly name for the operation. + :type operation: str + :param description: The localized friendly description for the operation + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__(self, *, provider: str=None, resource: str=None, operation: str=None, description: str=None, **kwargs) -> None: + super(OperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description diff --git a/src/signalr/azext_signalr/signalr/models/operation_paged.py b/src/signalr/azext_signalr/signalr/models/operation_paged.py new file mode 100644 index 0000000000..6010913796 --- /dev/null +++ b/src/signalr/azext_signalr/signalr/models/operation_paged.py @@ -0,0 +1,27 @@ +# 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.paging import Paged + + +class OperationPaged(Paged): + """ + A paging container for iterating over a list of :class:`Operation ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Operation]'} + } + + def __init__(self, *args, **kwargs): + + super(OperationPaged, self).__init__(*args, **kwargs) diff --git a/src/signalr/azext_signalr/signalr/models/operation_properties.py b/src/signalr/azext_signalr/signalr/models/operation_properties.py new file mode 100644 index 0000000000..5884decce6 --- /dev/null +++ b/src/signalr/azext_signalr/signalr/models/operation_properties.py @@ -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 OperationProperties(Model): + """Extra Operation properties. + + :param service_specification: The service specifications. + :type service_specification: + ~azure.mgmt.signalr.models.ServiceSpecification + """ + + _attribute_map = { + 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, + } + + def __init__(self, **kwargs): + super(OperationProperties, self).__init__(**kwargs) + self.service_specification = kwargs.get('service_specification', None) diff --git a/src/signalr/azext_signalr/signalr/models/operation_properties_py3.py b/src/signalr/azext_signalr/signalr/models/operation_properties_py3.py new file mode 100644 index 0000000000..c78e2043eb --- /dev/null +++ b/src/signalr/azext_signalr/signalr/models/operation_properties_py3.py @@ -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 OperationProperties(Model): + """Extra Operation properties. + + :param service_specification: The service specifications. + :type service_specification: + ~azure.mgmt.signalr.models.ServiceSpecification + """ + + _attribute_map = { + 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, + } + + def __init__(self, *, service_specification=None, **kwargs) -> None: + super(OperationProperties, self).__init__(**kwargs) + self.service_specification = service_specification diff --git a/src/signalr/azext_signalr/signalr/models/operation_py3.py b/src/signalr/azext_signalr/signalr/models/operation_py3.py new file mode 100644 index 0000000000..47e90891f0 --- /dev/null +++ b/src/signalr/azext_signalr/signalr/models/operation_py3.py @@ -0,0 +1,42 @@ +# 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 Operation(Model): + """REST API operation supported by SignalR resource provider. + + :param name: Name of the operation with format: + {provider}/{resource}/{operation} + :type name: str + :param display: The object that describes the operation. + :type display: ~azure.mgmt.signalr.models.OperationDisplay + :param origin: Optional. The intended executor of the operation; governs + the display of the operation in the RBAC UX and the audit logs UX. + :type origin: str + :param properties: Extra properties for the operation. + :type properties: ~azure.mgmt.signalr.models.OperationProperties + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'OperationProperties'}, + } + + def __init__(self, *, name: str=None, display=None, origin: str=None, properties=None, **kwargs) -> None: + super(Operation, self).__init__(**kwargs) + self.name = name + self.display = display + self.origin = origin + self.properties = properties diff --git a/src/signalr/azext_signalr/signalr/models/regenerate_key_parameters.py b/src/signalr/azext_signalr/signalr/models/regenerate_key_parameters.py new file mode 100644 index 0000000000..5e313a7a9f --- /dev/null +++ b/src/signalr/azext_signalr/signalr/models/regenerate_key_parameters.py @@ -0,0 +1,30 @@ +# 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 RegenerateKeyParameters(Model): + """Parameters describes the request to regenerate access keys. + + :param key_type: The keyType to regenerate. Must be either 'primary' or + 'secondary'(case-insensitive). Possible values include: 'Primary', + 'Secondary' + :type key_type: str or ~azure.mgmt.signalr.models.KeyType + """ + + _attribute_map = { + 'key_type': {'key': 'keyType', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(RegenerateKeyParameters, self).__init__(**kwargs) + self.key_type = kwargs.get('key_type', None) diff --git a/src/signalr/azext_signalr/signalr/models/regenerate_key_parameters_py3.py b/src/signalr/azext_signalr/signalr/models/regenerate_key_parameters_py3.py new file mode 100644 index 0000000000..84996057d0 --- /dev/null +++ b/src/signalr/azext_signalr/signalr/models/regenerate_key_parameters_py3.py @@ -0,0 +1,30 @@ +# 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 RegenerateKeyParameters(Model): + """Parameters describes the request to regenerate access keys. + + :param key_type: The keyType to regenerate. Must be either 'primary' or + 'secondary'(case-insensitive). Possible values include: 'Primary', + 'Secondary' + :type key_type: str or ~azure.mgmt.signalr.models.KeyType + """ + + _attribute_map = { + 'key_type': {'key': 'keyType', 'type': 'str'}, + } + + def __init__(self, *, key_type=None, **kwargs) -> None: + super(RegenerateKeyParameters, self).__init__(**kwargs) + self.key_type = key_type diff --git a/src/signalr/azext_signalr/signalr/models/resource.py b/src/signalr/azext_signalr/signalr/models/resource.py new file mode 100644 index 0000000000..52faf058b5 --- /dev/null +++ b/src/signalr/azext_signalr/signalr/models/resource.py @@ -0,0 +1,46 @@ +# 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 Resource(Model): + """The core properties of ARM resources. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resouce. + :vartype name: str + :ivar type: The type of the service - e.g. + "Microsoft.SignalRService/SignalR" + :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(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None diff --git a/src/signalr/azext_signalr/signalr/models/resource_py3.py b/src/signalr/azext_signalr/signalr/models/resource_py3.py new file mode 100644 index 0000000000..e0a419dfa7 --- /dev/null +++ b/src/signalr/azext_signalr/signalr/models/resource_py3.py @@ -0,0 +1,46 @@ +# 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 Resource(Model): + """The core properties of ARM resources. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resouce. + :vartype name: str + :ivar type: The type of the service - e.g. + "Microsoft.SignalRService/SignalR" + :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) -> None: + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None diff --git a/src/signalr/azext_signalr/signalr/models/resource_sku.py b/src/signalr/azext_signalr/signalr/models/resource_sku.py new file mode 100644 index 0000000000..18cebb3dcf --- /dev/null +++ b/src/signalr/azext_signalr/signalr/models/resource_sku.py @@ -0,0 +1,56 @@ +# 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 ResourceSku(Model): + """The billing information of the resource.(e.g. basic vs. standard). + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the SKU. This is typically a letter + + number code, such as A0 or P3. Required (if sku is specified) + :type name: str + :param tier: The tier of this particular SKU. Optional. Possible values + include: 'Free', 'Basic', 'Premium' + :type tier: str or ~azure.mgmt.signalr.models.SignalRSkuTier + :param size: Optional, string. When the name field is the combination of + tier and some other value, this would be the standalone code. + :type size: str + :param family: Optional, string. If the service has different generations + of hardware, for the same SKU, then that can be captured here. + :type family: str + :param capacity: Optional, integer. If the SKU supports scale out/in then + the capacity integer should be included. If scale out/in is not + possible for the resource this may be omitted. + :type capacity: int + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'size': {'key': 'size', 'type': 'str'}, + 'family': {'key': 'family', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(ResourceSku, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.tier = kwargs.get('tier', None) + self.size = kwargs.get('size', None) + self.family = kwargs.get('family', None) + self.capacity = kwargs.get('capacity', None) diff --git a/src/signalr/azext_signalr/signalr/models/resource_sku_py3.py b/src/signalr/azext_signalr/signalr/models/resource_sku_py3.py new file mode 100644 index 0000000000..fb2ead5223 --- /dev/null +++ b/src/signalr/azext_signalr/signalr/models/resource_sku_py3.py @@ -0,0 +1,56 @@ +# 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 ResourceSku(Model): + """The billing information of the resource.(e.g. basic vs. standard). + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the SKU. This is typically a letter + + number code, such as A0 or P3. Required (if sku is specified) + :type name: str + :param tier: The tier of this particular SKU. Optional. Possible values + include: 'Free', 'Basic', 'Premium' + :type tier: str or ~azure.mgmt.signalr.models.SignalRSkuTier + :param size: Optional, string. When the name field is the combination of + tier and some other value, this would be the standalone code. + :type size: str + :param family: Optional, string. If the service has different generations + of hardware, for the same SKU, then that can be captured here. + :type family: str + :param capacity: Optional, integer. If the SKU supports scale out/in then + the capacity integer should be included. If scale out/in is not + possible for the resource this may be omitted. + :type capacity: int + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'size': {'key': 'size', 'type': 'str'}, + 'family': {'key': 'family', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + } + + def __init__(self, *, name: str, tier=None, size: str=None, family: str=None, capacity: int=None, **kwargs) -> None: + super(ResourceSku, self).__init__(**kwargs) + self.name = name + self.tier = tier + self.size = size + self.family = family + self.capacity = capacity diff --git a/src/signalr/azext_signalr/signalr/models/service_specification.py b/src/signalr/azext_signalr/signalr/models/service_specification.py new file mode 100644 index 0000000000..3c1c6a87bc --- /dev/null +++ b/src/signalr/azext_signalr/signalr/models/service_specification.py @@ -0,0 +1,30 @@ +# 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 ServiceSpecification(Model): + """An object that describes a specification. + + :param metric_specifications: Specifications of the Metrics for Azure + Monitoring. + :type metric_specifications: + list[~azure.mgmt.signalr.models.MetricSpecification] + """ + + _attribute_map = { + 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, + } + + def __init__(self, **kwargs): + super(ServiceSpecification, self).__init__(**kwargs) + self.metric_specifications = kwargs.get('metric_specifications', None) diff --git a/src/signalr/azext_signalr/signalr/models/service_specification_py3.py b/src/signalr/azext_signalr/signalr/models/service_specification_py3.py new file mode 100644 index 0000000000..16125e83ba --- /dev/null +++ b/src/signalr/azext_signalr/signalr/models/service_specification_py3.py @@ -0,0 +1,30 @@ +# 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 ServiceSpecification(Model): + """An object that describes a specification. + + :param metric_specifications: Specifications of the Metrics for Azure + Monitoring. + :type metric_specifications: + list[~azure.mgmt.signalr.models.MetricSpecification] + """ + + _attribute_map = { + 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, + } + + def __init__(self, *, metric_specifications=None, **kwargs) -> None: + super(ServiceSpecification, self).__init__(**kwargs) + self.metric_specifications = metric_specifications diff --git a/src/signalr/azext_signalr/signalr/models/signal_rcreate_or_update_properties.py b/src/signalr/azext_signalr/signalr/models/signal_rcreate_or_update_properties.py new file mode 100644 index 0000000000..4735f85fd6 --- /dev/null +++ b/src/signalr/azext_signalr/signalr/models/signal_rcreate_or_update_properties.py @@ -0,0 +1,31 @@ +# 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 SignalRCreateOrUpdateProperties(Model): + """Settings used to provision or configure the resource. + + :param host_name_prefix: Prefix for the hostName of the SignalR service. + Retained for future use. + The hostname will be of format: + <hostNamePrefix>.service.signalr.net. + :type host_name_prefix: str + """ + + _attribute_map = { + 'host_name_prefix': {'key': 'hostNamePrefix', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SignalRCreateOrUpdateProperties, self).__init__(**kwargs) + self.host_name_prefix = kwargs.get('host_name_prefix', None) diff --git a/src/signalr/azext_signalr/signalr/models/signal_rcreate_or_update_properties_py3.py b/src/signalr/azext_signalr/signalr/models/signal_rcreate_or_update_properties_py3.py new file mode 100644 index 0000000000..dd051d50d0 --- /dev/null +++ b/src/signalr/azext_signalr/signalr/models/signal_rcreate_or_update_properties_py3.py @@ -0,0 +1,31 @@ +# 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 SignalRCreateOrUpdateProperties(Model): + """Settings used to provision or configure the resource. + + :param host_name_prefix: Prefix for the hostName of the SignalR service. + Retained for future use. + The hostname will be of format: + <hostNamePrefix>.service.signalr.net. + :type host_name_prefix: str + """ + + _attribute_map = { + 'host_name_prefix': {'key': 'hostNamePrefix', 'type': 'str'}, + } + + def __init__(self, *, host_name_prefix: str=None, **kwargs) -> None: + super(SignalRCreateOrUpdateProperties, self).__init__(**kwargs) + self.host_name_prefix = host_name_prefix diff --git a/src/signalr/azext_signalr/signalr/models/signal_rcreate_parameters.py b/src/signalr/azext_signalr/signalr/models/signal_rcreate_parameters.py new file mode 100644 index 0000000000..69ee100c20 --- /dev/null +++ b/src/signalr/azext_signalr/signalr/models/signal_rcreate_parameters.py @@ -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 .signal_rupdate_parameters import SignalRUpdateParameters + + +class SignalRCreateParameters(SignalRUpdateParameters): + """Parameters for SignalR service create/update operation. + Keep the same schema as AzSignalR.Models.SignalRResource. + + All required parameters must be populated in order to send to Azure. + + :param tags: A list of key value pairs that describe the resource. + :type tags: dict[str, str] + :param sku: The billing information of the resource.(e.g. basic vs. + standard) + :type sku: ~azure.mgmt.signalr.models.ResourceSku + :param properties: Settings used to provision or configure the resource + :type properties: + ~azure.mgmt.signalr.models.SignalRCreateOrUpdateProperties + :param location: Required. Azure GEO region: e.g. West US | East US | + North Central US | South Central US | West Europe | North Europe | East + Asia | Southeast Asia | etc. + The geo region of a resource never changes after it is created. + :type location: str + """ + + _validation = { + 'location': {'required': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'ResourceSku'}, + 'properties': {'key': 'properties', 'type': 'SignalRCreateOrUpdateProperties'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SignalRCreateParameters, self).__init__(**kwargs) + self.location = kwargs.get('location', None) diff --git a/src/signalr/azext_signalr/signalr/models/signal_rcreate_parameters_py3.py b/src/signalr/azext_signalr/signalr/models/signal_rcreate_parameters_py3.py new file mode 100644 index 0000000000..f58bd64a88 --- /dev/null +++ b/src/signalr/azext_signalr/signalr/models/signal_rcreate_parameters_py3.py @@ -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 .signal_rupdate_parameters import SignalRUpdateParameters + + +class SignalRCreateParameters(SignalRUpdateParameters): + """Parameters for SignalR service create/update operation. + Keep the same schema as AzSignalR.Models.SignalRResource. + + All required parameters must be populated in order to send to Azure. + + :param tags: A list of key value pairs that describe the resource. + :type tags: dict[str, str] + :param sku: The billing information of the resource.(e.g. basic vs. + standard) + :type sku: ~azure.mgmt.signalr.models.ResourceSku + :param properties: Settings used to provision or configure the resource + :type properties: + ~azure.mgmt.signalr.models.SignalRCreateOrUpdateProperties + :param location: Required. Azure GEO region: e.g. West US | East US | + North Central US | South Central US | West Europe | North Europe | East + Asia | Southeast Asia | etc. + The geo region of a resource never changes after it is created. + :type location: str + """ + + _validation = { + 'location': {'required': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'ResourceSku'}, + 'properties': {'key': 'properties', 'type': 'SignalRCreateOrUpdateProperties'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__(self, *, location: str, tags=None, sku=None, properties=None, **kwargs) -> None: + super(SignalRCreateParameters, self).__init__(tags=tags, sku=sku, properties=properties, **kwargs) + self.location = location diff --git a/src/signalr/azext_signalr/signalr/models/signal_rkeys.py b/src/signalr/azext_signalr/signalr/models/signal_rkeys.py new file mode 100644 index 0000000000..8549853cbc --- /dev/null +++ b/src/signalr/azext_signalr/signalr/models/signal_rkeys.py @@ -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 SignalRKeys(Model): + """A class represents the access keys of SignalR service. + + :param primary_key: The primary access key. + :type primary_key: str + :param secondary_key: The secondary access key. + :type secondary_key: str + """ + + _attribute_map = { + 'primary_key': {'key': 'primaryKey', 'type': 'str'}, + 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SignalRKeys, self).__init__(**kwargs) + self.primary_key = kwargs.get('primary_key', None) + self.secondary_key = kwargs.get('secondary_key', None) diff --git a/src/signalr/azext_signalr/signalr/models/signal_rkeys_py3.py b/src/signalr/azext_signalr/signalr/models/signal_rkeys_py3.py new file mode 100644 index 0000000000..2ca3ca6588 --- /dev/null +++ b/src/signalr/azext_signalr/signalr/models/signal_rkeys_py3.py @@ -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 SignalRKeys(Model): + """A class represents the access keys of SignalR service. + + :param primary_key: The primary access key. + :type primary_key: str + :param secondary_key: The secondary access key. + :type secondary_key: str + """ + + _attribute_map = { + 'primary_key': {'key': 'primaryKey', 'type': 'str'}, + 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, + } + + def __init__(self, *, primary_key: str=None, secondary_key: str=None, **kwargs) -> None: + super(SignalRKeys, self).__init__(**kwargs) + self.primary_key = primary_key + self.secondary_key = secondary_key diff --git a/src/signalr/azext_signalr/signalr/models/signal_rmanagement_client_enums.py b/src/signalr/azext_signalr/signalr/models/signal_rmanagement_client_enums.py new file mode 100644 index 0000000000..7869b8dbfc --- /dev/null +++ b/src/signalr/azext_signalr/signalr/models/signal_rmanagement_client_enums.py @@ -0,0 +1,38 @@ +# 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 enum import Enum + + +class SignalRSkuTier(str, Enum): + + free = "Free" + basic = "Basic" + premium = "Premium" + + +class ProvisioningState(str, Enum): + + unknown = "Unknown" + succeeded = "Succeeded" + failed = "Failed" + canceled = "Canceled" + running = "Running" + creating = "Creating" + updating = "Updating" + deleting = "Deleting" + moving = "Moving" + + +class KeyType(str, Enum): + + primary = "Primary" + secondary = "Secondary" diff --git a/src/signalr/azext_signalr/signalr/models/signal_rresource.py b/src/signalr/azext_signalr/signalr/models/signal_rresource.py new file mode 100644 index 0000000000..45edb88c3d --- /dev/null +++ b/src/signalr/azext_signalr/signalr/models/signal_rresource.py @@ -0,0 +1,93 @@ +# 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 .tracked_resource import TrackedResource + + +class SignalRResource(TrackedResource): + """A class represent a SignalR service resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resouce. + :vartype name: str + :ivar type: The type of the service - e.g. + "Microsoft.SignalRService/SignalR" + :vartype type: str + :param location: The GEO location of the SignalR service. e.g. West US | + East US | North Central US | South Central US. + :type location: str + :param tags: Tags of the service which is a list of key value pairs that + describe the resource. + :type tags: dict[str, str] + :param sku: SKU of the service. + :type sku: ~azure.mgmt.signalr.models.ResourceSku + :param host_name_prefix: Prefix for the hostName of the SignalR service. + Retained for future use. + The hostname will be of format: + <hostNamePrefix>.service.signalr.net. + :type host_name_prefix: str + :ivar provisioning_state: Provisioning state of the resource. Possible + values include: 'Unknown', 'Succeeded', 'Failed', 'Canceled', 'Running', + 'Creating', 'Updating', 'Deleting', 'Moving' + :vartype provisioning_state: str or + ~azure.mgmt.signalr.models.ProvisioningState + :ivar external_ip: The publicly accessible IP of the SignalR service. + :vartype external_ip: str + :ivar host_name: FQDN of the SignalR service instance. Format: + xxx.service.signalr.net + :vartype host_name: str + :ivar public_port: The publicly accessibly port of the SignalR service + which is designed for browser/client side usage. + :vartype public_port: int + :ivar server_port: The publicly accessibly port of the SignalR service + which is designed for customer server side usage. + :vartype server_port: int + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'external_ip': {'readonly': True}, + 'host_name': {'readonly': True}, + 'public_port': {'readonly': True}, + 'server_port': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'ResourceSku'}, + 'host_name_prefix': {'key': 'properties.hostNamePrefix', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'external_ip': {'key': 'properties.externalIP', 'type': 'str'}, + 'host_name': {'key': 'properties.hostName', 'type': 'str'}, + 'public_port': {'key': 'properties.publicPort', 'type': 'int'}, + 'server_port': {'key': 'properties.serverPort', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(SignalRResource, self).__init__(**kwargs) + self.sku = kwargs.get('sku', None) + self.host_name_prefix = kwargs.get('host_name_prefix', None) + self.provisioning_state = None + self.external_ip = None + self.host_name = None + self.public_port = None + self.server_port = None diff --git a/src/signalr/azext_signalr/signalr/models/signal_rresource_paged.py b/src/signalr/azext_signalr/signalr/models/signal_rresource_paged.py new file mode 100644 index 0000000000..98b0225b9f --- /dev/null +++ b/src/signalr/azext_signalr/signalr/models/signal_rresource_paged.py @@ -0,0 +1,27 @@ +# 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.paging import Paged + + +class SignalRResourcePaged(Paged): + """ + A paging container for iterating over a list of :class:`SignalRResource ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[SignalRResource]'} + } + + def __init__(self, *args, **kwargs): + + super(SignalRResourcePaged, self).__init__(*args, **kwargs) diff --git a/src/signalr/azext_signalr/signalr/models/signal_rresource_py3.py b/src/signalr/azext_signalr/signalr/models/signal_rresource_py3.py new file mode 100644 index 0000000000..4356b4f06b --- /dev/null +++ b/src/signalr/azext_signalr/signalr/models/signal_rresource_py3.py @@ -0,0 +1,93 @@ +# 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 .tracked_resource import TrackedResource + + +class SignalRResource(TrackedResource): + """A class represent a SignalR service resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resouce. + :vartype name: str + :ivar type: The type of the service - e.g. + "Microsoft.SignalRService/SignalR" + :vartype type: str + :param location: The GEO location of the SignalR service. e.g. West US | + East US | North Central US | South Central US. + :type location: str + :param tags: Tags of the service which is a list of key value pairs that + describe the resource. + :type tags: dict[str, str] + :param sku: SKU of the service. + :type sku: ~azure.mgmt.signalr.models.ResourceSku + :param host_name_prefix: Prefix for the hostName of the SignalR service. + Retained for future use. + The hostname will be of format: + <hostNamePrefix>.service.signalr.net. + :type host_name_prefix: str + :ivar provisioning_state: Provisioning state of the resource. Possible + values include: 'Unknown', 'Succeeded', 'Failed', 'Canceled', 'Running', + 'Creating', 'Updating', 'Deleting', 'Moving' + :vartype provisioning_state: str or + ~azure.mgmt.signalr.models.ProvisioningState + :ivar external_ip: The publicly accessible IP of the SignalR service. + :vartype external_ip: str + :ivar host_name: FQDN of the SignalR service instance. Format: + xxx.service.signalr.net + :vartype host_name: str + :ivar public_port: The publicly accessibly port of the SignalR service + which is designed for browser/client side usage. + :vartype public_port: int + :ivar server_port: The publicly accessibly port of the SignalR service + which is designed for customer server side usage. + :vartype server_port: int + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'external_ip': {'readonly': True}, + 'host_name': {'readonly': True}, + 'public_port': {'readonly': True}, + 'server_port': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'ResourceSku'}, + 'host_name_prefix': {'key': 'properties.hostNamePrefix', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'external_ip': {'key': 'properties.externalIP', 'type': 'str'}, + 'host_name': {'key': 'properties.hostName', 'type': 'str'}, + 'public_port': {'key': 'properties.publicPort', 'type': 'int'}, + 'server_port': {'key': 'properties.serverPort', 'type': 'int'}, + } + + def __init__(self, *, location: str=None, tags=None, sku=None, host_name_prefix: str=None, **kwargs) -> None: + super(SignalRResource, self).__init__(location=location, tags=tags, **kwargs) + self.sku = sku + self.host_name_prefix = host_name_prefix + self.provisioning_state = None + self.external_ip = None + self.host_name = None + self.public_port = None + self.server_port = None diff --git a/src/signalr/azext_signalr/signalr/models/signal_rupdate_parameters.py b/src/signalr/azext_signalr/signalr/models/signal_rupdate_parameters.py new file mode 100644 index 0000000000..2f17725517 --- /dev/null +++ b/src/signalr/azext_signalr/signalr/models/signal_rupdate_parameters.py @@ -0,0 +1,38 @@ +# 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 SignalRUpdateParameters(Model): + """Parameters for SignalR service update operation. + + :param tags: A list of key value pairs that describe the resource. + :type tags: dict[str, str] + :param sku: The billing information of the resource.(e.g. basic vs. + standard) + :type sku: ~azure.mgmt.signalr.models.ResourceSku + :param properties: Settings used to provision or configure the resource + :type properties: + ~azure.mgmt.signalr.models.SignalRCreateOrUpdateProperties + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'ResourceSku'}, + 'properties': {'key': 'properties', 'type': 'SignalRCreateOrUpdateProperties'}, + } + + def __init__(self, **kwargs): + super(SignalRUpdateParameters, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.sku = kwargs.get('sku', None) + self.properties = kwargs.get('properties', None) diff --git a/src/signalr/azext_signalr/signalr/models/signal_rupdate_parameters_py3.py b/src/signalr/azext_signalr/signalr/models/signal_rupdate_parameters_py3.py new file mode 100644 index 0000000000..da20f519dd --- /dev/null +++ b/src/signalr/azext_signalr/signalr/models/signal_rupdate_parameters_py3.py @@ -0,0 +1,38 @@ +# 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 SignalRUpdateParameters(Model): + """Parameters for SignalR service update operation. + + :param tags: A list of key value pairs that describe the resource. + :type tags: dict[str, str] + :param sku: The billing information of the resource.(e.g. basic vs. + standard) + :type sku: ~azure.mgmt.signalr.models.ResourceSku + :param properties: Settings used to provision or configure the resource + :type properties: + ~azure.mgmt.signalr.models.SignalRCreateOrUpdateProperties + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'ResourceSku'}, + 'properties': {'key': 'properties', 'type': 'SignalRCreateOrUpdateProperties'}, + } + + def __init__(self, *, tags=None, sku=None, properties=None, **kwargs) -> None: + super(SignalRUpdateParameters, self).__init__(**kwargs) + self.tags = tags + self.sku = sku + self.properties = properties diff --git a/src/signalr/azext_signalr/signalr/models/tracked_resource.py b/src/signalr/azext_signalr/signalr/models/tracked_resource.py new file mode 100644 index 0000000000..ef21d96d00 --- /dev/null +++ b/src/signalr/azext_signalr/signalr/models/tracked_resource.py @@ -0,0 +1,53 @@ +# 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 .resource import Resource + + +class TrackedResource(Resource): + """The resource model definition for a ARM tracked top level resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resouce. + :vartype name: str + :ivar type: The type of the service - e.g. + "Microsoft.SignalRService/SignalR" + :vartype type: str + :param location: The GEO location of the SignalR service. e.g. West US | + East US | North Central US | South Central US. + :type location: str + :param tags: Tags of the service which is a list of key value pairs that + describe the resource. + :type tags: dict[str, 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'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(TrackedResource, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) diff --git a/src/signalr/azext_signalr/signalr/models/tracked_resource_py3.py b/src/signalr/azext_signalr/signalr/models/tracked_resource_py3.py new file mode 100644 index 0000000000..066145840c --- /dev/null +++ b/src/signalr/azext_signalr/signalr/models/tracked_resource_py3.py @@ -0,0 +1,53 @@ +# 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 .resource import Resource + + +class TrackedResource(Resource): + """The resource model definition for a ARM tracked top level resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resouce. + :vartype name: str + :ivar type: The type of the service - e.g. + "Microsoft.SignalRService/SignalR" + :vartype type: str + :param location: The GEO location of the SignalR service. e.g. West US | + East US | North Central US | South Central US. + :type location: str + :param tags: Tags of the service which is a list of key value pairs that + describe the resource. + :type tags: dict[str, 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'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, location: str=None, tags=None, **kwargs) -> None: + super(TrackedResource, self).__init__(**kwargs) + self.location = location + self.tags = tags diff --git a/src/signalr/azext_signalr/signalr/operations/__init__.py b/src/signalr/azext_signalr/signalr/operations/__init__.py new file mode 100644 index 0000000000..6eacbb8c5d --- /dev/null +++ b/src/signalr/azext_signalr/signalr/operations/__init__.py @@ -0,0 +1,18 @@ +# 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 .operations import Operations +from .signal_roperations import SignalROperations + +__all__ = [ + 'Operations', + 'SignalROperations', +] diff --git a/src/signalr/azext_signalr/signalr/operations/operations.py b/src/signalr/azext_signalr/signalr/operations/operations.py new file mode 100644 index 0000000000..e04d3eee40 --- /dev/null +++ b/src/signalr/azext_signalr/signalr/operations/operations.py @@ -0,0 +1,100 @@ +# 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 Operations(object): + """Operations 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: Client Api Version. Constant value: "2018-03-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-03-01-preview" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Lists all of the available REST API operations of the + Microsoft.SignalRService provider. + + :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: An iterator like instance of Operation + :rtype: + ~azure.mgmt.signalr.models.OperationPaged[~azure.mgmt.signalr.models.Operation] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list.metadata['url'] + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + 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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, 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 + + return response + + # Deserialize response + deserialized = models.OperationPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.OperationPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list.metadata = {'url': '/providers/Microsoft.SignalRService/operations'} diff --git a/src/signalr/azext_signalr/signalr/operations/signal_roperations.py b/src/signalr/azext_signalr/signalr/operations/signal_roperations.py new file mode 100644 index 0000000000..c2979f03f3 --- /dev/null +++ b/src/signalr/azext_signalr/signalr/operations/signal_roperations.py @@ -0,0 +1,780 @@ +# 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 msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class SignalROperations(object): + """SignalROperations 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: Client Api Version. Constant value: "2018-03-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-03-01-preview" + + self.config = config + + def check_name_availability( + self, type, name, custom_headers=None, raw=False, **operation_config): + """Checks that the SignalR name is valid and is not already in use. + + :param type: The resource type. Should be always + "Microsoft.SignalRService/SignalR". + :type type: str + :param name: The SignalR service name to validate. + e.g."my-signalR-name-here" + :type name: 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: NameAvailability or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.signalr.models.NameAvailability or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + parameters = None + if type is not None or name is not None: + parameters = models.NameAvailabilityParameters(type=type, name=name) + + # Construct URL + url = self.check_name_availability.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, '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['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 + if parameters is not None: + body_content = self._serialize.body(parameters, 'NameAvailabilityParameters') + else: + body_content = None + + # Construct and send request + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, 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('NameAvailability', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/checkNameAvailability'} + + def list_by_subscription( + self, custom_headers=None, raw=False, **operation_config): + """Handles requests to list all resources in a subscription. + + :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: An iterator like instance of SignalRResource + :rtype: + ~azure.mgmt.signalr.models.SignalRResourcePaged[~azure.mgmt.signalr.models.SignalRResource] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, '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') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + 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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, 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 + + return response + + # Deserialize response + deserialized = models.SignalRResourcePaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.SignalRResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/SignalR'} + + def list_by_resource_group( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Handles requests to list all resources in a resource group. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: 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: An iterator like instance of SignalRResource + :rtype: + ~azure.mgmt.signalr.models.SignalRResourcePaged[~azure.mgmt.signalr.models.SignalRResource] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, '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') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + 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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, 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 + + return response + + # Deserialize response + deserialized = models.SignalRResourcePaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.SignalRResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/SignalR'} + + def list_keys( + self, resource_group_name, resource_name, custom_headers=None, raw=False, **operation_config): + """Get the access keys of the SignalR resource. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param resource_name: The name of the SignalR resource. + :type resource_name: 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: SignalRKeys or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.signalr.models.SignalRKeys or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.list_keys.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, '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['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 and send request + request = self._client.post(url, query_parameters) + response = self._client.send(request, header_parameters, 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('SignalRKeys', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/SignalR/{resourceName}/listKeys'} + + + def _regenerate_key_initial( + self, resource_group_name, resource_name, key_type=None, custom_headers=None, raw=False, **operation_config): + parameters = None + if key_type is not None: + parameters = models.RegenerateKeyParameters(key_type=key_type) + + # Construct URL + url = self.regenerate_key.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, '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['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 + if parameters is not None: + body_content = self._serialize.body(parameters, 'RegenerateKeyParameters') + else: + body_content = None + + # Construct and send request + request = self._client.post(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) + + if response.status_code not in [201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 201: + deserialized = self._deserialize('SignalRKeys', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def regenerate_key( + self, resource_group_name, resource_name, key_type=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Regenerate SignalR service access key. PrimaryKey and SecondaryKey + cannot be regenerated at the same time. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param resource_name: The name of the SignalR resource. + :type resource_name: str + :param key_type: The keyType to regenerate. Must be either 'primary' + or 'secondary'(case-insensitive). Possible values include: 'Primary', + 'Secondary' + :type key_type: str or ~azure.mgmt.signalr.models.KeyType + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns SignalRKeys or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.signalr.models.SignalRKeys] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.signalr.models.SignalRKeys]] + :raises: :class:`CloudError` + """ + raw_result = self._regenerate_key_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + key_type=key_type, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('SignalRKeys', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/SignalR/{resourceName}/regenerateKey'} + + def get( + self, resource_group_name, resource_name, custom_headers=None, raw=False, **operation_config): + """Get the SignalR service and its properties. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param resource_name: The name of the SignalR resource. + :type resource_name: 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: SignalRResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.signalr.models.SignalRResource or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, '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['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 and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, 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('SignalRResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/SignalR/{resourceName}'} + + + def _create_or_update_initial( + self, resource_group_name, resource_name, parameters=None, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, '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['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 + if parameters is not None: + body_content = self._serialize.body(parameters, 'SignalRCreateParameters') + else: + body_content = None + + # Construct and send request + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) + + if response.status_code not in [201, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 201: + deserialized = self._deserialize('SignalRResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, resource_name, parameters=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Create a new SignalR service and update an exiting SignalR service. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param resource_name: The name of the SignalR resource. + :type resource_name: str + :param parameters: Parameters for the create or update operation + :type parameters: ~azure.mgmt.signalr.models.SignalRCreateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns SignalRResource or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.signalr.models.SignalRResource] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.signalr.models.SignalRResource]] + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('SignalRResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/SignalR/{resourceName}'} + + + def _delete_initial( + self, resource_group_name, resource_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, '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['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 and send request + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, resource_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Operation to delete a SignalR service. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param resource_name: The name of the SignalR resource. + :type resource_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/SignalR/{resourceName}'} + + + def _update_initial( + self, resource_group_name, resource_name, parameters=None, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, '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['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 + if parameters is not None: + body_content = self._serialize.body(parameters, 'SignalRUpdateParameters') + else: + body_content = None + + # Construct and send request + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + 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('SignalRResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, resource_name, parameters=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Operation to update an exiting SignalR service. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param resource_name: The name of the SignalR resource. + :type resource_name: str + :param parameters: Parameters for the update operation + :type parameters: ~azure.mgmt.signalr.models.SignalRUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns SignalRResource or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.signalr.models.SignalRResource] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.signalr.models.SignalRResource]] + :raises: :class:`CloudError` + """ + raw_result = self._update_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('SignalRResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/SignalR/{resourceName}'} diff --git a/src/signalr/azext_signalr/signalr/signal_rmanagement_client.py b/src/signalr/azext_signalr/signalr/signal_rmanagement_client.py new file mode 100644 index 0000000000..166b6bff53 --- /dev/null +++ b/src/signalr/azext_signalr/signalr/signal_rmanagement_client.py @@ -0,0 +1,90 @@ +# 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.service_client import SDKClient +from msrest import Serializer, Deserializer +from msrestazure import AzureConfiguration +from .version import VERSION +from .operations.operations import Operations +from .operations.signal_roperations import SignalROperations +from . import models + + +class SignalRManagementClientConfiguration(AzureConfiguration): + """Configuration for SignalRManagementClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: Gets subscription Id which uniquely identify the + Microsoft Azure subscription. The subscription ID forms part of the URI + for every service call. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(SignalRManagementClientConfiguration, self).__init__(base_url) + + self.add_user_agent('azure-mgmt-signalr/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id + + +class SignalRManagementClient(SDKClient): + """REST API for Azure SignalR Service + + :ivar config: Configuration for client. + :vartype config: SignalRManagementClientConfiguration + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.signalr.operations.Operations + :ivar signal_r: SignalR operations + :vartype signal_r: azure.mgmt.signalr.operations.SignalROperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: Gets subscription Id which uniquely identify the + Microsoft Azure subscription. The subscription ID forms part of the URI + for every service call. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + self.config = SignalRManagementClientConfiguration(credentials, subscription_id, base_url) + super(SignalRManagementClient, 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 = '2018-03-01-preview' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.operations = Operations( + self._client, self.config, self._serialize, self._deserialize) + self.signal_r = SignalROperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/src/signalr/azext_signalr/signalr/version.py b/src/signalr/azext_signalr/signalr/version.py new file mode 100644 index 0000000000..e0ec669828 --- /dev/null +++ b/src/signalr/azext_signalr/signalr/version.py @@ -0,0 +1,13 @@ +# 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. +# -------------------------------------------------------------------------- + +VERSION = "0.1.0" + diff --git a/src/signalr/azext_signalr/tests/__init__.py b/src/signalr/azext_signalr/tests/__init__.py new file mode 100644 index 0000000000..34913fb394 --- /dev/null +++ b/src/signalr/azext_signalr/tests/__init__.py @@ -0,0 +1,4 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- diff --git a/src/signalr/azext_signalr/tests/latest/__init__.py b/src/signalr/azext_signalr/tests/latest/__init__.py new file mode 100644 index 0000000000..34913fb394 --- /dev/null +++ b/src/signalr/azext_signalr/tests/latest/__init__.py @@ -0,0 +1,4 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- diff --git a/src/signalr/azext_signalr/tests/latest/recordings/test_signalr_commands.yaml b/src/signalr/azext_signalr/tests/latest/recordings/test_signalr_commands.yaml new file mode 100644 index 0000000000..6dbaa85b81 --- /dev/null +++ b/src/signalr/azext_signalr/tests/latest/recordings/test_signalr_commands.yaml @@ -0,0 +1,344 @@ +interactions: +- request: + body: !!python/unicode '{"location": "westus", "tags": {"date": "2018-04-18T06:43:11Z", + "product": "azurecli", "cause": "automation"}}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [group create] + Connection: [keep-alive] + Content-Length: ['110'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/2.7.14 (Windows-10-10.0.17133) requests/2.18.4 msrest/0.4.27 + msrest_azure/0.4.25 resourcemanagementclient/1.2.1 Azure-SDK-For-Python + AZURECLI/2.0.32] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg000001?api-version=2017-05-10 + response: + body: {string: !!python/unicode '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001","name":"clitest.rg000001","location":"westus","tags":{"date":"2018-04-18T06:43:11Z","product":"azurecli","cause":"automation"},"properties":{"provisioningState":"Succeeded"}}'} + headers: + cache-control: [no-cache] + content-length: ['274'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 18 Apr 2018 06:43:16 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-ms-ratelimit-remaining-subscription-writes: ['1185'] + status: {code: 201, message: Created} +- request: + body: !!python/unicode '{"sku": {"capacity": 1, "name": "Basic_DS2"}, "tags": + {"key": "value"}, "location": "eastus", "properties": {}}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [signalr create] + Connection: [keep-alive] + Content-Length: ['111'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/2.7.14 (Windows-10-10.0.17133) requests/2.18.4 msrest/0.4.27 + msrest_azure/0.4.25 azure-mgmt-signalr/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.32] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/SignalR/signalr000002?api-version=2018-03-01-preview + response: + body: {string: !!python/unicode '{"sku":{"name":"Basic_DS2","tier":"Basic","size":"DS2","capacity":1},"properties":{"provisioningState":"Creating","externalIP":null,"hostName":"signalr000002.service.signalr.net","publicPort":5001,"serverPort":5002,"hostNamePrefix":null},"location":"eastus","tags":{"key":"value"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/SignalR/signalr000002","name":"signalr000002","type":"Microsoft.SignalRService/SignalR"}'} + headers: + cache-control: [no-cache] + content-length: ['507'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 18 Apr 2018 06:43:22 GMT'] + expires: ['-1'] + location: ['/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/SignalR/signalr000002?api-version=2018-03-01-preview'] + pragma: [no-cache] + server: [Kestrel] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-ms-ratelimit-remaining-subscription-writes: ['1136'] + x-rp-server-mvid: [ce49f4a3-7c3a-4945-9c5c-73aa4062a6ec] + status: {code: 201, message: Created} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [signalr create] + Connection: [keep-alive] + User-Agent: [python/2.7.14 (Windows-10-10.0.17133) requests/2.18.4 msrest/0.4.27 + msrest_azure/0.4.25 azure-mgmt-signalr/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.32] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/SignalR/signalr000002?api-version=2018-03-01-preview + response: + body: {string: !!python/unicode '{"sku":{"name":"Basic_DS2","tier":"Basic","size":"DS2","capacity":1},"properties":{"provisioningState":"Creating","externalIP":null,"hostName":"signalr000002.service.signalr.net","publicPort":5001,"serverPort":5002,"hostNamePrefix":null},"location":"eastus","tags":{"key":"value"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/SignalR/signalr000002","name":"signalr000002","type":"Microsoft.SignalRService/SignalR"}'} + headers: + cache-control: [no-cache] + content-length: ['507'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 18 Apr 2018 06:43:54 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Kestrel] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-content-type-options: [nosniff] + x-rp-server-mvid: [ce49f4a3-7c3a-4945-9c5c-73aa4062a6ec] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [signalr create] + Connection: [keep-alive] + User-Agent: [python/2.7.14 (Windows-10-10.0.17133) requests/2.18.4 msrest/0.4.27 + msrest_azure/0.4.25 azure-mgmt-signalr/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.32] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/SignalR/signalr000002?api-version=2018-03-01-preview + response: + body: {string: !!python/unicode '{"sku":{"name":"Basic_DS2","tier":"Basic","size":"DS2","capacity":1},"properties":{"provisioningState":"Creating","externalIP":null,"hostName":"signalr000002.service.signalr.net","publicPort":5001,"serverPort":5002,"hostNamePrefix":null},"location":"eastus","tags":{"key":"value"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/SignalR/signalr000002","name":"signalr000002","type":"Microsoft.SignalRService/SignalR"}'} + headers: + cache-control: [no-cache] + content-length: ['507'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 18 Apr 2018 06:44:24 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Kestrel] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-content-type-options: [nosniff] + x-rp-server-mvid: [ce49f4a3-7c3a-4945-9c5c-73aa4062a6ec] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [signalr create] + Connection: [keep-alive] + User-Agent: [python/2.7.14 (Windows-10-10.0.17133) requests/2.18.4 msrest/0.4.27 + msrest_azure/0.4.25 azure-mgmt-signalr/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.32] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/SignalR/signalr000002?api-version=2018-03-01-preview + response: + body: {string: !!python/unicode '{"sku":{"name":"Basic_DS2","tier":"Basic","size":"DS2","capacity":1},"properties":{"provisioningState":"Creating","externalIP":"52.186.14.213","hostName":"signalr000002.service.signalr.net","publicPort":5001,"serverPort":5002,"hostNamePrefix":null},"location":"eastus","tags":{"key":"value"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/SignalR/signalr000002","name":"signalr000002","type":"Microsoft.SignalRService/SignalR"}'} + headers: + cache-control: [no-cache] + content-length: ['518'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 18 Apr 2018 06:44:56 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Kestrel] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-content-type-options: [nosniff] + x-rp-server-mvid: [ce49f4a3-7c3a-4945-9c5c-73aa4062a6ec] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [signalr create] + Connection: [keep-alive] + User-Agent: [python/2.7.14 (Windows-10-10.0.17133) requests/2.18.4 msrest/0.4.27 + msrest_azure/0.4.25 azure-mgmt-signalr/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.32] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/SignalR/signalr000002?api-version=2018-03-01-preview + response: + body: {string: !!python/unicode '{"sku":{"name":"Basic_DS2","tier":"Basic","size":"DS2","capacity":1},"properties":{"provisioningState":"Creating","externalIP":"52.186.14.213","hostName":"signalr000002.service.signalr.net","publicPort":5001,"serverPort":5002,"hostNamePrefix":null},"location":"eastus","tags":{"key":"value"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/SignalR/signalr000002","name":"signalr000002","type":"Microsoft.SignalRService/SignalR"}'} + headers: + cache-control: [no-cache] + content-length: ['518'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 18 Apr 2018 06:45:27 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Kestrel] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-content-type-options: [nosniff] + x-rp-server-mvid: [ce49f4a3-7c3a-4945-9c5c-73aa4062a6ec] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [signalr create] + Connection: [keep-alive] + User-Agent: [python/2.7.14 (Windows-10-10.0.17133) requests/2.18.4 msrest/0.4.27 + msrest_azure/0.4.25 azure-mgmt-signalr/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.32] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/SignalR/signalr000002?api-version=2018-03-01-preview + response: + body: {string: !!python/unicode '{"sku":{"name":"Basic_DS2","tier":"Basic","size":"DS2","capacity":1},"properties":{"provisioningState":"Succeeded","externalIP":"52.186.14.213","hostName":"signalr000002.service.signalr.net","publicPort":5001,"serverPort":5002,"hostNamePrefix":null},"location":"eastus","tags":{"key":"value"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/SignalR/signalr000002","name":"signalr000002","type":"Microsoft.SignalRService/SignalR"}'} + headers: + cache-control: [no-cache] + content-length: ['519'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 18 Apr 2018 06:45:57 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Kestrel] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-content-type-options: [nosniff] + x-rp-server-mvid: [ce49f4a3-7c3a-4945-9c5c-73aa4062a6ec] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [signalr show] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/2.7.14 (Windows-10-10.0.17133) requests/2.18.4 msrest/0.4.27 + msrest_azure/0.4.25 azure-mgmt-signalr/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.32] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/SignalR/signalr000002?api-version=2018-03-01-preview + response: + body: {string: !!python/unicode '{"sku":{"name":"Basic_DS2","tier":"Basic","size":"DS2","capacity":1},"properties":{"provisioningState":"Succeeded","externalIP":"52.186.14.213","hostName":"signalr000002.service.signalr.net","publicPort":5001,"serverPort":5002,"hostNamePrefix":null},"location":"eastus","tags":{"key":"value"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/SignalR/signalr000002","name":"signalr000002","type":"Microsoft.SignalRService/SignalR"}'} + headers: + cache-control: [no-cache] + content-length: ['519'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 18 Apr 2018 06:46:00 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Kestrel] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-content-type-options: [nosniff] + x-rp-server-mvid: [ce49f4a3-7c3a-4945-9c5c-73aa4062a6ec] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [signalr list] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/2.7.14 (Windows-10-10.0.17133) requests/2.18.4 msrest/0.4.27 + msrest_azure/0.4.25 azure-mgmt-signalr/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.32] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/SignalR?api-version=2018-03-01-preview + response: + body: {string: !!python/unicode '{"value":[{"sku":{"name":"Basic_DS2","tier":"Basic","size":"DS2","capacity":1},"properties":{"provisioningState":"Succeeded","externalIP":"52.186.14.213","hostName":"signalr000002.service.signalr.net","publicPort":5001,"serverPort":5002,"hostNamePrefix":null},"location":"eastus","tags":{"key":"value"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/SignalR/signalr000002","name":"signalr000002","type":"Microsoft.SignalRService/SignalR"}]}'} + headers: + cache-control: [no-cache] + content-length: ['531'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 18 Apr 2018 06:46:01 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Kestrel] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-content-type-options: [nosniff] + x-rp-server-mvid: [ce49f4a3-7c3a-4945-9c5c-73aa4062a6ec] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [signalr key list] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/2.7.14 (Windows-10-10.0.17133) requests/2.18.4 msrest/0.4.27 + msrest_azure/0.4.25 azure-mgmt-signalr/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.32] + accept-language: [en-US] + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/SignalR/signalr000002/listKeys?api-version=2018-03-01-preview + response: + body: {string: !!python/unicode '{"primaryKey":"jcDZZ4MraKySuGlDHIQ7Risc4xnTyN3dEjy4lZFFnVk=","secondaryKey":"A4oMGrPpHOK7/CwumXobfiDVuWRpmvNpeYCDgWtxkjk="}'} + headers: + cache-control: [no-cache] + content-length: ['123'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 18 Apr 2018 06:46:03 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Kestrel] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-content-type-options: [nosniff] + x-ms-ratelimit-remaining-subscription-writes: ['1140'] + x-rp-server-mvid: [ce49f4a3-7c3a-4945-9c5c-73aa4062a6ec] + status: {code: 200, message: OK} +- request: + body: !!python/unicode '{"keyType": "Secondary"}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [signalr key renew] + Connection: [keep-alive] + Content-Length: ['24'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/2.7.14 (Windows-10-10.0.17133) requests/2.18.4 msrest/0.4.27 + msrest_azure/0.4.25 azure-mgmt-signalr/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.32] + accept-language: [en-US] + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/SignalR/signalr000002/regenerateKey?api-version=2018-03-01-preview + response: + body: {string: !!python/unicode '{"primaryKey":"jcDZZ4MraKySuGlDHIQ7Risc4xnTyN3dEjy4lZFFnVk=","secondaryKey":"RzZiqdcre3PMa/77KfphUUnG+Ikgz+g2e2r+3ss6JPk="}'} + headers: + cache-control: [no-cache] + content-length: ['123'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 18 Apr 2018 06:46:05 GMT'] + expires: ['-1'] + location: ['https://signalrprod.eastus.cloudapp.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/operationResults/signalr000002/operationresult/43c2cf59-a595-4fe2-9695-d8d1975ea89b?api-version=2018-03-01-preview'] + pragma: [no-cache] + server: [Kestrel] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-ms-ratelimit-remaining-subscription-writes: ['1139'] + x-rp-server-mvid: [ce49f4a3-7c3a-4945-9c5c-73aa4062a6ec] + status: {code: 201, message: Created} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [group delete] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/2.7.14 (Windows-10-10.0.17133) requests/2.18.4 msrest/0.4.27 + msrest_azure/0.4.25 resourcemanagementclient/1.2.1 Azure-SDK-For-Python + AZURECLI/2.0.32] + accept-language: [en-US] + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg000001?api-version=2017-05-10 + response: + body: {string: !!python/unicode ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Wed, 18 Apr 2018 06:46:08 GMT'] + expires: ['-1'] + location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTElURVNUOjJFUkczNEM0V0hXU0pKLVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2017-05-10'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-ms-ratelimit-remaining-subscription-writes: ['1195'] + status: {code: 202, message: Accepted} +version: 1 diff --git a/src/signalr/azext_signalr/tests/latest/recordings/test_signalr_create.yaml b/src/signalr/azext_signalr/tests/latest/recordings/test_signalr_create.yaml new file mode 100644 index 0000000000..75aae86f48 --- /dev/null +++ b/src/signalr/azext_signalr/tests/latest/recordings/test_signalr_create.yaml @@ -0,0 +1,371 @@ +interactions: +- request: + body: !!python/unicode '{"location": "westus", "tags": {"date": "2018-04-18T03:06:18Z", + "product": "azurecli", "cause": "automation"}}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [group create] + Connection: [keep-alive] + Content-Length: ['110'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/2.7.14 (Windows-10-10.0.17133) requests/2.18.4 msrest/0.4.27 + msrest_azure/0.4.25 resourcemanagementclient/1.2.1 Azure-SDK-For-Python + AZURECLI/2.0.32] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg000001?api-version=2017-05-10 + response: + body: {string: !!python/unicode '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001","name":"clitest.rg000001","location":"westus","tags":{"date":"2018-04-18T03:06:18Z","product":"azurecli","cause":"automation"},"properties":{"provisioningState":"Succeeded"}}'} + headers: + cache-control: [no-cache] + content-length: ['274'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 18 Apr 2018 03:06:21 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-ms-ratelimit-remaining-subscription-writes: ['1138'] + status: {code: 201, message: Created} +- request: + body: !!python/unicode '{"sku": {"capacity": 1, "name": "Basic_DS2"}, "tags": + {"key": "value"}, "location": "eastus", "properties": {}}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [signalr create] + Connection: [keep-alive] + Content-Length: ['111'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/2.7.14 (Windows-10-10.0.17133) requests/2.18.4 msrest/0.4.27 + msrest_azure/0.4.25 azure-mgmt-signalr/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.32] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/SignalR/signalr000002?api-version=2018-03-01-preview + response: + body: {string: !!python/unicode '{"sku":{"name":"Basic_DS2","tier":"Basic","size":"DS2","capacity":1},"properties":{"provisioningState":"Creating","externalIP":null,"hostName":"signalr000002.service.signalr.net","publicPort":5001,"serverPort":5002,"hostNamePrefix":null},"location":"eastus","tags":{"key":"value"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/SignalR/signalr000002","name":"signalr000002","type":"Microsoft.SignalRService/SignalR"}'} + headers: + cache-control: [no-cache] + content-length: ['507'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 18 Apr 2018 03:06:26 GMT'] + expires: ['-1'] + location: ['/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/SignalR/signalr000002?api-version=2018-03-01-preview'] + pragma: [no-cache] + server: [Kestrel] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-ms-ratelimit-remaining-subscription-writes: ['1196'] + x-rp-server-mvid: [ce49f4a3-7c3a-4945-9c5c-73aa4062a6ec] + status: {code: 201, message: Created} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [signalr create] + Connection: [keep-alive] + User-Agent: [python/2.7.14 (Windows-10-10.0.17133) requests/2.18.4 msrest/0.4.27 + msrest_azure/0.4.25 azure-mgmt-signalr/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.32] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/SignalR/signalr000002?api-version=2018-03-01-preview + response: + body: {string: !!python/unicode '{"sku":{"name":"Basic_DS2","tier":"Basic","size":"DS2","capacity":1},"properties":{"provisioningState":"Creating","externalIP":null,"hostName":"signalr000002.service.signalr.net","publicPort":5001,"serverPort":5002,"hostNamePrefix":null},"location":"eastus","tags":{"key":"value"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/SignalR/signalr000002","name":"signalr000002","type":"Microsoft.SignalRService/SignalR"}'} + headers: + cache-control: [no-cache] + content-length: ['507'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 18 Apr 2018 03:06:57 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Kestrel] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-content-type-options: [nosniff] + x-rp-server-mvid: [ce49f4a3-7c3a-4945-9c5c-73aa4062a6ec] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [signalr create] + Connection: [keep-alive] + User-Agent: [python/2.7.14 (Windows-10-10.0.17133) requests/2.18.4 msrest/0.4.27 + msrest_azure/0.4.25 azure-mgmt-signalr/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.32] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/SignalR/signalr000002?api-version=2018-03-01-preview + response: + body: {string: !!python/unicode '{"sku":{"name":"Basic_DS2","tier":"Basic","size":"DS2","capacity":1},"properties":{"provisioningState":"Creating","externalIP":null,"hostName":"signalr000002.service.signalr.net","publicPort":5001,"serverPort":5002,"hostNamePrefix":null},"location":"eastus","tags":{"key":"value"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/SignalR/signalr000002","name":"signalr000002","type":"Microsoft.SignalRService/SignalR"}'} + headers: + cache-control: [no-cache] + content-length: ['507'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 18 Apr 2018 03:07:28 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Kestrel] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-content-type-options: [nosniff] + x-rp-server-mvid: [ce49f4a3-7c3a-4945-9c5c-73aa4062a6ec] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [signalr create] + Connection: [keep-alive] + User-Agent: [python/2.7.14 (Windows-10-10.0.17133) requests/2.18.4 msrest/0.4.27 + msrest_azure/0.4.25 azure-mgmt-signalr/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.32] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/SignalR/signalr000002?api-version=2018-03-01-preview + response: + body: {string: !!python/unicode '{"sku":{"name":"Basic_DS2","tier":"Basic","size":"DS2","capacity":1},"properties":{"provisioningState":"Creating","externalIP":null,"hostName":"signalr000002.service.signalr.net","publicPort":5001,"serverPort":5002,"hostNamePrefix":null},"location":"eastus","tags":{"key":"value"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/SignalR/signalr000002","name":"signalr000002","type":"Microsoft.SignalRService/SignalR"}'} + headers: + cache-control: [no-cache] + content-length: ['507'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 18 Apr 2018 03:07:59 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Kestrel] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-content-type-options: [nosniff] + x-rp-server-mvid: [ce49f4a3-7c3a-4945-9c5c-73aa4062a6ec] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [signalr create] + Connection: [keep-alive] + User-Agent: [python/2.7.14 (Windows-10-10.0.17133) requests/2.18.4 msrest/0.4.27 + msrest_azure/0.4.25 azure-mgmt-signalr/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.32] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/SignalR/signalr000002?api-version=2018-03-01-preview + response: + body: {string: !!python/unicode '{"sku":{"name":"Basic_DS2","tier":"Basic","size":"DS2","capacity":1},"properties":{"provisioningState":"Creating","externalIP":"13.82.48.132","hostName":"signalr000002.service.signalr.net","publicPort":5001,"serverPort":5002,"hostNamePrefix":null},"location":"eastus","tags":{"key":"value"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/SignalR/signalr000002","name":"signalr000002","type":"Microsoft.SignalRService/SignalR"}'} + headers: + cache-control: [no-cache] + content-length: ['517'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 18 Apr 2018 03:08:30 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Kestrel] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-content-type-options: [nosniff] + x-rp-server-mvid: [ce49f4a3-7c3a-4945-9c5c-73aa4062a6ec] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [signalr create] + Connection: [keep-alive] + User-Agent: [python/2.7.14 (Windows-10-10.0.17133) requests/2.18.4 msrest/0.4.27 + msrest_azure/0.4.25 azure-mgmt-signalr/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.32] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/SignalR/signalr000002?api-version=2018-03-01-preview + response: + body: {string: !!python/unicode '{"sku":{"name":"Basic_DS2","tier":"Basic","size":"DS2","capacity":1},"properties":{"provisioningState":"Creating","externalIP":"13.82.48.132","hostName":"signalr000002.service.signalr.net","publicPort":5001,"serverPort":5002,"hostNamePrefix":null},"location":"eastus","tags":{"key":"value"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/SignalR/signalr000002","name":"signalr000002","type":"Microsoft.SignalRService/SignalR"}'} + headers: + cache-control: [no-cache] + content-length: ['517'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 18 Apr 2018 03:09:00 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Kestrel] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-content-type-options: [nosniff] + x-rp-server-mvid: [ce49f4a3-7c3a-4945-9c5c-73aa4062a6ec] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [signalr create] + Connection: [keep-alive] + User-Agent: [python/2.7.14 (Windows-10-10.0.17133) requests/2.18.4 msrest/0.4.27 + msrest_azure/0.4.25 azure-mgmt-signalr/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.32] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/SignalR/signalr000002?api-version=2018-03-01-preview + response: + body: {string: !!python/unicode '{"sku":{"name":"Basic_DS2","tier":"Basic","size":"DS2","capacity":1},"properties":{"provisioningState":"Succeeded","externalIP":"13.82.48.132","hostName":"signalr000002.service.signalr.net","publicPort":5001,"serverPort":5002,"hostNamePrefix":null},"location":"eastus","tags":{"key":"value"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/SignalR/signalr000002","name":"signalr000002","type":"Microsoft.SignalRService/SignalR"}'} + headers: + cache-control: [no-cache] + content-length: ['518'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 18 Apr 2018 03:09:31 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Kestrel] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-content-type-options: [nosniff] + x-rp-server-mvid: [ce49f4a3-7c3a-4945-9c5c-73aa4062a6ec] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [signalr show] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/2.7.14 (Windows-10-10.0.17133) requests/2.18.4 msrest/0.4.27 + msrest_azure/0.4.25 azure-mgmt-signalr/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.32] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/SignalR/signalr000002?api-version=2018-03-01-preview + response: + body: {string: !!python/unicode '{"sku":{"name":"Basic_DS2","tier":"Basic","size":"DS2","capacity":1},"properties":{"provisioningState":"Succeeded","externalIP":"13.82.48.132","hostName":"signalr000002.service.signalr.net","publicPort":5001,"serverPort":5002,"hostNamePrefix":null},"location":"eastus","tags":{"key":"value"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/SignalR/signalr000002","name":"signalr000002","type":"Microsoft.SignalRService/SignalR"}'} + headers: + cache-control: [no-cache] + content-length: ['518'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 18 Apr 2018 03:09:34 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Kestrel] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-content-type-options: [nosniff] + x-rp-server-mvid: [ce49f4a3-7c3a-4945-9c5c-73aa4062a6ec] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [signalr list] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/2.7.14 (Windows-10-10.0.17133) requests/2.18.4 msrest/0.4.27 + msrest_azure/0.4.25 azure-mgmt-signalr/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.32] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/SignalR?api-version=2018-03-01-preview + response: + body: {string: !!python/unicode '{"value":[{"sku":{"name":"Basic_DS2","tier":"Basic","size":"DS2","capacity":1},"properties":{"provisioningState":"Succeeded","externalIP":"13.82.48.132","hostName":"signalr000002.service.signalr.net","publicPort":5001,"serverPort":5002,"hostNamePrefix":null},"location":"eastus","tags":{"key":"value"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/SignalR/signalr000002","name":"signalr000002","type":"Microsoft.SignalRService/SignalR"}]}'} + headers: + cache-control: [no-cache] + content-length: ['530'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 18 Apr 2018 03:11:14 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Kestrel] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-content-type-options: [nosniff] + x-rp-server-mvid: [ce49f4a3-7c3a-4945-9c5c-73aa4062a6ec] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [signalr key list] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/2.7.14 (Windows-10-10.0.17133) requests/2.18.4 msrest/0.4.27 + msrest_azure/0.4.25 azure-mgmt-signalr/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.32] + accept-language: [en-US] + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/SignalR/signalr000002/listKeys?api-version=2018-03-01-preview + response: + body: {string: !!python/unicode '{"primaryKey":"K96MqMucgXF3mcTj7oFjLiiQMRPjl5+wuTAeyntEK/w=","secondaryKey":"vAV/BSQGrA81JfPzi14bsdi9wc2EV8xgis6JruMzo94="}'} + headers: + cache-control: [no-cache] + content-length: ['123'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 18 Apr 2018 03:11:16 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Kestrel] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: [Accept-Encoding] + x-content-type-options: [nosniff] + x-ms-ratelimit-remaining-subscription-writes: ['1196'] + x-rp-server-mvid: [ce49f4a3-7c3a-4945-9c5c-73aa4062a6ec] + status: {code: 200, message: OK} +- request: + body: !!python/unicode '{"keyType": "Secondary"}' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [signalr key renew] + Connection: [keep-alive] + Content-Length: ['24'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/2.7.14 (Windows-10-10.0.17133) requests/2.18.4 msrest/0.4.27 + msrest_azure/0.4.25 azure-mgmt-signalr/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.32] + accept-language: [en-US] + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/SignalR/signalr000002/regenerateKey?api-version=2018-03-01-preview + response: + body: {string: !!python/unicode '{"primaryKey":"K96MqMucgXF3mcTj7oFjLiiQMRPjl5+wuTAeyntEK/w=","secondaryKey":"KAV5MtQTW/gXbNgEkcnluIuQLDqU7Ecpy1ljDtvOxi8="}'} + headers: + cache-control: [no-cache] + content-length: ['123'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 18 Apr 2018 03:11:18 GMT'] + expires: ['-1'] + location: ['https://signalrprod.eastus.cloudapp.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/operationResults/signalr000002/operationresult/22a6ffbd-e942-4f69-8de4-150feefbcea0?api-version=2018-03-01-preview'] + pragma: [no-cache] + server: [Kestrel] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-ms-ratelimit-remaining-subscription-writes: ['1137'] + x-rp-server-mvid: [ce49f4a3-7c3a-4945-9c5c-73aa4062a6ec] + status: {code: 201, message: Created} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [group delete] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/2.7.14 (Windows-10-10.0.17133) requests/2.18.4 msrest/0.4.27 + msrest_azure/0.4.25 resourcemanagementclient/1.2.1 Azure-SDK-For-Python + AZURECLI/2.0.32] + accept-language: [en-US] + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg000001?api-version=2017-05-10 + response: + body: {string: !!python/unicode ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Wed, 18 Apr 2018 03:11:20 GMT'] + expires: ['-1'] + location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTElURVNUOjJFUkc3WjY0N0JCT1NGLVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2017-05-10'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] + status: {code: 202, message: Accepted} +version: 1 diff --git a/src/signalr/azext_signalr/tests/latest/test_signalr_commands.py b/src/signalr/azext_signalr/tests/latest/test_signalr_commands.py new file mode 100644 index 0000000000..cc5efab786 --- /dev/null +++ b/src/signalr/azext_signalr/tests/latest/test_signalr_commands.py @@ -0,0 +1,79 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +import time +import unittest +from azure.cli.testsdk import ScenarioTest, ResourceGroupPreparer + + +class AzureSignalRServiceScenarioTest(ScenarioTest): + @ResourceGroupPreparer(random_name_length=20) + def test_signalr_commands(self, resource_group): + signalr_name = self.create_random_name('signalr', 16) + sku = 'Basic_DS2' + unit_count = 1 + location = 'eastus' + tags_key = 'key' + tags_val = 'value' + + self.kwargs.update({ + 'location': location, + 'signalr_name': signalr_name, + 'sku': sku, + 'unit_count': unit_count, + 'tags': '{}={}'.format(tags_key, tags_val) + }) + + # Test create + self.cmd('az signalr create -n {signalr_name} -g {rg} --sku {sku} --unit-count {unit_count} -l {location} --tags {tags}', + checks=[ + self.check('name', '{signalr_name}'), + self.check('location', '{location}'), + self.check('provisioningState', 'Succeeded'), + self.check('sku.name', '{sku}'), + self.check('sku.capacity', '{unit_count}'), + self.check('tags.{}'.format(tags_key), tags_val), + self.exists('hostName'), + self.exists('publicPort'), + self.exists('serverPort'), + ]) + + # Test show + self.cmd('az signalr show -n {signalr_name} -g {rg}', checks=[ + self.check('name', '{signalr_name}'), + self.check('location', '{location}'), + self.check('provisioningState', 'Succeeded'), + self.check('sku.name', '{sku}'), + self.check('sku.capacity', '{unit_count}'), + self.exists('hostName'), + self.exists('publicPort'), + self.exists('serverPort'), + self.exists('externalIp') + ]) + + # Test list + self.cmd('az signalr list -g {rg}', checks=[ + self.check('[0].name', '{signalr_name}'), + self.check('[0].location', '{location}'), + self.check('[0].provisioningState', 'Succeeded'), + self.check('[0].sku.name', '{sku}'), + self.check('[0].sku.capacity', '{unit_count}'), + self.exists('[0].hostName'), + self.exists('[0].publicPort'), + self.exists('[0].serverPort'), + self.exists('[0].externalIp') + ]) + + # Test key list + self.cmd('az signalr key list -n {signalr_name} -g {rg}', checks=[ + self.exists('primaryKey'), + self.exists('secondaryKey') + ]) + + # Test key renew + self.cmd('az signalr key renew -n {signalr_name} -g {rg} --key-type secondary', checks=[ + self.exists('primaryKey'), + self.exists('secondaryKey') + ]) diff --git a/src/signalr/setup.cfg b/src/signalr/setup.cfg new file mode 100644 index 0000000000..11d9c44f6e --- /dev/null +++ b/src/signalr/setup.cfg @@ -0,0 +1,3 @@ +[bdist_wheel] +universal=1 + diff --git a/src/signalr/setup.py b/src/signalr/setup.py new file mode 100644 index 0000000000..a9df604412 --- /dev/null +++ b/src/signalr/setup.py @@ -0,0 +1,38 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + + +from setuptools import setup, find_packages + + +VERSION = "0.1.0" +CLASSIFIERS = [ + 'Development Status :: 4 - Beta', + 'Intended Audience :: Developers', + 'Intended Audience :: System Administrators', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'License :: OSI Approved :: MIT License', +] + + +setup( + name='signalr', + version=VERSION, + description='Support for signalr management preview.', + long_description='Microsoft Azure Command-Line Extensions for SignalR Service', + license='MIT', + author='Visual Studio China SignalR Team', + author_email='vscsignalr@microsoft.com', + url='https://github.com/Azure/azure-cli-extensions', + classifiers=CLASSIFIERS, + package_data={'azext_signalr': ['azext_metadata.json']}, + packages=find_packages(exclude=['tests']) +)