dataplex

package
v0.8.2-alpha.5 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AccountTypeUser           = "user"
	AccountTypeServiceAccount = "serviceAccount"
)
View Source
const (
	ResourceTypeTag               = "tag"
	FineGrainReaderPermission     = "roles/datacatalog.categoryFineGrainedReader"
	FineGrainReaderPermissionRole = "fineGrainReader"
	PageSize                      = 100
)

Variables

View Source
var (

	// 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")
	ErrUnableToDecryptCredentials    = errors.New("unable to decrypt 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")
	ErrInvalidResourceFormatType = errors.New("invalid resource-name format, it should be projects/{project_id}/locations/{location}")
	ErrInvalidRole               = errors.New("invalid role")
	ErrInvalidResourceType       = errors.New("invalid resource type")

	ErrPermissionAlreadyExists = errors.New("permission already exists")
	ErrPermissionNotFound      = errors.New("permission not found")
	ErrNilProviderConfig       = errors.New("provider config 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")
	ErrInvalidDatasetPermission = errors.New("provided permission is not supported for dataset resource")
)

Functions

This section is empty.

Types

type Config

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

Config for policy_tag provider

func NewConfig

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

NewConfig returns policy_tag config struct

func (*Config) EncryptCredentials

func (c *Config) EncryptCredentials() error

EncryptCredentials encrypts the policy_tag credentials config

func (*Config) ParseAndValidate

func (c *Config) ParseAndValidate() error

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

type Credentials

type Credentials struct {
	ServiceAccountKey string `mapstructure:"service_account_key" json:"service_account_key" validate:"required,base64"`
	ResourceName      string `mapstructure:"resource_name" json:"resource_name" validate:"startswith=projects/"`
}

Credentials is the authentication configuration used by the policy_tag client

func (*Credentials) Decrypt

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

Decrypt decrypts GCP credentials

func (*Credentials) Encrypt

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

Encrypt encrypts GCP credentials

type Permission

type Permission string

Permission is for mapping role into policy tag fine-grained-reader permissions

type Policy

type Policy struct {
	Name                string
	DisplayName         string
	Description         string
	TaxonomyDisplayName string
}

Policy is a reference to a Dataplex Policy Tag

func (*Policy) FromDomain

func (p *Policy) FromDomain(r *domain.Resource)

func (*Policy) ToDomain

func (p *Policy) ToDomain() *domain.Resource

type PolicyTagClient

type PolicyTagClient interface {
	GetPolicies(ctx context.Context) ([]*Policy, error)
	GrantPolicyAccess(ctx context.Context, tag *Policy, user, role string) error
	RevokePolicyAccess(ctx context.Context, tag *Policy, user, role string) error
	ListAccess(ctx context.Context, resources []*domain.Resource) (domain.MapResourceAccess, error)
}

type Provider

type Provider struct {
	Clients map[string]PolicyTagClient
	// contains filtered or unexported fields
}

Provider for policy tag

func NewProvider

func NewProvider(typeName string, c encryptor) *Provider

NewProvider returns policy tag provider

func (*Provider) CreateConfig

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

CreateConfig validates provider config

func (*Provider) GetAccountTypes

func (p *Provider) GetAccountTypes() []string

func (*Provider) GetPermissions

func (p *Provider) GetPermissions(pc *domain.ProviderConfig, resourceType, role string) ([]interface{}, error)

func (*Provider) GetResources

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

func (*Provider) GetRoles

func (p *Provider) GetRoles(pc *domain.ProviderConfig, resourceType string) ([]*domain.Role, error)

func (*Provider) GetType

func (p *Provider) GetType() string

GetType returns the provider type

func (*Provider) GrantAccess

func (p *Provider) GrantAccess(ctx context.Context, pc *domain.ProviderConfig, a domain.Grant) error

func (*Provider) ListAccess

func (p *Provider) ListAccess(ctx context.Context, pc domain.ProviderConfig, resources []*domain.Resource) (domain.MapResourceAccess, error)

func (*Provider) RevokeAccess

func (p *Provider) RevokeAccess(ctx context.Context, pc *domain.ProviderConfig, a domain.Grant) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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