aws

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DownloadFileFromS3

func DownloadFileFromS3(ctx context.Context, downloadURL, filePath string) error

DownloadFileFromS3 takes an S3 URL and a filePath, downloads the file from s3 and stores it in the filePath.

Types

type S3URL

type S3URL struct {
	IsPathStyle bool
	EndPoint    string
	Bucket      string
	Key         string
	Region      string
}

S3URL holds interesting pieces after parsing a s3 URL

func ParseAmazonS3URL

func ParseAmazonS3URL(s3URL *url.URL) (S3URL, error)

ParseAmazonS3URL parses an HTTP/HTTPS URL for an S3 resource and returns an S3URL object.

S3 URLs come in two flavors: virtual hosted-style URLs and path-style URLs. Virtual hosted-style URLs have the bucket name as the first component of the hostname, e.g.

https://mybucket.s3.us-east-1.amazonaws.com/a/b/c

Path-style URLs have the bucket name as the first component of the path, e.g.

https://s3.us-east-1.amazonaws.com/mybucket/a/b/c

func (S3URL) DownloadFile

func (u S3URL) DownloadFile(ctx context.Context, w io.WriterAt) error

DownloadFile downloads a file from s3 based on the key and writes it into WriteAt.

Jump to

Keyboard shortcuts

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