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) LoadOrgMembers(ctx context.Context, userIDs []string) error
- func (c *Client) LoadOrganizations(ctx context.Context) (string, error)
- func (c *Client) LoadSubscribers(ctx context.Context) error
- func (c *Client) LoadTemplates(ctx context.Context) error
- func (c *Client) RegisterUsers(ctx context.Context) ([]string, error)
- type Config
- type Template
Constants ¶
This section is empty.
Variables ¶
var ( // ErrAPITokenMissing is returned when the openlane 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") // ErrInvalidTemplateName is returned when an invalid template name is provided ErrInvalidTemplateName = fmt.Errorf("invalid template name") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { *openlaneclient.OpenlaneClient // contains filtered or unexported fields }
Config represents provides the openlane client and configuration for the seed client
func NewDefaultClient ¶
NewDefaultClient creates a new openlane 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) LoadOrgMembers ¶
LoadOrgMembers loads orgs members from the user ids provided
func (*Client) LoadOrganizations ¶
LoadOrganizations loads the organizations from the organizations.csv file
func (*Client) LoadSubscribers ¶
LoadSubscribers loads the subscribers from the subscribers.csv file
func (*Client) LoadTemplates ¶
LoadTemplates loads the templates from the jsonschema/templates directory
type Config ¶
type Config struct { // Directory is the directory to save generated data Directory string `json:"directory" koanf:"directory" default:"demodata"` // OpenlaneHost is the host of the openlane server OpenlaneHost string `json:"openlaneHost" koanf:"openlaneHost" default:"http://localhost:17608"` // Token is the token to use for the openlane 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"` // GenerateTemplates is a flag to generate templates GenerateTemplates bool `json:"generateTemplates" koanf:"generateTemplates" default:"true"` }
Config is the configuration for the seed package
func NewDefaultConfig ¶
NewDefaultConfig returns a new Config with default values