cmd

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package cmd implements the CobraCLI commands for the methodaws CLI. Subcommands for the CLI should all live within this package. Logic should be delegated to internal packages and functions to keep the CLI commands clean and focused on CLI I/O.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MethodAws

type MethodAws struct {
	RootFlags    config.RootFlags
	OutputConfig writer.OutputConfig
	OutputSignal signal.Signal
	AwsConfig    *aws.Config
	RootCmd      *cobra.Command
	// contains filtered or unexported fields
}

MethodAws is the main struct that holds the root command and all subcommands that are used throughout execution of the CLI. It is also responsible for holding the AWS configuration, Output configuration, and Output signal for use by subcommands. The output signal is used to write the output of the command to the desired output format after the execution of the invoked commands Run function.

func NewMethodAws

func NewMethodAws(version string) *MethodAws

NewMethodAws returns a new MethodAws struct with the provided version string. The MethodAws struct is used to initialize the root command and all subcommands that are used throughout execution of the CLI. We pass the version command in here from the main.go file, where we set the version string during the build process.

func (*MethodAws) InitCurrentInstanceCommand

func (a *MethodAws) InitCurrentInstanceCommand()

InitCurrentInstanceCommand initializes the `methodaws current` subcommand that deals with evaluating the current properties and capabilities of an AWS instance.

func (*MethodAws) InitEc2Command

func (a *MethodAws) InitEc2Command()

InitEc2Command initializes the `methodaws ec2` subcommand that deals with enumerating EC2 instances and their related resources.

func (*MethodAws) InitEksCommand

func (a *MethodAws) InitEksCommand()

InitEksCommand initializes the `methodaws eks` subcommand that deals with enumerating EKS instances and their related resources.

func (*MethodAws) InitIamCommand

func (a *MethodAws) InitIamCommand()

InitIamCommand initializes the `methodaws iam` subcommand that deals with enumerating IAM roles, attached policies, inline policies and assume role policies within the AWS account.

func (*MethodAws) InitLoadBalancerCommand added in v0.0.5

func (a *MethodAws) InitLoadBalancerCommand()

func (*MethodAws) InitRdsCommand

func (a *MethodAws) InitRdsCommand()

InitRdsCommand initializes the `methodaws rds` subcommand that deals with enumerating RDS instances in the AWS account.

func (*MethodAws) InitRootCommand

func (a *MethodAws) InitRootCommand()

InitRootCommand initializes the root command for the methodaws CLI. This command is used to set the global flags that are used by all subcommands, such as the region, output format, and output file. It also initializes the version command that prints the version of the CLI. Critically, this sets the PersistentPreRunE and PersistentPostRunE functions that are inherited by all subcommands. The PersistentPreRunE function is used to validate the region flag and set the AWS configuration. The PersistentPostRunE function is used to write the output of the command to the desired output format after the execution of the invoked command's Run function.

func (*MethodAws) InitRoute53Command

func (a *MethodAws) InitRoute53Command()

InitRoute53Command initializes the `methodaws route53` subcommand that deals with enumerating Route53 resources.

func (*MethodAws) InitS3Command

func (a *MethodAws) InitS3Command()

InitS3Command initializes the `methodaws s3` subcommand that deals with enumerating S3 buckets and their related resources.

func (*MethodAws) InitSecurityGroupCommand

func (a *MethodAws) InitSecurityGroupCommand()

InitSecurityGroupCommand initializes the `methodaws securitygroup` subcommand that deals with enumerating security groups and their related resources.

func (*MethodAws) InitStsCommand

func (a *MethodAws) InitStsCommand()

InitStsCommand initializes the `methodaws ec2` subcommand that is responsible for interacting with the AWS STS service.

func (*MethodAws) InitVPCCommand

func (a *MethodAws) InitVPCCommand()

InitVPCCommand initializes the `methodaws vpc` subcommand that deals with enumerating VPCs and related resources in the AWS account.

Jump to

Keyboard shortcuts

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