Skip to main content

cmd/taisce/manage.go

cmd/taisce · 338 lines · 13 declarations · source

This file carries the package documentation, rendered on the package page.

Declarations​

const envManageAPI, envOperatorToken, envManageAddr and 2 more​

const (
envManageAPI = "TAISCE_MANAGE_API"
envOperatorToken = "TAISCE_OPERATOR_TOKEN"
envManageAddr = "TAISCE_MANAGE_ADDR"
envPortal = "TAISCE_PORTAL"
roleManage = "manage"
)

source

type manageClient​

type manageClient struct {
base string
token string
http *http.Client
}

manageClient is the CLI's view of the management surface.

source

func managementFromEnv​

func managementFromEnv() (*manageClient, bool)

managementFromEnv is the switch between the two paths. The token comes from the environment only, never a flag: a flag is in the shell history and the process list.

source

method manageClient.post​

func (c *manageClient) post(ctx context.Context, path string, body any, into any) error

source

method manageClient.project​

func (c *manageClient) project(ctx context.Context, args []string) error

source

func printProject​

func printProject(scope string, surfaces []string, retention string, suspended bool)

source

method manageClient.credential​

func (c *manageClient) credential(ctx context.Context, args []string) error

source

func retentionArgument​

func retentionArgument(args []string) (*int, error)

retentionArgument reads a retention the same way on both paths: whole days, or the word indefinite. Nil means indefinite, which is what a project starts with.

source

func printCredentials​

func printCredentials(listed []credential.Listed)

printCredentials is the credential listing both paths print.

source

method manageClient.formation​

func (c *manageClient) formation(ctx context.Context, args []string, out io.Writer) error

formation speaks the surface's formation operations. The arguments go through the parser the direct path uses, so both refuse the same input before anything is sent, and the answers are printed as the direct path prints them.

source

method manageClient.audit​

func (c *manageClient) audit(ctx context.Context, args []string) error

source

func operatorCommand​

func operatorCommand(ctx context.Context, args []string) error

operatorCommand mints an operator credential over the administrative connection: the one operation that has to exist before the management surface can be spoken to.

source

func operatorCredentials​

func operatorCredentials(ctx context.Context, pool *pgxpool.Pool) (int, error)

operatorCredentials counts the live operator credentials, for bootstrap to know whether the management surface can be reached by anyone.

source