KMS

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: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AwsxKmsConfigCmd = &cobra.Command{
	Use:   "getKmsConfig",
	Short: "getKmsConfig command gets kms configuration",
	Long:  `getKmsConfig command gets kms configuration`,

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

			instances, err := GetKmsInstanceByKeyId(keyId, clientAuth, nil)
			if err != nil {
				log.Println("error getting getKmsConfig by key id: ", err)
				return
			}
			fmt.Println(instances)

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

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

Functions

func GetKmsInstanceByKeyId

func GetKmsInstanceByKeyId(keyId string, clientAuth *model.Auth, client *kms.KMS) (*kms.DescribeKeyOutput, error)

func ListKmsInstances

func ListKmsInstances(clientAuth *model.Auth, client *kms.KMS) ([]*kms.DescribeKeyOutput, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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