cmd

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Copyright © 2023 Manoj Sharma manoj.sharma@synectiks.com

Index

Constants

This section is empty.

Variables

View Source
var AppconfigCmd = &cobra.Command{
	Use:   "appconfig",
	Short: "aws appconfig details",
	Long:  `aws appconfig details`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Calling appconfig summary api")
		vaultUrl, _ := cmd.Flags().GetString("vaultUrl")
		accountNo, _ := cmd.Flags().GetString("ac")
		region, _ := cmd.Flags().GetString("region")
		acKey, _ := cmd.Flags().GetString("accessKey")
		secKey, _ := cmd.Flags().GetString("secretKey")
		crossAccountRoleArn, _ := cmd.Flags().GetString("crossAccountRoleArn")

		if accountNo == "" && region == "" && acKey == "" && secKey == "" && crossAccountRoleArn == "" {
			fmt.Println("AWS credentials like account number or accesskey/secretkey/region/crossAccountRoleArn not provided")
			return
		}

		if vaultUrl != "" {
			if accountNo == "" {
				fmt.Println("AWS account number not provided")
				return
			}
			fmt.Println("Account number provided. Calling API to get account details")

			data, err := vault.GetAccountDetails(vaultUrl, accountNo)
			if err != nil {
				fmt.Println("Error while calling the account details api. Error ", err)
				return
			}
			if data.AccessKey == "" {
				log.Println("Account credentials not found.")
				return
			}
			getConfigResources(data.Region, data.CrossAccountRoleArn, data.AccessKey, data.SecretKey)
		} else {
			if region == "" || acKey == "" || secKey == "" || crossAccountRoleArn == "" {
				fmt.Println("AWS credentials like accesskey/secretkey/region/crossAccountRoleArn not provided")
				return
			}
			fmt.Println("Getting aws appconfig summary")
			getConfigResources(region, crossAccountRoleArn, acKey, secKey)
		}

	},
}

AppconfigCmd represents the base command when called without any subcommands

Functions

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func GetConfig added in v1.0.1

func GetConfig(region string, crossAccountRoleArn string, accessKey string, secretKey string) *configservice.GetDiscoveredResourceCountsOutput

Types

This section is empty.

Jump to

Keyboard shortcuts

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