gcs

package module
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: MIT Imports: 21 Imported by: 4

README

SMARTY DISCLAIMER: Subject to the terms of the associated license agreement, this software is freely available for your use. This software is FREE, AS IN PUPPIES, and is a gift. Enjoy your new responsibility. This means that while we may consider enhancement requests, we may or may not choose to entertain requests at our sole and absolute discretion.

Documentation

Index

Constants

View Source
const (
	GET  = "GET"
	PUT  = "PUT"
	HEAD = "HEAD"
)

Variables

View Source
var (
	ErrMalformedPrivateKey   = errors.New("malformed private key")
	ErrUnsupportedPrivateKey = errors.New("unsupported private key type")
	ErrMalformedJSON         = errors.New("malformed JSON")
)
View Source
var (
	ErrHTTPMethodMissing      = errors.New("missing HTTP method")
	ErrHTTPMethodUnrecognized = errors.New("unrecognized HTTP method")
	ErrBucketMissing          = errors.New("bucket is required")
	ErrResourceMissing        = errors.New("object resource key is required")
	ErrContentMissing         = errors.New("content payload is required")
)
View Source
var CredentialOptions credentialSingleton
View Source
var ErrCredentialsFailure = errors.New("unable to discover credentials")
View Source
var ErrFailedTokenRequest = errors.New("unable to resolve access token")

Functions

func NewRequest

func NewRequest(method string, options ...Option) (*http.Request, error)

Types

type AccessToken

type AccessToken struct {
	Value      string `json:"access_token"`
	Expiration uint16 `json:"expires_in"`
	Scope      string `json:"scope"`
	Type       string `json:"token_type"`
	ID         string `json:"id_token"`
}

type ClientIdentity

type ClientIdentity struct {
	ID           string `json:"client_id"`
	Secret       string `json:"client_secret"`
	RefreshToken string `json:"refresh_token"`
}

type Credentials

type Credentials struct {
	BearerToken string

	AccessID   string
	PrivateKey PrivateKey
}

func NewCredentials

func NewCredentials(accessID string, privateKey []byte) (Credentials, error)

func ParseCredentialsFromJSON

func ParseCredentialsFromJSON(raw []byte, options ...ResolverOption) (Credentials, error)

type CredentialsReader

type CredentialsReader interface {
	Read(context.Context, string) (Credentials, error)
}

func NewCredentialsReader

func NewCredentialsReader(options ...credentialOption) CredentialsReader

type Option

type Option func(*model)

func GetWithETag

func GetWithETag(value string) Option

func PutWithContent

func PutWithContent(value io.Reader) Option

func PutWithContentBytes

func PutWithContentBytes(value []byte) Option

func PutWithContentEncoding

func PutWithContentEncoding(value string) Option

func PutWithContentLength

func PutWithContentLength(value int64) Option

func PutWithContentMD5

func PutWithContentMD5(value []byte) Option

func PutWithContentString

func PutWithContentString(value string) Option

func PutWithContentType

func PutWithContentType(value string) Option

func PutWithGeneration

func PutWithGeneration(value string) Option

func WithBearerToken

func WithBearerToken(value string) Option

Deprecated

func WithBucket

func WithBucket(value string) Option

func WithCompositeOption

func WithCompositeOption(options ...Option) Option

func WithConditionalOption

func WithConditionalOption(option Option, condition bool) Option

func WithContext

func WithContext(value context.Context) Option

func WithCredentials

func WithCredentials(credentials Credentials) Option

func WithEndpoint

func WithEndpoint(scheme, host string) Option

func WithExpiration

func WithExpiration(value time.Time) Option

Deprecated

func WithResource

func WithResource(value string) Option

func WithSignedExpiration

func WithSignedExpiration(value time.Time) Option

type PrivateKey

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

func (*PrivateKey) Sign

func (this *PrivateKey) Sign(raw []byte) ([]byte, error)

type ResolverOption

type ResolverOption func(this *defaultResolver)

func WithResolverClient

func WithResolverClient(value httpClient) ResolverOption

func WithResolverContext

func WithResolverContext(value context.Context) ResolverOption

type TokenResolver

type TokenResolver interface {
	AccessToken(ClientIdentity) (AccessToken, error)
}

Jump to

Keyboard shortcuts

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