coderbootstrap

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package coderbootstrap contains optional bootstrap integrations with the Coder API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsRateLimitError

func IsRateLimitError(err error) bool

IsRateLimitError reports whether err (or any wrapped cause) is a codersdk API error with HTTP 429 Too Many Requests.

Types

type Client

type Client interface {
	EnsureWorkspaceProxy(context.Context, RegisterWorkspaceProxyRequest) (RegisterWorkspaceProxyResponse, error)
	EnsureProvisionerKey(context.Context, EnsureProvisionerKeyRequest) (EnsureProvisionerKeyResponse, error)
	DeleteProvisionerKey(ctx context.Context, coderURL, sessionToken, orgName, keyName string) error
	Entitlements(ctx context.Context, coderURL, sessionToken string) (codersdk.Entitlements, error)
}

Client provides optional bootstrap operations against the Coder API.

type EnsureOperatorTokenRequest

type EnsureOperatorTokenRequest struct {
	PostgresURL      string
	OperatorUsername string
	OperatorEmail    string
	TokenName        string
	TokenLifetime    time.Duration
	ExistingToken    string
}

EnsureOperatorTokenRequest defines the input required to provision operator access directly in the coderd backing PostgreSQL database.

type EnsureProvisionerKeyRequest

type EnsureProvisionerKeyRequest struct {
	CoderURL         string
	SessionToken     string
	OrganizationName string
	KeyName          string
	Tags             map[string]string
}

EnsureProvisionerKeyRequest describes how to create or look up a provisioner key in Coder.

type EnsureProvisionerKeyResponse

type EnsureProvisionerKeyResponse struct {
	OrganizationID uuid.UUID
	KeyID          uuid.UUID
	KeyName        string
	// Key is the plaintext provisioner key. It is only non-empty when a key is created.
	Key string
}

EnsureProvisionerKeyResponse contains provisioner key metadata.

type OperatorAccessProvisioner

type OperatorAccessProvisioner interface {
	EnsureOperatorToken(context.Context, EnsureOperatorTokenRequest) (string, error)
	RevokeOperatorToken(context.Context, RevokeOperatorTokenRequest) error
}

OperatorAccessProvisioner provisions and revokes operator access credentials for coderd.

type PostgresOperatorAccessProvisioner

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

PostgresOperatorAccessProvisioner provisions operator access credentials by connecting directly to coderd's PostgreSQL database.

func NewPostgresOperatorAccessProvisioner

func NewPostgresOperatorAccessProvisioner() *PostgresOperatorAccessProvisioner

NewPostgresOperatorAccessProvisioner returns a PostgreSQL-backed operator access provisioner.

func (*PostgresOperatorAccessProvisioner) EnsureOperatorToken

EnsureOperatorToken ensures the operator system user exists, grants organization-admin membership in all organizations, reuses the provided existing token when still valid, and otherwise rotates the token with the configured token name.

func (*PostgresOperatorAccessProvisioner) RevokeOperatorToken

RevokeOperatorToken deletes the managed operator API token when present.

type RegisterWorkspaceProxyRequest

type RegisterWorkspaceProxyRequest struct {
	CoderURL     string
	SessionToken string
	ProxyName    string
	DisplayName  string
	Icon         string
}

RegisterWorkspaceProxyRequest describes how to register a workspace proxy in Coder.

type RegisterWorkspaceProxyResponse

type RegisterWorkspaceProxyResponse struct {
	ProxyName  string
	ProxyToken string
}

RegisterWorkspaceProxyResponse contains the proxy identity and token returned by Coder.

type RevokeOperatorTokenRequest

type RevokeOperatorTokenRequest struct {
	PostgresURL      string
	OperatorUsername string
	TokenName        string
}

RevokeOperatorTokenRequest defines the input required to revoke the managed operator token from coderd's PostgreSQL database.

type SDKClient

type SDKClient struct{}

SDKClient uses codersdk to perform bootstrap operations.

func NewSDKClient

func NewSDKClient() *SDKClient

NewSDKClient returns a bootstrap client backed by codersdk.

func (*SDKClient) DeleteProvisionerKey

func (c *SDKClient) DeleteProvisionerKey(ctx context.Context, coderURL, sessionToken, orgName, keyName string) error

DeleteProvisionerKey deletes a provisioner key by name. A missing key is treated as success for idempotency.

func (*SDKClient) EnsureProvisionerKey

EnsureProvisionerKey creates a provisioner key if it does not already exist, otherwise it returns the existing key metadata.

func (*SDKClient) EnsureWorkspaceProxy

EnsureWorkspaceProxy creates or updates a workspace proxy and returns a token suitable for the workspace proxy process.

func (*SDKClient) Entitlements

func (c *SDKClient) Entitlements(ctx context.Context, coderURL, sessionToken string) (codersdk.Entitlements, error)

Entitlements returns deployment entitlements for the given coderd instance.

Jump to

Keyboard shortcuts

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