diff --git a/src/command_modules/azure-cli-iotcentral/HISTORY.rst b/src/command_modules/azure-cli-iotcentral/HISTORY.rst index 29dfb10d6cd..8dac7f195b9 100644 --- a/src/command_modules/azure-cli-iotcentral/HISTORY.rst +++ b/src/command_modules/azure-cli-iotcentral/HISTORY.rst @@ -3,6 +3,12 @@ Release History =============== +0.1.3 ++++++ +* Added template and display name options for IoT Central Application creation. +* BREAKING CHANGE: The F1 Sku is no longer supported. +* Please use the S1 Sku (default) for app creation. + 0.1.2 +++++ * Minor fixes diff --git a/src/command_modules/azure-cli-iotcentral/azure/cli/command_modules/iotcentral/_help.py b/src/command_modules/azure-cli-iotcentral/azure/cli/command_modules/iotcentral/_help.py index fe8375ca49c..3b1cf578273 100644 --- a/src/command_modules/azure-cli-iotcentral/azure/cli/command_modules/iotcentral/_help.py +++ b/src/command_modules/azure-cli-iotcentral/azure/cli/command_modules/iotcentral/_help.py @@ -20,15 +20,18 @@ helps['iotcentral app create'] = """ type: command short-summary: Create an IoT Central application. - long-summary: For an introduction to IoT Central, see https://docs.microsoft.com/en-us/azure/iot-central/ + long-summary: | + For an introduction to IoT Central, see https://docs.microsoft.com/en-us/azure/iot-central/. + The F1 Sku is no longer supported. Please use the S1 Sku (default) for app creation. + For more pricing information, please visit https://azure.microsoft.com/en-us/pricing/details/iot-central/. examples: - - name: Create an IoT Central application with the free pricing tier F1, in the region of the resource group. + - name: Create an IoT Central application in the standard pricing tier S1, in the region of the resource group. text: > - az iotcentral app create --resource-group MyResourceGroup --name MyApp --subdomain myapp - - name: Create an IoT Central application with the standard pricing tier S1 in the 'westus' region. + az iotcentral app create --resource-group MyResourceGroup --name my-app-resource --subdomain my-app-subdomain + - name: Create an IoT Central application with the standard pricing tier S1 in the 'westus' region, with a custom display name, based on the iotc-default template. text: > - az iotcentral app create --resource-group MyResourceGroup --name MyApp --sku S1 --location westus - --subdomain myapp + az iotcentral app create --resource-group MyResourceGroup --name my-app-resource-name --sku S1 --location westus + --subdomain my-app-subdomain --template iotc-default@1.0.0 --display-name 'My Custom Display Name' """ helps['iotcentral app show'] = """ diff --git a/src/command_modules/azure-cli-iotcentral/azure/cli/command_modules/iotcentral/_params.py b/src/command_modules/azure-cli-iotcentral/azure/cli/command_modules/iotcentral/_params.py index d0ded6b1cae..d0994f20aa6 100644 --- a/src/command_modules/azure-cli-iotcentral/azure/cli/command_modules/iotcentral/_params.py +++ b/src/command_modules/azure-cli-iotcentral/azure/cli/command_modules/iotcentral/_params.py @@ -30,6 +30,10 @@ def load_arguments(self, _): c.argument('location', get_location_type(self.cli_ctx), help='Location of your IoT Central application. Default is the location of target resource group.') c.argument('sku', arg_type=get_enum_type(AppSku), - help='Pricing tier for IoT Central applications. Default value is F1, which is free.') + help='Pricing tier for IoT Central applications. Default value is S1.') c.argument( 'subdomain', help='Subdomain for the IoT Central URL. Each application must have a unique subdomain.') + c.argument( + 'template', help='IoT Central application template name. Default is a custom application.') + c.argument( + 'display_name', help='Custom display name for the IoT Central application. Default is resource name.') diff --git a/src/command_modules/azure-cli-iotcentral/azure/cli/command_modules/iotcentral/custom.py b/src/command_modules/azure-cli-iotcentral/azure/cli/command_modules/iotcentral/custom.py index e98aaa44c21..10cc1d56ff4 100644 --- a/src/command_modules/azure-cli-iotcentral/azure/cli/command_modules/iotcentral/custom.py +++ b/src/command_modules/azure-cli-iotcentral/azure/cli/command_modules/iotcentral/custom.py @@ -14,17 +14,21 @@ logger = get_logger(__name__) -def iotcentral_app_create(cmd, client, app_name, resource_group_name, subdomain, sku="F1", location=None): +def iotcentral_app_create( + cmd, client, app_name, resource_group_name, subdomain, sku="S1", + location=None, template=None, display_name=None +): cli_ctx = cmd.cli_ctx _check_name_availability(client, app_name) location = _ensure_location(cli_ctx, resource_group_name, location) - + display_name = _ensure_display_name(app_name, display_name) appSku = AppSkuInfo(name=sku) app = App(subdomain=subdomain, location=location, - display_name=app_name, - sku=appSku) + display_name=display_name, + sku=appSku, + template=template) createResult = client.apps.create_or_update( resource_group_name, app_name, app) @@ -74,6 +78,12 @@ def _ensure_location(cli_ctx, resource_group_name, location): return location +def _ensure_display_name(app_name, display_name): + if not display_name or display_name.isspace(): + return app_name + return display_name + + def _get_iotcentral_app_by_name(client, app_name): """Search the current subscription for an app with the given name. :param object client: IoTCentralClient diff --git a/src/command_modules/azure-cli-iotcentral/azure/cli/command_modules/iotcentral/tests/latest/recordings/test_iotcentral_app.yaml b/src/command_modules/azure-cli-iotcentral/azure/cli/command_modules/iotcentral/tests/latest/recordings/test_iotcentral_app.yaml index 6f5ccb37e83..481d5867cc7 100644 --- a/src/command_modules/azure-cli-iotcentral/azure/cli/command_modules/iotcentral/tests/latest/recordings/test_iotcentral_app.yaml +++ b/src/command_modules/azure-cli-iotcentral/azure/cli/command_modules/iotcentral/tests/latest/recordings/test_iotcentral_app.yaml @@ -1,7 +1,7 @@ interactions: - request: - body: !!python/unicode '{"location": "westus", "tags": {"date": "2018-08-08T20:03:48Z", - "product": "azurecli", "cause": "automation"}}' + body: '{"location": "westus", "tags": {"product": "azurecli", "cause": "automation", + "date": "2018-10-09T17:21:06Z"}}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] @@ -9,19 +9,19 @@ interactions: Connection: [keep-alive] Content-Length: ['110'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/2.7.12 (Linux-4.4.0-17134-Microsoft-x86_64-with-Ubuntu-16.04-xenial) - requests/2.19.1 msrest/0.5.4 msrest_azure/0.4.34 resourcemanagementclient/2.0.0 - Azure-SDK-For-Python AZURECLI/2.0.44] + User-Agent: [python/3.7.0 (Windows-10-10.0.17763-SP0) requests/2.19.1 msrest/0.5.5 + msrest_azure/0.4.34 resourcemanagementclient/2.0.0 Azure-SDK-For-Python + AZURECLI/2.0.47] 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: !!python/unicode '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001","name":"clitest.rg000001","location":"westus","tags":{"date":"2018-08-08T20:03:48Z","product":"azurecli","cause":"automation"},"properties":{"provisioningState":"Succeeded"}}'} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001","name":"clitest.rg000001","location":"westus","tags":{"product":"azurecli","cause":"automation","date":"2018-10-09T17:21:06Z"},"properties":{"provisioningState":"Succeeded"}}'} headers: cache-control: [no-cache] content-length: ['384'] content-type: [application/json; charset=utf-8] - date: ['Wed, 08 Aug 2018 20:03:52 GMT'] + date: ['Tue, 09 Oct 2018 17:21:11 GMT'] expires: ['-1'] pragma: [no-cache] strict-transport-security: [max-age=31536000; includeSubDomains] @@ -29,38 +29,36 @@ interactions: x-ms-ratelimit-remaining-subscription-writes: ['1199'] status: {code: 201, message: Created} - request: - body: !!python/unicode '{"name": "iotcentral-app-for-cli-test"}' + body: 'b''{"name": "iotc-cli-test000002"}''' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] CommandName: [iotcentral app create] Connection: [keep-alive] - Content-Length: ['39'] + Content-Length: ['36'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/2.7.12 (Linux-4.4.0-17134-Microsoft-x86_64-with-Ubuntu-16.04-xenial) - requests/2.19.1 msrest/0.5.4 msrest_azure/0.4.34 azure-mgmt-iotcentral/0.2.0 - Azure-SDK-For-Python AZURECLI/2.0.44] + User-Agent: [python/3.7.0 (Windows-10-10.0.17763-SP0) requests/2.19.1 msrest/0.5.5 + msrest_azure/0.4.34 azure-mgmt-iotcentral/0.2.0 Azure-SDK-For-Python AZURECLI/2.0.47] accept-language: [en-US] method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.IoTCentral/checkNameAvailability?api-version=2018-09-01 response: - body: {string: !!python/unicode '{"nameAvailable":true}'} + body: {string: '{"nameAvailable":true}'} headers: cache-control: ['no-store, must-revalidate, no-cache, max-stale=0, private, post-check=0, pre-check=0'] content-length: ['22'] content-type: [application/json; charset=utf-8] - date: ['Wed, 08 Aug 2018 20:03:54 GMT'] + date: ['Tue, 09 Oct 2018 17:21:12 GMT'] etag: [W/"16-4/x+wI91pK3bZiWtoOg+Zr/n2HE"] + server: [openresty] strict-transport-security: [max-age=31536000; includeSubDomains] transfer-encoding: [chunked] vary: ['Accept-Encoding,Accept-Encoding'] x-content-type-options: [nosniff] - x-iot-cluster: [iotcprodwestus01] - x-iot-version: ['20180802.3'] + x-iot-cluster: [iotcprodeastus01] + x-iot-version: ['20181004.13'] x-ms-ratelimit-remaining-subscription-writes: ['1199'] - x-msedge-ref: ['Ref A: F20836FC51A943409342E3B7BF6E229A Ref B: CO1EDGE0220 Ref - C: 2018-08-08T20:03:54Z'] x-powered-by: [Express] status: {code: 200, message: OK} - request: @@ -71,19 +69,19 @@ interactions: CommandName: [iotcentral app create] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/2.7.12 (Linux-4.4.0-17134-Microsoft-x86_64-with-Ubuntu-16.04-xenial) - requests/2.19.1 msrest/0.5.4 msrest_azure/0.4.34 resourcemanagementclient/2.0.0 - Azure-SDK-For-Python AZURECLI/2.0.44] + User-Agent: [python/3.7.0 (Windows-10-10.0.17763-SP0) requests/2.19.1 msrest/0.5.5 + msrest_azure/0.4.34 resourcemanagementclient/2.0.0 Azure-SDK-For-Python + AZURECLI/2.0.47] accept-language: [en-US] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg000001?api-version=2018-05-01 response: - body: {string: !!python/unicode '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001","name":"clitest.rg000001","location":"westus","tags":{"date":"2018-08-08T20:03:48Z","product":"azurecli","cause":"automation"},"properties":{"provisioningState":"Succeeded"}}'} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001","name":"clitest.rg000001","location":"westus","tags":{"product":"azurecli","cause":"automation","date":"2018-10-09T17:21:06Z"},"properties":{"provisioningState":"Succeeded"}}'} headers: cache-control: [no-cache] content-length: ['384'] content-type: [application/json; charset=utf-8] - date: ['Wed, 08 Aug 2018 20:03:54 GMT'] + date: ['Tue, 09 Oct 2018 17:21:12 GMT'] expires: ['-1'] pragma: [no-cache] strict-transport-security: [max-age=31536000; includeSubDomains] @@ -91,37 +89,35 @@ interactions: x-content-type-options: [nosniff] status: {code: 200, message: OK} - request: - body: !!python/unicode '{"sku": {"name": "S1"}, "properties": {"subdomain": "iotcentral-app-for-cli-test", - "displayName": "iotcentral-app-for-cli-test"}, "location": "westus"}' + body: 'b''{"location": "westus", "properties": {"displayName": "iotc-cli-test000002", + "subdomain": "iotc-cli-test000002"}, "sku": {"name": "S1"}}''' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] CommandName: [iotcentral app create] Connection: [keep-alive] - Content-Length: ['151'] + Content-Length: ['145'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/2.7.12 (Linux-4.4.0-17134-Microsoft-x86_64-with-Ubuntu-16.04-xenial) - requests/2.19.1 msrest/0.5.4 msrest_azure/0.4.34 azure-mgmt-iotcentral/0.2.0 - Azure-SDK-For-Python AZURECLI/2.0.44] + User-Agent: [python/3.7.0 (Windows-10-10.0.17763-SP0) requests/2.19.1 msrest/0.5.5 + msrest_azure/0.4.34 azure-mgmt-iotcentral/0.2.0 Azure-SDK-For-Python AZURECLI/2.0.47] accept-language: [en-US] method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.IoTCentral/IoTApps/iotcentral-app-for-cli-test?api-version=2018-09-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.IoTCentral/IoTApps/iotc-cli-test000002?api-version=2018-09-01 response: - body: {string: !!python/unicode '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.IoTCentral/IoTApps/iotcentral-app-for-cli-test","name":"iotcentral-app-for-cli-test","type":"Microsoft.IoTCentral/IoTApps","location":"westus","properties":{"applicationId":"e90a34f5-fcc2-4200-8e76-8af36d71de7f","state":"created","displayName":"iotcentral-app-for-cli-test","subdomain":"iotcentral-app-for-cli-test","createdDate":"2018-08-08T20:03:57.894Z","template":"iotc-default@1.0.0"},"sku":{"name":"S1"},"etag":"\"bb00e498-0000-0000-0000-5b6b4cac0000\""}'} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.IoTCentral/IoTApps/iotc-cli-test000002","name":"iotc-cli-test000002","type":"Microsoft.IoTCentral/IoTApps","location":"westus","properties":{"applicationId":"26972ef4-c1c5-4487-a770-30b7a2bab871","state":"created","displayName":"iotc-cli-test000002","tenant":"72f988bf-86f1-41af-91ab-2d7cd011db47","subdomain":"iotc-cli-test000002","createdDate":"2018-10-09T17:21:14.885Z","template":"iotc-default@1.0.0"},"sku":{"name":"S1"},"etag":"\"00000541-0000-0000-0000-5bbce38a0000\""}'} headers: cache-control: ['no-store, must-revalidate, no-cache, max-stale=0, private, post-check=0, pre-check=0'] - content-length: ['630'] + content-length: ['666'] content-type: [application/json; charset=utf-8] - date: ['Wed, 08 Aug 2018 20:03:56 GMT'] - etag: ['"bb00e498-0000-0000-0000-5b6b4cac0000"'] + date: ['Tue, 09 Oct 2018 17:21:14 GMT'] + etag: ['"00000541-0000-0000-0000-5bbce38a0000"'] + server: [openresty] strict-transport-security: [max-age=31536000; includeSubDomains] x-content-type-options: [nosniff] - x-iot-cluster: [iotcprodwestus01] - x-iot-version: ['20180802.3'] + x-iot-cluster: [iotcprodeastus01] + x-iot-version: ['20181004.13'] x-ms-ratelimit-remaining-subscription-writes: ['1199'] - x-msedge-ref: ['Ref A: F38078064FA24380BA4A39135D5208A1 Ref B: CO1EDGE0512 Ref - C: 2018-08-08T20:03:57Z'] x-powered-by: [Express] status: {code: 201, message: Created} - request: @@ -131,28 +127,181 @@ interactions: Accept-Encoding: ['gzip, deflate'] CommandName: [iotcentral app create] Connection: [keep-alive] - User-Agent: [python/2.7.12 (Linux-4.4.0-17134-Microsoft-x86_64-with-Ubuntu-16.04-xenial) - requests/2.19.1 msrest/0.5.4 msrest_azure/0.4.34 azure-mgmt-iotcentral/0.2.0 - Azure-SDK-For-Python AZURECLI/2.0.44] + User-Agent: [python/3.7.0 (Windows-10-10.0.17763-SP0) requests/2.19.1 msrest/0.5.5 + msrest_azure/0.4.34 azure-mgmt-iotcentral/0.2.0 Azure-SDK-For-Python AZURECLI/2.0.47] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.IoTCentral/IoTApps/iotcentral-app-for-cli-test?api-version=2018-09-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.IoTCentral/IoTApps/iotc-cli-test000002?api-version=2018-09-01 response: - body: {string: !!python/unicode '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.IoTCentral/IoTApps/iotcentral-app-for-cli-test","name":"iotcentral-app-for-cli-test","type":"Microsoft.IoTCentral/IoTApps","location":"westus","properties":{"applicationId":"e90a34f5-fcc2-4200-8e76-8af36d71de7f","state":"created","displayName":"iotcentral-app-for-cli-test","subdomain":"iotcentral-app-for-cli-test","createdDate":"2018-08-08T20:03:57.894Z","template":"iotc-default@1.0.0"},"sku":{"name":"S1"},"etag":"\"bb00e498-0000-0000-0000-5b6b4cac0000\""}'} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.IoTCentral/IoTApps/iotc-cli-test000002","name":"iotc-cli-test000002","type":"Microsoft.IoTCentral/IoTApps","location":"westus","properties":{"applicationId":"26972ef4-c1c5-4487-a770-30b7a2bab871","state":"created","displayName":"iotc-cli-test000002","tenant":"72f988bf-86f1-41af-91ab-2d7cd011db47","subdomain":"iotc-cli-test000002","createdDate":"2018-10-09T17:21:14.885Z","template":"iotc-default@1.0.0"},"sku":{"name":"S1"},"etag":"\"00000541-0000-0000-0000-5bbce38a0000\""}'} headers: cache-control: ['no-store, must-revalidate, no-cache, max-stale=0, private, post-check=0, pre-check=0'] - content-length: ['630'] + content-length: ['666'] content-type: [application/json; charset=utf-8] - date: ['Wed, 08 Aug 2018 20:04:27 GMT'] - etag: [W/"bb00e498-0000-0000-0000-5b6b4cac0000"] + date: ['Tue, 09 Oct 2018 17:21:46 GMT'] + etag: [W/"00000541-0000-0000-0000-5bbce38a0000"] + server: [openresty] strict-transport-security: [max-age=31536000; includeSubDomains] transfer-encoding: [chunked] vary: ['Accept-Encoding,Accept-Encoding'] x-content-type-options: [nosniff] - x-iot-cluster: [iotcprodwestus01] - x-iot-version: ['20180802.3'] - x-msedge-ref: ['Ref A: EE16F80A5E054358B755A447731BA12C Ref B: CO1EDGE0915 Ref - C: 2018-08-08T20:04:28Z'] + x-iot-cluster: [iotcprodeastus01] + x-iot-version: ['20181004.13'] + x-powered-by: [Express] + status: {code: 200, message: OK} +- request: + body: 'b''{"name": "iotc-cli-test000002-template"}''' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [iotcentral app create] + Connection: [keep-alive] + Content-Length: ['45'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.7.0 (Windows-10-10.0.17763-SP0) requests/2.19.1 msrest/0.5.5 + msrest_azure/0.4.34 azure-mgmt-iotcentral/0.2.0 Azure-SDK-For-Python AZURECLI/2.0.47] + accept-language: [en-US] + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.IoTCentral/checkNameAvailability?api-version=2018-09-01 + response: + body: {string: '{"nameAvailable":true}'} + headers: + cache-control: ['no-store, must-revalidate, no-cache, max-stale=0, private, + post-check=0, pre-check=0'] + content-length: ['22'] + content-type: [application/json; charset=utf-8] + date: ['Tue, 09 Oct 2018 17:21:47 GMT'] + etag: [W/"16-4/x+wI91pK3bZiWtoOg+Zr/n2HE"] + server: [openresty] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: ['Accept-Encoding,Accept-Encoding'] + x-content-type-options: [nosniff] + x-iot-cluster: [iotcprodeastus01] + x-iot-version: ['20181004.13'] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] + x-powered-by: [Express] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [iotcentral app create] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.7.0 (Windows-10-10.0.17763-SP0) requests/2.19.1 msrest/0.5.5 + msrest_azure/0.4.34 resourcemanagementclient/2.0.0 Azure-SDK-For-Python + AZURECLI/2.0.47] + accept-language: [en-US] + method: GET + 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-10-09T17:21:06Z"},"properties":{"provisioningState":"Succeeded"}}'} + headers: + cache-control: [no-cache] + content-length: ['384'] + content-type: [application/json; charset=utf-8] + date: ['Tue, 09 Oct 2018 17:21:47 GMT'] + expires: ['-1'] + pragma: [no-cache] + strict-transport-security: [max-age=31536000; includeSubDomains] + vary: [Accept-Encoding] + x-content-type-options: [nosniff] + status: {code: 200, message: OK} +- request: + body: 'b''{"location": "westus", "properties": {"displayName": "My Custom App + Display Name", "subdomain": "iotc-cli-test000002-template", "template": "iotc-devkit-sample@1.0.0"}, + "sku": {"name": "S1"}}''' + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [iotcentral app create] + Connection: [keep-alive] + Content-Length: ['196'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.7.0 (Windows-10-10.0.17763-SP0) requests/2.19.1 msrest/0.5.5 + msrest_azure/0.4.34 azure-mgmt-iotcentral/0.2.0 Azure-SDK-For-Python AZURECLI/2.0.47] + accept-language: [en-US] + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.IoTCentral/IoTApps/iotc-cli-test000002-template?api-version=2018-09-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.IoTCentral/IoTApps/iotc-cli-test000002-template","name":"iotc-cli-test000002-template","type":"Microsoft.IoTCentral/IoTApps","location":"westus","properties":{"applicationId":"09c38123-3f4b-43a8-bdd7-a277e531e893","state":"created","displayName":"My + Custom App Display Name","tenant":"72f988bf-86f1-41af-91ab-2d7cd011db47","subdomain":"iotc-cli-test000002-template","createdDate":"2018-10-09T17:21:49.964Z","template":"iotc-devkit-sample@1.0.0"},"sku":{"name":"S1"},"etag":"\"2d005842-0000-0000-0000-5bbce3ad0000\""}'} + headers: + cache-control: ['no-store, must-revalidate, no-cache, max-stale=0, private, + post-check=0, pre-check=0'] + content-length: ['701'] + content-type: [application/json; charset=utf-8] + date: ['Tue, 09 Oct 2018 17:21:49 GMT'] + etag: ['"2d005842-0000-0000-0000-5bbce3ad0000"'] + server: [openresty] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-iot-cluster: [iotcprodeastus01] + x-iot-version: ['20181004.13'] + x-ms-ratelimit-remaining-subscription-writes: ['1199'] + x-powered-by: [Express] + status: {code: 201, message: Created} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [iotcentral app create] + Connection: [keep-alive] + User-Agent: [python/3.7.0 (Windows-10-10.0.17763-SP0) requests/2.19.1 msrest/0.5.5 + msrest_azure/0.4.34 azure-mgmt-iotcentral/0.2.0 Azure-SDK-For-Python AZURECLI/2.0.47] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.IoTCentral/IoTApps/iotc-cli-test000002-template?api-version=2018-09-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.IoTCentral/IoTApps/iotc-cli-test000002-template","name":"iotc-cli-test000002-template","type":"Microsoft.IoTCentral/IoTApps","location":"westus","properties":{"applicationId":"09c38123-3f4b-43a8-bdd7-a277e531e893","state":"created","displayName":"My + Custom App Display Name","tenant":"72f988bf-86f1-41af-91ab-2d7cd011db47","subdomain":"iotc-cli-test000002-template","createdDate":"2018-10-09T17:21:49.964Z","template":"iotc-devkit-sample@1.0.0"},"sku":{"name":"S1"},"etag":"\"2d005842-0000-0000-0000-5bbce3ad0000\""}'} + headers: + cache-control: ['no-store, must-revalidate, no-cache, max-stale=0, private, + post-check=0, pre-check=0'] + content-length: ['701'] + content-type: [application/json; charset=utf-8] + date: ['Tue, 09 Oct 2018 17:22:20 GMT'] + etag: [W/"2d005842-0000-0000-0000-5bbce3ad0000"] + server: [openresty] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: ['Accept-Encoding,Accept-Encoding'] + x-content-type-options: [nosniff] + x-iot-cluster: [iotcprodeastus01] + x-iot-version: ['20181004.13'] + x-powered-by: [Express] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [iotcentral app show] + Connection: [keep-alive] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.7.0 (Windows-10-10.0.17763-SP0) requests/2.19.1 msrest/0.5.5 + msrest_azure/0.4.34 azure-mgmt-iotcentral/0.2.0 Azure-SDK-For-Python AZURECLI/2.0.47] + accept-language: [en-US] + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.IoTCentral/IoTApps/iotc-cli-test000002?api-version=2018-09-01 + response: + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.IoTCentral/IoTApps/iotc-cli-test000002","name":"iotc-cli-test000002","type":"Microsoft.IoTCentral/IoTApps","location":"westus","properties":{"applicationId":"26972ef4-c1c5-4487-a770-30b7a2bab871","state":"created","displayName":"iotc-cli-test000002","tenant":"72f988bf-86f1-41af-91ab-2d7cd011db47","subdomain":"iotc-cli-test000002","createdDate":"2018-10-09T17:21:14.885Z","template":"iotc-default@1.0.0"},"sku":{"name":"S1"},"etag":"\"00000541-0000-0000-0000-5bbce38a0000\""}'} + headers: + cache-control: ['no-store, must-revalidate, no-cache, max-stale=0, private, + post-check=0, pre-check=0'] + content-length: ['666'] + content-type: [application/json; charset=utf-8] + date: ['Tue, 09 Oct 2018 17:22:21 GMT'] + etag: [W/"00000541-0000-0000-0000-5bbce38a0000"] + server: [openresty] + strict-transport-security: [max-age=31536000; includeSubDomains] + transfer-encoding: [chunked] + vary: ['Accept-Encoding,Accept-Encoding'] + x-content-type-options: [nosniff] + x-iot-cluster: [iotcprodeastus01] + x-iot-version: ['20181004.13'] x-powered-by: [Express] status: {code: 200, message: OK} - request: @@ -163,31 +312,92 @@ interactions: CommandName: [iotcentral app show] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/2.7.12 (Linux-4.4.0-17134-Microsoft-x86_64-with-Ubuntu-16.04-xenial) - requests/2.19.1 msrest/0.5.4 msrest_azure/0.4.34 azure-mgmt-iotcentral/0.2.0 - Azure-SDK-For-Python AZURECLI/2.0.44] + User-Agent: [python/3.7.0 (Windows-10-10.0.17763-SP0) requests/2.19.1 msrest/0.5.5 + msrest_azure/0.4.34 azure-mgmt-iotcentral/0.2.0 Azure-SDK-For-Python AZURECLI/2.0.47] accept-language: [en-US] method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.IoTCentral/IoTApps/iotcentral-app-for-cli-test?api-version=2018-09-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.IoTCentral/IoTApps/iotc-cli-test000002-template?api-version=2018-09-01 response: - body: {string: !!python/unicode '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.IoTCentral/IoTApps/iotcentral-app-for-cli-test","name":"iotcentral-app-for-cli-test","type":"Microsoft.IoTCentral/IoTApps","location":"westus","properties":{"applicationId":"e90a34f5-fcc2-4200-8e76-8af36d71de7f","state":"created","displayName":"iotcentral-app-for-cli-test","subdomain":"iotcentral-app-for-cli-test","createdDate":"2018-08-08T20:03:57.894Z","template":"iotc-default@1.0.0"},"sku":{"name":"S1"},"etag":"\"bb00e498-0000-0000-0000-5b6b4cac0000\""}'} + body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.IoTCentral/IoTApps/iotc-cli-test000002-template","name":"iotc-cli-test000002-template","type":"Microsoft.IoTCentral/IoTApps","location":"westus","properties":{"applicationId":"09c38123-3f4b-43a8-bdd7-a277e531e893","state":"created","displayName":"My + Custom App Display Name","tenant":"72f988bf-86f1-41af-91ab-2d7cd011db47","subdomain":"iotc-cli-test000002-template","createdDate":"2018-10-09T17:21:49.964Z","template":"iotc-devkit-sample@1.0.0"},"sku":{"name":"S1"},"etag":"\"2d005842-0000-0000-0000-5bbce3ad0000\""}'} headers: cache-control: ['no-store, must-revalidate, no-cache, max-stale=0, private, post-check=0, pre-check=0'] - content-length: ['630'] + content-length: ['701'] content-type: [application/json; charset=utf-8] - date: ['Wed, 08 Aug 2018 20:04:28 GMT'] - etag: [W/"bb00e498-0000-0000-0000-5b6b4cac0000"] + date: ['Tue, 09 Oct 2018 17:22:22 GMT'] + etag: [W/"2d005842-0000-0000-0000-5bbce3ad0000"] + server: [openresty] strict-transport-security: [max-age=31536000; includeSubDomains] transfer-encoding: [chunked] vary: ['Accept-Encoding,Accept-Encoding'] x-content-type-options: [nosniff] - x-iot-cluster: [iotcprodwestus01] - x-iot-version: ['20180802.3'] - x-msedge-ref: ['Ref A: F29B1A8CF58F4589B9DEBD44A7CCFC0B Ref B: CO1EDGE0911 Ref - C: 2018-08-08T20:04:29Z'] + x-iot-cluster: [iotcprodeastus01] + x-iot-version: ['20181004.13'] x-powered-by: [Express] status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [iotcentral app delete] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.7.0 (Windows-10-10.0.17763-SP0) requests/2.19.1 msrest/0.5.5 + msrest_azure/0.4.34 azure-mgmt-iotcentral/0.2.0 Azure-SDK-For-Python AZURECLI/2.0.47] + accept-language: [en-US] + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.IoTCentral/IoTApps/iotc-cli-test000002-template?api-version=2018-09-01 + response: + body: {string: '"{\"message\":\"Header X-IoT-Subject is required.\",\"code\":\"400.030.006.002\"}"'} + headers: + cache-control: ['no-store, must-revalidate, no-cache, max-stale=0, private, + post-check=0, pre-check=0'] + connection: [close] + content-length: ['82'] + content-type: [application/json; charset=utf-8] + date: ['Tue, 09 Oct 2018 17:22:23 GMT'] + etag: [W/"52-i+3T86wxZcJ1AQBjEXMUOAdScB8"] + server: [openresty] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-iot-cluster: [iotcprodeastus01] + x-iot-version: ['20181004.13'] + x-ms-failure-cause: [service] + x-ms-ratelimit-remaining-subscription-deletes: ['14999'] + x-powered-by: [Express] + status: {code: 500, message: Internal Server Error} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [iotcentral app delete] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.7.0 (Windows-10-10.0.17763-SP0) requests/2.19.1 msrest/0.5.5 + msrest_azure/0.4.34 azure-mgmt-iotcentral/0.2.0 Azure-SDK-For-Python AZURECLI/2.0.47] + accept-language: [en-US] + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.IoTCentral/IoTApps/iotc-cli-test000002-template?api-version=2018-09-01 + response: + body: {string: ''} + headers: + cache-control: ['no-store, must-revalidate, no-cache, max-stale=0, private, + post-check=0, pre-check=0'] + date: ['Tue, 09 Oct 2018 17:22:24 GMT'] + etag: [W/"48-49tb709nJYOz7SyvcfMdAh/S/Bg"] + server: [openresty] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-iot-cluster: [iotcprodeastus01] + x-iot-version: ['20181004.13'] + x-ms-ratelimit-remaining-subscription-deletes: ['14999'] + x-powered-by: [Express] + status: {code: 204, message: No Content} - request: body: null headers: @@ -196,29 +406,27 @@ interactions: CommandName: [iotcentral app list] Connection: [keep-alive] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/2.7.12 (Linux-4.4.0-17134-Microsoft-x86_64-with-Ubuntu-16.04-xenial) - requests/2.19.1 msrest/0.5.4 msrest_azure/0.4.34 azure-mgmt-iotcentral/0.2.0 - Azure-SDK-For-Python AZURECLI/2.0.44] + User-Agent: [python/3.7.0 (Windows-10-10.0.17763-SP0) requests/2.19.1 msrest/0.5.5 + msrest_azure/0.4.34 azure-mgmt-iotcentral/0.2.0 Azure-SDK-For-Python AZURECLI/2.0.47] accept-language: [en-US] method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.IoTCentral/IoTApps?api-version=2018-09-01 response: - body: {string: !!python/unicode '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.IoTCentral/IoTApps/iotcentral-app-for-cli-test","name":"iotcentral-app-for-cli-test","type":"Microsoft.IoTCentral/IoTApps","location":"westus","properties":{"applicationId":"e90a34f5-fcc2-4200-8e76-8af36d71de7f","state":"created","displayName":"iotcentral-app-for-cli-test","subdomain":"iotcentral-app-for-cli-test","createdDate":"2018-08-08T20:03:57.894Z","template":"iotc-default@1.0.0"},"sku":{"name":"S1"},"etag":"\"bb00e498-0000-0000-0000-5b6b4cac0000\""}],"nextLink":null}'} + body: {string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.IoTCentral/IoTApps/iotc-cli-test000002","name":"iotc-cli-test000002","type":"Microsoft.IoTCentral/IoTApps","location":"westus","properties":{"applicationId":"26972ef4-c1c5-4487-a770-30b7a2bab871","state":"created","displayName":"iotc-cli-test000002","tenant":"72f988bf-86f1-41af-91ab-2d7cd011db47","subdomain":"iotc-cli-test000002","createdDate":"2018-10-09T17:21:14.885Z","template":"iotc-default@1.0.0"},"sku":{"name":"S1"},"etag":"\"00000541-0000-0000-0000-5bbce38a0000\""}],"nextLink":null}'} headers: cache-control: ['no-store, must-revalidate, no-cache, max-stale=0, private, post-check=0, pre-check=0'] - content-length: ['658'] + content-length: ['694'] content-type: [application/json; charset=utf-8] - date: ['Wed, 08 Aug 2018 20:04:29 GMT'] - etag: [W/"292-/wvjZUNtt8/Qgfn4reJK7fvR/K4"] + date: ['Tue, 09 Oct 2018 17:22:25 GMT'] + etag: [W/"2b6-e4ZphsnwdtBGqXTX4tVZtQ3ZaX8"] + server: [openresty] strict-transport-security: [max-age=31536000; includeSubDomains] transfer-encoding: [chunked] vary: ['Accept-Encoding,Accept-Encoding'] x-content-type-options: [nosniff] - x-iot-cluster: [iotcprodwestus01] - x-iot-version: ['20180802.3'] - x-msedge-ref: ['Ref A: 7CE40C8813A44750AD8DC30920BF08A3 Ref B: CO1EDGE0113 Ref - C: 2018-08-08T20:04:30Z'] + x-iot-cluster: [iotcprodeastus01] + x-iot-version: ['20181004.13'] x-powered-by: [Express] status: {code: 200, message: OK} - request: @@ -230,28 +438,59 @@ interactions: Connection: [keep-alive] Content-Length: ['0'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/2.7.12 (Linux-4.4.0-17134-Microsoft-x86_64-with-Ubuntu-16.04-xenial) - requests/2.19.1 msrest/0.5.4 msrest_azure/0.4.34 azure-mgmt-iotcentral/0.2.0 - Azure-SDK-For-Python AZURECLI/2.0.44] + User-Agent: [python/3.7.0 (Windows-10-10.0.17763-SP0) requests/2.19.1 msrest/0.5.5 + msrest_azure/0.4.34 azure-mgmt-iotcentral/0.2.0 Azure-SDK-For-Python AZURECLI/2.0.47] accept-language: [en-US] method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.IoTCentral/IoTApps/iotcentral-app-for-cli-test?api-version=2018-09-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.IoTCentral/IoTApps/iotc-cli-test000002?api-version=2018-09-01 response: - body: {string: !!python/unicode ''} + body: {string: '"{\"message\":\"Header X-IoT-Subject is required.\",\"code\":\"400.030.006.002\"}"'} headers: cache-control: ['no-store, must-revalidate, no-cache, max-stale=0, private, post-check=0, pre-check=0'] - content-length: ['0'] - date: ['Wed, 08 Aug 2018 20:04:40 GMT'] + connection: [close] + content-length: ['82'] + content-type: [application/json; charset=utf-8] + date: ['Tue, 09 Oct 2018 17:22:26 GMT'] + etag: [W/"52-i+3T86wxZcJ1AQBjEXMUOAdScB8"] + server: [openresty] strict-transport-security: [max-age=31536000; includeSubDomains] x-content-type-options: [nosniff] - x-iot-cluster: [iotcprodwestus01] - x-iot-version: ['20180802.3'] + x-iot-cluster: [iotcprodeastus01] + x-iot-version: ['20181004.13'] + x-ms-failure-cause: [service] x-ms-ratelimit-remaining-subscription-deletes: ['14999'] - x-msedge-ref: ['Ref A: BDE7E30AA2654C6289B4693B7804FCFA Ref B: CO1EDGE0322 Ref - C: 2018-08-08T20:04:31Z'] x-powered-by: [Express] - status: {code: 200, message: OK} + status: {code: 500, message: Internal Server Error} +- request: + body: null + headers: + Accept: [application/json] + Accept-Encoding: ['gzip, deflate'] + CommandName: [iotcentral app delete] + Connection: [keep-alive] + Content-Length: ['0'] + Content-Type: [application/json; charset=utf-8] + User-Agent: [python/3.7.0 (Windows-10-10.0.17763-SP0) requests/2.19.1 msrest/0.5.5 + msrest_azure/0.4.34 azure-mgmt-iotcentral/0.2.0 Azure-SDK-For-Python AZURECLI/2.0.47] + accept-language: [en-US] + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.IoTCentral/IoTApps/iotc-cli-test000002?api-version=2018-09-01 + response: + body: {string: ''} + headers: + cache-control: ['no-store, must-revalidate, no-cache, max-stale=0, private, + post-check=0, pre-check=0'] + date: ['Tue, 09 Oct 2018 17:22:27 GMT'] + etag: [W/"48-49tb709nJYOz7SyvcfMdAh/S/Bg"] + server: [openresty] + strict-transport-security: [max-age=31536000; includeSubDomains] + x-content-type-options: [nosniff] + x-iot-cluster: [iotcprodeastus01] + x-iot-version: ['20181004.13'] + x-ms-ratelimit-remaining-subscription-deletes: ['14999'] + x-powered-by: [Express] + status: {code: 204, message: No Content} - request: body: null headers: @@ -261,20 +500,20 @@ interactions: Connection: [keep-alive] Content-Length: ['0'] Content-Type: [application/json; charset=utf-8] - User-Agent: [python/2.7.12 (Linux-4.4.0-17134-Microsoft-x86_64-with-Ubuntu-16.04-xenial) - requests/2.19.1 msrest/0.5.4 msrest_azure/0.4.34 resourcemanagementclient/2.0.0 - Azure-SDK-For-Python AZURECLI/2.0.44] + User-Agent: [python/3.7.0 (Windows-10-10.0.17763-SP0) requests/2.19.1 msrest/0.5.5 + msrest_azure/0.4.34 resourcemanagementclient/2.0.0 Azure-SDK-For-Python + AZURECLI/2.0.47] 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: !!python/unicode ''} + body: {string: ''} headers: cache-control: [no-cache] content-length: ['0'] - date: ['Wed, 08 Aug 2018 20:04:41 GMT'] + date: ['Tue, 09 Oct 2018 17:22:28 GMT'] expires: ['-1'] - location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTElURVNUOjJFUkdNSlBWWEtINENERzJXM1UyWTVPM0RLSDJQR0FTRUpaUVdNN3w3NkY0QzcxQzg5MUIzRDRELVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2018-05-01'] + location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTElURVNUOjJFUkdTQ1hSTFRCSVRRTkJNR00yTFNISFZLQ0VKNE5XMkNKV1dFSHw4QjNFMkMwQzMzMEI2OTFCLVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2018-05-01'] pragma: [no-cache] strict-transport-security: [max-age=31536000; includeSubDomains] x-content-type-options: [nosniff] diff --git a/src/command_modules/azure-cli-iotcentral/azure/cli/command_modules/iotcentral/tests/latest/test_iotcentral_commands.py b/src/command_modules/azure-cli-iotcentral/azure/cli/command_modules/iotcentral/tests/latest/test_iotcentral_commands.py index 29e0ca9fc9f..0f744cf4d0a 100644 --- a/src/command_modules/azure-cli-iotcentral/azure/cli/command_modules/iotcentral/tests/latest/test_iotcentral_commands.py +++ b/src/command_modules/azure-cli-iotcentral/azure/cli/command_modules/iotcentral/tests/latest/test_iotcentral_commands.py @@ -10,9 +10,12 @@ class IoTCentralTest(ScenarioTest): @ResourceGroupPreparer() # name_prefix not required, but can be useful def test_iotcentral_app(self, resource_group, resource_group_location): - app_name = 'iotcentral-app-for-cli-test' + app_name = self.create_random_name(prefix='iotc-cli-test', length=24) + template_app_name = app_name + '-template' + template_app_display_name = "My Custom App Display Name" rg = resource_group location = resource_group_location + template = 'iotc-devkit-sample@1.0.0' # Test 'az iotcentral app create' self.cmd('iotcentral app create -n {0} -g {1} --sku S1 --subdomain {2}'.format(app_name, rg, app_name), checks=[ @@ -22,6 +25,16 @@ def test_iotcentral_app(self, resource_group, resource_group_location): self.check('displayName', app_name), self.check('sku.name', 'S1')]) + # Test 'az iotcentral app create with template and display name' + self.cmd('iotcentral app create -n {0} -g {1} --sku S1 --subdomain {2} --template {3} --display-name \"{4}\"' + .format(template_app_name, rg, template_app_name, template, template_app_display_name), checks=[ + self.check('resourceGroup', rg), + self.check('location', location), + self.check('subdomain', template_app_name), + self.check('displayName', template_app_display_name), + self.check('sku.name', 'S1'), + self.check('template', template)]) + # Test 'az iotcentral app show' self.cmd('iotcentral app show -n {0} -g {1}'.format(app_name, rg), checks=[ self.check('resourceGroup', rg), @@ -30,6 +43,19 @@ def test_iotcentral_app(self, resource_group, resource_group_location): self.check('displayName', app_name), self.check('sku.name', 'S1')]) + # Test 'az iotcentral app show with template and display name' + self.cmd('iotcentral app show -n {0} -g {1}'.format(template_app_name, rg), checks=[ + self.check('resourceGroup', rg), + self.check('location', location), + self.check('subdomain', template_app_name), + self.check('displayName', template_app_display_name), + self.check('sku.name', 'S1'), + self.check('template', template)]) + + # Test 'az iotcentral app delete with template and display name' + self.cmd('iotcentral app delete -n {0} -g {1}'.format(template_app_name, rg), checks=[ + self.is_empty()]) + # Test 'az iotcentral app list' self.cmd('iotcentral app list -g {0}'.format(rg), checks=[ self.check('length([*])', 1), diff --git a/src/command_modules/azure-cli-iotcentral/setup.py b/src/command_modules/azure-cli-iotcentral/setup.py index 3ca371c9fee..61376fa2ab7 100644 --- a/src/command_modules/azure-cli-iotcentral/setup.py +++ b/src/command_modules/azure-cli-iotcentral/setup.py @@ -14,7 +14,7 @@ logger.warn("Wheel is not available, disabling bdist_wheel hook") cmdclass = {} -VERSION = "0.1.2" +VERSION = "0.1.3" # The full list of classifiers is available at # https://pypi.python.org/pypi?%3Aaction=list_classifiers