Documentation
¶
Overview ¶
Package coderbootstrap contains optional bootstrap integrations with the Coder API.
Index ¶
- func IsRateLimitError(err error) bool
- type Client
- type DeleteProvisionerKeyByIDRequest
- type EnsureOperatorTokenRequest
- type EnsureProvisionerKeyRequest
- type EnsureProvisionerKeyResponse
- type OperatorAccessProvisioner
- type PostgresOperatorAccessProvisioner
- type RegisterWorkspaceProxyRequest
- type RegisterWorkspaceProxyResponse
- type RevokeOperatorTokenRequest
- type SDKClient
- func (c *SDKClient) DeleteProvisionerKey(ctx context.Context, coderURL, sessionToken, orgName, keyName string) error
- func (c *SDKClient) DeleteProvisionerKeyByID(ctx context.Context, req DeleteProvisionerKeyByIDRequest) error
- func (c *SDKClient) EnsureProvisionerKey(ctx context.Context, req EnsureProvisionerKeyRequest) (EnsureProvisionerKeyResponse, error)
- func (c *SDKClient) EnsureWorkspaceProxy(ctx context.Context, req RegisterWorkspaceProxyRequest) (RegisterWorkspaceProxyResponse, error)
- func (c *SDKClient) Entitlements(ctx context.Context, coderURL, sessionToken string) (codersdk.Entitlements, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsRateLimitError ¶
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
DeleteProvisionerKeyByID(context.Context, DeleteProvisionerKeyByIDRequest) error
Entitlements(ctx context.Context, coderURL, sessionToken string) (codersdk.Entitlements, error)
}
Client provides optional bootstrap operations against the Coder API.
type DeleteProvisionerKeyByIDRequest ¶ added in v0.1.4
type DeleteProvisionerKeyByIDRequest struct {
CoderURL string
SessionToken string
OrganizationID uuid.UUID
KeyID uuid.UUID
}
DeleteProvisionerKeyByIDRequest identifies one provisioner key by the IDs that the caller recorded when it applied the key.
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 ¶
func (p *PostgresOperatorAccessProvisioner) EnsureOperatorToken(ctx context.Context, req EnsureOperatorTokenRequest) (string, error)
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 ¶
func (p *PostgresOperatorAccessProvisioner) RevokeOperatorToken(ctx context.Context, req RevokeOperatorTokenRequest) error
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 ¶
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) DeleteProvisionerKeyByID ¶ added in v0.1.4
func (c *SDKClient) DeleteProvisionerKeyByID(ctx context.Context, req DeleteProvisionerKeyByIDRequest) error
DeleteProvisionerKeyByID deletes the provisioner key with req.KeyID in the organization req.OrganizationID. It does nothing when no key has that ID, so a key that someone else created with the same name stays. The Coder API deletes keys only by name, so the key is looked up by ID first. The lookup and the delete are two requests: a key deleted and created again with the same name between them is deleted too.
func (*SDKClient) EnsureProvisionerKey ¶
func (c *SDKClient) EnsureProvisionerKey(ctx context.Context, req EnsureProvisionerKeyRequest) (EnsureProvisionerKeyResponse, error)
EnsureProvisionerKey creates a provisioner key if it does not already exist, otherwise it returns the existing key metadata.
func (*SDKClient) EnsureWorkspaceProxy ¶
func (c *SDKClient) EnsureWorkspaceProxy(ctx context.Context, req RegisterWorkspaceProxyRequest) (RegisterWorkspaceProxyResponse, error)
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.