che

package
v0.0.0-...-ef83997 Latest Latest
Warning

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

Go to latest
Published: May 2, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IdeUrlRel   = "ide url"
	SelfLinkRel = "self link"
)

Following const define commonly used WorkspaceLink rel

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	CreateWorkspace(ctx context.Context, workspace WorkspaceRequest) (*WorkspaceResponse, error)
	ListWorkspaces(ctx context.Context, repository string) ([]*WorkspaceResponse, error)
	DeleteWorkspace(ctx context.Context, workspaceName string) error
	StartExistingWorkspace(ctx context.Context, workspaceName string) (*WorkspaceResponse, error)
	GetCheServerState(ctx context.Context) (*ServerStateResponse, error)
	StartCheServer(ctx context.Context) (*ServerStateResponse, error)
}

Client the interface for remote operations on Che

func NewStarterClient

func NewStarterClient(cheStarterURL, openshiftMasterURL string, namespace string, client *http.Client) Client

NewStarterClient is a helper function to create a new CheStarter client Uses http.DefaultClient

type ProjectSource

type ProjectSource struct {
	Location   string                  `json:"location,omitempty"`
	Parameters ProjectSourceParameters `json:"parameters,omitempty"`
}

ProjectSource represents project source of workspace

type ProjectSourceParameters

type ProjectSourceParameters struct {
	Branch string `json:"branch,omitempty"`
}

ProjectSourceParameters represent project source parameters e.g. branch

type ServerStateResponse

type ServerStateResponse struct {
	Running     bool `json:"running"`
	MultiTenant bool `json:"multiTenant"`
}

ServerStateResponse represents a get che state response body

type StarterClient

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

StarterClient describes the REST interface between Platform and Che Starter

func (*StarterClient) CreateWorkspace

func (cs *StarterClient) CreateWorkspace(ctx context.Context, workspace WorkspaceRequest) (*WorkspaceResponse, error)

CreateWorkspace creates a new Che Workspace based on a repository

func (*StarterClient) DeleteWorkspace

func (cs *StarterClient) DeleteWorkspace(ctx context.Context, workspaceName string) error

DeleteWorkspace deletes a Che Workspace by its name

func (*StarterClient) GetCheServerState

func (cs *StarterClient) GetCheServerState(ctx context.Context) (*ServerStateResponse, error)

GetCheServerState get che server state.

func (*StarterClient) ListWorkspaces

func (cs *StarterClient) ListWorkspaces(ctx context.Context, repository string) ([]*WorkspaceResponse, error)

ListWorkspaces lists the available workspaces for a given user

func (*StarterClient) StartCheServer

func (cs *StarterClient) StartCheServer(ctx context.Context) (*ServerStateResponse, error)

StartCheServer start che server if not running.

func (*StarterClient) StartExistingWorkspace

func (cs *StarterClient) StartExistingWorkspace(ctx context.Context, workspaceName string) (*WorkspaceResponse, error)

StartExistingWorkspace starts an existing Che Workspace based on a repository

type StarterError

type StarterError struct {
	Status    int    `json:"status"`
	ErrorMsg  string `json:"error"`
	Message   string `json:"message"`
	Timestamp string `json:"timeStamp"`
	Trace     string `json:"trace"`
}

StarterError represent an error comming from the che-starter service

func (*StarterError) Error

func (err *StarterError) Error() string

func (*StarterError) String

func (err *StarterError) String() string

type WorkspaceConfig

type WorkspaceConfig struct {
	Name     string             `json:"name"`
	Projects []WorkspaceProject `json:"projects,omitempty"`
}

WorkspaceConfig represents the workspace config

type WorkspaceLink struct {
	Href   string `json:"href"`
	Method string `json:"method"`
	Rel    string `json:"rel"`
}

WorkspaceLink represents a URL for the location of a workspace

type WorkspaceProject

type WorkspaceProject struct {
	Source ProjectSource `json:"source,omitempty"`
}

WorkspaceProject represents workspace project

type WorkspaceRequest

type WorkspaceRequest struct {
	Branch      string `json:"branch,omitempty"`
	Description string `json:"description,omitempty"`
	Name        string `json:"config.name,omitempty"`
	Repository  string `json:"repo,omitempty"`
	StackID     string `json:"stackId,omitempty"`
}

WorkspaceRequest represents a create workspace request body

type WorkspaceResponse

type WorkspaceResponse struct {
	ID          string          `json:"id,omitempty"`
	Description string          `json:"description,omitempty"`
	Config      WorkspaceConfig `json:"config,omitempty"`
	Status      string          `json:"status,omitempty"`
	Links       []WorkspaceLink `json:"links,omitempty"`
}

WorkspaceResponse represents a create workspace response body

func (w WorkspaceResponse) GetHrefByRelOfWorkspaceLink(rel string) string

GetHrefByRel return the 'href' of 'rel' of WorkspaceLink

{
  "href": "https://che.prod-preview.openshift.io/user/wksp-0dae",
  "rel": "ide url",
  "method": "GET"
}

Jump to

Keyboard shortcuts

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