diff --git a/doc/sphinx/azhelpgen/doc_source_map.json b/doc/sphinx/azhelpgen/doc_source_map.json index 9911040d3eb..0c0ac9bf254 100644 --- a/doc/sphinx/azhelpgen/doc_source_map.json +++ b/doc/sphinx/azhelpgen/doc_source_map.json @@ -46,6 +46,7 @@ "resource": "src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/_help.py", "relay": "src/command_modules/azure-cli-relay/azure/cli/command_modules/relay/_help.py", "role": "src/command_modules/azure-cli-role/azure/cli/command_modules/role/_help.py", + "signalr": "src/command_modules/azure-cli-signalr/azure/cli/command_modules/signalr/_help.py", "sql": "src/command_modules/azure-cli-sql/azure/cli/command_modules/sql/_help.py", "storage": "src/command_modules/azure-cli-storage/azure/cli/command_modules/storage/_help.py", "tag": "src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/_help.py", diff --git a/src/command_modules/azure-cli-signalr/HISTORY.rst b/src/command_modules/azure-cli-signalr/HISTORY.rst new file mode 100644 index 00000000000..e56244d1c2a --- /dev/null +++ b/src/command_modules/azure-cli-signalr/HISTORY.rst @@ -0,0 +1,9 @@ +.. :changelog: + +Release History +=============== + +1.0.0 ++++++++++++++++++++++ + +* General available release. diff --git a/src/command_modules/azure-cli-signalr/MANIFEST.in b/src/command_modules/azure-cli-signalr/MANIFEST.in new file mode 100644 index 00000000000..bb37a2723da --- /dev/null +++ b/src/command_modules/azure-cli-signalr/MANIFEST.in @@ -0,0 +1 @@ +include *.rst diff --git a/src/command_modules/azure-cli-signalr/README.rst b/src/command_modules/azure-cli-signalr/README.rst new file mode 100644 index 00000000000..e43968545ec --- /dev/null +++ b/src/command_modules/azure-cli-signalr/README.rst @@ -0,0 +1,5 @@ +Microsoft Azure CLI 'signalr' Command Module +============================================= + +This package is for the 'signalr' module. +i.e. 'az signalr' diff --git a/src/command_modules/azure-cli-signalr/azure/__init__.py b/src/command_modules/azure-cli-signalr/azure/__init__.py new file mode 100644 index 00000000000..a9dfa5391b9 --- /dev/null +++ b/src/command_modules/azure-cli-signalr/azure/__init__.py @@ -0,0 +1,7 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +import pkg_resources +pkg_resources.declare_namespace(__name__) diff --git a/src/command_modules/azure-cli-signalr/azure/cli/__init__.py b/src/command_modules/azure-cli-signalr/azure/cli/__init__.py new file mode 100644 index 00000000000..a9dfa5391b9 --- /dev/null +++ b/src/command_modules/azure-cli-signalr/azure/cli/__init__.py @@ -0,0 +1,7 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +import pkg_resources +pkg_resources.declare_namespace(__name__) diff --git a/src/command_modules/azure-cli-signalr/azure/cli/command_modules/__init__.py b/src/command_modules/azure-cli-signalr/azure/cli/command_modules/__init__.py new file mode 100644 index 00000000000..a9dfa5391b9 --- /dev/null +++ b/src/command_modules/azure-cli-signalr/azure/cli/command_modules/__init__.py @@ -0,0 +1,7 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +import pkg_resources +pkg_resources.declare_namespace(__name__) diff --git a/src/command_modules/azure-cli-signalr/azure/cli/command_modules/signalr/__init__.py b/src/command_modules/azure-cli-signalr/azure/cli/command_modules/signalr/__init__.py new file mode 100644 index 00000000000..e4144d0c486 --- /dev/null +++ b/src/command_modules/azure-cli-signalr/azure/cli/command_modules/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 azure.cli.command_modules.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/command_modules/azure-cli-signalr/azure/cli/command_modules/signalr/_client_factory.py b/src/command_modules/azure-cli-signalr/azure/cli/command_modules/signalr/_client_factory.py new file mode 100644 index 00000000000..577242c722d --- /dev/null +++ b/src/command_modules/azure-cli-signalr/azure/cli/command_modules/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 azure.mgmt.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/command_modules/azure-cli-signalr/azure/cli/command_modules/signalr/_constants.py b/src/command_modules/azure-cli-signalr/azure/cli/command_modules/signalr/_constants.py new file mode 100644 index 00000000000..447bf433130 --- /dev/null +++ b/src/command_modules/azure-cli-signalr/azure/cli/command_modules/signalr/_constants.py @@ -0,0 +1,8 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + + +SIGNALR_RESOURCE_TYPE = 'Microsoft.SignalRService/SignalR' +SIGNALR_KEY_TYPE = ['primary', 'secondary'] diff --git a/src/command_modules/azure-cli-signalr/azure/cli/command_modules/signalr/_help.py b/src/command_modules/azure-cli-signalr/azure/cli/command_modules/signalr/_help.py new file mode 100644 index 00000000000..2e0368c75f0 --- /dev/null +++ b/src/command_modules/azure-cli-signalr/azure/cli/command_modules/signalr/_help.py @@ -0,0 +1,75 @@ +# 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. +# -------------------------------------------------------------------------------------------- + +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 Standard_S1 --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/command_modules/azure-cli-signalr/azure/cli/command_modules/signalr/_params.py b/src/command_modules/azure-cli-signalr/azure/cli/command_modules/signalr/_params.py new file mode 100644 index 00000000000..42a215b8383 --- /dev/null +++ b/src/command_modules/azure-cli-signalr/azure/cli/command_modules/signalr/_params.py @@ -0,0 +1,43 @@ +# 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 azure.cli.core.commands.parameters import ( + resource_group_name_type, + get_location_type, + get_resource_name_completion_list, + tags_type +) + +from knack.log import get_logger + +from ._constants import ( + 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. E.g. Standard_S1') + 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/command_modules/azure-cli-signalr/azure/cli/command_modules/signalr/commands.py b/src/command_modules/azure-cli-signalr/azure/cli/command_modules/signalr/commands.py new file mode 100644 index 00000000000..6a97707b9d5 --- /dev/null +++ b/src/command_modules/azure-cli-signalr/azure/cli/command_modules/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 azure.cli.core.util import empty_on_404 + +from ._client_factory import cf_signalr + + +def load_command_table(self, _): + + signalr_custom_utils = CliCommandType( + operations_tmpl='azure.cli.command_modules.signalr.custom#{}', + client_factory=cf_signalr + ) + + signalr_key_utils = CliCommandType( + operations_tmpl='azure.cli.command_modules.signalr.key#{}', + client_factory=cf_signalr + ) + + with self.command_group('signalr', signalr_custom_utils) 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/command_modules/azure-cli-signalr/azure/cli/command_modules/signalr/custom.py b/src/command_modules/azure-cli-signalr/azure/cli/command_modules/signalr/custom.py new file mode 100644 index 00000000000..b1b16b45553 --- /dev/null +++ b/src/command_modules/azure-cli-signalr/azure/cli/command_modules/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 azure.mgmt.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/command_modules/azure-cli-signalr/azure/cli/command_modules/signalr/key.py b/src/command_modules/azure-cli-signalr/azure/cli/command_modules/signalr/key.py new file mode 100644 index 00000000000..21bdc06420a --- /dev/null +++ b/src/command_modules/azure-cli-signalr/azure/cli/command_modules/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 azure.mgmt.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/command_modules/azure-cli-signalr/azure/cli/command_modules/signalr/tests/__init__.py b/src/command_modules/azure-cli-signalr/azure/cli/command_modules/signalr/tests/__init__.py new file mode 100644 index 00000000000..34913fb394d --- /dev/null +++ b/src/command_modules/azure-cli-signalr/azure/cli/command_modules/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/command_modules/azure-cli-signalr/azure/cli/command_modules/signalr/tests/latest/__init__.py b/src/command_modules/azure-cli-signalr/azure/cli/command_modules/signalr/tests/latest/__init__.py new file mode 100644 index 00000000000..34913fb394d --- /dev/null +++ b/src/command_modules/azure-cli-signalr/azure/cli/command_modules/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/command_modules/azure-cli-signalr/azure/cli/command_modules/signalr/tests/latest/recordings/test_signalr_commands.yaml b/src/command_modules/azure-cli-signalr/azure/cli/command_modules/signalr/tests/latest/recordings/test_signalr_commands.yaml new file mode 100644 index 00000000000..4f6c17d1f2e --- /dev/null +++ b/src/command_modules/azure-cli-signalr/azure/cli/command_modules/signalr/tests/latest/recordings/test_signalr_commands.yaml @@ -0,0 +1,407 @@ +interactions: +- request: + body: '{"location": "westus", "tags": {"product": "azurecli", "cause": "automation", + "date": "2018-08-29T02:05:34Z"}}' + 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/3.7.0 (Windows-10-10.0.17134-SP0) requests/2.19.1 msrest/0.5.4 + msrest_azure/0.4.34 resourcemanagementclient/2.0.0 Azure-SDK-For-Python + AZURECLI/2.0.45] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg000001?api-version=2018-05-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001","name":"clitest.rg000001","location":"westus","tags":{"product":"azurecli","cause":"automation","date":"2018-08-29T02:05:34Z"},"properties":{"provisioningState":"Succeeded"}}'} + headers: + cache-control: [no-cache] + content-length: ['274'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 29 Aug 2018 02:05:38 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] + status: {code: 201, message: Created} +- request: + body: 'b''{"tags": {"key": "value"}, "sku": {"name": "Standard_S1", "capacity": + 1}, "properties": {"hostNamePrefix": "signalr000002"}, "location": "eastus"}''' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [signalr create] + Connection: [keep-alive] + Content-Length: ['149'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.7.0 (Windows-10-10.0.17134-SP0) requests/2.19.1 msrest/0.5.4 + msrest_azure/0.4.34 azure-mgmt-signalr/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.45] + 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: '{"sku":{"name":"Standard_S1","tier":"Standard","size":"S1","capacity":1},"properties":{"provisioningState":"Creating","externalIP":null,"hostName":"signalr000002.service.signalr.net","publicPort":5001,"serverPort":5002,"version":"1.0-preview","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: ['535'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 29 Aug 2018 02:05:46 GMT'] + expires: ['-1'] + location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/locations/eastus/operationResults/3affeb35-898f-46bf-8a13-e8e68047bf7b/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: ['1199'] + x-rp-server-mvid: [8828a1fd-9d7b-4b2f-af6f-9535e08f2ceb] + 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/3.7.0 (Windows-10-10.0.17134-SP0) requests/2.19.1 msrest/0.5.4 + msrest_azure/0.4.34 azure-mgmt-signalr/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.45] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/locations/eastus/operationResults/3affeb35-898f-46bf-8a13-e8e68047bf7b/SignalR/signalr000002?api-version=2018-03-01-preview + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Wed, 29 Aug 2018 02:06:17 GMT'] + expires: ['-1'] + location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/locations/eastus/operationResults/3affeb35-898f-46bf-8a13-e8e68047bf7b/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-rp-server-mvid: [8828a1fd-9d7b-4b2f-af6f-9535e08f2ceb] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [signalr create] + Connection: [keep-alive] + User-Agent: [python/3.7.0 (Windows-10-10.0.17134-SP0) requests/2.19.1 msrest/0.5.4 + msrest_azure/0.4.34 azure-mgmt-signalr/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.45] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/locations/eastus/operationResults/3affeb35-898f-46bf-8a13-e8e68047bf7b/SignalR/signalr000002?api-version=2018-03-01-preview + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Wed, 29 Aug 2018 02:06:48 GMT'] + expires: ['-1'] + location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/locations/eastus/operationResults/3affeb35-898f-46bf-8a13-e8e68047bf7b/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-rp-server-mvid: [8828a1fd-9d7b-4b2f-af6f-9535e08f2ceb] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [signalr create] + Connection: [keep-alive] + User-Agent: [python/3.7.0 (Windows-10-10.0.17134-SP0) requests/2.19.1 msrest/0.5.4 + msrest_azure/0.4.34 azure-mgmt-signalr/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.45] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/locations/eastus/operationResults/3affeb35-898f-46bf-8a13-e8e68047bf7b/SignalR/signalr000002?api-version=2018-03-01-preview + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Wed, 29 Aug 2018 02:07:19 GMT'] + expires: ['-1'] + location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/locations/eastus/operationResults/3affeb35-898f-46bf-8a13-e8e68047bf7b/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-rp-server-mvid: [8828a1fd-9d7b-4b2f-af6f-9535e08f2ceb] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [signalr create] + Connection: [keep-alive] + User-Agent: [python/3.7.0 (Windows-10-10.0.17134-SP0) requests/2.19.1 msrest/0.5.4 + msrest_azure/0.4.34 azure-mgmt-signalr/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.45] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/locations/eastus/operationResults/3affeb35-898f-46bf-8a13-e8e68047bf7b/SignalR/signalr000002?api-version=2018-03-01-preview + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Wed, 29 Aug 2018 02:07:50 GMT'] + expires: ['-1'] + location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/locations/eastus/operationResults/3affeb35-898f-46bf-8a13-e8e68047bf7b/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-rp-server-mvid: [8828a1fd-9d7b-4b2f-af6f-9535e08f2ceb] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [signalr create] + Connection: [keep-alive] + User-Agent: [python/3.7.0 (Windows-10-10.0.17134-SP0) requests/2.19.1 msrest/0.5.4 + msrest_azure/0.4.34 azure-mgmt-signalr/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.45] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/locations/eastus/operationResults/3affeb35-898f-46bf-8a13-e8e68047bf7b/SignalR/signalr000002?api-version=2018-03-01-preview + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Wed, 29 Aug 2018 02:08:21 GMT'] + expires: ['-1'] + location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/locations/eastus/operationResults/3affeb35-898f-46bf-8a13-e8e68047bf7b/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-rp-server-mvid: [8828a1fd-9d7b-4b2f-af6f-9535e08f2ceb] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [signalr create] + Connection: [keep-alive] + User-Agent: [python/3.7.0 (Windows-10-10.0.17134-SP0) requests/2.19.1 msrest/0.5.4 + msrest_azure/0.4.34 azure-mgmt-signalr/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.45] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/locations/eastus/operationResults/3affeb35-898f-46bf-8a13-e8e68047bf7b/SignalR/signalr000002?api-version=2018-03-01-preview + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Wed, 29 Aug 2018 02:08:52 GMT'] + expires: ['-1'] + location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/locations/eastus/operationResults/3affeb35-898f-46bf-8a13-e8e68047bf7b/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-rp-server-mvid: [8828a1fd-9d7b-4b2f-af6f-9535e08f2ceb] + status: {code: 202, message: Accepted} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [signalr create] + Connection: [keep-alive] + User-Agent: [python/3.7.0 (Windows-10-10.0.17134-SP0) requests/2.19.1 msrest/0.5.4 + msrest_azure/0.4.34 azure-mgmt-signalr/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.45] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/locations/eastus/operationResults/3affeb35-898f-46bf-8a13-e8e68047bf7b/SignalR/signalr000002?api-version=2018-03-01-preview + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Wed, 29 Aug 2018 02:09:22 GMT'] + expires: ['-1'] + pragma: [no-cache] + server: [Kestrel] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-rp-server-mvid: [8828a1fd-9d7b-4b2f-af6f-9535e08f2ceb] + 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/3.7.0 (Windows-10-10.0.17134-SP0) requests/2.19.1 msrest/0.5.4 + msrest_azure/0.4.34 azure-mgmt-signalr/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.45] + 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: '{"sku":{"name":"Standard_S1","tier":"Standard","size":"S1","capacity":1},"properties":{"provisioningState":"Succeeded","externalIP":"137.135.85.104","hostName":"signalr000002.service.signalr.net","publicPort":5001,"serverPort":5002,"version":"1.0-preview","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: ['548'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 29 Aug 2018 02:09: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: [8828a1fd-9d7b-4b2f-af6f-9535e08f2ceb] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [signalr show] + Connection: [keep-alive] + User-Agent: [python/3.7.0 (Windows-10-10.0.17134-SP0) requests/2.19.1 msrest/0.5.4 + msrest_azure/0.4.34 azure-mgmt-signalr/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.45] + 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: '{"sku":{"name":"Standard_S1","tier":"Standard","size":"S1","capacity":1},"properties":{"provisioningState":"Succeeded","externalIP":"137.135.85.104","hostName":"signalr000002.service.signalr.net","publicPort":5001,"serverPort":5002,"version":"1.0-preview","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: ['548'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 29 Aug 2018 02:09:26 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: [8828a1fd-9d7b-4b2f-af6f-9535e08f2ceb] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [signalr list] + Connection: [keep-alive] + User-Agent: [python/3.7.0 (Windows-10-10.0.17134-SP0) requests/2.19.1 msrest/0.5.4 + msrest_azure/0.4.34 azure-mgmt-signalr/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.45] + 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: '{"value":[{"sku":{"name":"Standard_S1","tier":"Standard","size":"S1","capacity":1},"properties":{"provisioningState":"Succeeded","externalIP":"137.135.85.104","hostName":"signalr000002.service.signalr.net","publicPort":5001,"serverPort":5002,"version":"1.0-preview","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: ['560'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 29 Aug 2018 02:09: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: [8828a1fd-9d7b-4b2f-af6f-9535e08f2ceb] + 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'] + User-Agent: [python/3.7.0 (Windows-10-10.0.17134-SP0) requests/2.19.1 msrest/0.5.4 + msrest_azure/0.4.34 azure-mgmt-signalr/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.45] + 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: '{"primaryKey":"DTTyoAxeR2uo4IoY6svX5GJi7KWenIU4Ov1ulcjuT3Q=","secondaryKey":"jr/iQfW6kfzyRzCpjFi83e44VBvl5Dg405jYn+KIa1A=","primaryConnectionString":"Endpoint=https://signalr000002.service.signalr.net;AccessKey=DTTyoAxeR2uo4IoY6svX5GJi7KWenIU4Ov1ulcjuT3Q=;","secondaryConnectionString":"Endpoint=https://signalr000002.service.signalr.net;AccessKey=jr/iQfW6kfzyRzCpjFi83e44VBvl5Dg405jYn+KIa1A=;"}'} + headers: + cache-control: [no-cache] + content-length: ['401'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 29 Aug 2018 02:09:29 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: ['1199'] + x-rp-server-mvid: [8828a1fd-9d7b-4b2f-af6f-9535e08f2ceb] + status: {code: 200, message: OK} +- request: + body: '{"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/3.7.0 (Windows-10-10.0.17134-SP0) requests/2.19.1 msrest/0.5.4 + msrest_azure/0.4.34 azure-mgmt-signalr/0.1.0 Azure-SDK-For-Python AZURECLI/2.0.45] + 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: '{"primaryKey":"DTTyoAxeR2uo4IoY6svX5GJi7KWenIU4Ov1ulcjuT3Q=","secondaryKey":"fJ0i2IbbElfogRVLv/J38/nvkWSq9DU4VFW9TTxqRUI=","primaryConnectionString":"Endpoint=https://signalr000002.service.signalr.net;AccessKey=DTTyoAxeR2uo4IoY6svX5GJi7KWenIU4Ov1ulcjuT3Q=;","secondaryConnectionString":"Endpoint=https://signalr000002.service.signalr.net;AccessKey=fJ0i2IbbElfogRVLv/J38/nvkWSq9DU4VFW9TTxqRUI=;"}'} + headers: + cache-control: [no-cache] + content-length: ['401'] + content-type: [application/json; charset=utf-8] + date: ['Wed, 29 Aug 2018 02:09:30 GMT'] + expires: ['-1'] + location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.SignalRService/locations/eastus/operationResults/0bd6ad30-cf8b-412f-aa45-ea7ce6b05881/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: ['1199'] + x-rp-server-mvid: [8828a1fd-9d7b-4b2f-af6f-9535e08f2ceb] + 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/3.7.0 (Windows-10-10.0.17134-SP0) requests/2.19.1 msrest/0.5.4 + msrest_azure/0.4.34 resourcemanagementclient/2.0.0 Azure-SDK-For-Python + AZURECLI/2.0.45] + accept-language: [en-US] + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg000001?api-version=2018-05-01 + response: + body: {string: ''} + headers: + cache-control: [no-cache] + content-length: ['0'] + date: ['Wed, 29 Aug 2018 02:09:33 GMT'] + expires: ['-1'] + location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTElURVNUOjJFUkdUR1FJUlhBRlQzLVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2018-05-01'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-ms-ratelimit-remaining-subscription-deletes: ['14999'] + status: {code: 202, message: Accepted} +version: 1 diff --git a/src/command_modules/azure-cli-signalr/azure/cli/command_modules/signalr/tests/latest/test_signalr_commands.py b/src/command_modules/azure-cli-signalr/azure/cli/command_modules/signalr/tests/latest/test_signalr_commands.py new file mode 100644 index 00000000000..1c97341a9b9 --- /dev/null +++ b/src/command_modules/azure-cli-signalr/azure/cli/command_modules/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 = 'Standard_S1' + 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/command_modules/azure-cli-signalr/azure_bdist_wheel.py b/src/command_modules/azure-cli-signalr/azure_bdist_wheel.py new file mode 100644 index 00000000000..8a81d1b6177 --- /dev/null +++ b/src/command_modules/azure-cli-signalr/azure_bdist_wheel.py @@ -0,0 +1,54 @@ +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +from distutils import log as logger +import os.path + +from wheel.bdist_wheel import bdist_wheel +class azure_bdist_wheel(bdist_wheel): + """The purpose of this class is to build wheel a little differently than the sdist, + without requiring to build the wheel from the sdist (i.e. you can build the wheel + directly from source). + """ + + description = "Create an Azure wheel distribution" + + user_options = bdist_wheel.user_options + \ + [('azure-namespace-package=', None, + "Name of the deepest nspkg used")] + + def initialize_options(self): + bdist_wheel.initialize_options(self) + self.azure_namespace_package = None + + def finalize_options(self): + bdist_wheel.finalize_options(self) + if self.azure_namespace_package and not self.azure_namespace_package.endswith("-nspkg"): + raise ValueError("azure_namespace_package must finish by -nspkg") + + def run(self): + if not self.distribution.install_requires: + self.distribution.install_requires = [] + self.distribution.install_requires.append( + "{}>=2.0.0".format(self.azure_namespace_package)) + bdist_wheel.run(self) + + def write_record(self, bdist_dir, distinfo_dir): + if self.azure_namespace_package: + # Split and remove last part, assuming it's "nspkg" + subparts = self.azure_namespace_package.split('-')[0:-1] + folder_with_init = [os.path.join(*subparts[0:i+1]) for i in range(len(subparts))] + for azure_sub_package in folder_with_init: + init_file = os.path.join(bdist_dir, azure_sub_package, '__init__.py') + if os.path.isfile(init_file): + logger.info("manually remove {} while building the wheel".format(init_file)) + os.remove(init_file) + else: + raise ValueError("Unable to find {}. Are you sure of your namespace package?".format(init_file)) + bdist_wheel.write_record(self, bdist_dir, distinfo_dir) +cmdclass = { + 'bdist_wheel': azure_bdist_wheel, +} diff --git a/src/command_modules/azure-cli-signalr/setup.cfg b/src/command_modules/azure-cli-signalr/setup.cfg new file mode 100644 index 00000000000..3326c62a76e --- /dev/null +++ b/src/command_modules/azure-cli-signalr/setup.cfg @@ -0,0 +1,3 @@ +[bdist_wheel] +universal=1 +azure-namespace-package=azure-cli-command_modules-nspkg diff --git a/src/command_modules/azure-cli-signalr/setup.py b/src/command_modules/azure-cli-signalr/setup.py new file mode 100644 index 00000000000..b55ae787fba --- /dev/null +++ b/src/command_modules/azure-cli-signalr/setup.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python + +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + + +from codecs import open +from setuptools import setup +try: + from azure_bdist_wheel import cmdclass +except ImportError: + from distutils import log as logger + logger.warn("Wheel is not available, disabling bdist_wheel hook") + cmdclass = {} + +VERSION = "1.0.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', +] + +DEPENDENCIES = [ + 'azure-mgmt-signalr==0.1.0', + 'azure-cli-core' +] + +with open('README.rst', 'r', encoding='utf-8') as f: + README = f.read() +with open('HISTORY.rst', 'r', encoding='utf-8') as f: + HISTORY = f.read() + + +setup( + name='azure-cli-signalr', + version=VERSION, + description='Microsoft Azure Command-Line Tools SignalR Command Module', + long_description=README + '\n\n' + HISTORY, + license='MIT', + author='Microsoft Corporation', + author_email='azpycli@microsoft.com', + url='https://github.com/Azure/azure-cli', + classifiers=CLASSIFIERS, + packages=[ + 'azure', + 'azure.cli', + 'azure.cli.command_modules', + 'azure.cli.command_modules.signalr' + ], + install_requires=DEPENDENCIES, + cmdclass=cmdclass, +)