Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/command_modules/azure-cli-iotcentral/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 [email protected] --display-name 'My Custom Display Name'
"""

helps['iotcentral app show'] = """
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.')
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
Loading