S3

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AwsxS3ConfigCmd = &cobra.Command{
	Use:   "getS3Config",
	Short: "getS3Config command gets s3 configuration",
	Long:  `getS3Config command gets s3 configuration`,

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

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

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

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

Functions

func GetBucketRegionWithClient added in v1.0.2

func GetBucketRegionWithClient(svc s3iface.S3API, bucket string) (string, error)

Types

type S3Bucket

type S3Bucket struct {
	Bucket interface{} `json:"bucket"`
	Tags   interface{} `json:"tags"`
	Region interface{} `json:"region"`
}

func GetS3InstanceByBucketName

func GetS3InstanceByBucketName(bucketName string, clientAuth *model.Auth, client *s3.S3) (*S3Bucket, error)

func ListS3Instances

func ListS3Instances(clientAuth *model.Auth, client *s3.S3) ([]S3Bucket, error)

Jump to

Keyboard shortcuts

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