Documentation ¶
Index ¶
- Constants
- Variables
- func MatchesRawTags(p *json.RawMessage, values []string) bool
- func ParseTag(p *json.RawMessage) (string, []string, error)
- type ClientGroup
- type ClientGroupProvider
- type ClientParams
- type Param
- type ParamValues
- type SqliteProvider
- func (p *SqliteProvider) Close() error
- func (p *SqliteProvider) Create(ctx context.Context, group *ClientGroup) error
- func (p *SqliteProvider) Delete(ctx context.Context, id string) error
- func (p *SqliteProvider) Get(ctx context.Context, id string) (*ClientGroup, error)
- func (p *SqliteProvider) GetAll(ctx context.Context) ([]*ClientGroup, error)
- func (p *SqliteProvider) List(ctx context.Context, options *query.ListOptions) ([]*ClientGroup, error)
- func (p *SqliteProvider) Update(ctx context.Context, group *ClientGroup) error
Constants ¶
View Source
const OptionsResource = "client_groups"
Variables ¶
View Source
var OptionsListDefaultFields = map[string][]string{ fmt.Sprintf("fields[%s]", OptionsResource): { "id", "description", }, }
View Source
var OptionsListDefaultSort = map[string][]string{
"sort": {"id"},
}
View Source
var OptionsSupportedFields = map[string]map[string]bool{ OptionsResource: { "id": true, "description": true, "params": true, "allowed_user_groups": true, "client_ids": true, "num_clients": true, "num_clients_connected": true, }, }
View Source
var OptionsSupportedFiltersAndSorts = map[string]bool{ "id": true, "description": true, }
Functions ¶
func MatchesRawTags ¶
func MatchesRawTags(p *json.RawMessage, values []string) bool
Types ¶
type ClientGroup ¶
type ClientGroup struct { ID string `json:"id" db:"id"` Description string `json:"description" db:"description"` Params *ClientParams `json:"params" db:"params"` AllowedUserGroups types.StringSlice `json:"allowed_user_groups" db:"allowed_user_groups"` // ClientIDs shows what clients belong to a given group. Note: it's populated separately. ClientIDs []string `json:"client_ids" db:"-"` }
func (*ClientGroup) OneOfUserGroupsIsAllowed ¶
func (g *ClientGroup) OneOfUserGroupsIsAllowed(userGroups []string) bool
func (*ClientGroup) UserGroupIsAllowed ¶
func (g *ClientGroup) UserGroupIsAllowed(requiredUserGroup string) bool
type ClientGroupProvider ¶
type ClientGroupProvider interface { Get(ctx context.Context, id string) (*ClientGroup, error) GetAll(ctx context.Context) ([]*ClientGroup, error) List(ctx context.Context, options *query.ListOptions) ([]*ClientGroup, error) Create(ctx context.Context, group *ClientGroup) error Update(ctx context.Context, group *ClientGroup) error Delete(ctx context.Context, id string) error Close() error }
type ClientParams ¶
type ClientParams struct { ClientID *ParamValues `json:"client_id"` Name *ParamValues `json:"name"` OS *ParamValues `json:"os"` OSArch *ParamValues `json:"os_arch"` OSFamily *ParamValues `json:"os_family"` OSKernel *ParamValues `json:"os_kernel"` Hostname *ParamValues `json:"hostname"` IPv4 *ParamValues `json:"ipv4"` IPv6 *ParamValues `json:"ipv6"` Tag *json.RawMessage `json:"tag"` Version *ParamValues `json:"version"` Address *ParamValues `json:"address"` ClientAuthID *ParamValues `json:"client_auth_id"` ConnectionState *ParamValues `json:"connection_state"` }
func (*ClientParams) HasNoParams ¶
func (p *ClientParams) HasNoParams() bool
func (*ClientParams) Scan ¶
func (p *ClientParams) Scan(value interface{}) error
type ParamValues ¶
type ParamValues []Param
func (*ParamValues) MatchesOneOf ¶
func (p *ParamValues) MatchesOneOf(values ...string) bool
type SqliteProvider ¶
type SqliteProvider struct {
// contains filtered or unexported fields
}
func NewSqliteProvider ¶
func NewSqliteProvider(db *sqlx.DB) (*SqliteProvider, error)
func (*SqliteProvider) Close ¶
func (p *SqliteProvider) Close() error
func (*SqliteProvider) Create ¶
func (p *SqliteProvider) Create(ctx context.Context, group *ClientGroup) error
func (*SqliteProvider) Delete ¶
func (p *SqliteProvider) Delete(ctx context.Context, id string) error
func (*SqliteProvider) Get ¶
func (p *SqliteProvider) Get(ctx context.Context, id string) (*ClientGroup, error)
func (*SqliteProvider) GetAll ¶
func (p *SqliteProvider) GetAll(ctx context.Context) ([]*ClientGroup, error)
func (*SqliteProvider) List ¶
func (p *SqliteProvider) List(ctx context.Context, options *query.ListOptions) ([]*ClientGroup, error)
func (*SqliteProvider) Update ¶
func (p *SqliteProvider) Update(ctx context.Context, group *ClientGroup) error
Click to show internal directories.
Click to hide internal directories.