Azure / azure-powershell

Microsoft Azure PowerShell
Other
4.13k stars 3.77k forks source link

Add generic Sku completer #8004

Open maddieclayton opened 5 years ago

maddieclayton commented 5 years ago

Description

Using a style similar to the other generic resource completers here. Add support for a generic SKU completer.

In this case, SKUs are listed using calls from individual RPs, s, in each case, there should be two parts to the completer attribute

Note that some services (for example, Compute) provide SDK calls that list all resource SKUs, and calls that list available skus for updating an existing resource (like a virtual machien scaleset), you will likely need to provide separate concrete attributes for each of these. It would be appropriate to sue the 'list all resource skus' api when creating a 'New' resource, and the sku list for a specific resource when updating an existing resource.

We will do this for the following cmdlets

cormacpayne commented 5 years ago

Potential convenience cmdlet for listing skus

cormacpayne commented 5 years ago

Analysis Services

Servers - List Skus for Existing

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AnalysisServices/servers/{serverName}/skus?api-version=2017-08-01

Servers - List Skus for New

GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.AnalysisServices/skus?api-version=2017-08-01

Api Management

Api Management Service Skus - List Available Service Skus

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/skus?api-version=2018-06-01-preview

App Service

App Service Environments - List Multi Role Pool Skus

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/skus?api-version=2016-09-01

App Service Environments - List Worker Pool Skus

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/skus?api-version=2016-09-01

App Service Plans - Get Server Farm Skus

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/skus?api-version=2016-09-01

Batch

Account - List Node Agent Skus

GET {batchUrl}/nodeagentskus?api-version=2018-12-01.8.0

Cognitive Services

Accounts - List Skus

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/skus?api-version=2017-04-18

Check Sku Availability - List

POST https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/checkSkuAvailability?api-version=2017-04-18

Resource Skus - List

GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/skus?api-version=2017-04-18

Compute

Resource Skus - List

GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Compute/skus?api-version=2017-09-01

Virtual Machine Images - List Skus

GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus?api-version=2018-06-01

Virtual Machine Scale Sets - List Skus

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus?api-version=2018-06-01

Data Migration

Resource Skus - List Skus

GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.DataMigration/skus?api-version=2018-04-19

Services - List Skus

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/skus?api-version=2018-04-19

Event Hubs

Regions - List By Sku

GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.EventHub/sku/{sku}/regions?api-version=2017-04-01

IoT Hub

Iot Hub Resource - Get Valid Skus

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus?api-version=2018-04-01

IoT Hub Device Provisioning Service

Iot Dps Resource - list Valid Skus

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/skus?api-version=2018-01-22

Machine Learning

Skus - List

GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearning/skus?api-version=2016-05-01-preview

Power BI Embedded

Capacities - List Skus

GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.PowerBIDedicated/skus?api-version=2017-10-01

Capacities - List Skus For Capacity

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBIDedicated/capacities/{dedicatedCapacityName}/skus?api-version=2017-10-01

Service Bus

Regions - List By Sku

GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/sku/{sku}/regions?api-version=2017-04-01

Storage

Skus - List

GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Storage/skus?api-version=2018-11-01

isra-fel commented 4 years ago

Hi @markcowl , I have some concerns about some of the cmdlets we planned to implement SKU completer.

New-AzAvailabilitySet & Update-AzAvailabilitySet

They only accepts Aligned or Classic as SKU. I think the behavior should be stable, so better to use a PSArgumentCompleter here.

New-AzSnapshoptUpdateConfig & New-AzStorageAccount & Set-AzStorageAccount

Problem is, each of them supports a (different) subset of storage account skus, but there's no individual APIs to get those subsets. I think we have two choices:

  1. Implemnet them as ValidationSet (current behavior)
  2. Use the full storage account sku list, dispite that part of the list might not apply

🤔 What's your opinion?