cdsclient

package
Version: v0.50.0 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2021 License: BSD-3-Clause Imports: 36 Imported by: 3

Documentation

Index

Constants

View Source
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"
)

Variables

This section is empty.

Functions

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

Types

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(service string, id string) error
	AdminDatabaseMigrationUnlock(service string, id string) error
	AdminDatabaseMigrationsList(service string) ([]sdk.DatabaseMigrationStatus, error)
	AdminDatabaseSignaturesResume(service string) (sdk.CanonicalFormUsageResume, error)
	AdminDatabaseSignaturesRollEntity(service string, e string) error
	AdminDatabaseSignaturesRollAllEntities(service string) error
	AdminDatabaseListEncryptedEntities(service string) ([]string, error)
	AdminDatabaseRollEncryptedEntity(service string, e string) error
	AdminDatabaseRollAllEncryptedEntities(service string) error
	AdminCDSMigrationList() ([]sdk.Migration, error)
	AdminCDSMigrationCancel(id int64) error
	AdminCDSMigrationReset(id int64) error
	AdminWorkflowUpdateMaxRuns(projectKey string, workflowName string, maxRuns int64) error
	Features() ([]sdk.Feature, error)
	FeatureCreate(f sdk.Feature) error
	FeatureDelete(name sdk.FeatureName) error
	FeatureGet(name sdk.FeatureName) (sdk.Feature, error)
	FeatureUpdate(f sdk.Feature) 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, newDuration int64, overlapDuration string) (sdk.AuthConsumerCreateResponse, error)
	AuthConsumerCreateForUser(username string, request sdk.AuthConsumer) (sdk.AuthConsumerCreateResponse, error)
	AuthSessionListByUser(username string) (sdk.AuthSessions, error)
	AuthSessionDelete(username, id string) error
	AuthSessionGet(id string) (sdk.AuthCurrentConsumerResponse, 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 CDNClient

type CDNClient interface {
	CDNItemUpload(ctx context.Context, cdnAddr string, signature string, fs afero.Fs, path string) (time.Duration, error)
	CDNItemDownload(ctx context.Context, cdnAddr string, hash string, itemType sdk.CDNItemType, md5 string, writer io.WriteSeeker) error
	CDNItemStream(ctx context.Context, cdnAddr string, hash string, itemType sdk.CDNItemType) (io.Reader, error)
}

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
}

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 Error

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

func (*Error) Cause

func (e *Error) Cause() error

func (*Error) Error

func (e *Error) Error() string

func (*Error) StackTrace

func (e *Error) StackTrace() string

type EventsClient

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

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)
	GroupExport(name string, mods ...RequestModifier) ([]byte, error)
	GroupImport(content io.Reader, mods ...RequestModifier) ([]byte, 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

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(ctx context.Context, 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
	ProjectAccess(ctx context.Context, projectKey, sessionID string, itemType sdk.CDNItemType) error
	ProjectIntegrationWorkerHookGet(projectKey string, integrationName string) (*sdk.WorkerHookProjectIntegrationModel, error)
	ProjectIntegrationWorkerHooksImport(projectKey string, integrationName string, hook sdk.WorkerHookProjectIntegrationModel) 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)
	VariableListEncrypt(projectKey string) ([]sdk.Secret, error)
	VariableEncryptDelete(projectKey, name string) 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(mods ...RequestModifier) ([]sdk.WorkflowNodeJobRun, error)
	QueueCountWorkflowNodeJobRun(since *time.Time, until *time.Time, modelType string, ratioService *int) (sdk.WorkflowNodeJobRunCount, error)
	QueuePolling(ctx context.Context, goRoutines *sdk.GoRoutines, jobs chan<- sdk.WorkflowNodeJobRun, errs chan<- error, delay time.Duration, ms ...RequestModifier) error
	QueueTakeJob(ctx context.Context, job sdk.WorkflowNodeJobRun) (*sdk.WorkflowNodeJobRunData, error)
	QueueJobBook(ctx context.Context, id int64) (sdk.WorkflowNodeJobRunBooked, 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
	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
	QueueJobSetVersion(ctx context.Context, jobID int64, version sdk.WorkflowRunVersion) error
	QueueWorkerCacheLink(ctx context.Context, jobID int64, tag string) (sdk.CDNItemLinks, error)
	QueueWorkflowRunResultsAdd(ctx context.Context, jobID int64, addRequest sdk.WorkflowRunResult) error
	QueueWorkflowRunResultCheck(ctx context.Context, jobID int64, runResultCheck sdk.WorkflowRunResultCheck) (int, 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)
	Stream(ctx context.Context, httpClient HTTPClient, method string, path string, body io.Reader, mods ...RequestModifier) (io.ReadCloser, http.Header, int, error)
	HTTPClient() *http.Client
	HTTPNoTimeoutClient() *http.Client
	HTTPWebsocketClient() *websocket.Dialer
}

Raw is a low-level interface exposing HTTP functions

type RepositoriesManagerInterface

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

RepositoriesManagerInterface exposes all repostories manager functions

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 Full

func Full() RequestModifier

Full allows to get job details on a workflow v3.

func ModelType

func ModelType(modelType string) RequestModifier

func RatioService

func RatioService(ratioService int) RequestModifier

func Region

func Region(regions ...string) RequestModifier

func SetHeader

func SetHeader(key, value string) RequestModifier

SetHeader modify headers of http.Request

func Status

func Status(status ...string) RequestModifier

func WithDeepPipelines

func WithDeepPipelines() RequestModifier

WithDeepPipelines allows to get pipelines details on a workflow.

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 ServiceClient

type ServiceClient interface {
	ServiceConfigurationGet(context.Context, string) ([]sdk.ServiceConfiguration, error)
}

ServiceClient exposes functions used for services

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 UserClient

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

UserClient exposes users functions

type WebsocketClient

type WebsocketClient interface {
	RequestWebsocket(ctx context.Context, goRoutines *sdk.GoRoutines, path string, msgToSend <-chan json.RawMessage, msgReceived chan<- json.RawMessage, errorReceived chan<- error) error
}

type WorkerClient

type WorkerClient interface {
	WorkerGet(ctx context.Context, name string, mods ...RequestModifier) (*sdk.Worker, error)
	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
	CDNClient
}

WorkerClient exposes workers functions

type WorkerInterface

type WorkerInterface interface {
	GRPCPluginsClient
	ProjectIntegrationGet(projectKey string, integrationName string, clearPassword bool) (sdk.ProjectIntegration, error)
	ProjectIntegrationWorkerHookGet(projectKey string, integrationName string) (*sdk.WorkerHookProjectIntegrationModel, error)
	QueueClient
	Requirements() ([]sdk.Requirement, error)
	ServiceClient
	WorkerClient
	WorkflowRunArtifacts(projectKey string, name string, number int64) ([]sdk.WorkflowNodeRunArtifact, error)
	WorkflowRunGet(projectKey string, workflowName string, number int64) (*sdk.WorkflowRun, error)
	WorkflowCachePush(projectKey, integrationName, ref string, tarContent io.Reader, size int) error
	WorkflowCachePull(projectKey, integrationName, ref string) (io.Reader, error)
	WorkflowRunList(projectKey string, workflowName string, offset, limit int64) ([]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
	WorkflowRunArtifactsLinks(projectKey string, name string, number int64) (sdk.CDNItemLinks, error)
	WorkflowRunResultsList(ctx context.Context, projectKey string, name string, number int64) ([]sdk.WorkflowRunResult, 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, opts ...RequestModifier) 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
	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)
	WorkflowRunArtifactsLinks(projectKey string, name string, number int64) (sdk.CDNItemLinks, error)
	WorkflowRunResultsList(ctx context.Context, projectKey string, name string, number int64) ([]sdk.WorkflowRunResult, 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
	WorkflowNodeRunJobStepLinks(ctx context.Context, projectKey string, workflowName string, nodeRunID, job int64) (*sdk.CDNLogLinks, error)
	WorkflowNodeRunJobStepLink(ctx context.Context, projectKey string, workflowName string, nodeRunID, job int64, step int64) (*sdk.CDNLogLink, error)
	WorkflowNodeRunJobServiceLink(ctx context.Context, projectKey string, workflowName string, nodeRunID, job int64, serviceName string) (*sdk.CDNLogLink, error)
	WorkflowAccess(ctx context.Context, projectKey string, workflowID int64, sessionID string, itemType sdk.CDNItemType) error
	WorkflowLogDownload(ctx context.Context, link sdk.CDNLogLink) ([]byte, error)
	WorkflowNodeRunRelease(projectKey string, workflowName string, runNumber int64, nodeRunID int64, release sdk.WorkflowNodeRunRelease) error
	WorkflowAllHooksList() ([]sdk.NodeHook, error)
	WorkflowAllHooksExecutions() ([]string, 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)
}

WorkflowClient exposes workflows functions

type WorkflowV3Client

type WorkflowV3Client interface {
	WorkflowV3Get(projectKey string, workflowName string, opts ...RequestModifier) ([]byte, error)
}

Directories

Path Synopsis
Package mock_cdsclient is a generated GoMock package.
Package mock_cdsclient is a generated GoMock package.

Jump to

Keyboard shortcuts

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