cloud

package
v0.0.0-...-3e9387d Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Copyright © 2023 Daniel Chalef

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Glob

func Glob(ctx context.Context, uri, pattern string) ([]string, error)

Glob enumerates cloud storage objects/file names at a URI and returns a list of objects/ filename URIs that match the given pattern. Context can be used to cancel any cloud operations. Google Cloud Storage, AWS S3, and local filesystem URIs are supported. Use the correct URI scheme for the storage provider (gs://, s3://) or no scheme for local filesystem. The pattern is a glob pattern, not a regular expression.

func IsCloudURI

func IsCloudURI(uri string) bool

IsCloudURI returns true if the URI is a cloud storage URI (gs:// or s3://). It does so by attempting to parse the URI and checking if the scheme is non-empty.

func JoinURI

func JoinURI(left, right string) string

JoinURI joins two URI parts together, removing any trailing slashes from the left part and any leading slashes from the right part.

func NewReader

func NewReader(ctx context.Context, uri string) (io.ReadCloser, error)

NewReader creates a new io.ReadCloser for the given URI. Context can be used to cancel any operations. Google Cloud Storage, AWS S3, and local filesystem URIs are supported. Use the correct URI scheme for the storage provider (gs://, s3://) or no scheme for local filesystem. The URI must be a file, not a directory.

func NewWriter

func NewWriter(ctx context.Context, uri string) (io.WriteCloser, error)

NewWriter creates a new io.WriteCloser for the given URI. Context can be used to cancel any operations. Google Cloud Storage, AWS S3, and local filesystem URIs are supported. Use the correct URI scheme for the storage provider (gs://, s3://) or no scheme for local filesystem.

func OpenBucket

func OpenBucket(ctx context.Context, uri string) (*blob.Bucket, error)

OpenBucket opens a blob storage bucket at the URI. Context can be used to cancel any operations. Google CDK is used to support both AWS S3 and Google Cloud Storage. Use the correct URI scheme to specify the storage provider (gs:// or s3://).

func ParseBlobURI

func ParseBlobURI(uri string) (scheme, bucket, key string, err error)

ParseBlobURI parses a URI into its scheme, bucket, and key components.

Types

This section is empty.

Jump to

Keyboard shortcuts

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