Documentation ¶
Index ¶
- Variables
- func GetEc2InstanceById(instanceId string, clientAuth *model.Auth, client *ec2.EC2) (*ec2.DescribeInstancesOutput, error)
- func GetEc2InstanceByTagName(tagName string, clientAuth *model.Auth, ec2Client *ec2.EC2) (*ec2.DescribeInstancesOutput, error)
- func ListEc2Instances(clientAuth *model.Auth, client *ec2.EC2) (*ec2.DescribeInstancesOutput, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var AwsxEc2ConfigCmd = &cobra.Command{ Use: "getEc2Config", Short: "getEc2Config command gets ec2 configuration", Long: `getEc2Config command gets ec2 configuration`, Run: func(cmd *cobra.Command, args []string) { fmt.Println("executing getEc2Config command") var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd) if err != nil { log.Printf("error during authentication: %v\n", err) err := cmd.Help() if err != nil { return } return } if authFlag { tagName, _ := cmd.Flags().GetString("tagName") instanceId, _ := cmd.Flags().GetString("instanceId") if tagName == "" && instanceId == "" { log.Printf("ec2 instance-id or tag missing") err := cmd.Help() if err != nil { return } return } if tagName != "" { instances, err := GetEc2InstanceByTagName(tagName, clientAuth, nil) if err != nil { log.Println("error getting getEc2Config by tag name: ", err) return } fmt.Println(instances) } if instanceId != "" { instances, err := GetEc2InstanceById(instanceId, clientAuth, nil) if err != nil { log.Println("error getting getEc2Config by instance id: ", err) return } fmt.Println(instances) } } }, }
View Source
var AwsxEc2ListCmd = &cobra.Command{ Use: "getEc2List", Short: "getEc2List command gets list of ec2 instances of an aws account", Long: `getEc2List command gets list of ec2 instances of an aws account`, Run: func(cmd *cobra.Command, args []string) { fmt.Println("executing getEc2List command") var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd) if err != nil { log.Printf("error during authentication: %v\n", err) err := cmd.Help() if err != nil { return } return } if authFlag { resp, err := ListEc2Instances(clientAuth, nil) if err != nil { log.Println("error getting getEc2List: ", err) return } fmt.Println(resp) } }, }
Functions ¶
func GetEc2InstanceById ¶
func GetEc2InstanceByTagName ¶
func ListEc2Instances ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.