mirror of
https://github.com/grafana/grafana.git
synced 2024-11-29 20:24:18 -06:00
b287047052
* WIP * Set public_suffix to a pre Ruby 2.6 version * we don't need to install python * Stretch->Buster * Bump versions in lib.star * Manually update linter Sort of messy, but the .mod-file need to contain all dependencies that use 1.16+ features, otherwise they're assumed to be compiled with -lang=go1.16 and cannot access generics et al. Bingo doesn't seem to understand that, but it's possible to manually update things to get Bingo happy. * undo reformatting * Various lint improvements * More from the linter * goimports -w ./pkg/ * Disable gocritic * Add/modify linter exceptions * lint + flatten nested list Go 1.19 doesn't support nested lists, and there wasn't an obvious workaround. https://go.dev/doc/comment#lists
46 lines
1.3 KiB
Go
46 lines
1.3 KiB
Go
// Package gcsifaces provides interfaces for Google Cloud Storage.
|
|
//
|
|
//go:generate mockgen -source $GOFILE -destination ../../mocks/mock_gcsifaces/mocks.go StorageClient
|
|
package gcsifaces
|
|
|
|
import (
|
|
"context"
|
|
"io"
|
|
|
|
"cloud.google.com/go/storage"
|
|
"golang.org/x/oauth2/google"
|
|
"golang.org/x/oauth2/jwt"
|
|
)
|
|
|
|
// StorageClient represents a GCS client.
|
|
type StorageClient interface {
|
|
// Bucket gets a StorageBucket.
|
|
Bucket(name string) StorageBucket
|
|
// FindDefaultCredentials finds default Google credentials.
|
|
FindDefaultCredentials(ctx context.Context, scope string) (*google.Credentials, error)
|
|
// JWTConfigFromJSON gets JWT config from a JSON document.
|
|
JWTConfigFromJSON(keyJSON []byte) (*jwt.Config, error)
|
|
// SignedURL returns a signed URL for the specified object.
|
|
SignedURL(bucket, name string, opts *storage.SignedURLOptions) (string, error)
|
|
}
|
|
|
|
// StorageBucket represents a GCS bucket.
|
|
type StorageBucket interface {
|
|
// Object returns a StorageObject for a key.
|
|
Object(key string) StorageObject
|
|
}
|
|
|
|
// StorageObject represents a GCS object.
|
|
type StorageObject interface {
|
|
// NewWriter returns a new StorageWriter.
|
|
NewWriter(ctx context.Context) StorageWriter
|
|
}
|
|
|
|
// StorageWriter represents a GCS writer.
|
|
type StorageWriter interface {
|
|
io.WriteCloser
|
|
|
|
// SetACL sets a pre-defined ACL.
|
|
SetACL(acl string)
|
|
}
|