Documentation
¶
Index ¶
- func NewHttpClient() *http.Client
- type Client
- func (c *Client) CreateDomain(teamId int, domainName string) (*Domain, error)
- func (c *Client) CreateTeam(name string, dc int) (*Team, error)
- func (c *Client) CreateWorkspace(args CreateWorkspaceArgs) (*Workspace, error)
- func (c *Client) DeleteDomain(teamId int, domainName string) error
- func (c *Client) DeleteTeam(teamId int) error
- func (c *Client) DeleteWorkspace(workspaceId int) error
- func (client Client) DeployWorkspace(args DeployWorkspaceArgs) (*Workspace, error)
- func (c *Client) ExecCommand(workspaceId int, command string, workdir string, env map[string]string) (string, string, error)
- func (c *Client) GetDomain(teamId int, domainName string) (*Domain, error)
- func (c *Client) GetPipelineState(wsId int, stage string) ([]PipelineStatus, error)
- func (c *Client) GetTeam(teamId int) (*Team, error)
- func (c *Client) GetWorkspace(workspaceId int) (Workspace, error)
- func (c Client) GitPull(workspaceId int, remote string, branch string) error
- func (c *Client) ListDataCenters() ([]DataCenter, error)
- func (c *Client) ListDomains(teamId int) ([]Domain, error)
- func (c *Client) ListTeams() ([]Team, error)
- func (c *Client) ListWorkspacePlans() ([]WorkspacePlan, error)
- func (c *Client) ListWorkspaces(teamId int) ([]Workspace, error)
- func (client *Client) PlanByName(name string) (WorkspacePlan, error)
- func (c *Client) SetEnvVarOnWorkspace(workspaceId int, envVars map[string]string) error
- func (c *Client) StartPipelineStage(wsId int, profile string, stage string) error
- func (client *Client) TeamIdByName(name string) (Team, error)
- func (c *Client) UpdateDomain(teamId int, domainName string, args UpdateDomainArgs) (*Domain, error)
- func (c *Client) UpdateWorkspaceConnections(teamId int, domainName string, connections PathToWorkspaces) (*Domain, error)
- func (c *Client) VerifyDomain(teamId int, domainName string) (*DomainVerificationStatus, error)
- func (client *Client) WaitForWorkspaceRunning(workspace *Workspace, timeout time.Duration) error
- func (c *Client) WorkspaceStatus(workspaceId int) (*WorkspaceStatus, error)
- type Configuration
- type CreateWorkspaceArgs
- type DataCenter
- type DeployWorkspaceArgs
- type Domain
- type DomainVerificationStatus
- type MockTime
- type MockTime_Expecter
- type MockTime_Now_Call
- type MockTime_Sleep_Call
- type PathToWorkspaces
- type PipelineStatus
- type RealTime
- type Team
- type Time
- type UpdateDomainArgs
- type Workspace
- type WorkspacePlan
- type WorkspaceStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHttpClient ¶ added in v0.9.1
NewHttpClient creates a http client to use for API calls. The default http.Client only copies a few "safe" headers This custom CheckRedirect ensures all headers are transferred, including authorization headers which are necessary for DC redirects
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClientWithCustomDeps ¶
func NewClientWithCustomDeps(ctx context.Context, opts Configuration, api *openapi_client.APIClient, time Time) *Client
For use in tests
func (*Client) CreateDomain ¶
func (*Client) CreateWorkspace ¶
func (c *Client) CreateWorkspace(args CreateWorkspaceArgs) (*Workspace, error)
func (*Client) DeleteTeam ¶
func (*Client) DeleteWorkspace ¶ added in v0.6.0
func (Client) DeployWorkspace ¶
func (client Client) DeployWorkspace(args DeployWorkspaceArgs) (*Workspace, error)
Deploys a workspace with the given configuration.
Returns [TimedOut] error if the timeout is reached
func (*Client) ExecCommand ¶ added in v0.3.0
func (*Client) GetPipelineState ¶ added in v0.6.0
func (c *Client) GetPipelineState(wsId int, stage string) ([]PipelineStatus, error)
func (*Client) GetWorkspace ¶ added in v0.3.0
func (*Client) ListDataCenters ¶
func (c *Client) ListDataCenters() ([]DataCenter, error)
func (*Client) ListWorkspacePlans ¶
func (c *Client) ListWorkspacePlans() ([]WorkspacePlan, error)
func (*Client) PlanByName ¶
func (client *Client) PlanByName(name string) (WorkspacePlan, error)
Fetches the workspace plan for a given name.
Returns [NotFound] if no plan with the given Id could be found
func (*Client) SetEnvVarOnWorkspace ¶
func (*Client) StartPipelineStage ¶ added in v0.6.0
func (*Client) TeamIdByName ¶
Fetches the team for a given team name. If the name is ambigous an error is thrown.
Returns [NotFound] if no plan with the given Id could be found Returns [Duplicated] if no plan with the given Id could be found
func (*Client) UpdateDomain ¶
func (*Client) UpdateWorkspaceConnections ¶
func (*Client) VerifyDomain ¶
func (c *Client) VerifyDomain( teamId int, domainName string, ) (*DomainVerificationStatus, error)
func (*Client) WaitForWorkspaceRunning ¶
Waits for a given workspace to be running.
Returns [TimedOut] error if the workspace does not become running in time.
func (*Client) WorkspaceStatus ¶
func (c *Client) WorkspaceStatus(workspaceId int) (*WorkspaceStatus, error)
type Configuration ¶
type Configuration struct { // Url of the codesphere environment // Defaults to https://codesphere.com BaseUrl *url.URL // Codesphere api token Token string }
func (Configuration) GetApiUrl ¶
func (c Configuration) GetApiUrl() *url.URL
type CreateWorkspaceArgs ¶
type CreateWorkspaceArgs = openapi.WorkspacesCreateWorkspaceRequest
type DataCenter ¶
type DataCenter = openapi.MetadataGetDatacenters200ResponseInner
type DeployWorkspaceArgs ¶
type Domain ¶
type Domain = openapi.DomainsGetDomain200Response
type DomainVerificationStatus ¶
type DomainVerificationStatus = openapi.DomainsGetDomain200ResponseDomainVerificationStatus
type MockTime ¶
MockTime is an autogenerated mock type for the Time type
func NewMockTime ¶
NewMockTime creates a new instance of MockTime. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*MockTime) EXPECT ¶
func (_m *MockTime) EXPECT() *MockTime_Expecter
type MockTime_Expecter ¶
type MockTime_Expecter struct {
// contains filtered or unexported fields
}
func (*MockTime_Expecter) Now ¶
func (_e *MockTime_Expecter) Now() *MockTime_Now_Call
Now is a helper method to define mock.On call
func (*MockTime_Expecter) Sleep ¶
func (_e *MockTime_Expecter) Sleep(duration interface{}) *MockTime_Sleep_Call
Sleep is a helper method to define mock.On call
- duration
type MockTime_Now_Call ¶
MockTime_Now_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Now'
func (*MockTime_Now_Call) Return ¶
func (_c *MockTime_Now_Call) Return(time1 time.Time) *MockTime_Now_Call
func (*MockTime_Now_Call) Run ¶
func (_c *MockTime_Now_Call) Run(run func()) *MockTime_Now_Call
func (*MockTime_Now_Call) RunAndReturn ¶
func (_c *MockTime_Now_Call) RunAndReturn(run func() time.Time) *MockTime_Now_Call
type MockTime_Sleep_Call ¶
MockTime_Sleep_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Sleep'
func (*MockTime_Sleep_Call) Return ¶
func (_c *MockTime_Sleep_Call) Return() *MockTime_Sleep_Call
func (*MockTime_Sleep_Call) Run ¶
func (_c *MockTime_Sleep_Call) Run(run func(duration time.Duration)) *MockTime_Sleep_Call
func (*MockTime_Sleep_Call) RunAndReturn ¶
func (_c *MockTime_Sleep_Call) RunAndReturn(run func(duration time.Duration)) *MockTime_Sleep_Call
type PathToWorkspaces ¶
type PipelineStatus ¶ added in v0.6.0
type PipelineStatus = openapi.WorkspacesPipelineStatus200ResponseInner
type Team ¶
type Team = openapi.TeamsListTeams200ResponseInner
func ConvertToTeam ¶
func ConvertToTeam(t *openapi.TeamsGetTeam200Response) *Team
TODO: remove the conversion once the api is fixed
type UpdateDomainArgs ¶
type UpdateDomainArgs = openapi.DomainsGetDomain200ResponseCustomConfig
type Workspace ¶
type Workspace = openapi.WorkspacesGetWorkspace200Response
type WorkspacePlan ¶
type WorkspacePlan = openapi.MetadataGetWorkspacePlans200ResponseInner
type WorkspaceStatus ¶
type WorkspaceStatus = openapi.WorkspacesGetWorkspaceStatus200Response