VPC

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AwsxVpcConfigCmd = &cobra.Command{
	Use:   "getVpcConfig",
	Short: "getVpcConfig command gets vpc configuration",
	Long:  `getVpcConfig command gets vpc configuration`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("executing getVpcConfig 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 {
			instanceId, _ := cmd.Flags().GetString("instanceId")
			if instanceId == "" {
				log.Printf("vpc id missing")
				err := cmd.Help()
				if err != nil {
					return
				}
				return
			}

			instances, err := GetVpcInstanceById(instanceId, clientAuth, nil)
			if err != nil {
				log.Println("error getting getVpcConfig by bucket name: ", err)
				return
			}
			fmt.Println(instances)

		}
	},
}
View Source
var AwsxVpcListCmd = &cobra.Command{
	Use:   "getVpcList",
	Short: "getVpcList command gets list of vpc instances of an aws account",
	Long:  `getVpcList command gets list of vpc instances of an aws account`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("executing getVpcList 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 := ListVpcInstances(clientAuth, nil)
			if err != nil {
				log.Println("error getting getVpcList: ", err)
				return
			}
			fmt.Println(resp)
		}
	},
}

Functions

This section is empty.

Types

type VpcOutput added in v1.0.2

type VpcOutput struct {
	VPC    interface{} `json:"vpc"`
	Region interface{} `json:"region"`
}

func GetVpcInstanceById

func GetVpcInstanceById(instanceId string, clientAuth *model.Auth, client *ec2.EC2) (*VpcOutput, error)

func ListVpcInstances

func ListVpcInstances(clientAuth *model.Auth, client *ec2.EC2) ([]VpcOutput, error)

Jump to

Keyboard shortcuts

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