WIP ugh
parent
056abde56d
commit
aebbb3743f
|
@ -296,17 +296,17 @@ type UsersStore interface {
|
|||
Update(context.Context, *User) error
|
||||
}
|
||||
|
||||
// type Database struct {
|
||||
// Name string `json:"name"` // a unique string identifier for the database
|
||||
// Duration string `json:"duration,omitempty"` // the duration (when creating a default retention policy)
|
||||
// Replication int32 `json:"replication,omitempty"` // the replication factor (when creating a default retention policy)
|
||||
// ShardDuration string `json:shardDuration,omitempty` // the shard duration (when creating a default retention policy)
|
||||
// }
|
||||
//
|
||||
// type Databases interface {
|
||||
// // All lists all databases
|
||||
// AllDB(context.Context) ([]Database, error)
|
||||
// }
|
||||
type Database struct {
|
||||
Name string `json:"name"` // a unique string identifier for the database
|
||||
Duration string `json:"duration,omitempty"` // the duration (when creating a default retention policy)
|
||||
Replication int32 `json:"replication,omitempty"` // the replication factor (when creating a default retention policy)
|
||||
ShardDuration string `json:shardDuration,omitempty` // the shard duration (when creating a default retention policy)
|
||||
}
|
||||
|
||||
type Databases interface {
|
||||
// All lists all databases
|
||||
AllDB(context.Context) ([]Database, error)
|
||||
}
|
||||
|
||||
// DashboardID is the dashboard ID
|
||||
type DashboardID int
|
||||
|
|
|
@ -35,7 +35,8 @@ type Ctrl interface {
|
|||
AddRoleUsers(ctx context.Context, name string, users []string) error
|
||||
RemoveRoleUsers(ctx context.Context, name string, users []string) error
|
||||
|
||||
Databases(ctx context.Context) (*Databases, error)
|
||||
// TODO add error here?
|
||||
Databases(ctx context.Context) chronograf.Databases
|
||||
}
|
||||
|
||||
// Client is a device for retrieving time series data from an Influx Enterprise
|
||||
|
@ -142,6 +143,10 @@ func (c *Client) Query(ctx context.Context, q chronograf.Query) (chronograf.Resp
|
|||
return c.nextDataNode().Query(ctx, q)
|
||||
}
|
||||
|
||||
// func (c *Client) Databases(context.Context) chronograf.Databases {
|
||||
// return c.Databases
|
||||
// }
|
||||
|
||||
// Users is the interface to the users within Influx Enterprise
|
||||
func (c *Client) Users(context.Context) chronograf.UsersStore {
|
||||
return c.UsersStore
|
||||
|
|
|
@ -46,6 +46,17 @@ func (m *MetaClient) ShowCluster(ctx context.Context) (*Cluster, error) {
|
|||
return out, nil
|
||||
}
|
||||
|
||||
func (m *MetaClient) Databases(ctx context.Context) chronograf.Databases {
|
||||
res, _ := m.Do(ctx, "GET", "/databases", nil, nil)
|
||||
|
||||
defer res.Body.Close()
|
||||
dec := json.NewDecoder(res.Body)
|
||||
dbs := []chronograf.Database{}
|
||||
databases := chronograf.Databases{Databases: dbs}
|
||||
// _ = dec.Decode(databases)
|
||||
return databases
|
||||
}
|
||||
|
||||
// Users gets all the users. If name is not nil it filters for a single user
|
||||
func (m *MetaClient) Users(ctx context.Context, name *string) (*Users, error) {
|
||||
params := map[string]string{}
|
||||
|
|
Loading…
Reference in New Issue