list

package
v0.77.0-dev-2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 15, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &cobra.Command{
	Use:   "list",
	Short: "List all resources in DigitalOcean account",
	Long: `List all resources in DigitalOcean account

Currently, all resources means:

- Kubernetes Clusters
- Droplets
- Volumes
- LoadBalancers
- Domains
- Keys (SSH)
`,
	Args: cobra.NoArgs,
	Run: func(c *cobra.Command, args []string) {
		s := config.ReadSecrets()
		if FlagAllAccounts {
			for _, do := range s.DigitalOcean {
				fmt.Printf("===== Account: %s =====\n", do.Alias)
				digitalocean_utils.ListAll(do.Token)
				fmt.Println("")
			}
		} else {
			var do *config.SluSecretsDigitalOcean

			if FlagAlias == "" {

				do = config_utils.GetCurrentDigitalOceanAccount()
			} else {

				do = config_utils.GetDigitalOceanAccountByAlias(FlagAlias)
			}

			if do == nil {
				log.Fatal("No credentials or context found")
			}

			fmt.Printf("===== Account: %s =====\n", do.Alias)
			digitalocean_utils.ListAll(do.Token)
			fmt.Println("")
		}
	},
}
View Source
var FlagAlias string
View Source
var FlagAllAccounts bool

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL