Documentation
¶
Index ¶
- Constants
- func BucketToURL(bucket, key string) string
- func NormalizeProvider(p string, fallback string) string
- func NormalizeStoragePath(rawPath, bucket string) (string, error)
- func ParseBucketProvider(raw string) (string, error)
- func ParseS3URL(raw string) (bucket string, key string, ok bool)
- func ProviderFromScheme(scheme string) string
- func ProviderToScheme(p string) string
- func SchemeFromURL(raw string) string
- func TrimLeadingStoragePrefix(key, prefix string) string
- func ValidateBucketNameWithEndpoint(providerName, bucketName, endpoint string) error
- type ParsedLocation
Constants ¶
const ( S3Provider = "s3" GCSProvider = "gcs" AzureProvider = "azure" FileProvider = "file" S3Prefix = "s3://" GCSPrefix = "gs://" AzurePrefix = "azblob://" DRSPrefix = "drs://" )
Variables ¶
This section is empty.
Functions ¶
func BucketToURL ¶
BucketToURL converts a bucket and key to an s3:// URL.
func NormalizeProvider ¶
func NormalizeStoragePath ¶
func ParseBucketProvider ¶
ParseBucketProvider returns a canonical bucket provider name or an error for unsupported values.
func ParseS3URL ¶
ParseS3URL extracts bucket/key pairs from an s3:// URL.
func ProviderFromScheme ¶
func ProviderToScheme ¶
func SchemeFromURL ¶
SchemeFromURL extracts the scheme from a URL string.
func TrimLeadingStoragePrefix ¶ added in v0.4.2
TrimLeadingStoragePrefix removes a complete storage prefix from a key.
func ValidateBucketNameWithEndpoint ¶
ValidateBucketNameWithEndpoint validates a bucket/container name for the given provider and endpoint. S3-compatible backends with a custom endpoint may allow names that would be invalid for AWS virtual-hosted DNS names.
Types ¶
type ParsedLocation ¶ added in v0.4.2
type ParsedLocation struct {
URL string
Scheme string
Provider string
Bucket string
Key string
Path string
}
ParsedLocation is the syntax and provider information extracted from a storage location. Path retains the parsed URL path, while Key is the object key with its leading slash removed.
func ParseLocation ¶ added in v0.4.2
func ParseLocation(raw string) (ParsedLocation, error)
ParseLocation parses a storage URL or filesystem path once for callers that need both provider-neutral and provider-specific location fields.