From 6a5e7de78fb233ea3261f7dca79104aed24f2ea4 Mon Sep 17 00:00:00 2001 From: chenyl Date: Fri, 4 May 2018 13:22:30 +0800 Subject: [PATCH] Update SKU --- src/index.json | 2 +- src/signalr/azext_signalr/_constants.py | 3 ++- src/signalr/azext_signalr/custom.py | 7 +++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/index.json b/src/index.json index ca43e2721a1..5c677c58cce 100644 --- a/src/index.json +++ b/src/index.json @@ -653,7 +653,7 @@ "signalr": [ { "filename": "signalr-0.1.0-py2.py3-none-any.whl", - "sha256Digest": "0cd98580aa10b660602c1b4496c9beef24cf9c8e15df8113b2642c75457772ee", + "sha256Digest": "be38f9e49f1a92d194e7f141d978e10de852f77b63db2ef6c02f838fc3067f9f", "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", diff --git a/src/signalr/azext_signalr/_constants.py b/src/signalr/azext_signalr/_constants.py index eaa0d06b749..ba7bfe58ea3 100644 --- a/src/signalr/azext_signalr/_constants.py +++ b/src/signalr/azext_signalr/_constants.py @@ -4,6 +4,7 @@ # -------------------------------------------------------------------------------------------- -SIGNALR_SKU = ['Basic_DS2'] +SIGNALR_SKU = ['Basic_DS2', 'Free_DS2'] SIGNALR_RESOURCE_TYPE = 'Microsoft.SignalRService/SignalR' SIGNALR_KEY_TYPE = ['primary', 'secondary'] +UNIT_COUNT_MAXIMUM = 10 diff --git a/src/signalr/azext_signalr/custom.py b/src/signalr/azext_signalr/custom.py index 5e854bde5bb..46ea4330f80 100644 --- a/src/signalr/azext_signalr/custom.py +++ b/src/signalr/azext_signalr/custom.py @@ -5,9 +5,16 @@ from azext_signalr.signalr.models import (ResourceSku, SignalRCreateOrUpdateProperties, SignalRCreateParameters) +from ._constants import ( + UNIT_COUNT_MAXIMUM +) def signalr_create(client, signalr_name, resource_group_name, sku, unit_count=1, location=None, tags=None): + if unit_count < 1 or unit_count > UNIT_COUNT_MAXIMUM: + from azure.cli.core.util import CLIError + raise CLIError('Unit count should between 1 and {}'.format(UNIT_COUNT_MAXIMUM)) + sku = ResourceSku(name=sku, capacity=unit_count) properties = SignalRCreateOrUpdateProperties(host_name_prefix=signalr_name)