Documentation ¶
Overview ¶
Package seed is used to generate test data for a demo or seeded environment.
Index ¶
- Variables
- type Client
- func (c *Client) AuthorizeOrganizationOnPAT(ctx context.Context, orgID, patID string) error
- func (c *Client) GenerateSeedAPIToken(ctx context.Context, orgID string) error
- func (c *Client) LoadGroups(ctx context.Context) error
- func (c *Client) LoadInvites(ctx context.Context) error
- func (c *Client) LoadOrganizations(ctx context.Context) (string, error)
- func (c *Client) LoadSubscribers(ctx context.Context) error
- func (c *Client) RegisterUsers(ctx context.Context) error
- type Config
Constants ¶
This section is empty.
Variables ¶
var ( // ErrDatumAPITokenMissing is returned when the Datum API token is missing ErrAPITokenMissing = fmt.Errorf("token is required but not provided") // ErrColumnNotFound is returned when a column is not found in the CSV file ErrColumnNotFound = fmt.Errorf("column not found in CSV file") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { *datumclient.DatumClient // contains filtered or unexported fields }
Config represents provides the datum client and configuration for the seed client
func NewDefaultClient ¶
NewDefaultClient creates a new datum client using the default configuration variables
func (*Client) AuthorizeOrganizationOnPAT ¶
AuthorizeOrganizationOnPAT authorizes the organization id on the personal access token id
func (*Client) GenerateSeedAPIToken ¶
GenerateSeedAPIToken generates an API token for the organization id to use for seeding and authenticates the client with the token for future requests
func (*Client) LoadGroups ¶
LoadGroups loads the groups from the groups.csv file
func (*Client) LoadInvites ¶
LoadInvites loads the invites from the invites.csv file
func (*Client) LoadOrganizations ¶
LoadOrganizations loads the organizations from the organizations.csv file
func (*Client) LoadSubscribers ¶
LoadSubscribers loads the subscribers from the subscribers.csv file
type Config ¶
type Config struct { // Directory is the directory to save generated data Directory string `json:"directory" koanf:"directory" default:"demodata"` // DatumHost is the host of the datum server DatumHost string `json:"datumHost" koanf:"datum" default:"http://localhost:17608"` // Token is the token to use for the datum client Token string `json:"token" koanf:"token" default:""` // NumOrganizations is the number of organizations to generate NumOrganizations int `json:"numOrganizations" koanf:"numOrganizations" default:"1"` // NumUsers is the number of users to generate NumUsers int `json:"NumUsers" koanf:"NumUsers" default:"10"` // NumGroups is the number of groups to generate NumGroups int `json:"NumGroups" koanf:"NumGroups" default:"10"` // NumInvites is the number of invites to generate NumInvites int `json:"NumInvites" koanf:"NumInvites" default:"5"` // NumSubscribers is the number of subscribers to generate NumSubscribers int `json:"NumSubscribers" koanf:"NumSubscribers" default:"30"` }
Config is the configuration for the seed package
func NewDefaultConfig ¶
NewDefaultConfig returns a new Config with default values