redhat-developer / app-services-cli

Command Line Interface for RHOAS
https://redhat-developer.github.io/app-services-website/
Apache License 2.0
42 stars 72 forks source link

Command to show available providers and regions #1386

Open ppatierno opened 2 years ago

ppatierno commented 2 years ago

First of all sorry if there is a way to do what I am going to describe but I wasn't able to find any information in the doc. I want to use rhoas CLI for interacting with the RHOSAK service. In order to create a new Kafka instance, it seems I can specify the --name for the instance as well as the --provider and --region but I don't see any way to get the list of available providers and regions. I know that if I don't set any command line parameters, I get an interactive wizard which allows me to see the available providers (just aws for now) and regions (eu-west-1 and us-east-1).

rhoas kafka create
? Name: test
? Cloud Provider: aws
? Cloud Region:  [Use arrows to move, type to filter, ? for more help]
  eu-west-1
> us-east-1

It would be great to have a way to get providers and regions lists with a kind of new command in rhoas. For example, when I use the Azure CLI for handling my services on Azure, there is a specific command to list the locations (aka regions) available for the current Microsoft Azure Subscription where I can create and run my service.

az account --list-locations

The above command provides a JSON output listing different information about each location/region like following.

{
    "displayName": "East US",
    "id": "/subscriptions/.....",
    "metadata": {
      "geographyGroup": "US",
      "latitude": "37.3719",
      "longitude": "-79.8164",
      "pairedRegion": [
        {
          "id": "/subscriptions/......",
          "name": "westus",
          "subscriptionId": null
        }
      ],
      "physicalLocation": "Virginia",
      "regionCategory": "Recommended",
      "regionType": "Physical"
    },
    "name": "eastus",
    "regionalDisplayName": "(US) East US",
    "subscriptionId": null
  }

Of course, we don't want all this info because with az we are already on Azure and it provides details about locations but having just a list of regions as eu-west-1 and us-east-1 would be useful. The same applies to providers of course.

wtrocki commented 2 years ago

Already done in but not released yet

https://github.com/redhat-developer/app-services-cli/pull/1362

ppatierno commented 2 years ago

Yeah that PR is really cool and great to have. What I am suggesting is slightly different, it's about having a dedicated command to get providers and regions before "trying" to create a Kafka instance. With that PR you have to make a mistake first to get suggestions or you know the valid values from the beginning, but having a way to have a valid list up front would be useful imho.

wtrocki commented 2 years ago

@rkpattnaik780 FYI

Looking for feedback and good cmd name

rhoas kafka locations?

rkpattnaik780 commented 2 years ago

How does rhoas kafka list-regions sound?

wtrocki commented 2 years ago

@craicoverflow will be expert in terms of guidance.

Service registry has some examples of 2 part commands

craicoverflow commented 2 years ago

rhoas kafka list-regions

I love it. It fits very nicely with the existing language.