utils

package
v0.0.0-...-49be90b Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Copy

func Copy(srcBucketName, srcObjectName, dstBucketName, dstObjectName string) error

Copy copies the specified object into the specified target

func DeleteObjectWithPrefix

func DeleteObjectWithPrefix(bucketName, prefix string) error

DeleteObjectWithPrefix deletes any object in the specified bucket that starts with the specified prefix.

func GetAllObjectNamesWithPrefix

func GetAllObjectNamesWithPrefix(bucketName, prefix string) ([]string, error)

GetAllObjectNamesWithPrefix returns all object start with specified prefix under the specified bucket. If no prefix is supplied, it returns all objects under that bucket.

func GetAllPrefixesUnderBucketWithPrefix

func GetAllPrefixesUnderBucketWithPrefix(bucketName, prefix string) ([]string, error)

GetAllPrefixesUnderBucketWithPrefix returns all the prefixes (sub-folders at the bottom most layer) within the specified bucket.

func HTTPGet

func HTTPGet(url string) ([]byte, error)

HTTPGet returns the body of the HTTP GET response

func NameFromUniquified

func NameFromUniquified(uniquified string) (string, error)

NameFromUniquified extracts the original name from the uniquified string

func Read

func Read(bucketName, objectName string) ([]byte, error)

Read returns the content of the specified file under specified bucket

func StrSliceRemove

func StrSliceRemove(in []string, i int) []string

StrSliceRemove removes an element from a string slice at the specified index

func ToCompoundName

func ToCompoundName(delim string, tags ...string) string

ToCompoundName accepts list of tags and returns a compound name. It ignores any empty tag (i.e.: empty string) If the final element only contains one string, then that string is returned as the compound name

func ToTags

func ToTags(delim, compoundName string) []string

ToTags splits the compound name to a list of individual tags (names).

func Uniquify

func Uniquify(name string) (string, error)

Uniquify uniquifies a string by attaching a UUID to it

func WriteToBucket

func WriteToBucket(
	bucketName string,
	objectPrefix string,
	objectName string,
	data []byte,
) error

WriteToBucket writes the specified content to the specified bucket.

  • bucketName: Name of the bucket this fn writes to
  • objectPrefix: Prefix of the file. EX: folder1
  • objectName: Name for the file that this fn creates for writing out data.
  • data: Content of the file.

Types

This section is empty.

Jump to

Keyboard shortcuts

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