address

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
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

func BucketToURL(bucket, key string) string

BucketToURL converts a bucket and key to an s3:// URL.

func NormalizeProvider

func NormalizeProvider(p string, fallback string) string

func NormalizeStoragePath

func NormalizeStoragePath(rawPath, bucket string) (string, error)

func ParseBucketProvider

func ParseBucketProvider(raw string) (string, error)

ParseBucketProvider returns a canonical bucket provider name or an error for unsupported values.

func ParseS3URL

func ParseS3URL(raw string) (bucket string, key string, ok bool)

ParseS3URL extracts bucket/key pairs from an s3:// URL.

func ProviderFromScheme

func ProviderFromScheme(scheme string) string

func ProviderToScheme

func ProviderToScheme(p string) string

func SchemeFromURL

func SchemeFromURL(raw string) string

SchemeFromURL extracts the scheme from a URL string.

func TrimLeadingStoragePrefix added in v0.4.2

func TrimLeadingStoragePrefix(key, prefix string) string

TrimLeadingStoragePrefix removes a complete storage prefix from a key.

func ValidateBucketNameWithEndpoint

func ValidateBucketNameWithEndpoint(providerName, bucketName, endpoint string) error

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.

Jump to

Keyboard shortcuts

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