zeroward

package
v1.0.47 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const DEKKeyMetadataKey = "dek-key" // Metadata key for the DEK key

Variables

View Source
var ObjectsCmd = &cobra.Command{
	Use:   "objects",
	Short: "List All Objects(Files/Images/Docs) stored on the Cloud Storage",
	Long:  `This command is used to list all your Objects (Files/Images/Docs) that are stored for you on the cloud storage.`,
	Run: func(cmd *cobra.Command, args []string) {

		accessKeyID, _ := cmd.Flags().GetString("accessKeyID")

		secretAccessKey, _ := cmd.Flags().GetString("secretAccessKey")

		bcktName, _ := cmd.Flags().GetString("bucketName")

		KeyAccessDefined := common.IsNotKeyAccessDefined()
		region := viper.GetString("Region")

		if KeyAccessDefined {
			if accessKeyID == "" || secretAccessKey == "" || bcktName == "" {
				fmt.Println("Error: Access Key ID and Secret Access Key are required as for your login and password of the Cloud Storage, also the bucket name is required!")
				return
			}

			common.StoreCredentials(accessKeyID, secretAccessKey, region)

			err := listingobjects.ListObjects(region, accessKeyID, secretAccessKey, bcktName)

			if err != nil {
				fmt.Println("Error:", err)
				return
			}

		}
		if bcktName == "" {
			fmt.Println("Error:  the bucket name is required!")
			return
		}
		if !KeyAccessDefined {
			if bcktName != "" {
				err := listingobjects.ListObjects(region, viper.GetString("AWSAccessKeyID"), viper.GetString("AWSSecretAccessKey"), bcktName)
				if err != nil {
					fmt.Println("Error:", err)
					return
				}
			}
		}
	},
}

Functions

func CreateConfigFile

func CreateConfigFile() error

func Execute

func Execute()

Types

type Config

type Config struct {
	KEKkey             string `json:"kekkey"`
	Region             string `json:"region"`
	AWSAccessKeyID     string `json:"aws_access_key_id"`
	AWSSecretAccessKey string `json:"aws_secret_access_key"`
}

Jump to

Keyboard shortcuts

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