codesphere

package
v1.24.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIClient

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

APIClient wraps the cs-go API client

func NewClient

func NewClient(baseURL, token string) (*APIClient, error)

NewClient creates a new Codesphere API client

func (*APIClient) CreateWorkspace

func (c *APIClient) CreateWorkspace(teamID, planID int, name string, repoURL *string) (int, error)

CreateWorkspace creates a new workspace and waits for it to be running

func (*APIClient) DeleteWorkspace

func (c *APIClient) DeleteWorkspace(workspaceID int) error

DeleteWorkspace deletes a workspace

func (*APIClient) ExecuteCommand

func (c *APIClient) ExecuteCommand(workspaceID int, command string) error

ExecuteCommand executes a command in the workspace

func (*APIClient) ListTeams added in v0.61.0

func (c *APIClient) ListTeams() ([]api.Team, error)

ListTeams lists the teams available

func (*APIClient) ListWorkspacePlans added in v0.61.0

func (c *APIClient) ListWorkspacePlans() ([]api.WorkspacePlan, error)

ListWorkspacePlans lists the plans available

func (*APIClient) SetEnvVar

func (c *APIClient) SetEnvVar(workspaceID int, key, value string) error

SetEnvVar sets an environment variable in the workspace

func (*APIClient) StartPipeline

func (c *APIClient) StartPipeline(workspaceID int, profile, stage string) error

StartPipeline starts a pipeline stage

func (*APIClient) SyncLandscape

func (c *APIClient) SyncLandscape(workspaceID int, profile string) error

SyncLandscape syncs the landscape/CI configuration

type Client

type Client interface {
	CreateWorkspace(teamID, planID int, name string, repoURL *string) (workspaceID int, err error)
	SetEnvVar(workspaceID int, key, value string) error
	ExecuteCommand(workspaceID int, command string) error
	SyncLandscape(workspaceID int, profile string) error
	StartPipeline(workspaceID int, profile, stage string) error
	DeleteWorkspace(workspaceID int) error
	ListWorkspacePlans() ([]api.WorkspacePlan, error)
	ListTeams() ([]api.Team, error)
}

Client interface abstracts Codesphere API operations for testing

type MockClient

type MockClient struct {
	mock.Mock
}

MockClient is an autogenerated mock type for the Client type

func NewMockClient

func NewMockClient(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockClient

NewMockClient creates a new instance of MockClient. 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 (*MockClient) CreateWorkspace

func (_mock *MockClient) CreateWorkspace(teamID int, planID int, name string, repoURL *string) (int, error)

CreateWorkspace provides a mock function for the type MockClient

func (*MockClient) DeleteWorkspace

func (_mock *MockClient) DeleteWorkspace(workspaceID int) error

DeleteWorkspace provides a mock function for the type MockClient

func (*MockClient) EXPECT

func (_m *MockClient) EXPECT() *MockClient_Expecter

func (*MockClient) ExecuteCommand

func (_mock *MockClient) ExecuteCommand(workspaceID int, command string) error

ExecuteCommand provides a mock function for the type MockClient

func (*MockClient) ListTeams added in v0.61.0

func (_mock *MockClient) ListTeams() ([]api.Team, error)

ListTeams provides a mock function for the type MockClient

func (*MockClient) ListWorkspacePlans added in v0.61.0

func (_mock *MockClient) ListWorkspacePlans() ([]api.WorkspacePlan, error)

ListWorkspacePlans provides a mock function for the type MockClient

func (*MockClient) SetEnvVar

func (_mock *MockClient) SetEnvVar(workspaceID int, key string, value string) error

SetEnvVar provides a mock function for the type MockClient

func (*MockClient) StartPipeline

func (_mock *MockClient) StartPipeline(workspaceID int, profile string, stage string) error

StartPipeline provides a mock function for the type MockClient

func (*MockClient) SyncLandscape

func (_mock *MockClient) SyncLandscape(workspaceID int, profile string) error

SyncLandscape provides a mock function for the type MockClient

type MockClient_CreateWorkspace_Call

type MockClient_CreateWorkspace_Call struct {
	*mock.Call
}

MockClient_CreateWorkspace_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateWorkspace'

func (*MockClient_CreateWorkspace_Call) Return

func (*MockClient_CreateWorkspace_Call) Run

func (_c *MockClient_CreateWorkspace_Call) Run(run func(teamID int, planID int, name string, repoURL *string)) *MockClient_CreateWorkspace_Call

func (*MockClient_CreateWorkspace_Call) RunAndReturn

func (_c *MockClient_CreateWorkspace_Call) RunAndReturn(run func(teamID int, planID int, name string, repoURL *string) (int, error)) *MockClient_CreateWorkspace_Call

type MockClient_DeleteWorkspace_Call

type MockClient_DeleteWorkspace_Call struct {
	*mock.Call
}

MockClient_DeleteWorkspace_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteWorkspace'

func (*MockClient_DeleteWorkspace_Call) Return

func (*MockClient_DeleteWorkspace_Call) Run

func (*MockClient_DeleteWorkspace_Call) RunAndReturn

func (_c *MockClient_DeleteWorkspace_Call) RunAndReturn(run func(workspaceID int) error) *MockClient_DeleteWorkspace_Call

type MockClient_ExecuteCommand_Call

type MockClient_ExecuteCommand_Call struct {
	*mock.Call
}

MockClient_ExecuteCommand_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ExecuteCommand'

func (*MockClient_ExecuteCommand_Call) Return

func (*MockClient_ExecuteCommand_Call) Run

func (_c *MockClient_ExecuteCommand_Call) Run(run func(workspaceID int, command string)) *MockClient_ExecuteCommand_Call

func (*MockClient_ExecuteCommand_Call) RunAndReturn

func (_c *MockClient_ExecuteCommand_Call) RunAndReturn(run func(workspaceID int, command string) error) *MockClient_ExecuteCommand_Call

type MockClient_Expecter

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

func (*MockClient_Expecter) CreateWorkspace

func (_e *MockClient_Expecter) CreateWorkspace(teamID interface{}, planID interface{}, name interface{}, repoURL interface{}) *MockClient_CreateWorkspace_Call

CreateWorkspace is a helper method to define mock.On call

  • teamID int
  • planID int
  • name string
  • repoURL *string

func (*MockClient_Expecter) DeleteWorkspace

func (_e *MockClient_Expecter) DeleteWorkspace(workspaceID interface{}) *MockClient_DeleteWorkspace_Call

DeleteWorkspace is a helper method to define mock.On call

  • workspaceID int

func (*MockClient_Expecter) ExecuteCommand

func (_e *MockClient_Expecter) ExecuteCommand(workspaceID interface{}, command interface{}) *MockClient_ExecuteCommand_Call

ExecuteCommand is a helper method to define mock.On call

  • workspaceID int
  • command string

func (*MockClient_Expecter) ListTeams added in v0.61.0

ListTeams is a helper method to define mock.On call

func (*MockClient_Expecter) ListWorkspacePlans added in v0.61.0

func (_e *MockClient_Expecter) ListWorkspacePlans() *MockClient_ListWorkspacePlans_Call

ListWorkspacePlans is a helper method to define mock.On call

func (*MockClient_Expecter) SetEnvVar

func (_e *MockClient_Expecter) SetEnvVar(workspaceID interface{}, key interface{}, value interface{}) *MockClient_SetEnvVar_Call

SetEnvVar is a helper method to define mock.On call

  • workspaceID int
  • key string
  • value string

func (*MockClient_Expecter) StartPipeline

func (_e *MockClient_Expecter) StartPipeline(workspaceID interface{}, profile interface{}, stage interface{}) *MockClient_StartPipeline_Call

StartPipeline is a helper method to define mock.On call

  • workspaceID int
  • profile string
  • stage string

func (*MockClient_Expecter) SyncLandscape

func (_e *MockClient_Expecter) SyncLandscape(workspaceID interface{}, profile interface{}) *MockClient_SyncLandscape_Call

SyncLandscape is a helper method to define mock.On call

  • workspaceID int
  • profile string

type MockClient_ListTeams_Call added in v0.61.0

type MockClient_ListTeams_Call struct {
	*mock.Call
}

MockClient_ListTeams_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListTeams'

func (*MockClient_ListTeams_Call) Return added in v0.61.0

func (*MockClient_ListTeams_Call) Run added in v0.61.0

func (*MockClient_ListTeams_Call) RunAndReturn added in v0.61.0

func (_c *MockClient_ListTeams_Call) RunAndReturn(run func() ([]api.Team, error)) *MockClient_ListTeams_Call

type MockClient_ListWorkspacePlans_Call added in v0.61.0

type MockClient_ListWorkspacePlans_Call struct {
	*mock.Call
}

MockClient_ListWorkspacePlans_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListWorkspacePlans'

func (*MockClient_ListWorkspacePlans_Call) Return added in v0.61.0

func (*MockClient_ListWorkspacePlans_Call) Run added in v0.61.0

func (*MockClient_ListWorkspacePlans_Call) RunAndReturn added in v0.61.0

type MockClient_SetEnvVar_Call

type MockClient_SetEnvVar_Call struct {
	*mock.Call
}

MockClient_SetEnvVar_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetEnvVar'

func (*MockClient_SetEnvVar_Call) Return

func (*MockClient_SetEnvVar_Call) Run

func (_c *MockClient_SetEnvVar_Call) Run(run func(workspaceID int, key string, value string)) *MockClient_SetEnvVar_Call

func (*MockClient_SetEnvVar_Call) RunAndReturn

func (_c *MockClient_SetEnvVar_Call) RunAndReturn(run func(workspaceID int, key string, value string) error) *MockClient_SetEnvVar_Call

type MockClient_StartPipeline_Call

type MockClient_StartPipeline_Call struct {
	*mock.Call
}

MockClient_StartPipeline_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StartPipeline'

func (*MockClient_StartPipeline_Call) Return

func (*MockClient_StartPipeline_Call) Run

func (_c *MockClient_StartPipeline_Call) Run(run func(workspaceID int, profile string, stage string)) *MockClient_StartPipeline_Call

func (*MockClient_StartPipeline_Call) RunAndReturn

func (_c *MockClient_StartPipeline_Call) RunAndReturn(run func(workspaceID int, profile string, stage string) error) *MockClient_StartPipeline_Call

type MockClient_SyncLandscape_Call

type MockClient_SyncLandscape_Call struct {
	*mock.Call
}

MockClient_SyncLandscape_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SyncLandscape'

func (*MockClient_SyncLandscape_Call) Return

func (*MockClient_SyncLandscape_Call) Run

func (_c *MockClient_SyncLandscape_Call) Run(run func(workspaceID int, profile string)) *MockClient_SyncLandscape_Call

func (*MockClient_SyncLandscape_Call) RunAndReturn

func (_c *MockClient_SyncLandscape_Call) RunAndReturn(run func(workspaceID int, profile string) error) *MockClient_SyncLandscape_Call

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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