Documentation ¶
Index ¶
- Constants
- func GetBucket(ctx context.Context, s3Credentials []byte, path string) (*blob.Bucket, error)
- func HasStorageProviderPrefix(path string) bool
- func ParseStoragePath(storagePath string) (storageProvider, bucket, relativePath string, err error)
- func StoragePath(bucket, path string) (string, error)
Constants ¶
const ( S3 = "s3" GS = "gs" // TODO(danilo-gemoli): complete the implementation since at this time only opener.Writer() // is supported File = "file" )
Variables ¶
This section is empty.
Functions ¶
func GetBucket ¶
GetBucket opens and returns a gocloud blob.Bucket based on credentials and a path. The path is used to discover which storageProvider should be used.
If the storageProvider file is detected, we don't need any credentials and just open a file bucket If no credentials are given, we just fall back to blob.OpenBucket which tries to auto discover credentials e.g. via environment variables. For more details, see: https://gocloud.dev/howto/blob/
If we specify credentials and an 3:// path is used, credentials must be given in one of the following formats:
- AWS S3 (s3://): { "region": "us-east-1", "s3_force_path_style": true, "access_key": "access_key", "secret_key": "secret_key" }
- S3-compatible service, e.g. self-hosted Minio (s3://): { "region": "minio", "endpoint": "https://minio-hl-svc.minio-operator-ns:9000", "s3_force_path_style": true, "access_key": "access_key", "secret_key": "secret_key" }
func HasStorageProviderPrefix ¶
HasStorageProviderPrefix returns true if the given string starts with any of the known storageProviders and a slash, e.g. * gs/kubernetes-jenkins returns true * kubernetes-jenkins returns false
func ParseStoragePath ¶
ParseStoragePath parses storagePath and returns the storageProvider, bucket and relativePath For example gs://prow-artifacts/test.log results in (gs, prow-artifacts, test.log) Currently detected storageProviders are GS, S3 and file. Paths with a leading / instead of a storageProvider prefix are treated as file paths for backwards compatibility reasons. File paths are split into a directory and a file. Directory is returned as bucket, file is returned. as relativePath. For all other paths the first part is treated as storageProvider prefix, the second segment as bucket and everything after the bucket as relativePath.
func StoragePath ¶
StoragePath is the reverse of ParseStoragePath.
Types ¶
This section is empty.