Documentation
¶
Overview ¶
Package redash is a simple redash client library
Index ¶
- type Client
- func (c *Client) CreateDataSource(dataSourcePayload *DataSource) (*DataSource, error)
- func (c *Client) CreateGroup(groupPayload *GroupCreatePayload) (*Group, error)
- func (c *Client) CreateUser(userCreatePayload *UserCreatePayload) (*User, error)
- func (c *Client) DeleteDataSource(id int) error
- func (c *Client) DeleteGroup(id int) error
- func (c *Client) DisableUser(id int) error
- func (c *Client) GetDataSource(id int) (*DataSource, error)
- func (c *Client) GetDataSourceTypes() ([]DataSourceType, error)
- func (c *Client) GetDataSources() (*[]DataSource, error)
- func (c *Client) GetGroup(id int) (*Group, error)
- func (c *Client) GetGroups() (*[]Group, error)
- func (c *Client) GetUser(id int) (*User, error)
- func (c *Client) GetUserByEmail(email string) (*User, error)
- func (c *Client) GetUsers(pageSize int) (*UserList, error)
- func (c *Client) GroupAddDataSource(groupID int, dataSourceID int) error
- func (c *Client) GroupAddUser(groupID int, userID int) error
- func (c *Client) GroupRemoveDataSource(groupID int, dataSourceID int) error
- func (c *Client) GroupRemoveUser(groupID int, userID int) error
- func (c *Client) IsStrict() bool
- func (c *Client) SanitizeDataSourceOptions(dataSource *DataSource) (*DataSource, error)
- func (c *Client) SearchUsers(term string) (*UserList, error)
- func (c *Client) UpdateDataSource(id int, dataSourcePayload *DataSource) (*DataSource, error)
- func (c *Client) UpdateGroup(id int, group *Group) (*Group, error)
- func (c *Client) UpdateUser(id int, userUpdatePayload *UserUpdatePayload) (*User, error)
- type Config
- type DataSource
- type DataSourceType
- type DataSourceTypePropertyField
- type Group
- type GroupCreatePayload
- type GroupDataSource
- type GroupUser
- type User
- type UserCreatePayload
- type UserList
- type UserUpdatePayload
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
Config *Config
}
Client contains an active Redash API client
func (*Client) CreateDataSource ¶
func (c *Client) CreateDataSource(dataSourcePayload *DataSource) (*DataSource, error)
CreateDataSource creates a new DataSource
func (*Client) CreateGroup ¶
func (c *Client) CreateGroup(groupPayload *GroupCreatePayload) (*Group, error)
CreateGroup creates a new Redash group
func (*Client) CreateUser ¶
func (c *Client) CreateUser(userCreatePayload *UserCreatePayload) (*User, error)
CreateUser creates a new Redash user
func (*Client) DeleteDataSource ¶
DeleteDataSource deletes a specific DataSource
func (*Client) DeleteGroup ¶
DeleteGroup deletes a Redash group
func (*Client) DisableUser ¶
DisableUser disables an active user.
func (*Client) GetDataSource ¶
func (c *Client) GetDataSource(id int) (*DataSource, error)
GetDataSource gets a specific DataSource
func (*Client) GetDataSourceTypes ¶
func (c *Client) GetDataSourceTypes() ([]DataSourceType, error)
GetDataSourceTypes gets all available types with configuration details
func (*Client) GetDataSources ¶
func (c *Client) GetDataSources() (*[]DataSource, error)
GetDataSources gets an array of all DataSources available
func (*Client) GetUserByEmail ¶
GetUserByEmail returns a single user from their email address
func (*Client) GroupAddDataSource ¶
GroupAddDataSource adds a Data Source to a Redash group
func (*Client) GroupAddUser ¶
GroupAddUser adds a user to a Redash group
func (*Client) GroupRemoveDataSource ¶
GroupRemoveDataSource removes a Data Source from a Redash group
func (*Client) GroupRemoveUser ¶
GroupRemoveUser removes a user from a Redash group
func (*Client) IsStrict ¶
IsStrict returns true if StrictMode is set. This currently causes data_source creates/updates to fail if extraneous properties are present in the payload.
func (*Client) SanitizeDataSourceOptions ¶
func (c *Client) SanitizeDataSourceOptions(dataSource *DataSource) (*DataSource, error)
SanitizeDataSourceOptions checks the validity of the options field in a DataSource.Option against Redash's API and cleans up when possible
func (*Client) SearchUsers ¶
SearchUsers finds a list of users matching a string (searches `name` and `email` fields)
func (*Client) UpdateDataSource ¶
func (c *Client) UpdateDataSource(id int, dataSourcePayload *DataSource) (*DataSource, error)
UpdateDataSource Updates an existing DataSource
func (*Client) UpdateGroup ¶
UpdateGroup updates an existing Redash group
func (*Client) UpdateUser ¶
func (c *Client) UpdateUser(id int, userUpdatePayload *UserUpdatePayload) (*User, error)
UpdateUser updates an existing Redash user
type DataSource ¶
type DataSource struct { ID int `json:"id,omitempty"` Name string `json:"name,omitempty"` ScheduledQueueName string `json:"scheduled_queue_name,omitempty"` QueueName string `json:"queue_name,omitempty"` Options map[string]interface{} `json:"options,omitempty"` Paused int `json:"paused,omitempty"` PauseReason string `json:"pause_reason,omitempty"` Type string `json:"type,omitempty"` Syntax string `json:"syntax,omitempty"` Groups map[int]bool `json:"groups,omitempty"` }
DataSource struct
type DataSourceType ¶
type DataSourceType struct { Type string `json:"type"` Name string `json:"name,omitempty"` ConfigurationSchema struct { Secret []string `json:"secret,omitempty"` Required []string `json:"required,omitempty"` Type string `json:"type,omitempty"` Order []string `json:"order,omitempty"` Properties map[string]DataSourceTypePropertyField `json:"properties,omitempty"` } `json:"configuration_schema,omitempty"` }
DataSourceType struct
type DataSourceTypePropertyField ¶
DataSourceTypePropertyField struct
type Group ¶
type Group struct { CreatedAt time.Time `json:"created_at,omitempty"` Permissions []string `json:"permissions,omitempty"` Type string `json:"type,omitempty"` ID int `json:"id,omitempty"` Name string `json:"name,omitempty"` }
Group struct
type GroupCreatePayload ¶
type GroupCreatePayload struct {
Name string `json:"name"`
}
GroupCreatePayload struct
type GroupDataSource ¶
type GroupDataSource struct {
DataSourceID int `json:"data_source_id"`
}
GroupDataSource struct
type User ¶
type User struct { AuthType string `json:"auth_type,omitempty"` IsDisabled bool `json:"is_disabled,omitempty"` UpdatedAt time.Time `json:"updated_at,omitempty"` ProfileImageURL string `json:"profile_image_url,omitempty"` IsInvitationPending bool `json:"is_invitation_pending,omitempty"` Groups []int `json:"groups,omitempty"` ID int `json:"id,omitempty"` Name string `json:"name,omitempty"` CreatedAt time.Time `json:"created_at,omitempty"` DisabledAt interface{} `json:"disabled_at,omitempty"` IsEmailVerified bool `json:"is_email_verified,omitempty"` ActiveAt time.Time `json:"active_at,omitempty"` Email string `json:"email,omitempty"` }
User representation
type UserCreatePayload ¶
UserCreatePayload struct for mutating users.
type UserList ¶
type UserList struct { Count int `json:"count"` Page int `json:"page"` PageSize int `json:"page_size"` Results []struct { AuthType string `json:"auth_type,omitempty"` IsDisabled bool `json:"is_disabled,omitempty"` UpdatedAt time.Time `json:"updated_at,omitempty"` ProfileImageURL string `json:"profile_image_url,omitempty"` IsInvitationPending bool `json:"is_invitation_pending,omitempty"` Groups []struct { ID int `json:"id,omitempty"` Name string `json:"name,omitempty"` } `json:"groups,omitempty"` ID int `json:"id,omitempty"` Name string `json:"name,omitempty"` CreatedAt time.Time `json:"created_at,omitempty"` DisabledAt interface{} `json:"disabled_at,omitempty"` IsEmailVerified bool `json:"is_email_verified,omitempty"` ActiveAt time.Time `json:"active_at,omitempty"` Email string `json:"email,omitempty"` } `json:"results,omitempty"` }
UserList struct
type UserUpdatePayload ¶
type UserUpdatePayload struct { Name string `json:"name"` Email string `json:"email"` Groups []int `json:"group_ids"` }
UserUpdatePayload struct for mutating users.