Documentation ¶
Overview ¶
********************************************************************************** The MIT License (MIT)
Copyright (c) 2022 Sean Beard ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **********************************************************************************
Index ¶
- func CreateNewBucket(connect aws.ConnectConfig, bucket string) error
- func DoesBucketExist(connect aws.ConnectConfig, bucketName string) bool
- func GetDownloadResponseReader(connect aws.ConnectConfig, bucket, path string) (io.Reader, error)
- func GetFileBytes(connect aws.ConnectConfig, bucket, key string) ([]byte, error)
- func UploadObject(connect aws.ConnectConfig, reader io.Reader, bucket, key, storageClass string, ...) (string, error)
- type BucketContents
- type Configuration
- type ListObjectContents
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateNewBucket ¶
func CreateNewBucket(connect aws.ConnectConfig, bucket string) error
CreateNewBucket creates a new bucket in the specified region with the specified name
func DoesBucketExist ¶
func DoesBucketExist(connect aws.ConnectConfig, bucketName string) bool
DoesBucketExist verfies is the passed in bucket exists within the connect configuration. True is returned if the bucket exists
func GetDownloadResponseReader ¶
GetDownloadResponseReader uses the passed in parameters to download the object and returns a reader to read the object from, otherwise an error is returned
func GetFileBytes ¶
func GetFileBytes(connect aws.ConnectConfig, bucket, key string) ([]byte, error)
GetFileBytes downloads an object from S3 and returns the byte slice representing the file, otherwise an error is returned
Types ¶
type BucketContents ¶
BucketContents holds the returned parameters for a single S3 bucket that resulted from executing a list buckets call
func GetBuckets ¶
func GetBuckets(connect aws.ConnectConfig) ([]BucketContents, error)
GetBuckets returns a slice of Buckets - maybe?
type Configuration ¶
type Configuration struct { Connect aws.ConnectConfig `json:"connect" yaml:"connect" mapstructure:"connect"` Bucket string `json:"bucket" yaml:"bucket" mapstructure:"bucket"` Path string `json:"path" yaml:"path" mapstructure:"path"` Prefix string `json:"prefix" yaml:"prefix" mapstructure:"prefix"` StorageClass aws.S3StorageClassType `json:"storageclass" yaml:"storageclass" ,apstructure:"storageclass"` }
Configuration holds all of the required parameters to connect o the S3 bucket. It is assumed that the AWS credentials have already been configured on the host. By executing the 'aws configure' or otherwise part of the credential verification chain, such as environment variables
func (*Configuration) MarshalJSON ¶
func (s3Config *Configuration) MarshalJSON() ([]byte, error)
MarshalJSON is a method implemented allowing serialization of the S3StorageClass and logLevel values from an enumerated type to a string
func (*Configuration) UnmarshalJSON ¶
func (s3Config *Configuration) UnmarshalJSON(data []byte) error
UnmarshalJSON is a method implemented allowing de-serialization of the S3StorageClass value from a string to the enumerated type
type ListObjectContents ¶
type ListObjectContents struct { Key string Path string ObjectName string LastModified string Size int64 }
ListObjectContents holds the returned parameters for a single S3 object that resulted from executing a list object call against a S3 bucket
func GetBucketKeys ¶
func GetBucketKeys(connect aws.ConnectConfig, bucket, path string) ([]ListObjectContents, error)
GetBucketKeys returns a slice of ListObjectContents as a result of executing a ListObjects call against the specified bucket, otherwise an error is returned