Documentation
¶
Index ¶
- Constants
- Variables
- func NewClient(config *ClientConfig, logger log.Logger) (*client, error)
- func NewProvider(typeName string, crypto domain.Crypto, logger log.Logger) *provider
- type ClientConfig
- type Collection
- type Config
- type Credentials
- type Database
- type Group
- type GroupResource
- type HTTPClient
- type MetabaseClient
- type Permission
- type ResourceGroupDetails
- type SessionRequest
- type SessionResponse
- type Table
Constants ¶
View Source
const ( DatabaseRoleViewer = "schemas:all" DatabaseRoleEditor = "native:write" CollectionRoleViewer = "read" CollectionRoleCurate = "write" TableRoleViewer = "all" AccountTypeUser = "user" )
View Source
const ( ResourceTypeDatabase = "database" ResourceTypeTable = "table" ResourceTypeCollection = "collection" ResourceTypeGroup = "group" GuardianGroupPrefix = "_guardian_" )
Variables ¶
View Source
var ( ErrInvalidCredentials = errors.New("invalid credentials type") ErrInvalidPermissionConfig = errors.New("invalid permission config type") ErrUnableToEncryptNilCredentials = errors.New("unable to encrypt nil credentials") ErrUnableToDecryptNilCredentials = errors.New("unable to decrypt nil credentials") ErrUserNotFound = errors.New("metabase user not found") ErrInvalidRole = errors.New("invalid role") ErrInvalidResourceType = errors.New("invalid resource type") ErrPermissionNotFound = errors.New("permission not found") ErrInvalidApiResponse = errors.New("invalid api response") ErrInvalidDatabaseURN = errors.New("database URN is invalid") ErrInvalidTableURN = errors.New("table URN is invalid") ErrInvalidGroupURN = errors.New("group URN is invalid") ErrInvalidCollectionURN = errors.New("collection URN is invalid") )
Functions ¶
Types ¶
type ClientConfig ¶
type ClientConfig struct {
Host string `validate:"required,url" mapstructure:"host"`
Username string `validate:"required" mapstructure:"username"`
Password string `validate:"required" mapstructure:"password"`
HTTPClient HTTPClient
}
type Collection ¶
type Collection struct {
ID interface{} `json:"id"`
Name string `json:"name"`
Slug string `json:"slug"`
Location string `json:"location,omitempty"`
Namespace string `json:"namespace,omitempty"`
PersonalOwnerId interface{} `json:"personal_owner_id,omitempty"`
}
func (*Collection) FromDomain ¶
func (c *Collection) FromDomain(r *domain.Resource) error
func (*Collection) ToDomain ¶
func (c *Collection) ToDomain() *domain.Resource
type Config ¶
type Config struct {
ProviderConfig *domain.ProviderConfig
// contains filtered or unexported fields
}
func (*Config) EncryptCredentials ¶
func (*Config) ParseAndValidate ¶
type Credentials ¶
type Database ¶
type Database struct {
ID int `json:"id" mapstructure:"id"`
Name string `json:"name" mapstructure:"name"`
CacheFieldValuesSchedule string `json:"cache_field_values_schedule" mapstructure:"cache_field_values_schedule"`
Timezone string `json:"timezone" mapstructure:"timezone"`
AutoRunQueries bool `json:"auto_run_queries" mapstructure:"auto_run_queries"`
MetadataSyncSchedule string `json:"metadata_sync_schedule" mapstructure:"metadata_sync_schedule"`
Engine string `json:"engine" mapstructure:"engine"`
NativePermissions string `json:"native_permissions" mapstructure:"native_permissions"`
Tables []Table `json:"tables" mapstructure:"tables"`
}
type Group ¶
type Group struct {
ID int `json:"id" mapstructure:"id"`
Name string `json:"name" mapstructure:"name"`
DatabaseResources []*GroupResource `json:"database" mapstructure:"database"`
CollectionResources []*GroupResource `json:"collection" mapstructure:"collection"`
}
type GroupResource ¶
type MetabaseClient ¶
type MetabaseClient interface {
GetDatabases() ([]*Database, error)
GetCollections() ([]*Collection, error)
GetGroups() ([]*Group, ResourceGroupDetails, ResourceGroupDetails, error)
GrantDatabaseAccess(resource *Database, user, role string, groups map[string]*Group) error
RevokeDatabaseAccess(resource *Database, user, role string) error
GrantCollectionAccess(resource *Collection, user, role string) error
RevokeCollectionAccess(resource *Collection, user, role string) error
GrantTableAccess(resource *Table, user, role string, groups map[string]*Group) error
RevokeTableAccess(resource *Table, user, role string) error
GrantGroupAccess(groupID int, email string) error
RevokeGroupAccess(groupID int, email string) error
}
type Permission ¶
type Permission string
type ResourceGroupDetails ¶
type SessionRequest ¶
type SessionResponse ¶
type SessionResponse struct {
ID string `json:"id"`
}
Click to show internal directories.
Click to hide internal directories.