Skip to content

[Suggestion] Use separate commands for each provider #29

Open
@burtonr

Description

Rather than using an ambiguous string to define a provider, rather have each provider as a sub-command to the create command

Expected Behaviour

Have better type safety, better discovery, and easier usage for users

Current Behaviour

Run the create command and add flags as they are needed. Different per provider

Possible Solution

Create separate commands for each provider. The files are already separated, this would just be to add the &cobra.Command{} to the top of each file, and adding the commands to the create command.

The added bonus here is that there can be provider specific help information displayed in the terminal. An excellent use of the help text would be to display what is being created... (this is only known by reading the code, or inlets-operator readme)

$ inletsctl create gcp --help
Create an exit node on Google Cloud Platform.

Note: The account associated with the access token 
    will need compute.firewalls.create and serviceaccount user permissions

Usage: 
    inletsctl create gcp \
        --access-token-file $HOME/gcp-token.json \
        --zone "us-central1-a" \
        --project-id "awesomness"

Flags:
  ...

This would also allow the flags available to be specific to the provider being used rather than having to negotiate a long list where some are relevant, and others are not.

It also provides an outlet for provider specific information. In the above example, this includes access permissions needed for inletsctl needs to be successful

It would also remove 19 if checks each with a string value defined each time (maintenance overhead).

Steps to Reproduce (for bugs)

N/A

Context

I read through the code to know what each flag was being used for in the specific provider I was planning on using. Some of the flags are called out in the help, but not all.
"Do the commands with no provider called out mean it's required for all or none?"

eg: --region

"What happens if I leave one of the flags empty?"

eg: --remote-tcp

Also, there is no specific documentation for any one provider. In the demo gif, it's DigitalOcean, in the readme, there is an example for Scaleway, but again nothing inclusive

Your Environment

  • inlets version inlets --version
    Version: 0.3.9
  • Docker/Kubernetes version docker version / kubectl version:
    N/A
  • Operating System and version (e.g. Linux, Windows, MacOS):
    Ubuntu Linux
  • Link to your project or a code example to reproduce issue:
    N/A

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions