Documentation ¶
Index ¶
- Constants
- Variables
- func NewClient(config *ClientConfig) (*client, error)
- func NewProvider(typeName string, crypto domain.Crypto) *provider
- type ClientConfig
- type Collection
- type Config
- type Credentials
- type Database
- type HTTPClient
- type MetabaseClient
- type PermissionConfig
- type SessionRequest
- type SessionResponse
Constants ¶
View Source
const ( DatabaseRoleViewer = "schemas:all" DatabaseRoleEditor = "native:write" )
View Source
const ( ResourceTypeDatabase = "database" ResourceTypeCollection = "collection" )
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") )
Functions ¶
func NewClient ¶
func NewClient(config *ClientConfig) (*client, error)
func NewProvider ¶
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"` }
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"` Name string `json:"name"` CacheFieldValuesSchedule string `json:"cache_field_values_schedule"` Timezone string `json:"timezone"` AutoRunQueries bool `json:"auto_run_queries"` MetadataSyncSchedule string `json:"metadata_sync_schedule"` Engine string `json:"engine"` NativePermissions string `json:"native_permissions"` }
type MetabaseClient ¶
type MetabaseClient interface { GetDatabases() ([]*Database, error) GetCollections() ([]*Collection, error) GrantDatabaseAccess(resource *Database, user, role string) error RevokeDatabaseAccess(resource *Database, user, role string) error GrantCollectionAccess(resource *Collection, user, role string) error RevokeCollectionAccess(resource *Collection, user, role string) error }
type PermissionConfig ¶ added in v0.2.0
type PermissionConfig struct {
Name string `json:"name" mapstructure:"name" validate:"required"`
}
type SessionRequest ¶
type SessionResponse ¶
type SessionResponse struct {
ID string `json:"id"`
}
Click to show internal directories.
Click to hide internal directories.