Documentation ¶
Index ¶
- Constants
- Variables
- type Config
- type Credentials
- type Permission
- type Policy
- type PolicyTagClient
- type Provider
- func (p *Provider) CreateConfig(pc *domain.ProviderConfig) error
- func (p *Provider) GetAccountTypes() []string
- func (p *Provider) GetPermissions(pc *domain.ProviderConfig, resourceType, role string) ([]interface{}, error)
- func (p *Provider) GetResources(pc *domain.ProviderConfig) ([]*domain.Resource, error)
- func (p *Provider) GetRoles(pc *domain.ProviderConfig, resourceType string) ([]*domain.Role, error)
- func (p *Provider) GetType() string
- func (p *Provider) GrantAccess(pc *domain.ProviderConfig, a domain.Grant) error
- func (p *Provider) ListAccess(ctx context.Context, pc domain.ProviderConfig, resources []*domain.Resource) (domain.MapResourceAccess, error)
- func (p *Provider) RevokeAccess(pc *domain.ProviderConfig, a domain.Grant) error
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 ¶
EncryptCredentials encrypts the policy_tag credentials config
func (*Config) ParseAndValidate ¶
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
type Permission ¶
type Permission string
Permission is for mapping role into policy tag fine-grained-reader permissions
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 ¶
NewProvider returns policy tag provider
func (*Provider) CreateConfig ¶
func (p *Provider) CreateConfig(pc *domain.ProviderConfig) error
CreateConfig validates provider config
func (*Provider) GetAccountTypes ¶
func (*Provider) GetPermissions ¶
func (p *Provider) GetPermissions(pc *domain.ProviderConfig, resourceType, role string) ([]interface{}, error)
func (*Provider) GetResources ¶
func (*Provider) GrantAccess ¶
func (*Provider) ListAccess ¶
func (p *Provider) ListAccess(ctx context.Context, pc domain.ProviderConfig, resources []*domain.Resource) (domain.MapResourceAccess, error)
func (*Provider) RevokeAccess ¶
Click to show internal directories.
Click to hide internal directories.