gcs

package
v0.0.0-...-185445a Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientWithCreds

func ClientWithCreds(ctx context.Context, creds ...string) (*storage.Client, error)

ClientWithCreds returns a storage client, optionally authenticated with the specified .json creds

func Upload

func Upload(ctx context.Context, client *storage.Client, path Path, buf []byte) error

Upload writes bytes to the specified Path

Types

type Path

type Path struct {
	// contains filtered or unexported fields
}

Path parses gs://bucket/obj urls

func (Path) Bucket

func (g Path) Bucket() string

Bucket returns bucket in gs://bucket/obj

func (Path) Object

func (g Path) Object() string

Object returns path/to/something in gs://bucket/path/to/something

func (Path) ResolveReference

func (g Path) ResolveReference(ref *url.URL) (*Path, error)

ResolveReference returns the path relative to the current path

func (*Path) Set

func (g *Path) Set(v string) error

Set updates value from a gs://bucket/obj string, validating errors.

func (*Path) SetURL

func (g *Path) SetURL(u *url.URL) error

SetURL updates value to the passed in gs://bucket/obj url

func (Path) String

func (g Path) String() string

String returns the gs://bucket/obj url

Jump to

Keyboard shortcuts

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