From 01dde9fe06f334663808f99c3e05973811b453d8 Mon Sep 17 00:00:00 2001 From: Feiyue Yu Date: Wed, 24 Mar 2021 15:18:07 +0800 Subject: [PATCH 01/12] [Core] Linter rule for service_name.json --- azure-pipelines.yml | 1 + scripts/ci/service_name.py | 51 +++ src/azure-cli/service_name.json | 702 ++++++++++++++++++++++++++++++++ 3 files changed, 754 insertions(+) create mode 100644 scripts/ci/service_name.py create mode 100644 src/azure-cli/service_name.json diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 609a0141c14..bc4b56a6516 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -858,6 +858,7 @@ jobs: - bash: | set -ev . env/bin/activate + python .scripts/ci/service_name.py if [[ "$(System.PullRequest.TargetBranch)" != "" ]]; then azdev linter --ci-exclusions --min-severity medium --repo=./ --src=HEAD --tgt=origin/$(System.PullRequest.TargetBranch) else diff --git a/scripts/ci/service_name.py b/scripts/ci/service_name.py new file mode 100644 index 00000000000..0ffaf8c3094 --- /dev/null +++ b/scripts/ci/service_name.py @@ -0,0 +1,51 @@ +#!/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. +# -------------------------------------------------------------------------------------------- +import json + +from azure.cli.core import MainCommandsLoader, AzCli +from azure.cli.core._help import AzCliHelp +from azure.cli.core.commands import AzCliCommandInvoker +from azure.cli.core.file_util import create_invoker_and_load_cmds_and_args, get_all_help +from azure.cli.core.parser import AzCliCommandParser +from mock import patch + + +def main(): + az_cli = AzCli(cli_name='az', + commands_loader_cls=MainCommandsLoader, + invocation_cls=AzCliCommandInvoker, + parser_cls=AzCliCommandParser, + help_cls=AzCliHelp) + with patch('getpass.getuser', return_value='your_system_user_login_name'): + create_invoker_and_load_cmds_and_args(az_cli) + help_files = get_all_help(az_cli) + high_command_set = set() + for help_file in help_files: + if help_file.command: + high_command_set.add(help_file.command.split()[0]) + print(high_command_set) + # Check existence in service_name.json + with open('src/azure-cli/service_name.json') as f: + service_names = json.load(f) + # print(service_names) + service_name_map = {} + for service_name in service_names: + command = service_name['Command'] + service = service_name['AzureServiceName'] + if not command.startswith('az '): + raise Exception('{} not starts with az'.format(command)) + if not service: + raise Exception('AzureServiceName of {} is empty!'.format(command)) + service_name_map[command[3:]] = service + print(service_name_map) + for high_command in high_command_set: + if high_command not in service_name_map: + raise Exception('No entry of {} in service_name.json'.format(high_command)) + + +if __name__ == "__main__": + main() diff --git a/src/azure-cli/service_name.json b/src/azure-cli/service_name.json new file mode 100644 index 00000000000..e46cf010f89 --- /dev/null +++ b/src/azure-cli/service_name.json @@ -0,0 +1,702 @@ +[ + { + "Command": "az account", + "Description": "Manage Azure subscription information.", + "AzureServiceName": "Azure CLI", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/cost-management-billing/manage/create-subscription" + }, + { + "Command": "az acr", + "Description": "Manage private registries with Azure Container Registries.", + "AzureServiceName": "Azure Container Registries", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/container-registry/" + }, + { + "Command": "az acs", + "Description": "Manage Azure Container Services.", + "AzureServiceName": "Azure Container Services", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/aks/" + }, + { + "Command": "az ad", + "Description": "Manage Azure Active Directory Graph entities needed for Role Based Access Control.", + "AzureServiceName": "Azure Active Directory", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/active-directory/" + }, + { + "Command": "az advisor", + "Description": "Manage Azure Advisor.", + "AzureServiceName": "Azure Advisor", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/advisor/" + }, + { + "Command": "az aks", + "Description": "Manage Azure Kubernetes Services.", + "AzureServiceName": "Azure Kubernetes Service", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/aks/" + }, + { + "Command": "az ams", + "Description": "Manage Azure Media Services resources.", + "AzureServiceName": "Azure Media Services", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/media-services/" + }, + { + "Command": "az apim", + "Description": "Manage Azure API Management services.", + "AzureServiceName": "API Management", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/api-management/" + }, + { + "Command": "az appconfig", + "Description": "Manage App Configurations.", + "AzureServiceName": "Azure App Configuration", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/azure-app-configuration/" + }, + { + "Command": "az appservice", + "Description": "Manage App Service plans.", + "AzureServiceName": "Azure App Service", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/app-service/" + }, + { + "Command": "az aro", + "Description": "Manage Azure Red Hat OpenShift clusters.", + "AzureServiceName": "Azure Red Hat OpenShift", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/openshift/" + }, + { + "Command": "az artifacts", + "Description": "Manage Azure Artifacts.", + "AzureServiceName": "Azure Artifacts", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/devops/artifacts/" + }, + { + "Command": "az backup", + "Description": "Manage Azure Backups.", + "AzureServiceName": "Azure Backup", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/backup/" + }, + { + "Command": "az batch", + "Description": "Manage Azure Batch.", + "AzureServiceName": "Azure Batch", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/batch/" + }, + { + "Command": "az batchai", + "Description": "Manage Batch AI resources.", + "AzureServiceName": "Azure Machine Learning", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/previous-versions/azure/batch-ai/how-to-migrate" + }, + { + "Command": "az billing", + "Description": "Manage Azure Billing.", + "AzureServiceName": "Azure Cost Management + Billing", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/cost-management-billing/" + }, + { + "Command": "az boards", + "Description": "Manage Azure Boards.", + "AzureServiceName": "Azure Boards", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/devops/boards/" + }, + { + "Command": "az bot", + "Description": "Manage Microsoft Azure Bot Service.", + "AzureServiceName": "Azure Bot Service", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/bot-service/" + }, + { + "Command": "az cache", + "Description": "Commands to manage CLI objects cached using the\u00a0--defer\u00a0argument.", + "AzureServiceName": "Azure CLI", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/cli/azure/" + }, + { + "Command": "az cdn", + "Description": "Manage Azure Content Delivery Networks (CDNs).", + "AzureServiceName": "Azure Network", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/cdn/" + }, + { + "Command": "az cloud", + "Description": "Manage registered Azure clouds.", + "AzureServiceName": "Azure CLI", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/cloud-services/" + }, + { + "Command": "az cognitiveservices", + "Description": "Manage Azure Cognitive Services accounts.", + "AzureServiceName": "Azure Cognitive Service", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/cognitive-services/" + }, + { + "Command": "az config", + "Description": "Manage Azure CLI configuration.", + "AzureServiceName": "Azure CLI", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/cli/azure/" + }, + { + "Command": "az configure", + "Description": "Manage Azure CLI configuration. This command is interactive.", + "AzureServiceName": "Azure CLI", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/cli/azure/" + }, + { + "Command": "az consumption", + "Description": "Manage consumption of Azure resources.", + "AzureServiceName": "Azure Cost Management + Billing", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/cost-management-billing/" + }, + { + "Command": "az container", + "Description": "Manage Azure Container Instances.", + "AzureServiceName": "Azure Container Instances", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/container-instances/" + }, + { + "Command": "az cosmosdb", + "Description": "Manage Azure Cosmos DB database accounts.", + "AzureServiceName": "Azure Cosmos DB", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/cosmos-db/" + }, + { + "Command": "az databoxedge", + "Description": "Support data box edge device and management.", + "AzureServiceName": "Azure Stack Edge", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/databox-online/" + }, + { + "Command": "az demo", + "Description": "Demos for designing, developing and demonstrating Azure CLI.", + "AzureServiceName": "Azure CLI", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/cli/azure/" + }, + { + "Command": "az deployment", + "Description": "Manage Azure Resource Manager template deployment at subscription scope.", + "AzureServiceName": "Azure Resource Manager", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/azure-resource-manager/templates/template-tutorial-deployment-script" + }, + { + "Command": "az deployment-scripts", + "Description": "Manage deployment scripts at subscription or resource group scope.", + "AzureServiceName": "Azure Resource Manager", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/azure-resource-manager/templates/template-tutorial-deployment-script" + }, + { + "Command": "az deploymentmanager", + "Description": "Create and manage rollouts for your service.", + "AzureServiceName": "Azure Resource Manager", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/azure-resource-manager/templates/deployment-manager-overview" + }, + { + "Command": "az devops", + "Description": "Manage Azure DevOps organization level operations.", + "AzureServiceName": "Azure DevOps", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/devops/" + }, + { + "Command": "az disk", + "Description": "Manage Azure Managed Disks.", + "AzureServiceName": "Azure Disk Storage", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/virtual-machines/windows/managed-disks-overview" + }, + { + "Command": "az disk-access", + "Description": "Manage disk access resources.", + "AzureServiceName": "Azure Disk Storage", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/virtual-machines/windows/managed-disks-overview" + }, + { + "Command": "az disk-encryption-set", + "Description": "Disk Encryption Set resource.", + "AzureServiceName": "Azure Disk Storage", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/virtual-machines/linux/disk-encryption" + }, + { + "Command": "az dla", + "Description": "Manage Data Lake Analytics accounts, jobs, and catalogs.", + "AzureServiceName": "Azure Data Lake Analytics", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/data-lake-analytics/" + }, + { + "Command": "az dls", + "Description": "Manage Data Lake Store accounts and filesystems.", + "AzureServiceName": "Azure Data Lake Storage", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/storage/blobs/data-lake-storage-introduction" + }, + { + "Command": "az dms", + "Description": "Manage Azure Data Migration Service (DMS) instances.", + "AzureServiceName": "Azure Data Migration", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/dms/" + }, + { + "Command": "az eventgrid", + "Description": "Manage Azure Event Grid topics, domains, domain topics, system topics partner topics, event subscriptions, system topic event subscriptions and partner topic event subscriptions.", + "AzureServiceName": "Azure Event Grid", + "ExtensionName": "eventgrid", + "URL": "https://docs.microsoft.com/azure/event-grid/" + }, + { + "Command": "az eventhubs", + "Description": "Manage Azure Event Hubs namespaces, eventhubs, consumergroups and geo recovery configurations - Alias.", + "AzureServiceName": "Azure Event Hubs", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/event-hubs/" + }, + { + "Command": "az extension", + "Description": "Manage and update CLI extensions.", + "AzureServiceName": "Azure CLI", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/cli/azure/" + }, + { + "Command": "az feature", + "Description": "Manage resource provider features.", + "AzureServiceName": "Azure resource providers", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/azure-resource-manager/management/resource-providers-and-types" + }, + { + "Command": "az feedback", + "Description": "Send feedback to the Azure CLI Team!", + "AzureServiceName": "Azure CLI", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/cli/azure/" + }, + { + "Command": "az find", + "Description": "I'm an AI robot, my advice is based on our Azure documentation as well as the usage patterns of Azure CLI and Azure ARM users. Using me improves Azure products and documentation.", + "AzureServiceName": "Azure Application Insights", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/azure-monitor/app/usage-overview" + }, + { + "Command": "az functionapp", + "Description": "Manage function apps. To install the Azure Functions Core tools see\u00a0https://github.com/Azure/azure-functions-core-tools.", + "AzureServiceName": "Azure Functions", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/azure-functions/" + }, + { + "Command": "az group", + "Description": "Manage resource groups and template deployments.", + "AzureServiceName": "Azure Resource Manager", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/azure-resource-manager/templates/deploy-to-management-group" + }, + { + "Command": "az hdinsight", + "Description": "Manage HDInsight resources.", + "AzureServiceName": "Azure HDInsight", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/hdinsight/" + }, + { + "Command": "az identity", + "Description": "Managed Service Identities.", + "AzureServiceName": "Azure Active Directory", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/active-directory/develop/" + }, + { + "Command": "az image", + "Description": "Manage custom virtual machine images.", + "AzureServiceName": "Azure Virtual Machines", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/virtual-machines/windows/capture-image-resource" + }, + { + "Command": "az iot", + "Description": "Manage Internet of Things (IoT) assets.", + "AzureServiceName": "Azure IoT", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/iot-fundamentals/" + }, + { + "Command": "az iotcentral", + "Description": "Manage IoT Central assets.", + "AzureServiceName": "Azure IoT", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/iot-central/core/overview-iot-central" + }, + { + "Command": "az keyvault", + "Description": "Manage KeyVault keys, secrets, and certificates.", + "AzureServiceName": "Azure Key Vault", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/key-vault/" + }, + { + "Command": "az kusto", + "Description": "Manage Azure Kusto resources.", + "AzureServiceName": "Azure Data Explorer", + "ExtensionName": "kusto", + "URL": "https://docs.microsoft.com/azure/data-explorer/kusto/concepts/" + }, + { + "Command": "az lab", + "Description": "Manage Azure DevTest Labs.", + "AzureServiceName": "Azure DevTest Labs", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/devtest-labs/" + }, + { + "Command": "az local-context", + "Description": "Manage Local Context.", + "AzureServiceName": "Azure CLI", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/cli/azure/" + }, + { + "Command": "az lock", + "Description": "Manage Azure locks.", + "AzureServiceName": "Azure Resource Manager", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/azure-resource-manager/management/lock-resources" + }, + { + "Command": "az login", + "Description": "Log in to Azure.", + "AzureServiceName": "Azure CLI", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/cli/azure/" + }, + { + "Command": "az logout", + "Description": "Log out to remove access to Azure subscriptions.", + "AzureServiceName": "Azure CLI", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/cli/azure/" + }, + { + "Command": "az managedapp", + "Description": "Manage template solutions provided and maintained by Independent Software Vendors (ISVs).", + "AzureServiceName": "Azure Managed Applications", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/azure-resource-manager/managed-applications/overview" + }, + { + "Command": "az managedservices", + "Description": "Manage the registration assignments and definitions in Azure.", + "AzureServiceName": "Azure Managed Services", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/rest/api/managedservices/registrationassignments/list" + }, + { + "Command": "az maps", + "Description": "Manage Azure Maps.", + "AzureServiceName": "Azure Maps", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/azure-maps/" + }, + { + "Command": "az mariadb", + "Description": "Manage Azure Database for MariaDB servers.", + "AzureServiceName": "Azure Database for MariaDB", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/mariadb/" + }, + { + "Command": "az monitor", + "Description": "Manage the Azure Monitor Service.", + "AzureServiceName": "Azure Monitor", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/azure-monitor/" + }, + { + "Command": "az mysql", + "Description": "Manage Azure Database for MySQL servers.", + "AzureServiceName": "Azure Database for MySQL", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/mysql/" + }, + { + "Command": "az netappfiles", + "Description": "Manage Azure NetApp Files (ANF) Resources.", + "AzureServiceName": "Azure NetApp Files", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/azure-netapp-files/" + }, + { + "Command": "az network", + "Description": "Manage Azure Network resources.", + "AzureServiceName": "Azure Network", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/expressroute/" + }, + { + "Command": "az openshift", + "Description": "Manage Azure Red Hat OpenShift Services.", + "AzureServiceName": "Azure Red Hat OpenShift", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/openshift/" + }, + { + "Command": "az pipelines", + "Description": "Manage Azure Pipelines.", + "AzureServiceName": "Azure Pipelines", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/devops/pipelines/" + }, + { + "Command": "az policy", + "Description": "Manage resource policies.", + "AzureServiceName": "Azure Policy", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/governance/policy/" + }, + { + "Command": "az postgres", + "Description": "Manage Azure Database for PostgreSQL servers.", + "AzureServiceName": "Azure Database for PostgreSQL", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/postgresql/" + }, + { + "Command": "az ppg", + "Description": "Manage Proximity Placement Groups.", + "AzureServiceName": "Azure Virtual Machines", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/virtual-machines/linux/proximity-placement-groups" + }, + { + "Command": "az provider", + "Description": "Manage resource providers.", + "AzureServiceName": "Azure Resource Manager", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/azure-resource-manager/management/azure-services-resource-providers" + }, + { + "Command": "az redis", + "Description": "Manage dedicated Redis caches for your Azure applications.", + "AzureServiceName": "Azure Cache for Redis", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/azure-cache-for-redis/" + }, + { + "Command": "az relay", + "Description": "Manage Azure Relay Service namespaces, WCF relays, hybrid connections, and rules.", + "AzureServiceName": "Azure Relay", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/azure-relay/" + }, + { + "Command": "az repos", + "Description": "Manage Azure Repos.", + "AzureServiceName": "Azure Repos", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/devops/repos/" + }, + { + "Command": "az reservations", + "Description": "Manage Azure Reservations.", + "AzureServiceName": "Azure Reservations", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/cost-management-billing/reservations/manage-reserved-vm-instance" + }, + { + "Command": "az resource", + "Description": "Manage Azure resources.", + "AzureServiceName": "Azure Resource Manager", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/azure-resource-manager/management/overview" + }, + { + "Command": "az rest", + "Description": "Invoke a custom request.", + "AzureServiceName": "Azure CLI", + "ExtensionName": "", + "URL": "" + }, + { + "Command": "az role", + "Description": "Manage user roles for access control with Azure Active Directory and service principals.", + "AzureServiceName": "Azure role-based access Control", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/role-based-access-control/overview" + }, + { + "Command": "az search", + "Description": "Manage Azure Search services, admin keys and query keys.", + "AzureServiceName": "Azure Cognitive Search", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/search/search-what-is-azure-search" + }, + { + "Command": "az security", + "Description": "Manage your security posture with Azure Security Center.", + "AzureServiceName": "Azure Security Center", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/security-center/" + }, + { + "Command": "az self-test", + "Description": "Runs a self-test of the CLI.", + "AzureServiceName": "Azure CLI", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/cli/azure/" + }, + { + "Command": "az servicebus", + "Description": "Manage Azure Service Bus namespaces, queues, topics, subscriptions, rules and geo-disaster recovery configuration alias.", + "AzureServiceName": "Azure Service Bus Messaging", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/service-bus-messaging/" + }, + { + "Command": "az sf", + "Description": "Manage and administer Azure Service Fabric clusters.", + "AzureServiceName": "Azure Service Fabric", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/service-fabric/" + }, + { + "Command": "az sig", + "Description": "Manage shared image gallery.", + "AzureServiceName": "Azure Virtual Machines", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/virtual-machines/windows/shared-image-galleries" + }, + { + "Command": "az signalr", + "Description": "Manage Azure SignalR Service.", + "AzureServiceName": "Azure SignalR", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/azure-signalr/" + }, + { + "Command": "az snapshot", + "Description": "Manage point-in-time copies of managed disks, native blobs, or other snapshots.", + "AzureServiceName": "Azure Storage", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/virtual-machines/windows/managed-disks-overview" + }, + { + "Command": "az sql", + "Description": "Manage Azure SQL Databases and Data Warehouses.", + "AzureServiceName": "Azure SQL Server", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/azure-sql/" + }, + { + "Command": "az sshkey", + "Description": "Manage ssh public keys in Virtual Machines", + "AzureServiceName": "Azure Virtual Machines", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/virtual-machines/" + }, + { + "Command": "az staticwebapp", + "Description": "Manage static apps.", + "AzureServiceName": "Azure Web Apps", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/static-web-apps/overview" + }, + { + "Command": "az storage", + "Description": "Manage Azure Cloud Storage resources.", + "AzureServiceName": "Azure Storage", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/storage/" + }, + { + "Command": "az synapse", + "Description": "Manage and operate Synapse Workspace, Spark Pool, SQL Pool.", + "AzureServiceName": "Azure Synapse Analytics", + "ExtensionName": "synapse", + "URL": "https://docs.microsoft.com/azure/synapse-analytics/sql-data-warehouse/" + }, + { + "Command": "az tag", + "Description": "Tag Management on a resource.", + "AzureServiceName": "Azure Resource Manager", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/azure-resource-manager/management/tag-resources" + }, + { + "Command": "az ts", + "Description": "Manage template specs at subscription or resource group scope", + "AzureServiceName": "Azure Resource Manager", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/azure-resource-manager/templates/template-specs" + }, + { + "Command": "az upgrade", + "Description": "Upgrade Azure CLI and extensions.", + "AzureServiceName": "Azure CLI", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/cli/azure/" + }, + { + "Command": "az version", + "Description": "Show the versions of Azure CLI modules and extensions in JSON format by default or format configured by --output.", + "AzureServiceName": "Azure CLI", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/cli/azure/" + }, + { + "Command": "az vm", + "Description": "Manage Linux or Windows virtual machines.", + "AzureServiceName": "Azure Virtual Machines", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/virtual-machines/" + }, + { + "Command": "az vmss", + "Description": "Manage groupings of virtual machines in an Azure Virtual Machine Scale Set (VMSS).", + "AzureServiceName": "Azure Virtual Machine scale sets", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/virtual-machine-scale-sets/overview" + }, + { + "Command": "az webapp", + "Description": "Manage web apps.", + "AzureServiceName": "Azure Web Apps", + "ExtensionName": "webapp", + "URL": "https://docs.microsoft.com/rest/api/appservice/webapps" + } +] From 5b292a4aa6b27e307c18199d31e36d6140fecf32 Mon Sep 17 00:00:00 2001 From: Feiyue Yu Date: Wed, 24 Mar 2021 15:28:20 +0800 Subject: [PATCH 02/12] Fix a small bug --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index bc4b56a6516..83f478b3810 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -858,7 +858,7 @@ jobs: - bash: | set -ev . env/bin/activate - python .scripts/ci/service_name.py + python scripts/ci/service_name.py if [[ "$(System.PullRequest.TargetBranch)" != "" ]]; then azdev linter --ci-exclusions --min-severity medium --repo=./ --src=HEAD --tgt=origin/$(System.PullRequest.TargetBranch) else From 8051af47138e7296ee620af47efbf94f9182dca8 Mon Sep 17 00:00:00 2001 From: Feiyue Yu Date: Wed, 24 Mar 2021 15:43:11 +0800 Subject: [PATCH 03/12] afd --- src/azure-cli/service_name.json | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/azure-cli/service_name.json b/src/azure-cli/service_name.json index e46cf010f89..30622330ee3 100644 --- a/src/azure-cli/service_name.json +++ b/src/azure-cli/service_name.json @@ -34,6 +34,13 @@ "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/advisor/" }, + { + "Command": "az afd", + "Description": "", + "AzureServiceName": "Azure Front Door", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/azure/frontdoor/" + }, { "Command": "az aks", "Description": "Manage Azure Kubernetes Services.", @@ -135,7 +142,7 @@ { "Command": "az cdn", "Description": "Manage Azure Content Delivery Networks (CDNs).", - "AzureServiceName": "Azure Network", + "AzureServiceName": "Content Delivery Network", "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/cdn/" }, From 1cafd2a1c2a280fa56e649f0dcbff0a345f2c9fd Mon Sep 17 00:00:00 2001 From: Feiyue Yu Date: Wed, 24 Mar 2021 15:52:06 +0800 Subject: [PATCH 04/12] interactive --- src/azure-cli/service_name.json | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/azure-cli/service_name.json b/src/azure-cli/service_name.json index 30622330ee3..59f96bcc9f6 100644 --- a/src/azure-cli/service_name.json +++ b/src/azure-cli/service_name.json @@ -356,6 +356,13 @@ "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/virtual-machines/windows/capture-image-resource" }, + { + "Command": "az interactive", + "Description": "", + "AzureServiceName": "Azure CLI", + "ExtensionName": "", + "URL": "https://docs.microsoft.com/cli/azure/" + }, { "Command": "az iot", "Description": "Manage Internet of Things (IoT) assets.", From b120e7e6ab4035f48de4c7778e152a1ad8dd408c Mon Sep 17 00:00:00 2001 From: Feiyue Yu Date: Wed, 24 Mar 2021 16:18:25 +0800 Subject: [PATCH 05/12] bicep --- src/azure-cli/service_name.json | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/azure-cli/service_name.json b/src/azure-cli/service_name.json index 59f96bcc9f6..34f6ed5f943 100644 --- a/src/azure-cli/service_name.json +++ b/src/azure-cli/service_name.json @@ -111,6 +111,13 @@ "ExtensionName": "", "URL": "https://docs.microsoft.com/previous-versions/azure/batch-ai/how-to-migrate" }, + { + "Command": "az bicep", + "Description": "", + "AzureServiceName": "Bicep", + "ExtensionName": "", + "URL": "https://github.com/Azure/bicep" + }, { "Command": "az billing", "Description": "Manage Azure Billing.", From 89d16d2cf85d4e9c7eea8831b8adbe2c9d9ab2dd Mon Sep 17 00:00:00 2001 From: Feiyue Yu Date: Wed, 24 Mar 2021 16:30:50 +0800 Subject: [PATCH 06/12] comment --- scripts/ci/service_name.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/ci/service_name.py b/scripts/ci/service_name.py index 0ffaf8c3094..2a8f1f08d11 100644 --- a/scripts/ci/service_name.py +++ b/scripts/ci/service_name.py @@ -4,6 +4,10 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- +""" +Check format of service_name.json. Command and AzureServiceName are required. Others are optional. +Each highest level command group should have reference in service_name.json. +""" import json from azure.cli.core import MainCommandsLoader, AzCli @@ -28,7 +32,8 @@ def main(): if help_file.command: high_command_set.add(help_file.command.split()[0]) print(high_command_set) - # Check existence in service_name.json + + # Load and check service_name.json with open('src/azure-cli/service_name.json') as f: service_names = json.load(f) # print(service_names) @@ -42,6 +47,8 @@ def main(): raise Exception('AzureServiceName of {} is empty!'.format(command)) service_name_map[command[3:]] = service print(service_name_map) + + # Check existence in service_name.json for high_command in high_command_set: if high_command not in service_name_map: raise Exception('No entry of {} in service_name.json'.format(high_command)) From 3ef41a5a376faba945529c181c866d74671b1c23 Mon Sep 17 00:00:00 2001 From: Feiyue Yu Date: Mon, 29 Mar 2021 13:34:22 +0800 Subject: [PATCH 07/12] remove description and extensionname --- src/azure-cli/service_name.json | 206 -------------------------------- 1 file changed, 206 deletions(-) diff --git a/src/azure-cli/service_name.json b/src/azure-cli/service_name.json index 34f6ed5f943..44121233b62 100644 --- a/src/azure-cli/service_name.json +++ b/src/azure-cli/service_name.json @@ -1,723 +1,517 @@ [ { "Command": "az account", - "Description": "Manage Azure subscription information.", "AzureServiceName": "Azure CLI", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/cost-management-billing/manage/create-subscription" }, { "Command": "az acr", - "Description": "Manage private registries with Azure Container Registries.", "AzureServiceName": "Azure Container Registries", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/container-registry/" }, { "Command": "az acs", - "Description": "Manage Azure Container Services.", "AzureServiceName": "Azure Container Services", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/aks/" }, { "Command": "az ad", - "Description": "Manage Azure Active Directory Graph entities needed for Role Based Access Control.", "AzureServiceName": "Azure Active Directory", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/active-directory/" }, { "Command": "az advisor", - "Description": "Manage Azure Advisor.", "AzureServiceName": "Azure Advisor", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/advisor/" }, { "Command": "az afd", - "Description": "", "AzureServiceName": "Azure Front Door", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/frontdoor/" }, { "Command": "az aks", - "Description": "Manage Azure Kubernetes Services.", "AzureServiceName": "Azure Kubernetes Service", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/aks/" }, { "Command": "az ams", - "Description": "Manage Azure Media Services resources.", "AzureServiceName": "Azure Media Services", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/media-services/" }, { "Command": "az apim", - "Description": "Manage Azure API Management services.", "AzureServiceName": "API Management", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/api-management/" }, { "Command": "az appconfig", - "Description": "Manage App Configurations.", "AzureServiceName": "Azure App Configuration", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/azure-app-configuration/" }, { "Command": "az appservice", - "Description": "Manage App Service plans.", "AzureServiceName": "Azure App Service", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/app-service/" }, { "Command": "az aro", - "Description": "Manage Azure Red Hat OpenShift clusters.", "AzureServiceName": "Azure Red Hat OpenShift", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/openshift/" }, { "Command": "az artifacts", - "Description": "Manage Azure Artifacts.", "AzureServiceName": "Azure Artifacts", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/devops/artifacts/" }, { "Command": "az backup", - "Description": "Manage Azure Backups.", "AzureServiceName": "Azure Backup", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/backup/" }, { "Command": "az batch", - "Description": "Manage Azure Batch.", "AzureServiceName": "Azure Batch", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/batch/" }, { "Command": "az batchai", - "Description": "Manage Batch AI resources.", "AzureServiceName": "Azure Machine Learning", - "ExtensionName": "", "URL": "https://docs.microsoft.com/previous-versions/azure/batch-ai/how-to-migrate" }, { "Command": "az bicep", - "Description": "", "AzureServiceName": "Bicep", - "ExtensionName": "", "URL": "https://github.com/Azure/bicep" }, { "Command": "az billing", - "Description": "Manage Azure Billing.", "AzureServiceName": "Azure Cost Management + Billing", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/cost-management-billing/" }, { "Command": "az boards", - "Description": "Manage Azure Boards.", "AzureServiceName": "Azure Boards", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/devops/boards/" }, { "Command": "az bot", - "Description": "Manage Microsoft Azure Bot Service.", "AzureServiceName": "Azure Bot Service", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/bot-service/" }, { "Command": "az cache", - "Description": "Commands to manage CLI objects cached using the\u00a0--defer\u00a0argument.", "AzureServiceName": "Azure CLI", - "ExtensionName": "", "URL": "https://docs.microsoft.com/cli/azure/" }, { "Command": "az cdn", - "Description": "Manage Azure Content Delivery Networks (CDNs).", "AzureServiceName": "Content Delivery Network", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/cdn/" }, { "Command": "az cloud", - "Description": "Manage registered Azure clouds.", "AzureServiceName": "Azure CLI", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/cloud-services/" }, { "Command": "az cognitiveservices", - "Description": "Manage Azure Cognitive Services accounts.", "AzureServiceName": "Azure Cognitive Service", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/cognitive-services/" }, { "Command": "az config", - "Description": "Manage Azure CLI configuration.", "AzureServiceName": "Azure CLI", - "ExtensionName": "", "URL": "https://docs.microsoft.com/cli/azure/" }, { "Command": "az configure", - "Description": "Manage Azure CLI configuration. This command is interactive.", "AzureServiceName": "Azure CLI", - "ExtensionName": "", "URL": "https://docs.microsoft.com/cli/azure/" }, { "Command": "az consumption", - "Description": "Manage consumption of Azure resources.", "AzureServiceName": "Azure Cost Management + Billing", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/cost-management-billing/" }, { "Command": "az container", - "Description": "Manage Azure Container Instances.", "AzureServiceName": "Azure Container Instances", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/container-instances/" }, { "Command": "az cosmosdb", - "Description": "Manage Azure Cosmos DB database accounts.", "AzureServiceName": "Azure Cosmos DB", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/cosmos-db/" }, { "Command": "az databoxedge", - "Description": "Support data box edge device and management.", "AzureServiceName": "Azure Stack Edge", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/databox-online/" }, { "Command": "az demo", - "Description": "Demos for designing, developing and demonstrating Azure CLI.", "AzureServiceName": "Azure CLI", - "ExtensionName": "", "URL": "https://docs.microsoft.com/cli/azure/" }, { "Command": "az deployment", - "Description": "Manage Azure Resource Manager template deployment at subscription scope.", "AzureServiceName": "Azure Resource Manager", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/azure-resource-manager/templates/template-tutorial-deployment-script" }, { "Command": "az deployment-scripts", - "Description": "Manage deployment scripts at subscription or resource group scope.", "AzureServiceName": "Azure Resource Manager", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/azure-resource-manager/templates/template-tutorial-deployment-script" }, { "Command": "az deploymentmanager", - "Description": "Create and manage rollouts for your service.", "AzureServiceName": "Azure Resource Manager", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/azure-resource-manager/templates/deployment-manager-overview" }, { "Command": "az devops", - "Description": "Manage Azure DevOps organization level operations.", "AzureServiceName": "Azure DevOps", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/devops/" }, { "Command": "az disk", - "Description": "Manage Azure Managed Disks.", "AzureServiceName": "Azure Disk Storage", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/virtual-machines/windows/managed-disks-overview" }, { "Command": "az disk-access", - "Description": "Manage disk access resources.", "AzureServiceName": "Azure Disk Storage", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/virtual-machines/windows/managed-disks-overview" }, { "Command": "az disk-encryption-set", - "Description": "Disk Encryption Set resource.", "AzureServiceName": "Azure Disk Storage", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/virtual-machines/linux/disk-encryption" }, { "Command": "az dla", - "Description": "Manage Data Lake Analytics accounts, jobs, and catalogs.", "AzureServiceName": "Azure Data Lake Analytics", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/data-lake-analytics/" }, { "Command": "az dls", - "Description": "Manage Data Lake Store accounts and filesystems.", "AzureServiceName": "Azure Data Lake Storage", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/storage/blobs/data-lake-storage-introduction" }, { "Command": "az dms", - "Description": "Manage Azure Data Migration Service (DMS) instances.", "AzureServiceName": "Azure Data Migration", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/dms/" }, { "Command": "az eventgrid", - "Description": "Manage Azure Event Grid topics, domains, domain topics, system topics partner topics, event subscriptions, system topic event subscriptions and partner topic event subscriptions.", "AzureServiceName": "Azure Event Grid", - "ExtensionName": "eventgrid", "URL": "https://docs.microsoft.com/azure/event-grid/" }, { "Command": "az eventhubs", - "Description": "Manage Azure Event Hubs namespaces, eventhubs, consumergroups and geo recovery configurations - Alias.", "AzureServiceName": "Azure Event Hubs", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/event-hubs/" }, { "Command": "az extension", - "Description": "Manage and update CLI extensions.", "AzureServiceName": "Azure CLI", - "ExtensionName": "", "URL": "https://docs.microsoft.com/cli/azure/" }, { "Command": "az feature", - "Description": "Manage resource provider features.", "AzureServiceName": "Azure resource providers", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/azure-resource-manager/management/resource-providers-and-types" }, { "Command": "az feedback", - "Description": "Send feedback to the Azure CLI Team!", "AzureServiceName": "Azure CLI", - "ExtensionName": "", "URL": "https://docs.microsoft.com/cli/azure/" }, { "Command": "az find", - "Description": "I'm an AI robot, my advice is based on our Azure documentation as well as the usage patterns of Azure CLI and Azure ARM users. Using me improves Azure products and documentation.", "AzureServiceName": "Azure Application Insights", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/azure-monitor/app/usage-overview" }, { "Command": "az functionapp", - "Description": "Manage function apps. To install the Azure Functions Core tools see\u00a0https://github.com/Azure/azure-functions-core-tools.", "AzureServiceName": "Azure Functions", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/azure-functions/" }, { "Command": "az group", - "Description": "Manage resource groups and template deployments.", "AzureServiceName": "Azure Resource Manager", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/azure-resource-manager/templates/deploy-to-management-group" }, { "Command": "az hdinsight", - "Description": "Manage HDInsight resources.", "AzureServiceName": "Azure HDInsight", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/hdinsight/" }, { "Command": "az identity", - "Description": "Managed Service Identities.", "AzureServiceName": "Azure Active Directory", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/active-directory/develop/" }, { "Command": "az image", - "Description": "Manage custom virtual machine images.", "AzureServiceName": "Azure Virtual Machines", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/virtual-machines/windows/capture-image-resource" }, { "Command": "az interactive", - "Description": "", "AzureServiceName": "Azure CLI", - "ExtensionName": "", "URL": "https://docs.microsoft.com/cli/azure/" }, { "Command": "az iot", - "Description": "Manage Internet of Things (IoT) assets.", "AzureServiceName": "Azure IoT", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/iot-fundamentals/" }, { "Command": "az iotcentral", - "Description": "Manage IoT Central assets.", "AzureServiceName": "Azure IoT", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/iot-central/core/overview-iot-central" }, { "Command": "az keyvault", - "Description": "Manage KeyVault keys, secrets, and certificates.", "AzureServiceName": "Azure Key Vault", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/key-vault/" }, { "Command": "az kusto", - "Description": "Manage Azure Kusto resources.", "AzureServiceName": "Azure Data Explorer", - "ExtensionName": "kusto", "URL": "https://docs.microsoft.com/azure/data-explorer/kusto/concepts/" }, { "Command": "az lab", - "Description": "Manage Azure DevTest Labs.", "AzureServiceName": "Azure DevTest Labs", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/devtest-labs/" }, { "Command": "az local-context", - "Description": "Manage Local Context.", "AzureServiceName": "Azure CLI", - "ExtensionName": "", "URL": "https://docs.microsoft.com/cli/azure/" }, { "Command": "az lock", - "Description": "Manage Azure locks.", "AzureServiceName": "Azure Resource Manager", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/azure-resource-manager/management/lock-resources" }, { "Command": "az login", - "Description": "Log in to Azure.", "AzureServiceName": "Azure CLI", - "ExtensionName": "", "URL": "https://docs.microsoft.com/cli/azure/" }, { "Command": "az logout", - "Description": "Log out to remove access to Azure subscriptions.", "AzureServiceName": "Azure CLI", - "ExtensionName": "", "URL": "https://docs.microsoft.com/cli/azure/" }, { "Command": "az managedapp", - "Description": "Manage template solutions provided and maintained by Independent Software Vendors (ISVs).", "AzureServiceName": "Azure Managed Applications", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/azure-resource-manager/managed-applications/overview" }, { "Command": "az managedservices", - "Description": "Manage the registration assignments and definitions in Azure.", "AzureServiceName": "Azure Managed Services", - "ExtensionName": "", "URL": "https://docs.microsoft.com/rest/api/managedservices/registrationassignments/list" }, { "Command": "az maps", - "Description": "Manage Azure Maps.", "AzureServiceName": "Azure Maps", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/azure-maps/" }, { "Command": "az mariadb", - "Description": "Manage Azure Database for MariaDB servers.", "AzureServiceName": "Azure Database for MariaDB", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/mariadb/" }, { "Command": "az monitor", - "Description": "Manage the Azure Monitor Service.", "AzureServiceName": "Azure Monitor", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/azure-monitor/" }, { "Command": "az mysql", - "Description": "Manage Azure Database for MySQL servers.", "AzureServiceName": "Azure Database for MySQL", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/mysql/" }, { "Command": "az netappfiles", - "Description": "Manage Azure NetApp Files (ANF) Resources.", "AzureServiceName": "Azure NetApp Files", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/azure-netapp-files/" }, { "Command": "az network", - "Description": "Manage Azure Network resources.", "AzureServiceName": "Azure Network", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/expressroute/" }, { "Command": "az openshift", - "Description": "Manage Azure Red Hat OpenShift Services.", "AzureServiceName": "Azure Red Hat OpenShift", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/openshift/" }, { "Command": "az pipelines", - "Description": "Manage Azure Pipelines.", "AzureServiceName": "Azure Pipelines", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/devops/pipelines/" }, { "Command": "az policy", - "Description": "Manage resource policies.", "AzureServiceName": "Azure Policy", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/governance/policy/" }, { "Command": "az postgres", - "Description": "Manage Azure Database for PostgreSQL servers.", "AzureServiceName": "Azure Database for PostgreSQL", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/postgresql/" }, { "Command": "az ppg", - "Description": "Manage Proximity Placement Groups.", "AzureServiceName": "Azure Virtual Machines", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/virtual-machines/linux/proximity-placement-groups" }, { "Command": "az provider", - "Description": "Manage resource providers.", "AzureServiceName": "Azure Resource Manager", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/azure-resource-manager/management/azure-services-resource-providers" }, { "Command": "az redis", - "Description": "Manage dedicated Redis caches for your Azure applications.", "AzureServiceName": "Azure Cache for Redis", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/azure-cache-for-redis/" }, { "Command": "az relay", - "Description": "Manage Azure Relay Service namespaces, WCF relays, hybrid connections, and rules.", "AzureServiceName": "Azure Relay", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/azure-relay/" }, { "Command": "az repos", - "Description": "Manage Azure Repos.", "AzureServiceName": "Azure Repos", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/devops/repos/" }, { "Command": "az reservations", - "Description": "Manage Azure Reservations.", "AzureServiceName": "Azure Reservations", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/cost-management-billing/reservations/manage-reserved-vm-instance" }, { "Command": "az resource", - "Description": "Manage Azure resources.", "AzureServiceName": "Azure Resource Manager", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/azure-resource-manager/management/overview" }, { "Command": "az rest", - "Description": "Invoke a custom request.", "AzureServiceName": "Azure CLI", - "ExtensionName": "", "URL": "" }, { "Command": "az role", - "Description": "Manage user roles for access control with Azure Active Directory and service principals.", "AzureServiceName": "Azure role-based access Control", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/role-based-access-control/overview" }, { "Command": "az search", - "Description": "Manage Azure Search services, admin keys and query keys.", "AzureServiceName": "Azure Cognitive Search", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/search/search-what-is-azure-search" }, { "Command": "az security", - "Description": "Manage your security posture with Azure Security Center.", "AzureServiceName": "Azure Security Center", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/security-center/" }, { "Command": "az self-test", - "Description": "Runs a self-test of the CLI.", "AzureServiceName": "Azure CLI", - "ExtensionName": "", "URL": "https://docs.microsoft.com/cli/azure/" }, { "Command": "az servicebus", - "Description": "Manage Azure Service Bus namespaces, queues, topics, subscriptions, rules and geo-disaster recovery configuration alias.", "AzureServiceName": "Azure Service Bus Messaging", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/service-bus-messaging/" }, { "Command": "az sf", - "Description": "Manage and administer Azure Service Fabric clusters.", "AzureServiceName": "Azure Service Fabric", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/service-fabric/" }, { "Command": "az sig", - "Description": "Manage shared image gallery.", "AzureServiceName": "Azure Virtual Machines", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/virtual-machines/windows/shared-image-galleries" }, { "Command": "az signalr", - "Description": "Manage Azure SignalR Service.", "AzureServiceName": "Azure SignalR", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/azure-signalr/" }, { "Command": "az snapshot", - "Description": "Manage point-in-time copies of managed disks, native blobs, or other snapshots.", "AzureServiceName": "Azure Storage", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/virtual-machines/windows/managed-disks-overview" }, { "Command": "az sql", - "Description": "Manage Azure SQL Databases and Data Warehouses.", "AzureServiceName": "Azure SQL Server", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/azure-sql/" }, { "Command": "az sshkey", - "Description": "Manage ssh public keys in Virtual Machines", "AzureServiceName": "Azure Virtual Machines", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/virtual-machines/" }, { "Command": "az staticwebapp", - "Description": "Manage static apps.", "AzureServiceName": "Azure Web Apps", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/static-web-apps/overview" }, { "Command": "az storage", - "Description": "Manage Azure Cloud Storage resources.", "AzureServiceName": "Azure Storage", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/storage/" }, { "Command": "az synapse", - "Description": "Manage and operate Synapse Workspace, Spark Pool, SQL Pool.", "AzureServiceName": "Azure Synapse Analytics", - "ExtensionName": "synapse", "URL": "https://docs.microsoft.com/azure/synapse-analytics/sql-data-warehouse/" }, { "Command": "az tag", - "Description": "Tag Management on a resource.", "AzureServiceName": "Azure Resource Manager", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/azure-resource-manager/management/tag-resources" }, { "Command": "az ts", - "Description": "Manage template specs at subscription or resource group scope", "AzureServiceName": "Azure Resource Manager", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/azure-resource-manager/templates/template-specs" }, { "Command": "az upgrade", - "Description": "Upgrade Azure CLI and extensions.", "AzureServiceName": "Azure CLI", - "ExtensionName": "", "URL": "https://docs.microsoft.com/cli/azure/" }, { "Command": "az version", - "Description": "Show the versions of Azure CLI modules and extensions in JSON format by default or format configured by --output.", "AzureServiceName": "Azure CLI", - "ExtensionName": "", "URL": "https://docs.microsoft.com/cli/azure/" }, { "Command": "az vm", - "Description": "Manage Linux or Windows virtual machines.", "AzureServiceName": "Azure Virtual Machines", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/virtual-machines/" }, { "Command": "az vmss", - "Description": "Manage groupings of virtual machines in an Azure Virtual Machine Scale Set (VMSS).", "AzureServiceName": "Azure Virtual Machine scale sets", - "ExtensionName": "", "URL": "https://docs.microsoft.com/azure/virtual-machine-scale-sets/overview" }, { "Command": "az webapp", - "Description": "Manage web apps.", "AzureServiceName": "Azure Web Apps", - "ExtensionName": "webapp", "URL": "https://docs.microsoft.com/rest/api/appservice/webapps" } ] From c2ed3e9da14e6da4a5e228bb113ea186d9bf31cf Mon Sep 17 00:00:00 2001 From: Feiyue Yu Date: Mon, 29 Mar 2021 15:16:52 +0800 Subject: [PATCH 08/12] update --- src/azure-cli/service_name.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/azure-cli/service_name.json b/src/azure-cli/service_name.json index 44121233b62..1c56f68bbc6 100644 --- a/src/azure-cli/service_name.json +++ b/src/azure-cli/service_name.json @@ -347,7 +347,7 @@ { "Command": "az network", "AzureServiceName": "Azure Network", - "URL": "https://docs.microsoft.com/azure/expressroute/" + "URL": "https://azure.microsoft.com/en-us/product-categories/networking/" }, { "Command": "az openshift", From 4910fcd3f76147da48ea7bc20ada26a0ec0210b2 Mon Sep 17 00:00:00 2001 From: Feiyue Yu Date: Tue, 30 Mar 2021 11:37:32 +0800 Subject: [PATCH 09/12] update --- scripts/ci/service_name.py | 8 +++++--- src/azure-cli/service_name.json | 30 +++++++++++++++--------------- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/scripts/ci/service_name.py b/scripts/ci/service_name.py index 2a8f1f08d11..1ab7be3c91e 100644 --- a/scripts/ci/service_name.py +++ b/scripts/ci/service_name.py @@ -15,7 +15,7 @@ from azure.cli.core.commands import AzCliCommandInvoker from azure.cli.core.file_util import create_invoker_and_load_cmds_and_args, get_all_help from azure.cli.core.parser import AzCliCommandParser -from mock import patch +from unittest.mock import patch def main(): @@ -31,21 +31,23 @@ def main(): for help_file in help_files: if help_file.command: high_command_set.add(help_file.command.split()[0]) + print('high_command_set:') print(high_command_set) # Load and check service_name.json with open('src/azure-cli/service_name.json') as f: service_names = json.load(f) - # print(service_names) + print('Verifying src/azure-cli/service_name.json') service_name_map = {} for service_name in service_names: command = service_name['Command'] service = service_name['AzureServiceName'] if not command.startswith('az '): - raise Exception('{} not starts with az'.format(command)) + raise Exception('{} does not start with az!'.format(command)) if not service: raise Exception('AzureServiceName of {} is empty!'.format(command)) service_name_map[command[3:]] = service + print('service_name_map:') print(service_name_map) # Check existence in service_name.json diff --git a/src/azure-cli/service_name.json b/src/azure-cli/service_name.json index 1c56f68bbc6..cc4728aa5a8 100644 --- a/src/azure-cli/service_name.json +++ b/src/azure-cli/service_name.json @@ -2,7 +2,7 @@ { "Command": "az account", "AzureServiceName": "Azure CLI", - "URL": "https://docs.microsoft.com/azure/cost-management-billing/manage/create-subscription" + "URL": "" }, { "Command": "az acr", @@ -102,7 +102,7 @@ { "Command": "az cache", "AzureServiceName": "Azure CLI", - "URL": "https://docs.microsoft.com/cli/azure/" + "URL": "" }, { "Command": "az cdn", @@ -112,7 +112,7 @@ { "Command": "az cloud", "AzureServiceName": "Azure CLI", - "URL": "https://docs.microsoft.com/azure/cloud-services/" + "URL": "" }, { "Command": "az cognitiveservices", @@ -122,12 +122,12 @@ { "Command": "az config", "AzureServiceName": "Azure CLI", - "URL": "https://docs.microsoft.com/cli/azure/" + "URL": "" }, { "Command": "az configure", "AzureServiceName": "Azure CLI", - "URL": "https://docs.microsoft.com/cli/azure/" + "URL": "" }, { "Command": "az consumption", @@ -152,7 +152,7 @@ { "Command": "az demo", "AzureServiceName": "Azure CLI", - "URL": "https://docs.microsoft.com/cli/azure/" + "URL": "" }, { "Command": "az deployment", @@ -217,7 +217,7 @@ { "Command": "az extension", "AzureServiceName": "Azure CLI", - "URL": "https://docs.microsoft.com/cli/azure/" + "URL": "" }, { "Command": "az feature", @@ -227,7 +227,7 @@ { "Command": "az feedback", "AzureServiceName": "Azure CLI", - "URL": "https://docs.microsoft.com/cli/azure/" + "URL": "" }, { "Command": "az find", @@ -262,7 +262,7 @@ { "Command": "az interactive", "AzureServiceName": "Azure CLI", - "URL": "https://docs.microsoft.com/cli/azure/" + "URL": "" }, { "Command": "az iot", @@ -292,7 +292,7 @@ { "Command": "az local-context", "AzureServiceName": "Azure CLI", - "URL": "https://docs.microsoft.com/cli/azure/" + "URL": "" }, { "Command": "az lock", @@ -302,12 +302,12 @@ { "Command": "az login", "AzureServiceName": "Azure CLI", - "URL": "https://docs.microsoft.com/cli/azure/" + "URL": "" }, { "Command": "az logout", "AzureServiceName": "Azure CLI", - "URL": "https://docs.microsoft.com/cli/azure/" + "URL": "" }, { "Command": "az managedapp", @@ -427,7 +427,7 @@ { "Command": "az self-test", "AzureServiceName": "Azure CLI", - "URL": "https://docs.microsoft.com/cli/azure/" + "URL": "" }, { "Command": "az servicebus", @@ -492,12 +492,12 @@ { "Command": "az upgrade", "AzureServiceName": "Azure CLI", - "URL": "https://docs.microsoft.com/cli/azure/" + "URL": "" }, { "Command": "az version", "AzureServiceName": "Azure CLI", - "URL": "https://docs.microsoft.com/cli/azure/" + "URL": "" }, { "Command": "az vm", From bd01fa725195ae5066b7bf8ce4f732f601dc8380 Mon Sep 17 00:00:00 2001 From: Feiyue Yu Date: Tue, 30 Mar 2021 11:43:22 +0800 Subject: [PATCH 10/12] message --- scripts/ci/service_name.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ci/service_name.py b/scripts/ci/service_name.py index 1ab7be3c91e..cadd992e61f 100644 --- a/scripts/ci/service_name.py +++ b/scripts/ci/service_name.py @@ -53,7 +53,7 @@ def main(): # Check existence in service_name.json for high_command in high_command_set: if high_command not in service_name_map: - raise Exception('No entry of {} in service_name.json'.format(high_command)) + raise Exception('No entry of {} in service_name.json. Please add one to the file.'.format(high_command)) if __name__ == "__main__": From ea80fc96dafa989e4dd6298a4d50452a2abc6ed9 Mon Sep 17 00:00:00 2001 From: Feiyue Yu Date: Wed, 31 Mar 2021 15:52:57 +0800 Subject: [PATCH 11/12] update --- scripts/ci/service_name.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/ci/service_name.py b/scripts/ci/service_name.py index cadd992e61f..f97a20620dc 100644 --- a/scripts/ci/service_name.py +++ b/scripts/ci/service_name.py @@ -24,8 +24,7 @@ def main(): invocation_cls=AzCliCommandInvoker, parser_cls=AzCliCommandParser, help_cls=AzCliHelp) - with patch('getpass.getuser', return_value='your_system_user_login_name'): - create_invoker_and_load_cmds_and_args(az_cli) + create_invoker_and_load_cmds_and_args(az_cli) help_files = get_all_help(az_cli) high_command_set = set() for help_file in help_files: From cad0e3e08f475b8c391c6219133548964ee849fd Mon Sep 17 00:00:00 2001 From: Feiyue Yu Date: Wed, 31 Mar 2021 15:53:30 +0800 Subject: [PATCH 12/12] style --- scripts/ci/service_name.py | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/ci/service_name.py b/scripts/ci/service_name.py index f97a20620dc..a242ce74cb1 100644 --- a/scripts/ci/service_name.py +++ b/scripts/ci/service_name.py @@ -15,7 +15,6 @@ from azure.cli.core.commands import AzCliCommandInvoker from azure.cli.core.file_util import create_invoker_and_load_cmds_and_args, get_all_help from azure.cli.core.parser import AzCliCommandParser -from unittest.mock import patch def main():