codefresh

package
v0.55.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: Apache-2.0 Imports: 15 Imported by: 22

Documentation

Index

Constants

View Source
const (
	KubernetesRunnerType = "kubernetes"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Account added in v0.26.2

type Account struct {
	Name string `json:"name"`
	ID   string `json:"_id"`
}

type AgentState added in v0.19.6

type AgentState struct {
	Kind  string      `json:"type"`
	Items interface{} `json:"items"`
}

type Annotation added in v0.19.6

type Annotation struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type AppProxyAPI added in v0.36.0

type AppProxyAPI interface {
	AppProxyClusters() IAppProxyClustersAPI
	GitIntegrations() IAppProxyGitIntegrationsAPI
	VersionInfo() IAppProxyVersionInfoAPI
	AppProxyGitSources() IAppProxyGitSourcesAPI
	AppProxyIsc() IAppProxyIscAPI
}

type ApplicationResources added in v0.19.6

type ApplicationResources struct {
	Name      string      `json:"name, omitempty"`
	HistoryId int64       `json:"historyId"`
	Revision  string      `json:"revision, omitempty"`
	Resources interface{} `json:"resources"`
	Context   *string     `json:"context"`
}

type ArgoAPI added in v0.19.6

type ArgoAPI interface {
	CreateIntegration(integration IntegrationPayloadData) error
	UpdateIntegration(name string, integration IntegrationPayloadData) error
	GetIntegrations() ([]*IntegrationPayload, error)
	GetIntegrationByName(name string) (*IntegrationPayload, error)
	DeleteIntegrationByName(name string) error
	HeartBeat(error string, version string, integration string) error
	SendResources(kind string, items interface{}, amount int, integration string) error
}

type AuthOptions

type AuthOptions struct {

	// Token - Codefresh token
	Token string
}

AuthOptions

type CFEnvironment added in v0.19.6

type CFEnvironment struct {
	Metadata struct {
		Name string `json:"name"`
	} `json:"metadata"`
	Spec struct {
		Type        string `json:"type"`
		Application string `json:"application"`
	} `json:"spec"`
}

type CliReleases added in v0.35.0

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

func (*CliReleases) GetLatest added in v0.35.0

func (releases *CliReleases) GetLatest(ctx context.Context) (string, error)

type ClientOptions added in v0.2.1

type ClientOptions struct {
	Auth   AuthOptions
	Debug  bool
	Host   string
	Client *http.Client
	// contains filtered or unexported fields
}

Options

type Cluster added in v0.19.5

type Cluster struct {
	Auth struct {
		Bearer string
	} `json:"auth"`
	Ca  string `json:"ca"`
	Url string `json:"url"`
}

type ClusterMinified added in v0.19.5

type ClusterMinified struct {
	Cluster struct {
		Name string `json:"name"`
	} `json:"cluster"`

	BehindFirewall bool   `json:"behindFirewall"`
	Selector       string `json:"selector"`
	Provider       string `json:"provider"`
}

type Codefresh

type Codefresh interface {
	Pipelines() IPipelineAPI
	Tokens() ITokenAPI
	RuntimeEnvironments() IRuntimeEnvironmentAPI
	Workflows() IWorkflowAPI
	Progresses() IProgressAPI
	Clusters() IClusterAPI
	Contexts() IContextAPI
	Users() UsersAPI
	Argo() ArgoAPI
	Gitops() GitopsAPI
	V2() V2API
	AppProxy(ctx context.Context, runtime string, insecure bool) (AppProxyAPI, error)
}

func New

func New(opt *ClientOptions) Codefresh

type CodefreshEvent added in v0.19.6

type CodefreshEvent struct {
	Event string            `json:"event"`
	Props map[string]string `json:"props"`
}

type Commit added in v0.19.6

type Commit struct {
	Time    *time.Time `json:"time,omitempty"`
	Message *string    `json:"message"`
	Avatar  *string    `json:"avatar"`
}

type ContextPayload added in v0.19.5

type ContextPayload struct {
	Metadata struct {
		Name string `json:"name"`
	}
	Spec struct {
		Type string `json:"type"`
		Data struct {
			Auth struct {
				Type     string `json:"type"`
				Username string `json:"username"`
				Password string `json:"password"`
				ApiHost  string `json:"apiHost"`
				// for gitlab
				ApiURL         string `json:"apiURL"`
				ApiPathPrefix  string `json:"apiPathPrefix"`
				SshPrivateKey  string `json:"sshPrivateKey"`
				AppId          string `json:"appId"`
				InstallationId string `json:"installationId"`
				PrivateKey     string `json:"privateKey"`
			} `json:"auth"`
		} `json:"data"`
	} `json:"spec"`
}

type CreateResponse added in v0.4.0

type CreateResponse struct {
	Name string
}

type CreateRuntimeOptions added in v0.1.0

type CreateRuntimeOptions struct {
	Cluster            string
	Namespace          string
	HasAgent           bool
	StorageClass       string
	RunnerType         string
	DockerDaemonParams string
	NodeSelector       map[string]string
	Annotations        map[string]string
}

type DockerDaemonScheduler added in v0.3.0

type DockerDaemonScheduler struct {
	Cluster struct {
		ClusterProvider struct {
			AccountID string `json:"accountId"`
			Selector  string `json:"selector"`
		} `json:"clusterProvider"`
		Namespace string `json:"namespace"`
	} `json:"cluster"`
	UserAccess bool `json:"userAccess"`
}

type Environment added in v0.19.6

type Environment struct {
	Gitops       Gitops                `json:"gitops"`
	FinishedAt   string                `json:"finishedAt"`
	HealthStatus string                `json:"healthStatus"`
	SyncStatus   string                `json:"status"`
	HistoryId    int64                 `json:"historyId"`
	SyncRevision string                `json:"revision"`
	Name         string                `json:"name"`
	Activities   []EnvironmentActivity `json:"activities"`
	Resources    interface{}           `json:"resources"`
	RepoUrl      string                `json:"repoUrl"`
	Commit       Commit                `json:"commit"`
	SyncPolicy   SyncPolicy            `json:"syncPolicy"`
	Date         string                `json:"date"`
	ParentApp    string                `json:"parentApp"`
	Namespace    string                `json:"namespace"`
	Server       string                `json:"server"`
	Context      *string               `json:"context"`
}

type EnvironmentActivity added in v0.19.6

type EnvironmentActivity struct {
	Name         string                `json:"name"`
	TargetImages []string              `json:"targetImages"`
	Status       string                `json:"status"`
	LiveImages   []string              `json:"liveImages"`
	ReplicaSet   EnvironmentActivityRS `json:"replicaSet"`
}

type EnvironmentActivityRS added in v0.19.6

type EnvironmentActivityRS struct {
	From ReplicaState `json:"from"`
	To   ReplicaState `json:"to"`
}

type EnvironmentMetadata added in v0.19.6

type EnvironmentMetadata struct {
	Name string `json:"name"`
}

type EnvironmentPayload added in v0.19.6

type EnvironmentPayload struct {
	Version  string              `json:"version"`
	Metadata EnvironmentMetadata `json:"metadata"`
	Spec     EnvironmentSpec     `json:"spec"`
}

type EnvironmentSpec added in v0.19.6

type EnvironmentSpec struct {
	Type        string `json:"type"`
	Context     string `json:"context"`
	Project     string `json:"project"`
	Application string `json:"application"`
}

type GitContextsQs added in v0.25.3

type GitContextsQs struct {
	Type    []string `url:"type"`
	Decrypt string   `url:"decrypt"`
}

type Gitops added in v0.19.6

type Gitops struct {
	Comitters []GitopsUser `json:"comitters"`
	Prs       []Annotation `json:"prs"`
	Issues    []Annotation `json:"issues"`
}

type GitopsAPI added in v0.19.6

type GitopsAPI interface {
	CreateEnvironment(name string, project string, application string, integration string) error
	SendEnvironment(environment Environment) (map[string]interface{}, error)
	DeleteEnvironment(name string) error
	GetEnvironments() ([]CFEnvironment, error)
	SendEvent(name string, props map[string]string) error
	SendApplicationResources(resources *ApplicationResources) error
}

type GitopsUser added in v0.26.2

type GitopsUser struct {
	Name   string `json:"name"`
	Avatar string `json:"avatar"`
}

type Heartbeat added in v0.19.6

type Heartbeat struct {
	Error        string `json:"error"`
	AgentVersion string `json:"agentVersion"`
}

type IAppProxyClustersAPI added in v0.38.0

type IAppProxyClustersAPI interface {
	CreateArgoRollouts(ctx context.Context, server string, namespace string) error
	Delete(ctx context.Context, server string, runtime string) error
}

type IAppProxyGitIntegrationsAPI added in v0.36.0

type IAppProxyGitIntegrationsAPI interface {
	List(ctx context.Context) ([]model.GitIntegration, error)
	Get(ctx context.Context, name *string) (*model.GitIntegration, error)
	Add(ctx context.Context, args *model.AddGitIntegrationArgs) (*model.GitIntegration, error)
	Edit(ctx context.Context, args *model.EditGitIntegrationArgs) (*model.GitIntegration, error)
	Remove(ctx context.Context, name string) error
	Register(ctx context.Context, args *model.RegisterToGitIntegrationArgs) (*model.GitIntegration, error)
	Deregister(ctx context.Context, name *string) (*model.GitIntegration, error)
}

type IAppProxyGitSourcesAPI added in v0.41.0

type IAppProxyGitSourcesAPI interface {
	Create(ctx context.Context, opts *appProxyModel.CreateGitSourceInput) error
	Delete(ctx context.Context, appName string) error
	Edit(ctx context.Context, opts *appProxyModel.EditGitSourceInput) error
}

type IAppProxyIscAPI added in v0.44.0

type IAppProxyIscAPI interface {
	RemoveRuntimeFromIscRepo(ctx context.Context) (int, error)
}

type IAppProxyVersionInfoAPI added in v0.36.0

type IAppProxyVersionInfoAPI interface {
	VersionInfo(ctx context.Context) (*model.AppProxyVersionInfo, error)
}

type ICliReleasesAPI added in v0.35.0

type ICliReleasesAPI interface {
	GetLatest(ctx context.Context) (string, error)
}

type IClusterAPI added in v0.19.5

type IClusterAPI interface {
	GetClusterCredentialsByAccountId(selector string) (*Cluster, error)
	GetAccountClusters() ([]*ClusterMinified, error)
}

type IClusterV2API added in v0.42.0

type IClusterV2API interface {
	List(ctx context.Context, runtime string) ([]model.Cluster, error)
}

type IComponentAPI added in v0.32.0

type IComponentAPI interface {
	List(ctx context.Context, runtimeName string) ([]model.Component, error)
}

type IContextAPI added in v0.19.5

type IContextAPI interface {
	GetGitContexts() (error, *[]ContextPayload)
	GetGitContextByName(name string) (error, *ContextPayload)
	GetDefaultGitContext() (error, *ContextPayload)
}

type IGitSourceAPI added in v0.31.2

type IGitSourceAPI interface {
	List(ctc context.Context, runtimeName string) ([]model.GitSource, error)
}

type IPipelineAPI

type IPipelineAPI interface {
	List(qs map[string]string) ([]*Pipeline, error)
	Run(string, *RunOptions) (string, error)
}

IPipelineAPI declers Codefresh pipeline API

type IPipelineV2API added in v0.33.0

type IPipelineV2API interface {
	Get(ctx context.Context, name, namespace, runtime string) (*model.Pipeline, error)
	List(ctx context.Context, filterArgs model.PipelinesFilterArgs) ([]model.Pipeline, error)
}

type IProgressAPI added in v0.19.3

type IProgressAPI interface {
	Get(string) (*Progress, error)
}

type IRuntimeAPI added in v0.32.0

type IRuntimeAPI interface {
	Create(ctx context.Context, opts *model.RuntimeInstallationArgs) (*model.RuntimeCreationResponse, error)
	Get(ctx context.Context, name string) (*model.Runtime, error)
	List(ctx context.Context) ([]model.Runtime, error)
	ReportErrors(ctx context.Context, opts *model.ReportRuntimeErrorsArgs) (int, error)
	Delete(ctx context.Context, runtimeName string) (int, error)
	DeleteManaged(ctx context.Context, runtimeName string) (int, error)
	SetSharedConfigRepo(ctx context.Context, suggestedSharedConfigRepo string) (string, error)
	ResetSharedConfigRepo(ctx context.Context) error
}

type IRuntimeEnvironmentAPI added in v0.1.0

type IRuntimeEnvironmentAPI interface {
	Create(*CreateRuntimeOptions) (*RuntimeEnvironment, error)
	Validate(*ValidateRuntimeOptions) error
	SignCertificate(*SignCertificatesOptions) ([]byte, error)
	Get(string) (*RuntimeEnvironment, error)
	List() ([]*RuntimeEnvironment, error)
	Delete(string) (bool, error)
	Default(string) (bool, error)
}

IRuntimeEnvironmentAPI declers Codefresh runtime environment API

type ITokenAPI

type ITokenAPI interface {
	Create(name string, subject string) (*Token, error)
	List() ([]*Token, error)
}

type IUsersV2API added in v0.43.11

type IUsersV2API interface {
	GetCurrent(ctx context.Context) (*model.User, error)
}

type IWorkflowAPI added in v0.6.0

type IWorkflowAPI interface {
	WaitForStatus(string, string, time.Duration, time.Duration) error
	Get(string) (*Workflow, error)
}

type IWorkflowV2API added in v0.33.0

type IWorkflowV2API interface {
	Get(ctx context.Context, uid string) (*model.Workflow, error)
	List(ctx context.Context, filterArgs model.WorkflowsFilterArgs) ([]model.Workflow, error)
}

type IntegrationItem added in v0.19.6

type IntegrationItem struct {
	Amount int `json:"amount"`
}

type IntegrationPayload added in v0.19.6

type IntegrationPayload struct {
	Type string                 `json:"type"`
	Data IntegrationPayloadData `json:"data"`
}

type IntegrationPayloadData added in v0.19.6

type IntegrationPayloadData struct {
	Name          string          `json:"name"`
	Url           string          `json:"url"`
	Clusters      IntegrationItem `json:"clusters"`
	Applications  IntegrationItem `json:"applications"`
	Repositories  IntegrationItem `json:"repositories"`
	Username      *string         `json:"username"`
	Password      *string         `json:"password"`
	Token         *string         `json:"token"`
	ClusterName   *string         `json:"clusterName"`
	ServerVersion *string         `json:"serverVersion"`
	Provider      *string         `json:"provider"`
}

type Location added in v0.19.3

type Location struct {
	Type string `json:"type"`
	URL  string `json:"url"`
}

type MongoCFEnvWrapper added in v0.19.6

type MongoCFEnvWrapper struct {
	Docs []CFEnvironment `json:"docs"`
}

type Pipeline

type Pipeline struct {
	Metadata PipelineMetadata `json:"metadata"`
	Spec     PipelineSpec     `json:"spec"`
}

type PipelineMetadata

type PipelineMetadata struct {
	Name     string `json:"name"`
	IsPublic bool   `json:"isPublic"`
	Labels   struct {
		Tags []string `json:"tags"`
	} `json:"labels"`
	Deprecate struct {
		ApplicationPort string `json:"applicationPort"`
		RepoPipeline    bool   `json:"repoPipeline"`
	} `json:"deprecate"`
	OriginalYamlString string    `json:"originalYamlString"`
	AccountID          string    `json:"accountId"`
	CreatedAt          time.Time `json:"created_at"`
	UpdatedAt          time.Time `json:"updated_at"`
	Project            string    `json:"project"`
	ID                 string    `json:"id"`
}

type PipelineSpec

type PipelineSpec struct {
	Triggers []struct {
		Type     string   `json:"type"`
		Repo     string   `json:"repo"`
		Events   []string `json:"events"`
		Provider string   `json:"provider"`
		Context  string   `json:"context"`
	} `json:"triggers"`
	Contexts  []interface{} `json:"contexts"`
	Variables []struct {
		Key   string `json:"key"`
		Value string `json:"value"`
	} `json:"variables"`
	Steps  map[string]interface{} `json:"steps"`
	Stages []interface{}          `json:"stages"`
	Mode   string                 `json:"mode"`
}

type Progress added in v0.19.3

type Progress struct {
	ID       string   `json:"id"`
	Status   string   `json:"status"`
	Location Location `json:"location"`
}

type ReplicaState added in v0.19.6

type ReplicaState struct {
	Current int64 `json:"current"`
	Desired int64 `json:"desired"`
}

type RunOptions added in v0.7.0

type RunOptions struct {
	Branch    string
	Variables map[string]string
}

type RuntimeEnvironment added in v0.1.0

type RuntimeEnvironment struct {
	Version               int                   `json:"version"`
	Metadata              RuntimeMetadata       `json:"metadata"`
	Extends               []string              `json:"extends"`
	Description           string                `json:"description"`
	AccountID             string                `json:"accountId"`
	RuntimeScheduler      RuntimeScheduler      `json:"runtimeScheduler"`
	DockerDaemonScheduler DockerDaemonScheduler `json:"dockerDaemonScheduler"`
	Status                struct {
		Message   string    `json:"message"`
		UpdatedAt time.Time `json:"updated_at"`
	} `json:"status"`
}

type RuntimeMetadata added in v0.3.0

type RuntimeMetadata struct {
	Agent        bool   `json:"agent"`
	Name         string `json:"name"`
	ChangedBy    string `json:"changedBy"`
	CreationTime string `json:"creationTime"`
}

type RuntimeScheduler added in v0.3.0

type RuntimeScheduler struct {
	Cluster struct {
		ClusterProvider struct {
			AccountID string `json:"accountId"`
			Selector  string `json:"selector"`
		} `json:"clusterProvider"`
		Namespace string `json:"namespace"`
	} `json:"cluster"`
	UserAccess bool `json:"userAccess"`
	Pvcs       struct {
		Dind struct {
			StorageClassName string `yaml:"storageClassName"`
		} `yaml:"dind"`
	} `yaml:"pvcs"`
}

type SignCertificatesOptions added in v0.2.0

type SignCertificatesOptions struct {
	AltName string
	CSR     string
}

type SyncPolicy added in v0.19.6

type SyncPolicy struct {
	AutoSync bool `json:"autoSync"`
}

type Token

type Token struct {
	ID          string    `json:"_id"`
	Name        string    `json:"name"`
	TokenPrefix string    `json:"tokenPrefix"`
	Created     time.Time `json:"created"`
	Subject     struct {
		Type string `json:"type"`
		Ref  string `json:"ref"`
	} `json:"subject"`
	Value string
}

type User added in v0.19.6

type User struct {
	ID                string    `json:"_id"`
	Name              string    `json:"userName"`
	Email             string    `json:"email"`
	Accounts          []Account `json:"account"`
	ActiveAccountName string    `json:"activeAccountName"`
	Roles             []string  `json:"roles"`
	UserData          struct {
		Avatar string `json:"image"`
	} `json:"user_data"`
}

func (*User) GetActiveAccount added in v0.26.2

func (u *User) GetActiveAccount() *Account

type UsersAPI added in v0.26.2

type UsersAPI interface {
	GetCurrent(ctx context.Context) (*User, error)
}

type V2API added in v0.32.0

type V2API interface {
	UsersV2() IUsersV2API
	Runtime() IRuntimeAPI
	Cluster() IClusterV2API
	GitSource() IGitSourceAPI
	Component() IComponentAPI
	Workflow() IWorkflowV2API
	Pipeline() IPipelineV2API
	CliReleases() ICliReleasesAPI
}

type ValidateRuntimeOptions added in v0.2.0

type ValidateRuntimeOptions struct {
	Cluster   string
	Namespace string
}

type Workflow added in v0.6.0

type Workflow struct {
	ID                 string    `json:"id"`
	Status             string    `json:"status"`
	UserYamlDescriptor string    `json:"userYamlDescriptor"`
	Progress           string    `json:"progress"`
	Created            time.Time `json:"created"`
	Updated            time.Time `json:"updated"`
	Finished           time.Time `json:"finished"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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