bigquery

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DatasetRoleReader = "READER"
	DatasetRoleWriter = "WRITER"
	DatasetRoleOwner  = "OWNER"
)
View Source
const (
	// ResourceTypeDataset is the resource type name for BigQuery dataset
	ResourceTypeDataset = "dataset"
	// ResourceTypeTable is the resource type name for BigQuery table
	ResourceTypeTable = "table"
)

Variables

View Source
var (
	// ErrInvalidCredentials is the error value for invalid credentials
	ErrInvalidCredentials = errors.New("invalid credentials type")
	// ErrInvalidPermissionConfig is the error value for invalid permission config
	ErrInvalidPermissionConfig = errors.New("invalid permission config type")
	// ErrUnableToEncryptNilCredentials is the error value if the to be encrypted credentials is nil
	ErrUnableToEncryptNilCredentials = errors.New("unable to encrypt nil credentials")
	// ErrUnableToDecryptNilCredentials is the error value if the to be decrypted credentials is nil
	ErrUnableToDecryptNilCredentials = errors.New("unable to decrypt nil credentials")
	// ErrInvalidCredentialsType is the error value if the credentials value can't be casted into the bigquery.Credentials type
	ErrInvalidCredentialsType  = errors.New("invalid credentials type")
	ErrInvalidRole             = errors.New("invalid role")
	ErrInvalidResourceType     = errors.New("invalid resource type")
	ErrInvalidTableURN         = errors.New("table URN is invalid")
	ErrPermissionAlreadyExists = errors.New("permission already exists")
	ErrPermissionNotFound      = errors.New("permission not found")
	ErrNilProviderConfig       = errors.New("provider config can't be nil")
	ErrNilAppeal               = errors.New("appeal can't be nil")
	ErrNilResource             = errors.New("designated resource can't be nil")
	ErrProviderTypeMismatch    = errors.New("provider type in the config and in the appeal don't match")
	ErrProviderURNMismatch     = errors.New("provider urn in the config and in the appeal don't match")
)

Functions

func NewDefaultBigQueryClient added in v0.1.1

func NewDefaultBigQueryClient(projectID string) (*bigQueryClient, error)

func NewDefaultCloudResourceManagerClient added in v0.2.0

func NewDefaultCloudResourceManagerClient() (*iamClient, error)

Types

type Config

type Config struct {
	ProviderConfig *domain.ProviderConfig
	// contains filtered or unexported fields
}

Config for bigquery provider

func NewConfig

func NewConfig(pc *domain.ProviderConfig, crypto domain.Crypto) *Config

NewConfig returns bigquery config struct

func (*Config) EncryptCredentials

func (c *Config) EncryptCredentials() error

EncryptCredentials encrypts the bigquery credentials config

func (*Config) ParseAndValidate

func (c *Config) ParseAndValidate() error

ParseAndValidate validates bigquery config within provider config and make the interface{} config value castable into the expected bigquery config value

type Credentials

type Credentials string

Credentials is the authentication configuration used by the bigquery client

func (*Credentials) Decrypt

func (c *Credentials) Decrypt(decryptor domain.Decryptor) error

Decrypt decrypts BigQuery credentials

func (*Credentials) Encrypt

func (c *Credentials) Encrypt(encryptor domain.Encryptor) error

Encrypt encrypts BigQuery credentials

type Dataset

type Dataset struct {
	ProjectID string
	DatasetID string
}

Dataset is a reference to a BigQuery dataset

type PermissionConfig

type PermissionConfig struct {
	Name   string `json:"name" mapstructure:"name" validate:"required"`
	Target string `json:"target,omitempty" mapstructure:"target"`
}

PermissionConfig is for mapping role into bigquery permissions

type Provider

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

Provider for bigquery

func NewProvider

func NewProvider(typeName string, crypto domain.Crypto) *Provider

NewProvider returns bigquery provider

func (*Provider) CreateConfig

func (p *Provider) CreateConfig(pc *domain.ProviderConfig) error

CreateConfig validates provider config

func (*Provider) GetResources

func (p *Provider) GetResources(pc *domain.ProviderConfig) ([]*domain.Resource, error)

GetResources returns BigQuery dataset and table resources

func (*Provider) GetType

func (p *Provider) GetType() string

GetType returns the provider type

func (*Provider) GrantAccess

func (p *Provider) GrantAccess(pc *domain.ProviderConfig, a *domain.Appeal) error

func (*Provider) RevokeAccess

func (p *Provider) RevokeAccess(pc *domain.ProviderConfig, a *domain.Appeal) error

type Table

type Table struct {
	ProjectID string
	DatasetID string
	TableID   string
}

Table is a reference to a BigQuery table

Jump to

Keyboard shortcuts

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