coder

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2020 License: GPL-3.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

View Source
const Me = "me"

Me is the route param to access resources of the authenticated user

Variables

View Source
var ErrNotFound = xerrors.Errorf("resource not found")

ErrNotFound describes an error case in which the requested resource could not be found

Functions

This section is empty.

Types

type Client

type Client struct {
	BaseURL *url.URL
	Token   string
}

Client wraps the Coder HTTP API

func (Client) DelDevURL

func (c Client) DelDevURL(ctx context.Context, envID, urlID string) error

DelDevURL deletes the specified devurl

func (*Client) DeleteSecretByName

func (c *Client) DeleteSecretByName(ctx context.Context, name, userID string) error

DeleteSecretByName deletes the authenticated users secret with the given name

func (Client) DialWsep

func (c Client) DialWsep(ctx context.Context, env *Environment) (*websocket.Conn, error)

DialWsep dials an environments command execution interface See github.com/cdr/wsep for details

func (Client) EnvironmentsByOrganization

func (c Client) EnvironmentsByOrganization(ctx context.Context, userID, orgID string) ([]Environment, error)

EnvironmentsByOrganization gets the list of environments owned by the given user.

func (Client) InsertDevURL

func (c Client) InsertDevURL(ctx context.Context, envID string, port int, name, access string) error

InsertDevURL inserts a new devurl for the authenticated user

func (*Client) InsertSecret

func (c *Client) InsertSecret(ctx context.Context, user *User, req InsertSecretReq) error

InsertSecret adds a new secret for the authed user

func (Client) Me

func (c Client) Me(ctx context.Context) (*User, error)

Me gets the details of the authenticated user.

func (Client) Orgs

func (c Client) Orgs(ctx context.Context) ([]Org, error)

Orgs gets all Organizations

func (Client) PushActivity

func (c Client) PushActivity(ctx context.Context, source string, envID string) error

PushActivity pushes CLI activity to Coder.

func (Client) SSHKey

func (c Client) SSHKey(ctx context.Context) (*SSHKey, error)

SSHKey gets the current SSH kepair of the authenticated user.

func (*Client) SecretByName

func (c *Client) SecretByName(ctx context.Context, name, userID string) (*Secret, error)

SecretByName gets a secret object by name

func (*Client) SecretWithValueByID

func (c *Client) SecretWithValueByID(ctx context.Context, id, userID string) (*Secret, error)

SecretWithValueByID gets the Coder secret with its value by the secret_id.

func (*Client) SecretWithValueByName

func (c *Client) SecretWithValueByName(ctx context.Context, name, userID string) (*Secret, error)

SecretWithValueByName gets the Coder secret with its value by its name.

func (*Client) Secrets

func (c *Client) Secrets(ctx context.Context, userID string) ([]Secret, error)

Secrets gets all secrets for the given user

func (Client) UpdateDevURL

func (c Client) UpdateDevURL(ctx context.Context, envID, urlID string, port int, name, access string) error

UpdateDevURL updates an existing devurl for the authenticated user

func (Client) UserByEmail

func (c Client) UserByEmail(ctx context.Context, email string) (*User, error)

UserByEmail gets a user by email.

func (Client) UserByID

func (c Client) UserByID(ctx context.Context, id string) (*User, error)

UserByID get the details of a user by their id.

func (Client) Users

func (c Client) Users(ctx context.Context) ([]User, error)

Users gets the list of user accounts.

type DevURL

type DevURL struct {
	ID     string `json:"id"`
	URL    string `json:"url"`
	Port   int    `json:"port"`
	Access string `json:"access"`
	Name   string `json:"name"`
}

DevURL is the parsed json response record for a devURL from cemanager

type Environment

type Environment struct {
	ID              string    `json:"id" tab:"-"`
	Name            string    `json:"name"`
	ImageID         string    `json:"image_id" tab:"-"`
	ImageTag        string    `json:"image_tag"`
	OrganizationID  string    `json:"organization_id" tab:"-"`
	UserID          string    `json:"user_id" tab:"-"`
	LastBuiltAt     time.Time `json:"last_built_at" tab:"-"`
	CPUCores        float32   `json:"cpu_cores"`
	MemoryGB        int       `json:"memory_gb"`
	DiskGB          int       `json:"disk_gb"`
	GPUs            int       `json:"gpus"`
	Updating        bool      `json:"updating"`
	RebuildMessages []struct {
		Text     string `json:"text"`
		Required bool   `json:"required"`
	} `json:"rebuild_messages" tab:"-"`
	CreatedAt        time.Time      `json:"created_at" tab:"-"`
	UpdatedAt        time.Time      `json:"updated_at" tab:"-"`
	LastOpenedAt     time.Time      `json:"last_opened_at" tab:"-"`
	LastConnectionAt time.Time      `json:"last_connection_at" tab:"-"`
	AutoOffThreshold xjson.Duration `json:"auto_off_threshold" tab:"-"`
}

Environment describes a Coder environment

type InsertSecretReq

type InsertSecretReq struct {
	Name        string `json:"name"`
	Value       string `json:"value"`
	Description string `json:"description"`
}

InsertSecretReq describes the request body for creating a new secret

type Org

type Org struct {
	ID      string `json:"id"`
	Name    string `json:"name"`
	Members []User `json:"members"`
}

Org describes an Organization in Coder

type SSHKey

type SSHKey struct {
	PublicKey  string `json:"public_key"`
	PrivateKey string `json:"private_key"`
}

SSHKey describes an SSH keypair

type Secret

type Secret struct {
	ID          string    `json:"id" tab:"-"`
	Name        string    `json:"name"`
	Value       string    `json:"value,omitempty"`
	Description string    `json:"description"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at" tab:"-"`
}

Secret describes a Coder secret

type User

type User struct {
	ID        string    `json:"id" tab:"-"`
	Email     string    `json:"email"`
	Username  string    `json:"username"`
	Name      string    `json:"name"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at" tab:"-"`
}

User describes a Coder user account.

Jump to

Keyboard shortcuts

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