copy_to_cloud

package
v0.81.0-dev-3 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &cobra.Command{
	Use:     "copy-to-cloud <local source file> <cloud alias>",
	Short:   "Copy local file to temporary cloud storage",
	Aliases: []string{"ctc"},
	Args:    cobra.ExactArgs(2),
	Run: func(c *cobra.Command, args []string) {
		sourceFile := args[0]
		targetAlias := args[1]

		f, err := os.Open(sourceFile)
		if err != nil {
			log.Fatalln(err)
		}

		accessKey, secretKey, region,
			endpoint, bucketName, err := vault_s3_utils.GetS3Secrets("secret/data/slu/cloud-copy")
		if err != nil {
			log.Fatalln(err)
		}

		err = s3_utils.Upload(
			accessKey,
			secretKey,
			region,
			endpoint,
			bucketName,
			targetAlias,
			f,
		)
		if err != nil {
			log.Fatalln(err)
		}
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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