package
0.0.15-pre
Repository: https://github.com/jessesomerville/ephemeral-iam.git
Documentation: pkg.go.dev

# README

Plugin Command Flags

Plugins can use the flags that are used by native ephemeral-iam commands. To see an example of this, reference the Command with flags example.

Here are the available flags and their intended usage.

NameCLI FormatDescription
ComputeInstanceFlag--instance/-iThe name of a compute instance
ProjectFlag--project/-pThe GCP project. Inherits from the active gcloud config by default
PubSubTopicFlag--topic/-tThe name of a Pub/Sub topic
ReasonFlag--reason/-RThe reason for running a command. ephemeral-iam uses this with the WithRequestReason option when creating API clients
RegionFlag--region/-rThe GCP region. Inherits from the active gcloud config by default
ServiceAccountEmailFlag--service-account-email/-sThe email address of a service account
StorageBucketFlag--bucket/-bThe name of a Storage Bucket
YesFlag--yes/-yAssume 'yes' to all prompts
ZoneFlag--zone/-zThe GCP zone. Inherits from the active gcloud config by default

Adding custom flags to plugin commands

Custom flags can be added to plugin commands just like any other Cobra command as long as the name/shortform does not conflict with an existing flag.

Example:

var (
	Plugin = &eiamplugin.EphemeralIamPlugin{
		// Command defines the top-level command that will be added to eiam.
		// It is an instance of cobra.Command (https://pkg.go.dev/github.com/spf13/cobra#Command)
		Command: pluginFuncWithEiamFlags(),
		Name:    "Plugin with command flags",
		Desc:    "This is an example plugin with command flags",
		Version: "v0.0.1",
	}

    Verbose bool
)

func pluginFuncWithEiamFlags() *cobra.Command {
    cmd := &cobra.Command{
        Use: "example",
        RunE: func(cmd *cobra.command, args []string) error {
            if Verbose {
                fmt.Println("Verbose output enabled")
            }
            return nil
        }
    }

    cmd.Flags().BoolVarP(&Verbose, "verbose", "v", false, "Enable verbose output")

	return cmd
}

# Variables

Plugin is the top-level definition of the plugin.
No description provided by the author
No description provided by the author