Back to godoc.org
github.com/ovh/cds / sdk / cdsclient

package cdsclient

v0.0.0 (3ea3a1b)
Latest Go to latest
Published: 3 hours ago | License: BSD-3-Clause | Module: github.com/ovh/cds

Index

Package Files

Constants

const (
	// RequestedIfModifiedSinceHeader is used as HTTP header
	RequestedIfModifiedSinceHeader = "If-Modified-Since"
	// ResponseAPITimeHeader is used as HTTP header
	ResponseAPITimeHeader = "X-Api-Time"
	// ResponseAPINanosecondsTimeHeader is used as HTTP header
	ResponseAPINanosecondsTimeHeader = "X-Api-Nanoseconds-Time"
	// ResponseEtagHeader is used as HTTP header
	ResponseEtagHeader = "Etag"
	// ResponseProcessTimeHeader is used as HTTP header
	ResponseProcessTimeHeader = "X-Api-Process-Time"
)

func NewHTTPClient

func NewHTTPClient(timeout time.Duration, insecureSkipVerifyTLS bool) *http.Client

NewHTTPClient returns a new HTTP Client.

func NewWebsocketDialer

func NewWebsocketDialer(insecureSkipVerifyTLS bool) *websocket.Dialer

type ActionClient

type ActionClient interface {
	ActionDelete(groupName, name string) error
	ActionGet(groupName, name string, mods ...RequestModifier) (*sdk.Action, error)
	ActionUsage(groupName, name string, mods ...RequestModifier) (*sdk.ActionUsages, error)
	ActionList() ([]sdk.Action, error)
	ActionImport(content io.Reader, mods ...RequestModifier) error
	ActionExport(groupName, name string, mods ...RequestModifier) ([]byte, error)
	ActionBuiltinList() ([]sdk.Action, error)
	ActionBuiltinGet(name string, mods ...RequestModifier) (*sdk.Action, error)
}

ActionClient exposes actions related functions

type Admin

type Admin interface {
	AdminDatabaseMigrationDelete(id string) error
	AdminDatabaseMigrationUnlock(id string) error
	AdminDatabaseMigrationsList() ([]sdk.DatabaseMigrationStatus, error)
	AdminDatabaseSignaturesResume() (sdk.CanonicalFormUsageResume, error)
	AdminDatabaseSignaturesRollEntity(e string) error
	AdminDatabaseSignaturesRollAllEntities() error
	AdminDatabaseListEncryptedEntities() ([]string, error)
	AdminDatabaseRollEncryptedEntity(e string) error
	AdminDatabaseRollAllEncryptedEntities() error
	AdminCDSMigrationList() ([]sdk.Migration, error)
	AdminCDSMigrationCancel(id int64) error
	AdminCDSMigrationReset(id int64) error
	Services() ([]sdk.Service, error)
	ServicesByName(name string) (*sdk.Service, error)
	ServiceDelete(name string) error
	ServicesByType(stype string) ([]sdk.Service, error)
	ServiceNameCallGET(name string, url string) ([]byte, error)
	ServiceCallGET(stype string, url string) ([]byte, error)
	ServiceCallPOST(stype string, url string, body []byte) ([]byte, error)
	ServiceCallPUT(stype string, url string, body []byte) ([]byte, error)
	ServiceCallDELETE(stype string, url string) error
}

Admin expose all function to CDS administration

type ApplicationClient

type ApplicationClient interface {
	ApplicationAttachToReposistoriesManager(projectKey, appName, reposManager, repoFullname string) error
	ApplicationCreate(projectKey string, app *sdk.Application) error
	ApplicationUpdate(projectKey string, appName string, app *sdk.Application) error
	ApplicationDelete(projectKey string, appName string) error
	ApplicationGet(projectKey string, appName string, opts ...RequestModifier) (*sdk.Application, error)
	ApplicationList(projectKey string) ([]sdk.Application, error)
	ApplicationVariableClient
	ApplicationKeysClient
}

ApplicationClient exposes application related functions

type ApplicationKeysClient

type ApplicationKeysClient interface {
	ApplicationKeysList(projectKey string, appName string) ([]sdk.ApplicationKey, error)
	ApplicationKeyCreate(projectKey string, appName string, keyApp *sdk.ApplicationKey) error
	ApplicationKeysDelete(projectKey string, appName string, KeyAppName string) error
}

ApplicationKeysClient exposes application keys related functions

type ApplicationVariableClient

type ApplicationVariableClient interface {
	ApplicationVariablesList(projectKey string, appName string) ([]sdk.Variable, error)
	ApplicationVariableCreate(projectKey string, appName string, variable *sdk.Variable) error
	ApplicationVariableDelete(projectKey string, appName string, varName string) error
	ApplicationVariableGet(projectKey string, appName string, varName string) (*sdk.Variable, error)
	ApplicationVariableUpdate(projectKey string, appName string, variable *sdk.Variable) error
}

ApplicationVariableClient exposes application variables related functions

type AuthClient

type AuthClient interface {
	AuthDriverList() (sdk.AuthDriverResponse, error)
	AuthConsumerSignin(sdk.AuthConsumerType, sdk.AuthConsumerSigninRequest) (sdk.AuthConsumerSigninResponse, error)
	AuthConsumerLocalAskResetPassword(sdk.AuthConsumerSigninRequest) error
	AuthConsumerLocalResetPassword(token, newPassword string) (sdk.AuthConsumerSigninResponse, error)
	AuthConsumerLocalSignup(sdk.AuthConsumerSigninRequest) error
	AuthConsumerLocalSignupVerify(token, initToken string) (sdk.AuthConsumerSigninResponse, error)
	AuthConsumerSignout() error
	AuthConsumerListByUser(username string) (sdk.AuthConsumers, error)
	AuthConsumerDelete(username, id string) error
	AuthConsumerRegen(username, id string) (sdk.AuthConsumerCreateResponse, error)
	AuthConsumerCreateForUser(username string, request sdk.AuthConsumer) (sdk.AuthConsumerCreateResponse, error)
	AuthSessionListByUser(username string) (sdk.AuthSessions, error)
	AuthSessionDelete(username, id string) error
	AuthMe() (sdk.AuthCurrentConsumerResponse, error)
}

AuthClient is the interface for authentication management.

type BroadcastClient

type BroadcastClient interface {
	Broadcasts() ([]sdk.Broadcast, error)
	BroadcastCreate(broadcast *sdk.Broadcast) error
	BroadcastGet(id string) (*sdk.Broadcast, error)
	BroadcastDelete(id string) error
}

BroadcastClient expose all function for CDS Broadcasts

type Config

type Config struct {
	Host                              string
	User                              string
	SessionToken                      string
	BuitinConsumerAuthenticationToken string
	Verbose                           bool
	Retry                             int
	InsecureSkipVerifyTLS             bool
	Mutex                             *sync.Mutex
}

Config is the configuration data used by the cdsclient interface implementation

func (*Config) HasValidSessionToken

func (c *Config) HasValidSessionToken() bool

type DownloadClient

type DownloadClient interface {
	Download() ([]sdk.DownloadableResource, error)
	DownloadURLFromAPI(name, os, arch, variant string) string
	DownloadURLFromGithub(filename string) (string, error)
}

DownloadClient exposes download related functions

type EnvironmentClient

type EnvironmentClient interface {
	EnvironmentCreate(projectKey string, env *sdk.Environment) error
	EnvironmentDelete(projectKey string, envName string) error
	EnvironmentGet(projectKey string, envName string, opts ...RequestModifier) (*sdk.Environment, error)
	EnvironmentList(projectKey string) ([]sdk.Environment, error)
	EnvironmentExport(projectKey, name string, mods ...RequestModifier) ([]byte, error)
	EnvironmentImport(projectKey string, content io.Reader, mods ...RequestModifier) ([]string, error)
	EnvironmentVariableClient
	EnvironmentKeysClient
}

EnvironmentClient exposes environment related functions

type EnvironmentKeysClient

type EnvironmentKeysClient interface {
	EnvironmentKeysList(projectKey string, envName string) ([]sdk.EnvironmentKey, error)
	EnvironmentKeyCreate(projectKey string, envName string, keyEnv *sdk.EnvironmentKey) error
	EnvironmentKeysDelete(projectKey string, envName string, keyEnvName string) error
}

EnvironmentKeysClient exposes environment keys related functions

type EnvironmentVariableClient

type EnvironmentVariableClient interface {
	EnvironmentVariablesList(key string, envName string) ([]sdk.Variable, error)
	EnvironmentVariableCreate(projectKey string, envName string, variable *sdk.Variable) error
	EnvironmentVariableDelete(projectKey string, envName string, varName string) error
	EnvironmentVariableGet(projectKey string, envName string, varName string) (*sdk.Variable, error)
	EnvironmentVariableUpdate(projectKey string, envName string, variable *sdk.Variable) error
}

EnvironmentVariableClient exposes environment variables related functions

type EventsClient

type EventsClient interface {
	// Must be  run in a go routine
	WebsocketEventsListen(ctx context.Context, chanMsgToSend <-chan []sdk.WebsocketFilter, chanMsgReceived chan<- sdk.WebsocketEvent)
}

EventsClient listen SSE Events from CDS API

type ExportImportInterface

type ExportImportInterface interface {
	PipelineExport(projectKey, name string, mods ...RequestModifier) ([]byte, error)
	PipelineImport(projectKey string, content io.Reader, mods ...RequestModifier) ([]string, error)
	ApplicationExport(projectKey, name string, mods ...RequestModifier) ([]byte, error)
	ApplicationImport(projectKey string, content io.Reader, mods ...RequestModifier) ([]string, error)
	WorkflowExport(projectKey, name string, mods ...RequestModifier) ([]byte, error)
	WorkflowPull(projectKey, name string, mods ...RequestModifier) (*tar.Reader, error)
	WorkflowImport(projectKey string, content io.Reader, mods ...RequestModifier) ([]string, error)
	WorkerModelExport(groupName, name string, mods ...RequestModifier) ([]byte, error)
	WorkerModelImport(content io.Reader, mods ...RequestModifier) (*sdk.Model, error)
	WorkflowPush(projectKey string, tarContent io.Reader, mods ...RequestModifier) ([]string, *tar.Reader, error)
	WorkflowAsCodeInterface
}

ExportImportInterface exposes pipeline and application export and import function

type Filter

type Filter struct {
	Name, Value string
}

type GRPCPluginsClient

type GRPCPluginsClient interface {
	PluginsList() ([]sdk.GRPCPlugin, error)
	PluginsGet(string) (*sdk.GRPCPlugin, error)
	PluginAdd(*sdk.GRPCPlugin) error
	PluginUpdate(*sdk.GRPCPlugin) error
	PluginDelete(string) error
	PluginAddBinary(*sdk.GRPCPlugin, *sdk.GRPCPluginBinary) error
	PluginDeleteBinary(name, os, arch string) error
	PluginGetBinary(name, os, arch string, w io.Writer) error
	PluginGetBinaryInfos(name, os, arch string) (*sdk.GRPCPluginBinary, error)
}

GRPCPluginsClient exposes plugins API

type GroupClient

type GroupClient interface {
	GroupList() ([]sdk.Group, error)
	GroupGet(name string, mods ...RequestModifier) (*sdk.Group, error)
	GroupCreate(group *sdk.Group) error
	GroupRename(oldName, newName string) error
	GroupDelete(name string) error
	GroupMemberAdd(groupName string, member *sdk.GroupMember) (sdk.Group, error)
	GroupMemberEdit(groupName string, member *sdk.GroupMember) (sdk.Group, error)
	GroupMemberRemove(groupName, username string) error
}

GroupClient exposes groups related functions

type HTTPClient

type HTTPClient interface {
	Do(*http.Request) (*http.Response, error)
}

HTTPClient is a interface for HTTPClient mock

type HookClient

type HookClient interface {
	PollVCSEvents(uuid string, workflowID int64, vcsServer string, timestamp int64) (events sdk.RepositoryEvents, interval time.Duration, err error)
	VCSConfiguration() (map[string]sdk.VCSConfiguration, error)
}

HookClient exposes functions used for hooks services

type IntegrationClient

type IntegrationClient interface {
	IntegrationModelList() ([]sdk.IntegrationModel, error)
	IntegrationModelGet(name string) (sdk.IntegrationModel, error)
	IntegrationModelAdd(m *sdk.IntegrationModel) error
	IntegrationModelUpdate(m *sdk.IntegrationModel) error
	IntegrationModelDelete(name string) error
}

IntegrationClient exposes integration functions

type Interface

type Interface interface {
	Raw
	AuthClient
	ActionClient
	Admin
	APIURL() string
	ApplicationClient
	ConfigUser() (sdk.ConfigUser, error)
	DownloadClient
	EnvironmentClient
	EventsClient
	ExportImportInterface
	GroupClient
	GRPCPluginsClient
	BroadcastClient
	MaintenanceClient
	PipelineClient
	IntegrationClient
	ProjectClient
	QueueClient
	Navbar() ([]sdk.NavbarProjectData, error)
	Requirements() ([]sdk.Requirement, error)
	RepositoriesManagerInterface
	ServiceRegister(context.Context, sdk.Service) (*sdk.Service, error)
	ServiceHeartbeat(sdk.MonitoringStatus) error
	UserClient
	WorkerClient
	WorkflowClient
	MonitoringClient
	HookClient
	Version() (*sdk.Version, error)
	TemplateClient
}

Interface is the main interface for cdsclient package generate mock with "mockgen -source=interface.go -destination=mock_cdsclient/interface_mock.go Interface" from directory ${GOPATH}/src/github.com/ovh/cds/sdk/cdsclient

func New

func New(c Config) Interface

New returns a client from a config struct

func NewServiceClient

func NewServiceClient(cfg ServiceConfig) (Interface, []byte, error)

NewServiceClient returns client for a service

type MaintenanceClient

type MaintenanceClient interface {
	Maintenance(enable bool, hooks bool) error
}

MaintenanceClient manage maintenance mode on CDS

type MonitoringClient

type MonitoringClient interface {
	MonStatus() (*sdk.MonitoringStatus, error)
	MonVersion() (*sdk.Version, error)
	MonDBMigrate() ([]sdk.MonDBMigrate, error)
	MonErrorsGet(requestID string) ([]sdk.Error, error)
}

MonitoringClient exposes monitoring functions

type PipelineClient

type PipelineClient interface {
	PipelineGet(projectKey, name string, mods ...RequestModifier) (*sdk.Pipeline, error)
	PipelineDelete(projectKey, name string) error
	PipelineCreate(projectKey string, pip *sdk.Pipeline) error
	PipelineList(projectKey string) ([]sdk.Pipeline, error)
}

PipelineClient exposes pipelines related functions

type ProjectClient

type ProjectClient interface {
	ProjectCreate(proj *sdk.Project) error
	ProjectDelete(projectKey string) error
	ProjectGroupAdd(projectKey, groupName string, permission int, projectOnly bool) error
	ProjectGroupDelete(projectKey, groupName string) error
	ProjectGet(projectKey string, opts ...RequestModifier) (*sdk.Project, error)
	ProjectUpdate(key string, project *sdk.Project) error
	ProjectList(withApplications, withWorkflow bool, filters ...Filter) ([]sdk.Project, error)
	ProjectKeysClient
	ProjectVariablesClient
	ProjectGroupsImport(projectKey string, content io.Reader, mods ...RequestModifier) (sdk.Project, error)
	ProjectIntegrationImport(projectKey string, content io.Reader, mods ...RequestModifier) (sdk.ProjectIntegration, error)
	ProjectIntegrationGet(projectKey string, integrationName string, clearPassword bool) (sdk.ProjectIntegration, error)
	ProjectIntegrationList(projectKey string) ([]sdk.ProjectIntegration, error)
	ProjectIntegrationDelete(projectKey string, integrationName string) error
	ProjectRepositoryManagerList(projectKey string) ([]sdk.ProjectVCSServer, error)
	ProjectRepositoryManagerDelete(projectKey string, repoManagerName string, force bool) error
}

ProjectClient exposes project related functions

type ProjectKeysClient

type ProjectKeysClient interface {
	ProjectKeysList(projectKey string) ([]sdk.ProjectKey, error)
	ProjectKeyCreate(projectKey string, key *sdk.ProjectKey) error
	ProjectKeysDelete(projectKey string, keyProjectName string) error
}

ProjectKeysClient exposes project keys related functions

type ProjectVariablesClient

type ProjectVariablesClient interface {
	ProjectVariablesList(key string) ([]sdk.Variable, error)
	ProjectVariableCreate(projectKey string, variable *sdk.Variable) error
	ProjectVariableDelete(projectKey string, varName string) error
	ProjectVariableGet(projectKey string, varName string) (*sdk.Variable, error)
	ProjectVariableUpdate(projectKey string, variable *sdk.Variable) error
	VariableEncrypt(projectKey string, varName string, content string) (*sdk.Variable, error)
}

ProjectVariablesClient exposes project variables related functions

type ProviderClient

type ProviderClient interface {
	ApplicationsList(projectKey string, opts ...RequestModifier) ([]sdk.Application, error)
	ApplicationDeploymentStrategyUpdate(projectKey, applicationName, integrationName string, config sdk.IntegrationConfig) error
	ApplicationMetadataUpdate(projectKey, applicationName, key, value string) error
	ProjectsList(opts ...RequestModifier) ([]sdk.Project, error)
	WorkflowsList(projectKey string) ([]sdk.Workflow, error)
	WorkflowLoad(projectKey, workflowName string) (*sdk.Workflow, error)
}
 ProviderClient exposes allowed methods for providers
 Usage:

 	cfg := ProviderConfig{
		Host: "https://my-cds-api:8081",
		Name: "my-provider-name",
		Token: "my-very-long-secret-token",
	}
	client := NewProviderClient(cfg)
	//Get the writable projects of a user
	projects, err := client.ProjectsList(FilterByUser("a-username"), FilterByWritablePermission())
	...

func NewProviderClient

func NewProviderClient(cfg ProviderConfig) ProviderClient

NewProviderClient returns an implementation for ProviderClient interface

type ProviderConfig

type ProviderConfig struct {
	Host                  string
	Token                 string
	RequestSecondsTimeout int
	InsecureSkipVerifyTLS bool
}

ProviderConfig is the configuration data used by the cdsclient ProviderClient interface implementation

type QueueClient

type QueueClient interface {
	QueueWorkflowNodeJobRun(status ...string) ([]sdk.WorkflowNodeJobRun, error)
	QueueCountWorkflowNodeJobRun(since *time.Time, until *time.Time, modelType string, ratioService *int) (sdk.WorkflowNodeJobRunCount, error)
	QueuePolling(ctx context.Context, jobs chan<- sdk.WorkflowNodeJobRun, errs chan<- error, delay time.Duration, modelType string, ratioService *int) error
	QueueTakeJob(ctx context.Context, job sdk.WorkflowNodeJobRun) (*sdk.WorkflowNodeJobRunData, error)
	QueueJobBook(ctx context.Context, id int64) error
	QueueJobRelease(ctx context.Context, id int64) error
	QueueJobInfo(ctx context.Context, id int64) (*sdk.WorkflowNodeJobRun, error)
	QueueJobSendSpawnInfo(ctx context.Context, id int64, in []sdk.SpawnInfo) error
	QueueSendCoverage(ctx context.Context, id int64, report coverage.Report) error
	QueueSendUnitTests(ctx context.Context, id int64, report venom.Tests) error
	QueueSendLogs(ctx context.Context, id int64, log sdk.Log) error
	QueueSendVulnerability(ctx context.Context, id int64, report sdk.VulnerabilityWorkerReport) error
	QueueSendStepResult(ctx context.Context, id int64, res sdk.StepStatus) error
	QueueSendResult(ctx context.Context, id int64, res sdk.Result) error
	QueueArtifactUpload(ctx context.Context, projectKey, integrationName string, nodeJobRunID int64, tag, filePath string) (bool, time.Duration, error)
	QueueStaticFilesUpload(ctx context.Context, projectKey, integrationName string, nodeJobRunID int64, name, entrypoint, staticKey string, tarContent io.Reader) (string, bool, time.Duration, error)
	QueueJobTag(ctx context.Context, jobID int64, tags []sdk.WorkflowRunTag) error
	QueueServiceLogs(ctx context.Context, logs []sdk.ServiceLog) error
}

QueueClient exposes queue related functions

type Raw

type Raw interface {
	PostJSON(ctx context.Context, path string, in interface{}, out interface{}, mods ...RequestModifier) (int, error)
	PutJSON(ctx context.Context, path string, in interface{}, out interface{}, mods ...RequestModifier) (int, error)
	GetJSON(ctx context.Context, path string, out interface{}, mods ...RequestModifier) (int, error)
	DeleteJSON(ctx context.Context, path string, out interface{}, mods ...RequestModifier) (int, error)
	RequestJSON(ctx context.Context, method, path string, in interface{}, out interface{}, mods ...RequestModifier) ([]byte, http.Header, int, error)
	Request(ctx context.Context, method string, path string, body io.Reader, mods ...RequestModifier) ([]byte, http.Header, int, error)
	HTTPClient() *http.Client
	HTTPSSEClient() *http.Client
	HTTPWebsocketClient() *websocket.Dialer
}

Raw is a low-level interface exposing HTTP functions

type ReleaseAsset

type ReleaseAsset struct {
	ID                 *int       `json:"id,omitempty"`
	URL                *string    `json:"url,omitempty"`
	Name               *string    `json:"name,omitempty"`
	Label              *string    `json:"label,omitempty"`
	State              *string    `json:"state,omitempty"`
	ContentType        *string    `json:"content_type,omitempty"`
	Size               *int       `json:"size,omitempty"`
	DownloadCount      *int       `json:"download_count,omitempty"`
	CreatedAt          *Timestamp `json:"created_at,omitempty"`
	UpdatedAt          *Timestamp `json:"updated_at,omitempty"`
	BrowserDownloadURL *string    `json:"browser_download_url,omitempty"`
}

ReleaseAsset represents a GitHub release asset in a repository.

type RepositoriesManagerInterface

type RepositoriesManagerInterface interface {
	RepositoriesList(projectKey string, repoManager string, resync bool) ([]sdk.VCSRepo, error)
}

RepositoriesManagerInterface exposes all repostories manager functions

type RepositoryRelease

type RepositoryRelease struct {
	ID              *int           `json:"id,omitempty"`
	TagName         *string        `json:"tag_name,omitempty"`
	TargetCommitish *string        `json:"target_commitish,omitempty"`
	Name            *string        `json:"name,omitempty"`
	Body            *string        `json:"body,omitempty"`
	Draft           *bool          `json:"draft,omitempty"`
	Prerelease      *bool          `json:"prerelease,omitempty"`
	CreatedAt       *Timestamp     `json:"created_at,omitempty"`
	PublishedAt     *Timestamp     `json:"published_at,omitempty"`
	URL             *string        `json:"url,omitempty"`
	HTMLURL         *string        `json:"html_url,omitempty"`
	AssetsURL       *string        `json:"assets_url,omitempty"`
	Assets          []ReleaseAsset `json:"assets,omitempty"`
	UploadURL       *string        `json:"upload_url,omitempty"`
	ZipballURL      *string        `json:"zipball_url,omitempty"`
	TarballURL      *string        `json:"tarball_url,omitempty"`
}

RepositoryRelease represents a GitHub release in a repository.

type RequestModifier

type RequestModifier func(req *http.Request)

RequestModifier is used to modify behavior of Request and Steam functions

func ContentType

func ContentType(value string) RequestModifier

func FilterByUser

func FilterByUser(username string) RequestModifier

FilterByUser allow a provider to perform a request as a user identified by its username

func FilterByWritablePermission

func FilterByWritablePermission() RequestModifier

FilterByWritablePermission allow a provider to filter only writable objects

func Force

func Force() RequestModifier

func Format

func Format(format string) RequestModifier

func SetHeader

func SetHeader(key, value string) RequestModifier

SetHeader modify headers of http.Request

func WithKeys

func WithKeys() RequestModifier

WithKeys allow a provider to retrieve a project with its keys.

func WithLabels

func WithLabels() RequestModifier

WithLabels allow a provider to retrieve a workflow with its labels

func WithPermissions

func WithPermissions() RequestModifier

WithPermissions allow a provider to retrieve a workflow with its permissions.

func WithQueryParameter

func WithQueryParameter(key, value string) RequestModifier

WithQueryParameter add query parameters to your http.Request

func WithTemplate

func WithTemplate() RequestModifier

WithTemplate allow a provider to retrieve a workflow with template if exists.

func WithUsage

func WithUsage() RequestModifier

WithUsage allow a provider to retrieve an application with its usage

func WithWorkflows

func WithWorkflows() RequestModifier

WithWorkflows allow a provider to retrieve a pipeline with its workflows usage

type ServiceConfig

type ServiceConfig struct {
	Host                  string
	Token                 string
	RequestSecondsTimeout int
	InsecureSkipVerifyTLS bool
	Hook                  func(Interface) error // This hook is used by unit tests
	Verbose               bool
}

ServiceConfig is the configuration data used by the cdsclient interface implementation

type TemplateClient

type TemplateClient interface {
	TemplateGet(groupName, templateSlug string) (*sdk.WorkflowTemplate, error)
	TemplateGetAll() ([]sdk.WorkflowTemplate, error)
	TemplateApply(groupName, templateSlug string, req sdk.WorkflowTemplateRequest) (*tar.Reader, error)
	TemplateBulk(groupName, templateSlug string, req sdk.WorkflowTemplateBulk) (*sdk.WorkflowTemplateBulk, error)
	TemplateGetBulk(groupName, templateSlug string, id int64) (*sdk.WorkflowTemplateBulk, error)
	TemplatePull(groupName, templateSlug string) (*tar.Reader, error)
	TemplatePush(tarContent io.Reader) ([]string, *tar.Reader, error)
	TemplateDelete(groupName, templateSlug string) error
	TemplateGetInstances(groupName, templateSlug string) ([]sdk.WorkflowTemplateInstance, error)
	TemplateDeleteInstance(groupName, templateSlug string, id int64) error
}

TemplateClient exposes templates functions

type Timestamp

type Timestamp struct {
	time.Time
}

Timestamp represents a time that can be unmarshalled from a JSON string formatted as either an RFC3339 or Unix timestamp. This is necessary for some fields since the GitHub API is inconsistent in how it represents times. All exported methods of time.Time can be called on Timestamp.

func (Timestamp) Equal

func (t Timestamp) Equal(u Timestamp) bool

Equal reports whether t and u are equal based on time.Equal

func (Timestamp) String

func (t Timestamp) String() string

func (*Timestamp) UnmarshalJSON

func (t *Timestamp) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON implements the json.Unmarshaler interface. Time is expected in RFC3339 or Unix format.

type UserClient

type UserClient interface {
	UserList() ([]sdk.AuthentifiedUser, error)
	UserGet(username string) (*sdk.AuthentifiedUser, error)
	UserGetMe() (*sdk.AuthentifiedUser, error)
	UserGetGroups(username string) (map[string][]sdk.Group, error)
	UpdateFavorite(params sdk.FavoriteParams) (interface{}, error)
	UserGetSchema() (sdk.SchemaResponse, error)
}

UserClient exposes users functions

type WorkerClient

type WorkerClient interface {
	WorkerModelBook(groupName, name string) error
	WorkerList(ctx context.Context) ([]sdk.Worker, error)
	WorkerRefresh(ctx context.Context) error
	WorkerUnregister(ctx context.Context) error
	WorkerDisable(ctx context.Context, id string) error
	WorkerModelAdd(name, modelType, patternName string, dockerModel *sdk.ModelDocker, vmModel *sdk.ModelVirtualMachine, groupID int64) (sdk.Model, error)
	WorkerModelGet(groupName, name string) (sdk.Model, error)
	WorkerModelDelete(groupName, name string) error
	WorkerModelSpawnError(groupName, name string, info sdk.SpawnErrorForm) error
	WorkerModelList(*WorkerModelFilter) ([]sdk.Model, error)
	WorkerModelEnabledList() ([]sdk.Model, error)
	WorkerModelSecretList(groupName, name string) (sdk.WorkerModelSecrets, error)
	WorkerRegister(ctx context.Context, authToken string, form sdk.WorkerRegistrationForm) (*sdk.Worker, bool, error)
	WorkerSetStatus(ctx context.Context, status string) error
}

WorkerClient exposes workers functions

type WorkerInterface

type WorkerInterface interface {
	GRPCPluginsClient
	ProjectIntegrationGet(projectKey string, integrationName string, clearPassword bool) (sdk.ProjectIntegration, error)
	QueueClient
	Requirements() ([]sdk.Requirement, error)
	ServiceConfigurationGet(context.Context, string) ([]sdk.ServiceConfiguration, error)
	WorkerClient
	WorkflowRunArtifacts(projectKey string, name string, number int64) ([]sdk.WorkflowNodeRunArtifact, error)
	WorkflowCachePush(projectKey, integrationName, ref string, tarContent io.Reader, size int) error
	WorkflowCachePull(projectKey, integrationName, ref string) (io.Reader, error)
	WorkflowRunSearch(projectKey string, offset, limit int64, filter ...Filter) ([]sdk.WorkflowRun, error)
	WorkflowNodeRunArtifactDownload(projectKey string, name string, a sdk.WorkflowNodeRunArtifact, w io.Writer) error
	WorkflowNodeRunRelease(projectKey string, workflowName string, runNumber int64, nodeRunID int64, release sdk.WorkflowNodeRunRelease) error
}

func NewWorker

func NewWorker(endpoint string, name string, c *http.Client) WorkerInterface

NewWorker returns client for a worker

type WorkerModelFilter

type WorkerModelFilter struct {
	State  string
	Binary string
}

WorkerModelFilter for model's calls.

type WorkflowAsCodeInterface

type WorkflowAsCodeInterface interface {
	WorkflowAsCodeStart(projectKey string, repoURL string, repoStrategy sdk.RepositoryStrategy) (*sdk.Operation, error)
	WorkflowAsCodeInfo(projectKey string, operationID string) (*sdk.Operation, error)
	WorkflowAsCodePerform(projectKey string, operationID string) ([]string, error)
}

WorkflowAsCodeInterface exposes all workflow as code functions

type WorkflowClient

type WorkflowClient interface {
	WorkflowSearch(opts ...RequestModifier) ([]sdk.Workflow, error)
	WorkflowList(projectKey string, opts ...RequestModifier) ([]sdk.Workflow, error)
	WorkflowGet(projectKey, name string, opts ...RequestModifier) (*sdk.Workflow, error)
	WorkflowUpdate(projectKey, name string, wf *sdk.Workflow) error
	WorkflowDelete(projectKey string, workflowName string) error
	WorkflowLabelAdd(projectKey, name, labelName string) error
	WorkflowLabelDelete(projectKey, name string, labelID int64) error
	WorkflowGroupAdd(projectKey, name, groupName string, permission int) error
	WorkflowGroupDelete(projectKey, name, groupName string) error
	WorkflowRunGet(projectKey string, workflowName string, number int64) (*sdk.WorkflowRun, error)
	WorkflowRunsDeleteByBranch(projectKey string, workflowName string, branch string) error
	WorkflowRunResync(projectKey string, workflowName string, number int64) (*sdk.WorkflowRun, error)
	WorkflowRunSearch(projectKey string, offset, limit int64, filter ...Filter) ([]sdk.WorkflowRun, error)
	WorkflowRunList(projectKey string, workflowName string, offset, limit int64) ([]sdk.WorkflowRun, error)
	WorkflowRunArtifacts(projectKey string, name string, number int64) ([]sdk.WorkflowNodeRunArtifact, error)
	WorkflowRunFromHook(projectKey string, workflowName string, hook sdk.WorkflowNodeRunHookEvent) (*sdk.WorkflowRun, error)
	WorkflowRunFromManual(projectKey string, workflowName string, manual sdk.WorkflowNodeRunManual, number, fromNodeID int64) (*sdk.WorkflowRun, error)
	WorkflowRunNumberGet(projectKey string, workflowName string) (*sdk.WorkflowRunNumber, error)
	WorkflowRunNumberSet(projectKey string, workflowName string, number int64) error
	WorkflowStop(projectKey string, workflowName string, number int64) (*sdk.WorkflowRun, error)
	WorkflowNodeStop(projectKey string, workflowName string, number, fromNodeID int64) (*sdk.WorkflowNodeRun, error)
	WorkflowNodeRun(projectKey string, name string, number int64, nodeRunID int64) (*sdk.WorkflowNodeRun, error)
	WorkflowNodeRunArtifactDownload(projectKey string, name string, a sdk.WorkflowNodeRunArtifact, w io.Writer) error
	WorkflowNodeRunJobStep(projectKey string, workflowName string, number int64, nodeRunID, job int64, step int) (*sdk.BuildState, error)
	WorkflowNodeRunRelease(projectKey string, workflowName string, runNumber int64, nodeRunID int64, release sdk.WorkflowNodeRunRelease) error
	WorkflowAllHooksList() ([]sdk.NodeHook, error)
	WorkflowCachePush(projectKey, integrationName, ref string, tarContent io.Reader, size int) error
	WorkflowCachePull(projectKey, integrationName, ref string) (io.Reader, error)
	WorkflowTransformAsCode(projectKey, workflowName, branch, message string) (*sdk.Operation, error)
	WorkflowTransformAsCodeFollow(projectKey, workflowName, opeUUID string) (*sdk.Operation, error)
}

WorkflowClient exposes workflows functions

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier