{"modulePath":"github.com/coder/coder-k8s","version":"v0.1.5","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package coderbootstrap\n\nPackage coderbootstrap contains optional bootstrap integrations with the Coder API.\n\n## Functions\n\n```go\nfunc IsRateLimitError(err error) bool\n```\nIsRateLimitError reports whether err (or any wrapped cause) is a codersdk API error with HTTP 429 Too Many Requests.\n\n## Types\n\n```go\ntype Client interface {\n\tEnsureWorkspaceProxy(context.Context, RegisterWorkspaceProxyRequest) (RegisterWorkspaceProxyResponse, error)\n\tEnsureProvisionerKey(context.Context, EnsureProvisionerKeyRequest) (EnsureProvisionerKeyResponse, error)\n\tDeleteProvisionerKey(ctx context.Context, coderURL, sessionToken, orgName, keyName string) error\n\tDeleteProvisionerKeyByID(context.Context, DeleteProvisionerKeyByIDRequest) error\n\tEntitlements(ctx context.Context, coderURL, sessionToken string) (codersdk.Entitlements, error)\n}\n```\nClient provides optional bootstrap operations against the Coder API.\n\n```go\ntype DeleteProvisionerKeyByIDRequest struct {\n\tCoderURL       string\n\tSessionToken   string\n\tOrganizationID uuid.UUID\n\tKeyID          uuid.UUID\n}\n```\nDeleteProvisionerKeyByIDRequest identifies one provisioner key by the IDs that the caller recorded when it applied the key.\n\n```go\ntype EnsureOperatorTokenRequest struct {\n\tPostgresURL      string\n\tOperatorUsername string\n\tOperatorEmail    string\n\tTokenName        string\n\tTokenLifetime    time.Duration\n\tExistingToken    string\n}\n```\nEnsureOperatorTokenRequest defines the input required to provision operator access directly in the coderd backing PostgreSQL database.\n\n```go\ntype EnsureProvisionerKeyRequest struct {\n\tCoderURL         string\n\tSessionToken     string\n\tOrganizationName string\n\tKeyName          string\n\tTags             map[string]string\n}\n```\nEnsureProvisionerKeyRequest describes how to create or look up a provisioner key in Coder.\n\n```go\ntype EnsureProvisionerKeyResponse struct {\n\tOrganizationID uuid.UUID\n\tKeyID          uuid.UUID\n\tKeyName        string\n\t// Key is the plaintext provisioner key. It is only non-empty when a key is created.\n\tKey string\n}\n```\nEnsureProvisionerKeyResponse contains provisioner key metadata.\n\n```go\ntype OperatorAccessProvisioner interface {\n\tEnsureOperatorToken(context.Context, EnsureOperatorTokenRequest) (string, error)\n\tRevokeOperatorToken(context.Context, RevokeOperatorTokenRequest) error\n}\n```\nOperatorAccessProvisioner provisions and revokes operator access credentials for coderd.\n\n```go\ntype PostgresOperatorAccessProvisioner struct {\n\t// contains filtered or unexported fields\n}\n```\nPostgresOperatorAccessProvisioner provisions operator access credentials by connecting directly to coderd's PostgreSQL database.\n\n```go\nfunc NewPostgresOperatorAccessProvisioner() *PostgresOperatorAccessProvisioner\n```\nNewPostgresOperatorAccessProvisioner returns a PostgreSQL-backed operator access provisioner.\n\n```go\nfunc (p *PostgresOperatorAccessProvisioner) EnsureOperatorToken(ctx context.Context, req EnsureOperatorTokenRequest) (string, error)\n```\nEnsureOperatorToken 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.\n\n```go\nfunc (p *PostgresOperatorAccessProvisioner) RevokeOperatorToken(ctx context.Context, req RevokeOperatorTokenRequest) error\n```\nRevokeOperatorToken deletes the managed operator API token when present.\n\n```go\ntype RegisterWorkspaceProxyRequest struct {\n\tCoderURL     string\n\tSessionToken string\n\tProxyName    string\n\tDisplayName  string\n\tIcon         string\n}\n```\nRegisterWorkspaceProxyRequest describes how to register a workspace proxy in Coder.\n\n```go\ntype RegisterWorkspaceProxyResponse struct {\n\tProxyName  string\n\tProxyToken string\n}\n```\nRegisterWorkspaceProxyResponse contains the proxy identity and token returned by Coder.\n\n```go\ntype RevokeOperatorTokenRequest struct {\n\tPostgresURL      string\n\tOperatorUsername string\n\tTokenName        string\n}\n```\nRevokeOperatorTokenRequest defines the input required to revoke the managed operator token from coderd's PostgreSQL database.\n\n```go\ntype SDKClient struct{}\n```\nSDKClient uses codersdk to perform bootstrap operations.\n\n```go\nfunc NewSDKClient() *SDKClient\n```\nNewSDKClient returns a bootstrap client backed by codersdk.\n\n```go\nfunc (c *SDKClient) DeleteProvisionerKey(ctx context.Context, coderURL, sessionToken, orgName, keyName string) error\n```\nDeleteProvisionerKey deletes a provisioner key by name. A missing key is treated as success for idempotency.\n\n```go\nfunc (c *SDKClient) DeleteProvisionerKeyByID(ctx context.Context, req DeleteProvisionerKeyByIDRequest) error\n```\nDeleteProvisionerKeyByID 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.\n\n```go\nfunc (c *SDKClient) EnsureProvisionerKey(ctx context.Context, req EnsureProvisionerKeyRequest) (EnsureProvisionerKeyResponse, error)\n```\nEnsureProvisionerKey creates a provisioner key if it does not already exist, otherwise it returns the existing key metadata.\n\n```go\nfunc (c *SDKClient) EnsureWorkspaceProxy(ctx context.Context, req RegisterWorkspaceProxyRequest) (RegisterWorkspaceProxyResponse, error)\n```\nEnsureWorkspaceProxy creates or updates a workspace proxy and returns a token suitable for the workspace proxy process.\n\n```go\nfunc (c *SDKClient) Entitlements(ctx context.Context, coderURL, sessionToken string) (codersdk.Entitlements, error)\n```\nEntitlements returns deployment entitlements for the given coderd instance.\n\n","path":"github.com/coder/coder-k8s/internal/coderbootstrap","name":"coderbootstrap","synopsis":"Package coderbootstrap contains optional bootstrap integrations with the Coder API.","isRedistributable":true}
