boltdbstate

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 5, 2022 License: MPL-2.0 Imports: 48 Imported by: 0

Documentation

Overview

Package state manages the state that the singleprocess server has, providing operations to mutate that state safely as needed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IndexTime

type IndexTime struct {
	Field string

	// Asc if true will index with ascending order. Usually you want to
	// find the most recent data so this is false by default.
	Asc bool
}

IndexTime indexes a time.Time field of a struct. TODO(mitchellh): test

func (*IndexTime) FromArgs

func (idx *IndexTime) FromArgs(args ...interface{}) ([]byte, error)

func (*IndexTime) FromObject

func (idx *IndexTime) FromObject(obj interface{}) (bool, []byte, error)

type InstanceLogs

type InstanceLogs struct {
	Id         int64
	InstanceId string

	LogBuffer *logbuffer.Buffer
}

InstanceLogs is a value that can be created to assist in coordination log writers and readers. It is a lighter weight version of an Instance used to manage virtual CEBs sending logs.

type State

type State struct {
	// contains filtered or unexported fields
}

State is the primary API for state mutation for the server.

func New

func New(log hclog.Logger, db *bolt.DB) (*State, error)

New initializes a new State store.

func TestState

func TestState(t testing.T) *State

TestState returns an initialized State for testing.

func TestStateRestart

func TestStateRestart(t testing.T, s *State) (*State, error)

TestStateRestart closes the given state and restarts it against the same DB file.

func (*State) AppDelete

func (s *State) AppDelete(ref *pb.Ref_Application) error

AppDelete deletes an application from a project. This will also delete all the operations associated with this application.

func (*State) AppGet

func (s *State) AppGet(ref *pb.Ref_Application) (*pb.Application, error)

AppGet retrieves the application..

func (*State) AppPut

func (s *State) AppPut(app *pb.Application) (*pb.Application, error)

AppPut creates or updates the application.

func (*State) ApplicationPollComplete

func (s *State) ApplicationPollComplete(
	project *pb.Project,
	t time.Time,
) error

ApplicationPollComplete sets the next poll time for a given project given the app reference along with the time interval "t".

func (*State) ApplicationPollPeek

func (s *State) ApplicationPollPeek(
	ws memdb.WatchSet,
) (*pb.Project, time.Time, error)

ApplicationPollPeek peeks at the next available project that will be polled against, and returns the project as the result along with the poll time. The poll queuer will queue a job against every defined application for the given project. For more information on how ProjectPollPeek works, refer to the ProjectPollPeek docs.

func (*State) ArtifactGet

func (s *State) ArtifactGet(ref *pb.Ref_Operation) (*pb.PushedArtifact, error)

ArtifactGet gets a artifact by ref.

func (*State) ArtifactLatest

func (s *State) ArtifactLatest(
	ref *pb.Ref_Application,
	ws *pb.Ref_Workspace,
) (*pb.PushedArtifact, error)

ArtifactLatest gets the latest artifact that was completed successfully.

func (*State) ArtifactList

func (s *State) ArtifactList(
	ref *pb.Ref_Application,
	opts ...serverstate.ListOperationOption,
) ([]*pb.PushedArtifact, error)

func (*State) ArtifactPut

func (s *State) ArtifactPut(update bool, b *pb.PushedArtifact) error

ArtifactPut inserts or updates a artifact record.

func (*State) AuthMethodDelete

func (s *State) AuthMethodDelete(ref *pb.Ref_AuthMethod) error

AuthMethodDelete deletes an auth method by reference.

func (*State) AuthMethodGet

func (s *State) AuthMethodGet(ref *pb.Ref_AuthMethod) (*pb.AuthMethod, error)

AuthMethodGet gets a auth method by reference.

func (*State) AuthMethodList

func (s *State) AuthMethodList() ([]*pb.AuthMethod, error)

AuthMethodList returns the list of projects.

func (*State) AuthMethodPut

func (s *State) AuthMethodPut(v *pb.AuthMethod) error

AuthMethodPut creates or updates the given auth method. .

func (*State) BuildGet

func (s *State) BuildGet(ref *pb.Ref_Operation) (*pb.Build, error)

BuildGet gets a build by ref.

func (*State) BuildLatest

func (s *State) BuildLatest(
	ref *pb.Ref_Application,
	ws *pb.Ref_Workspace,
) (*pb.Build, error)

BuildLatest gets the latest build that was completed successfully.

func (*State) BuildList

func (s *State) BuildList(
	ref *pb.Ref_Application,
	opts ...serverstate.ListOperationOption,
) ([]*pb.Build, error)

func (*State) BuildPut

func (s *State) BuildPut(update bool, b *pb.Build) error

BuildPut inserts or updates a build record.

func (*State) Close

func (s *State) Close() error

Close should be called to gracefully close any resources.

func (*State) ConfigGet

func (s *State) ConfigGet(req *pb.ConfigGetRequest) ([]*pb.ConfigVar, error)

ConfigGet gets all the configuration for the given request.

func (*State) ConfigGetWatch

func (s *State) ConfigGetWatch(req *pb.ConfigGetRequest, ws memdb.WatchSet) ([]*pb.ConfigVar, error)

ConfigGetWatch gets all the configuration for the given request. If a non-nil WatchSet is given, this can be watched for potential changes in the config.

func (*State) ConfigSet

func (s *State) ConfigSet(vs ...*pb.ConfigVar) error

ConfigSet writes a configuration variable to the data store. Deletes are always ordered before writes so that you can't delete a new value in a single ConfigSet (you should never want to do this).

func (*State) ConfigSourceGet

func (s *State) ConfigSourceGet(req *pb.GetConfigSourceRequest) ([]*pb.ConfigSource, error)

ConfigSourceGet gets all the configuration sources for the given request.

func (*State) ConfigSourceGetWatch

func (s *State) ConfigSourceGetWatch(req *pb.GetConfigSourceRequest, ws memdb.WatchSet) ([]*pb.ConfigSource, error)

ConfigSourceGetWatch gets all the configuration sources for the given request. If a non-nil WatchSet is given, this can be watched for potential changes in the config source settings.

func (*State) ConfigSourceSet

func (s *State) ConfigSourceSet(vs ...*pb.ConfigSource) error

ConfigSourceSet writes a set of config source values to the database.

func (*State) CreateSnapshot

func (s *State) CreateSnapshot(w io.Writer) error

CreateSnapshot creates a database snapshot and writes it to the given writer.

This will NOT buffer data to w, so you should wrap w in a bufio.Writer if you want buffering.

func (*State) DeploymentGet

func (s *State) DeploymentGet(ref *pb.Ref_Operation) (*pb.Deployment, error)

DeploymentGet gets a deployment by ref.

func (*State) DeploymentLatest

func (s *State) DeploymentLatest(
	ref *pb.Ref_Application,
	ws *pb.Ref_Workspace,
) (*pb.Deployment, error)

DeploymentLatest gets the latest deployment that was completed successfully.

func (*State) DeploymentList

func (s *State) DeploymentList(
	ref *pb.Ref_Application,
	opts ...serverstate.ListOperationOption,
) ([]*pb.Deployment, error)

func (*State) DeploymentPut

func (s *State) DeploymentPut(update bool, b *pb.Deployment) error

DeploymentPut inserts or updates a deployment record.

func (*State) GetFileChangeSignal

func (s *State) GetFileChangeSignal(scope *pb.Ref_Application) (string, error)

GetFileChangeSignal checks the metadata for the given application and its project, returning the value of FileChangeSignal that is most relevent.

func (*State) HMACKeyCreateIfNotExist

func (s *State) HMACKeyCreateIfNotExist(id string, size int) (*pb.HMACKey, error)

HMACKeyCreateIfNotExist creates a new HMAC key with the given ID and size. If a key with the given ID exists already it will be returned.

func (*State) HMACKeyEmpty

func (s *State) HMACKeyEmpty() bool

HMACKeyEmpty returns true if no HMAC keys have been created. This will be true only when the server is in a bootstrap state.

func (*State) HMACKeyGet

func (s *State) HMACKeyGet(id string) (*pb.HMACKey, error)

HMACKeyGet gets an HMAC key by ID. This will return a nil value if it doesn't exist.

func (*State) InstanceById

func (s *State) InstanceById(id string) (*serverstate.Instance, error)

func (*State) InstanceCreate

func (s *State) InstanceCreate(rec *serverstate.Instance) error

func (*State) InstanceDelete

func (s *State) InstanceDelete(id string) error

func (*State) InstanceExecById

func (s *State) InstanceExecById(id int64) (*serverstate.InstanceExec, error)

func (*State) InstanceExecConnect added in v0.9.0

func (s *State) InstanceExecConnect(ctx context.Context, id int64) (*serverstate.InstanceExec, error)

func (*State) InstanceExecCreateByDeployment

func (s *State) InstanceExecCreateByDeployment(did string, exec *serverstate.InstanceExec) error

func (*State) InstanceExecCreateByTargetedInstance

func (s *State) InstanceExecCreateByTargetedInstance(id string, exec *serverstate.InstanceExec) error

func (*State) InstanceExecCreateForVirtualInstance

func (s *State) InstanceExecCreateForVirtualInstance(ctx context.Context, id string, exec *serverstate.InstanceExec) error

InstanceExecCreateForVirtualInstance registers the given InstanceExec record on the instance specified. The instance does not yet have to be known (as it may not yet have connected to the server) so this code will use memdb watchers to detect the instance as it connects and then register the exec.

func (*State) InstanceExecDelete

func (s *State) InstanceExecDelete(id int64) error

func (*State) InstanceExecListByInstanceId

func (s *State) InstanceExecListByInstanceId(id string, ws memdb.WatchSet) ([]*serverstate.InstanceExec, error)

func (*State) InstanceExecWaitConnected added in v0.9.0

func (s *State) InstanceExecWaitConnected(ctx context.Context, exec *serverstate.InstanceExec) error

func (*State) InstanceLogsById

func (s *State) InstanceLogsById(id int64) (*InstanceLogs, error)

func (*State) InstanceLogsByInstanceId

func (s *State) InstanceLogsByInstanceId(id string) (*InstanceLogs, error)

func (*State) InstanceLogsCreate

func (s *State) InstanceLogsCreate(id string, logs *InstanceLogs) error

func (*State) InstanceLogsDelete

func (s *State) InstanceLogsDelete(id int64) error

func (*State) InstanceLogsListByInstanceId

func (s *State) InstanceLogsListByInstanceId(id string, ws memdb.WatchSet) ([]*InstanceLogs, error)

func (*State) InstancesByApp

func (s *State) InstancesByApp(
	ref *pb.Ref_Application,
	refws *pb.Ref_Workspace,
	ws memdb.WatchSet,
) ([]*serverstate.Instance, error)

func (*State) InstancesByDeployment

func (s *State) InstancesByDeployment(id string, ws memdb.WatchSet) ([]*serverstate.Instance, error)

func (*State) JobAck

func (s *State) JobAck(id string, ack bool) (*serverstate.Job, error)

JobAck acknowledges that a job has been accepted or rejected by the runner. If ack is false, then this will move the job back to the queued state and be eligible for assignment. Additionally, if a job is associated with an on-demand runner task, this func will progress the Tasks state machine depending on which job has currently been acked.

func (*State) JobAssignForRunner

func (s *State) JobAssignForRunner(ctx context.Context, r *pb.Runner) (*serverstate.Job, error)

JobAssignForRunner will wait for and assign a job to a specific runner. This will automatically evaluate any conditions that the runner and/or job may have on assignability.

The assigned job is put into a "waiting" state until the runner acks the assignment which can be set with JobAck.

If ctx is provided and assignment has to block waiting for new jobs, this will cancel when the context is done.

func (*State) JobById

func (s *State) JobById(id string, ws memdb.WatchSet) (*serverstate.Job, error)

JobById looks up a job by ID. The returned Job will be a deep copy of the job so it is safe to read/write. If the job can't be found, a nil result with no error is returned.

func (*State) JobCancel

func (s *State) JobCancel(id string, force bool) error

JobCancel marks a job as cancelled. This will set the internal state and request the cancel but if the job is running then it is up to downstream to listen for and react to Job changes for cancellation.

func (*State) JobComplete

func (s *State) JobComplete(id string, result *pb.Job_Result, cerr error) error

JobComplete marks a running job as complete. If an error is given, the job is marked as failed (a completed state). If no error is given, the job is marked as successful.

func (*State) JobCreate

func (s *State) JobCreate(jobs ...*pb.Job) error

JobCreate queues the given jobs. If any job fails to queue, no jobs are queued. If partial failures are acceptable, call this multiple times with a single job.

func (*State) JobExpire

func (s *State) JobExpire(id string) error

JobExpire expires a job. This will cancel the job if it is still queued.

func (*State) JobHeartbeat

func (s *State) JobHeartbeat(id string) error

JobHeartbeat resets the heartbeat timer for a running job. If the job is not currently running this does nothing, it will not return an error. If the job doesn't exist then this will return an error.

func (*State) JobIsAssignable

func (s *State) JobIsAssignable(ctx context.Context, jobpb *pb.Job) (bool, error)

JobIsAssignable returns whether there is a registered runner that meets the requirements to run this job.

If this returns true, the job if queued should eventually be assigned successfully to a runner. An assignable result does NOT mean that it will be in queue a short amount of time.

Note the result is a point-in-time result. If the only candidate runners deregister between this returning true and queueing, the job may still sit in a queue indefinitely.

func (*State) JobList

func (s *State) JobList(
	req *pb.ListJobsRequest,
) ([]*pb.Job, error)

JobList returns the list of jobs.

func (*State) JobPeekForRunner

func (s *State) JobPeekForRunner(ctx context.Context, r *pb.Runner) (*serverstate.Job, error)

JobPeekForRunner effectively simulates JobAssignForRunner with two changes: (1) jobs are not actually assigned (they remain queued) and (2) this will not block if a job isn't available. If a job isn't available, this will return (nil, nil).

func (*State) JobProjectScopedRequest

func (s *State) JobProjectScopedRequest(
	pRef *pb.Ref_Project,
	jobTemplate *pb.Job,
) ([]*pb.QueueJobRequest, error)

Given a Project Ref and a Job Template, this function will generate a slice of QueueJobRequests for every application inside the requested Project

func (*State) JobUpdate

func (s *State) JobUpdate(id string, cb func(jobpb *pb.Job) error) error

JobUpdate calls the given callback to update fields on the job data. The callback is called in the context of a database write lock so it should NOT compute anything and should be fast. The callback can return an error to abort the transaction.

Job states should NOT be modified using this, only metadata.

func (*State) JobUpdateRef

func (s *State) JobUpdateRef(id string, ref *pb.Job_DataSource_Ref) error

JobUpdateRef sets the data_source_ref field for a job. This job can be in any state.

func (*State) JobsByTaskRef added in v0.9.0

func (s *State) JobsByTaskRef(
	task *pb.Task,
) (startJob *pb.Job, taskJob *pb.Job, stopJob *pb.Job, watchJob *pb.Job, err error)

GetJobsByTaskRef will look up every job triple by Task ref in a single memdb transaction. This is often used via the API for building out a complete picture of a task beyond the job ID refs.

func (*State) OnDemandRunnerConfigDefault

func (s *State) OnDemandRunnerConfigDefault() ([]*pb.Ref_OnDemandRunnerConfig, error)

OnDemandRunnerConfigDefault returns the list of ondemandRunners that are defaults.

func (*State) OnDemandRunnerConfigDelete

func (s *State) OnDemandRunnerConfigDelete(ref *pb.Ref_OnDemandRunnerConfig) error

OnDemandRunnerConfigDelete deletes a ondemandRunner by reference. This is a complete data delete. This will delete all operations associated with this ondemandRunner as well.

func (*State) OnDemandRunnerConfigGet

func (s *State) OnDemandRunnerConfigGet(ref *pb.Ref_OnDemandRunnerConfig) (*pb.OnDemandRunnerConfig, error)

OnDemandRunnerConfigGet gets a ondemandRunner by reference.

func (*State) OnDemandRunnerConfigList

func (s *State) OnDemandRunnerConfigList() ([]*pb.OnDemandRunnerConfig, error)

OnDemandRunnerConfigList returns the list of ondemandRunners.

func (*State) OnDemandRunnerConfigPut

func (s *State) OnDemandRunnerConfigPut(o *pb.OnDemandRunnerConfig) error

OnDemandRunnerConfigPut creates or updates the given ondemandRunner.

Application changes will be ignored, you must use the Application APIs.

func (*State) ProjectDelete

func (s *State) ProjectDelete(ref *pb.Ref_Project) error

ProjectDelete deletes a project by reference. This is a complete data delete. This will delete all operations associated with this project as well.

func (*State) ProjectGet

func (s *State) ProjectGet(ref *pb.Ref_Project) (*pb.Project, error)

ProjectGet gets a project by reference.

func (*State) ProjectList

func (s *State) ProjectList() ([]*pb.Ref_Project, error)

ProjectList returns the list of projects.

func (*State) ProjectListWorkspaces

func (s *State) ProjectListWorkspaces(ref *pb.Ref_Project) ([]*pb.Workspace_Project, error)

ProjectListWorkspaces returns the list of workspaces that a project is in.

func (*State) ProjectPollComplete

func (s *State) ProjectPollComplete(p *pb.Project, t time.Time) error

ProjectPollComplete sets the next poll time for the given project to the time "t" plus the interval time for the project.

func (*State) ProjectPollPeek

func (s *State) ProjectPollPeek(ws memdb.WatchSet) (*pb.Project, time.Time, error)

ProjectPollPeek returns the next project that should be polled. This will return (nil,nil) if there are no projects to poll currently.

This is a "peek" operation so it does not update the project's next poll time. Therefore, calling this multiple times should return the same result unless a function like ProjectPollComplete is called.

If ws is non-nil, the WatchSet can be watched for any changes to projects to poll. This can be watched, for example, to detect when projects to poll are added. This is important functionality since callers may be sleeping on a deadline for awhile when a new project is inserted to poll immediately.

func (*State) ProjectPut

func (s *State) ProjectPut(p *pb.Project) error

ProjectPut creates or updates the given project.

Application changes will be ignored, you must use the Application APIs.

func (*State) ProjectUpdateDataRef

func (s *State) ProjectUpdateDataRef(
	ref *pb.Ref_Project,
	ws *pb.Ref_Workspace,
	dataRef *pb.Job_DataSource_Ref,
) error

ProjectUpdateDataRef updates the latest data ref used for a project. This data is available via the APIs for querying workspaces.

func (*State) Prune

func (s *State) Prune() error

Prune should be called in a on a regular interval to allow State to prune out old data.

func (*State) ReleaseGet

func (s *State) ReleaseGet(ref *pb.Ref_Operation) (*pb.Release, error)

ReleaseGet gets a release by ref.

func (*State) ReleaseLatest

func (s *State) ReleaseLatest(
	ref *pb.Ref_Application,
	ws *pb.Ref_Workspace,
) (*pb.Release, error)

ReleaseLatest gets the latest release that was completed successfully.

func (*State) ReleaseList

func (s *State) ReleaseList(
	ref *pb.Ref_Application,
	opts ...serverstate.ListOperationOption,
) ([]*pb.Release, error)

func (*State) ReleasePut

func (s *State) ReleasePut(update bool, b *pb.Release) error

ReleasePut inserts or updates a release record.

func (*State) RunnerAdopt

func (s *State) RunnerAdopt(id string, implicit bool) error

RunnerAdopt marks a runner as adopted.

If "implicit" is true, then this runner is implicitly adopted and the state goes to "PREADOPTED". This means that the runner instance itself was never explicitly adopted, but it already has a valid token so it is accepted.

func (*State) RunnerById

func (s *State) RunnerById(id string, ws memdb.WatchSet) (*pb.Runner, error)

func (*State) RunnerCreate

func (s *State) RunnerCreate(r *pb.Runner) error

func (*State) RunnerDelete

func (s *State) RunnerDelete(id string) error

RunnerDelete permanently deletes the runner record including any on-disk state such as adoption state. This effectively "forgets" the runner.

func (*State) RunnerList

func (s *State) RunnerList() ([]*pb.Runner, error)

RunnerList lists all the runners. This isn't a list of only online runners; this is ALL runners the database currently knows about.

func (*State) RunnerOffline

func (s *State) RunnerOffline(id string) error

RunnerOffline marks that a runner has gone offline. This is the preferred approach to deregistering a runner, since this will keep the adoption state around.

func (*State) RunnerReject

func (s *State) RunnerReject(id string) error

RunnerReject marks a runner as rejected.

func (*State) ServerConfigGet

func (s *State) ServerConfigGet() (*pb.ServerConfig, error)

ServerConfigGet gets the server configuration.

func (*State) ServerConfigSet

func (s *State) ServerConfigSet(c *pb.ServerConfig) error

ServerConfigSet writes the server configuration.

func (*State) ServerIdGet

func (s *State) ServerIdGet() (string, error)

ServerIdGet gets the server ID.

func (*State) ServerIdSet

func (s *State) ServerIdSet(id string) error

ServerIdSet writes the server ID.

func (*State) ServerURLTokenGet

func (s *State) ServerURLTokenGet() (string, error)

ServerURLTokenGet gets the server URL token.

func (*State) ServerURLTokenSet

func (s *State) ServerURLTokenSet(token string) error

ServerURLTokenSet writes the server URL token.

func (*State) StageRestoreSnapshot

func (s *State) StageRestoreSnapshot(r io.Reader) error

StageRestoreSnapshot stages a database restore for the next server restart. This will create a temporary file alongside the data file so we must have write access to the directory containing the database.

func (*State) StatusReportGet

func (s *State) StatusReportGet(ref *pb.Ref_Operation) (*pb.StatusReport, error)

get status report by referenced operation

func (*State) StatusReportLatest

func (s *State) StatusReportLatest(
	ref *pb.Ref_Application,
	ws *pb.Ref_Workspace,
	filter func(*pb.StatusReport) (bool, error),
) (*pb.StatusReport, error)

StatusReportLatest gets the latest generated status report

func (*State) StatusReportList

func (s *State) StatusReportList(
	ref *pb.Ref_Application,
	opts ...serverstate.ListOperationOption,
) ([]*pb.StatusReport, error)

func (*State) StatusReportPut

func (s *State) StatusReportPut(update bool, report *pb.StatusReport) error

create or update the latest status report

func (*State) TaskCancel added in v0.9.0

func (s *State) TaskCancel(ref *pb.Ref_Task) error

TaskCancel cancels a tasks jobs by task id or run job id reference. NOTE(briancain): this way means each cancel is its own transaction and commit, not the greatest. Previously I attempted to implement this with taskCancel where the entire job triple was canceled inside a single transaction. This ended up deadlocking because when we cancel a job, we also call a `db.Update` on each job when we update its state in the database. This caused a deadlock. For now we cancel each job separately.

func (*State) TaskDelete

func (s *State) TaskDelete(ref *pb.Ref_Task) error

TaskDelete deletes a task by reference.

func (*State) TaskGet

func (s *State) TaskGet(ref *pb.Ref_Task) (*pb.Task, error)

TaskGet gets a task by reference.

func (*State) TaskList

func (s *State) TaskList(req *pb.ListTaskRequest) ([]*pb.Task, error)

TaskList returns the list of tasks.

func (*State) TaskPut

func (s *State) TaskPut(t *pb.Task) error

TaskPut creates or updates the given Task.

func (*State) TriggerDelete

func (s *State) TriggerDelete(ref *pb.Ref_Trigger) error

TriggerDelete deletes a trigger by reference.

func (*State) TriggerGet

func (s *State) TriggerGet(ref *pb.Ref_Trigger) (*pb.Trigger, error)

TriggerGet gets a trigger by reference.

func (*State) TriggerList

func (s *State) TriggerList(
	refws *pb.Ref_Workspace,
	refproj *pb.Ref_Project,
	refapp *pb.Ref_Application,
	tagFilter []string,
) ([]*pb.Trigger, error)

TriggerList returns the list of triggers.

func (*State) TriggerPut

func (s *State) TriggerPut(t *pb.Trigger) error

TriggerPut creates or updates the given Trigger.

func (*State) UserDelete

func (s *State) UserDelete(ref *pb.Ref_User) error

UserDelete deletes a user by reference.

func (*State) UserEmpty

func (s *State) UserEmpty() (bool, error)

UserEmpty returns true if there are no users yet (bootstrap state).

func (*State) UserGet

func (s *State) UserGet(ref *pb.Ref_User) (*pb.User, error)

UserGet gets a user by reference.

func (*State) UserGetEmail

func (s *State) UserGetEmail(email string) (*pb.User, error)

UserGetEmail gets a user by by email lookup. This will return a codes.NotFound error if the user is not found.

func (*State) UserGetOIDC

func (s *State) UserGetOIDC(iss, sub string) (*pb.User, error)

UserGetOIDC gets a user by by OIDC link lookup. This will return a codes.NotFound error if the user is not found.

func (*State) UserList

func (s *State) UserList() ([]*pb.User, error)

UserList returns the list of projects.

func (*State) UserPut

func (s *State) UserPut(user *pb.User) error

UserPut creates or updates the given user. If the user has no ID set then an ID will be written directly to the parameter.

func (*State) WorkspaceGet

func (s *State) WorkspaceGet(n string) (*pb.Workspace, error)

WorkspaceGet gets a workspace with a specific name. If it doesn't exist, this will return an error with codes.NotFound.

func (*State) WorkspaceList

func (s *State) WorkspaceList() ([]*pb.Workspace, error)

WorkspaceList lists all the workspaces.

func (*State) WorkspaceListByApp

func (s *State) WorkspaceListByApp(ref *pb.Ref_Application) ([]*pb.Workspace, error)

WorkspaceListByApp lists all the workspaces used by a specific application.

func (*State) WorkspaceListByProject

func (s *State) WorkspaceListByProject(ref *pb.Ref_Project) ([]*pb.Workspace, error)

WorkspaceListByProject lists all the workspaces used by a project.

func (*State) WorkspacePut

func (s *State) WorkspacePut(workspace *pb.Workspace) error

WorkspacePut creates or updates the given Workspace.

Project changes will be ignored

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL