circleci

package module
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: MIT Imports: 12 Imported by: 7

README

go-circleci

CircleCI

This client supports the CircleCI V2 API.

Note this client is in beta. While I am using this client in my personal projects, many of the methods are not yet used in real projects and have not been fully tested. Therefore, this client may involve some breaking changes until it reaches v1.0. If you find any missing features or bugs, please kindly report it via an Issue or Pull Request.

Installation

Installation can be done with a normal go get:

go get -u github.com/grezar/go-circleci

Usage

import "github.com/grezar/go-circleci"

Construct a new CircleCI client, then use the various services on the client to access different parts of the CircleCI API. For example, to list all contexts:

config := circleci.DefaultConfig()
config.Token = "put-your-circleci-token-here"

client, err := circleci.NewClient(config)
if err != nil {
	log.Fatal(err)
}

contexts, err := client.Contexts.List(context.Background(), circleci.ContextListOptions{
	OwnerSlug: circleci.String("org"),
})
if err != nil {
	log.Fatal(err)
}

Documentation

TODO: Write code comments for Go Doc.

Contribution

If you find any issues with this package, please report an Issue.

TODO

LICENSE

The MIT License (MIT)

Documentation

Index

Constants

View Source
const (
	DefaultAddress  = "https://circleci.com"
	DefaultBasePath = "/api/v2/"
)

Variables

View Source
var (
	ErrUnauthorized = errors.New("unauthorized")
	ErrNotFound     = errors.New("not found")

	ErrRequiredEitherOrganizationIDOrSlug    = errors.New("either organization ID or slug is required")
	ErrRequiredContextID                     = errors.New("context ID is required")
	ErrRequiredEnvironmentVariableName       = errors.New("environment variable name is required")
	ErrRequiredEnvironmentVariableValue      = errors.New("missing environment variable value")
	ErrRequiredProjectSlug                   = errors.New("project slug is required")
	ErrRequiredProjectCheckoutKeyType        = errors.New("project checkout key type is required")
	ErrRequiredProjectCheckoutKeyFingerprint = errors.New("project checkout key fingerprint is required")
	ErrRequiredProjectVariableName           = errors.New("project variable name is required")
	ErrRequiredProjectVariableValue          = errors.New("project variable value is required")
	ErrRequiredUserID                        = errors.New("user id is required")
	ErrRequiredWorkflowID                    = errors.New("workflow id is required")
	ErrRequiredApprovalRequestID             = errors.New("approval request id (the id of the job being approved) is required")
	ErrRequiredPipelineContinuationKey       = errors.New("pipeline continuation key is required")
	ErrRequiredPipelineConfiguration         = errors.New("pipeline configuration is required")
	ErrRequiredPipelinePipelineID            = errors.New("pipeline ID is required")
	ErrRequiredPipelineNumber                = errors.New("pipeline number is required")
	ErrRequiredJobNumber                     = errors.New("job number is required")
	ErrRequiredWorkflowName                  = errors.New("workflow name is required")
	ErrRequiredJobName                       = errors.New("job name is required")
	ErrRequiredWebhookEvents                 = errors.New("webhook events is required")
	ErrRequiredWebhookName                   = errors.New("webhook name is required")
	ErrRequiredWebhookID                     = errors.New("webhook ID is required")
	ErrRequiredWebhookURL                    = errors.New("webhook URL is required")
	ErrRequiredWebhookVerifyTLS              = errors.New("webhook verifyTLS is required")
	ErrRequiredWebhookSigningSecret          = errors.New("webhook signingSecret is required")
	ErrRequiredWebhookScopeID                = errors.New("webhook scopeID is required")
	ErrRequiredWebhookScopeType              = errors.New("webhook scopeType is required")
)

Functions

func Bool

func Bool(v bool) *bool

Bool returns a pointer to the given bool.

func String

func String(v string) *string

String returns a pointer to the given string.

func Time

func Time(v time.Time) *time.Time

Time returns a pointer to the given time.Time

Types

type Actor

type Actor struct {
	Login     string `json:"login"`
	AvatarURL string `json:"avatar_url"`
}

type Artifact

type Artifact struct {
	Path      string `json:"path"`
	NodeIndex int64  `json:"node_index"`
	URL       string `json:"url"`
}

type ArtifactList

type ArtifactList struct {
	Items         []*Artifact `json:"items"`
	NextPageToken string      `json:"next_page_token"`
}

type CheckoutKeyTypeType added in v0.3.0

type CheckoutKeyTypeType string
const (
	CheckoutKeyTypeUserKey   CheckoutKeyTypeType = "user-key"
	CheckoutKeyTypeDeployKey CheckoutKeyTypeType = "deploy-key"
)

func CheckoutKeyType added in v0.2.0

func CheckoutKeyType(v CheckoutKeyTypeType) *CheckoutKeyTypeType

CheckoutKeyType return a pointer to the given CheckoutKeyTypeType

type Client

type Client struct {
	Contexts  Contexts
	Projects  Projects
	Users     Users
	Workflows Workflows
	Pipelines Pipelines
	Jobs      Jobs
	Insights  Insights
	Webhooks  Webhooks
	// contains filtered or unexported fields
}

func NewClient

func NewClient(cfg *Config) (*Client, error)

type Collaboration

type Collaboration struct {
	VcsType   string `json:"vcs-type"`
	Name      string `json:"name"`
	AvatarURL string `json:"avatar_url"`
}

type Commit

type Commit struct {
	Subject string `json:"subject"`
	Body    string `json:"body"`
}

type Config

type Config struct {
	Address    string
	BasePath   string
	Token      string
	Headers    http.Header
	HTTPClient *http.Client
}

func DefaultConfig

func DefaultConfig() *Config

type Context

type Context struct {
	ID        string    `json:"id"`
	Name      string    `json:"name"`
	CreatedAt time.Time `json:"created_at"`
}

type ContextAddOrUpdateVariableOptions added in v0.4.0

type ContextAddOrUpdateVariableOptions struct {
	Value *string `json:"value"`
}

type ContextCreateOptions

type ContextCreateOptions struct {
	Name  *string       `json:"name"`
	Owner *OwnerOptions `json:"owner"`
}

type ContextList

type ContextList struct {
	Items         []*Context `json:"items"`
	NextPageToken string     `json:"next_page_token"`
}

type ContextListOptions

type ContextListOptions struct {
	OwnerID   *string        `url:"owner-id,omitempty"`
	OwnerSlug *string        `url:"owner-slug,omitempty"`
	OwnerType *OwnerTypeType `url:"owner-type,omitempty"`
	PageToken *string        `url:"page-token,omitempty"`
}

type ContextListVariablesOptions added in v0.9.0

type ContextListVariablesOptions struct {
	PageToken *string `url:"page-token,omitempty"`
}

type ContextVariable

type ContextVariable struct {
	Variable  string    `json:"variable"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
	ContextID string    `json:"context_id"`
}

type ContextVariableList

type ContextVariableList struct {
	Items         []*ContextVariable
	NextPageToken string `json:"next_page_token"`
}

type Contexts

type Contexts interface {
	List(ctx context.Context, options ContextListOptions) (*ContextList, error)
	Get(ctx context.Context, contextID string) (*Context, error)
	Create(ctx context.Context, options ContextCreateOptions) (*Context, error)
	Delete(ctx context.Context, contextID string) error
	ListVariables(ctx context.Context, contextID string, options ContextListVariablesOptions) (*ContextVariableList, error)
	RemoveVariable(ctx context.Context, contextID string, variableName string) error
	AddOrUpdateVariable(ctx context.Context, contextID string, variableName string, options ContextAddOrUpdateVariableOptions) (*ContextVariable, error)
}

type DurationMetrics

type DurationMetrics struct {
	Min               int `json:"min"`
	Mean              int `json:"mean"`
	Median            int `json:"median"`
	P95               int `json:"p95"`
	Max               int `json:"max"`
	StandardDeviation int `json:"standard_deviation"`
}

type ErrorResponse

type ErrorResponse struct {
	Message string `json:"message"`
}

type Event added in v0.7.0

type Event string
const (
	EventWorkflowCompleted Event = "workflow-completed"
	EventJobCompleted      Event = "job-completed"
)

func EventType added in v0.7.0

func EventType(v Event) *Event

EventType return a pointer to the given Event

type Executor

type Executor struct {
	Type          string `json:"type"`
	ResourceClass string `json:"resource_class"`
}

type Insights

type Insights interface {
	ListSummaryMetricsForWorkflows(ctx context.Context, projectSlug string, options InsightsListSummaryMetricsOptions) (*SummaryMetricsList, error)
	ListSummaryMetricsForWorkflowJobs(ctx context.Context, projectSlug, workflowName string, options InsightsListSummaryMetricsOptions) (*SummaryMetricsList, error)
	GetTestMetricsForWorkflows(ctx context.Context, projectSlug, workflowName string, options InsightsGetTestMetricsOptions) (*TestMetrics, error)
	ListWorkflowRuns(ctx context.Context, projectSlug, workflowName string, options InsightsListWorkflowRunsOptions) (*WorkflowRunList, error)
	ListWorkflowJobRuns(ctx context.Context, projectSlug, workflowName, jobName string, options InsightsListWorkflowRunsOptions) (*WorkflowRunList, error)
}

type InsightsGetTestMetricsOptions

type InsightsGetTestMetricsOptions struct {
	AllBranches *bool   `url:"all-branches,omitempty"`
	PageToken   *string `url:"page-token,omitempty"`
}

type InsightsListSummaryMetricsOptions

type InsightsListSummaryMetricsOptions struct {
	ReportingWindow *ReportingWindowType `url:"reporting-window,omitempty"`
	AllBranches     *bool                `url:"all-branches,omitempty"`
	Branch          *string              `url:"branch,omitempty"`
	PageToken       *string              `url:"page-token,omitempty"`
}

type InsightsListWorkflowRunsOptions

type InsightsListWorkflowRunsOptions struct {
	AllBranches *bool      `url:"all-branches,omitempty"`
	Branch      *string    `url:"branch,omitempty"`
	StartDate   *time.Time `url:"start-date,omitempty"`
	EndDate     *time.Time `url:"end-date,omitempty"`
	PageToken   *string    `url:"page-token,omitempty"`
}

type Job

type Job struct {
	WebURL         string          `json:"web_url"`
	Project        *JobProject     `json:"project"`
	ParallelRuns   []*ParallelRuns `json:"parallel_runs"`
	StartedAt      time.Time       `json:"started_at"`
	LatestWorkflow *LatestWorkflow `json:"latest_workflow"`
	Name           string          `json:"name"`
	Executor       *Executor       `json:"executor"`
	Parallelism    int             `json:"parallelism"`
	Status         interface{}     `json:"status"`
	Number         int             `json:"number"`
	Pipeline       *JobPipeline    `json:"pipeline"`
	Duration       int             `json:"duration"`
	CreatedAt      time.Time       `json:"created_at"`
	Messages       []*JobMessage   `json:"messages"`
	Contexts       []*Context      `json:"contexts"`
	Organization   Organization    `json:"organization"`
	QueuedAt       time.Time       `json:"queued_at"`
	StoppedAt      time.Time       `json:"stopped_at"`
}

type JobContext

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

type JobMessage

type JobMessage struct {
	Type    string `json:"type"`
	Message string `json:"message"`
	Reason  string `json:"reason"`
}

type JobPipeline

type JobPipeline struct {
	ID string `json:"id"`
}

type JobProject

type JobProject struct {
	Slug        string `json:"slug"`
	Name        string `json:"name"`
	ExternalURL string `json:"external_url"`
}

type Jobs

type Jobs interface {
	Get(ctx context.Context, projectSlug string, jobNumber string) (*Job, error)
	Cancel(ctx context.Context, projectSlug string, jobNumber string) error
	ListArtifacts(ctx context.Context, projectSlug string, jobNumber string) (*ArtifactList, error)
	ListTestMetadata(ctx context.Context, projectSlug string, jobNumber string) (*TestMetadataList, error)
}

type LatestWorkflow

type LatestWorkflow struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type Metrics

type Metrics struct {
	TotalRuns        int              `json:"total_runs"`
	SuccessfulRuns   int              `json:"successful_runs"`
	Mttr             int              `json:"mttr"`
	TotalCreditsUsed int              `json:"total_credits_used"`
	FailedRuns       int              `json:"failed_runs"`
	SuccessRate      int              `json:"success_rate"`
	DurationMetrics  *DurationMetrics `json:"duration_metrics"`
	TotalRecoveries  int              `json:"total_recoveries"`
	Throughput       int              `json:"throughput"`
}

type MostFailedTest

type MostFailedTest struct {
	FailedRuns  int    `json:"failed_runs"`
	JobName     string `json:"job_name"`
	P95Duration int    `json:"p95_duration"`
	TestName    string `json:"test_name"`
	TotalRuns   int    `json:"total_runs"`
	Flaky       bool   `json:"flaky"`
}

type Organization

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

type OwnerOptions

type OwnerOptions struct {
	ID   *string        `json:"id,omitempty"`
	Slug *string        `json:"slug,omitempty"`
	Type *OwnerTypeType `json:"type,omitempty"`
}

type OwnerTypeType added in v0.3.0

type OwnerTypeType string
const (
	OwnerTypeOrganization OwnerTypeType = "organization"
	OwnerTypeAccount      OwnerTypeType = "account"
)

func OwnerType

func OwnerType(v OwnerTypeType) *OwnerTypeType

OwnerType returs a pointer to the given OwnerTypeType.

type ParallelRuns

type ParallelRuns struct {
	Index  int    `json:"index"`
	Status string `json:"status"`
}

type Pipeline

type Pipeline struct {
	ID          string           `json:"id"`
	ProjectSlug string           `json:"project_slug"`
	State       string           `json:"state"`
	Number      int64            `json:"number"`
	CreatedAt   time.Time        `json:"created_at"`
	UpdatedAt   time.Time        `json:"updated_at,omitempty"`
	Trigger     *Trigger         `json:"trigger"`
	Vcs         *VCS             `json:"vcs"`
	Errors      []*PipelineError `json:"errors"`
}

type PipelineConfig

type PipelineConfig struct {
	Source              string `json:"source"`
	Compiled            string `json:"compiled"`
	SetupConfig         string `json:"setup-config"`
	CompiledSetupConfig string `json:"compiled-setup-config"`
}

type PipelineContinueOptions

type PipelineContinueOptions struct {
	ContinuationKey *string                `json:"continuation-key"`
	Configuration   *string                `json:"configuration"`
	Parameters      map[string]interface{} `json:"parameters,omitempty"`
}

type PipelineError

type PipelineError struct {
	Type    string `json:"type"`
	Message string `json:"message"`
}

type PipelineList

type PipelineList struct {
	Items         []*Pipeline `json:"items"`
	NextPageToken string      `json:"next_page_token"`
}

type PipelineListOptions

type PipelineListOptions struct {
	OrgSlug   *string `url:"org-slug,omitempty"`
	Mine      *bool   `url:"mine,omitempty"`
	PageToken *string `url:"page-token,omitempty"`
}

type PipelineListWorkflowsOptions

type PipelineListWorkflowsOptions struct {
	PageToken *string `url:"page-token,omitempty"`
}

type Pipelines

type Pipelines interface {
	List(ctx context.Context, options PipelineListOptions) (*PipelineList, error)
	Continue(ctx context.Context, options PipelineContinueOptions) error
	Get(ctx context.Context, pipelineID string) (*Pipeline, error)
	GetConfig(ctx context.Context, pipelineID string) (*PipelineConfig, error)
	ListWorkflows(ctx context.Context, pipelineID string, options PipelineListWorkflowsOptions) (*WorkflowList, error)
}

type Project

type Project struct {
	ID               string   `json:"id"`
	Slug             string   `json:"slug"`
	Name             string   `json:"name"`
	OrganizationName string   `json:"organization_name"`
	VCSInfo          *VCSInfo `json:"vcs_info"`
}

type ProjectCheckoutKey

type ProjectCheckoutKey struct {
	// seems like public documentation says public-key should be the key but
	// actually returned one is public_key
	PublicKey   string              `json:"public_key"`
	Type        CheckoutKeyTypeType `json:"type"`
	Fingerprint string              `json:"fingerprint"`
	Preferred   bool                `json:"preferred"`
	// seems like public documentation says created-at should be the key but
	// actually returned one is created_at
	CreatedAt time.Time `json:"created_at"`
}

type ProjectCheckoutKeyList

type ProjectCheckoutKeyList struct {
	Items         []*ProjectCheckoutKey `json:"items"`
	NextPageToken string                `json:"next_page_token"`
}

type ProjectCreateCheckoutKeyOptions

type ProjectCreateCheckoutKeyOptions struct {
	Type *CheckoutKeyTypeType `json:"type"`
}

type ProjectCreateVariableOptions

type ProjectCreateVariableOptions struct {
	Name  *string `json:"name"`
	Value *string `json:"value"`
}

type ProjectListCheckoutKeysOptions added in v0.9.0

type ProjectListCheckoutKeysOptions struct {
	PageToken *string `url:"page-token,omitempty"`
}

type ProjectListMyPipelinesOptions

type ProjectListMyPipelinesOptions struct {
	PageToken *string `url:"page-token,omitempty"`
}

type ProjectListPipelinesOptions

type ProjectListPipelinesOptions struct {
	Branch    *string `url:"branch,omitempty"`
	PageToken *string `url:"page-token,omitempty"`
}

type ProjectListVariablesOptions added in v0.9.0

type ProjectListVariablesOptions struct {
	PageToken *string `url:"page-token,omitempty"`
}

type ProjectTriggerPipelineOptions

type ProjectTriggerPipelineOptions struct {
	Branch     *string                `json:"branch,omitempty"`
	Tag        *string                `json:"tag,omitempty"`
	Parameters map[string]interface{} `json:"parameters,omitempty"`
}

type ProjectVariable

type ProjectVariable struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type ProjectVariableList

type ProjectVariableList struct {
	Items         []*ProjectVariable `json:"items"`
	NextPageToken string             `json:"next_page_token"`
}

type Projects

type Projects interface {
	Get(ctx context.Context, projectSlug string) (*Project, error)
	CreateCheckoutKey(ctx context.Context, projectSlug string, options ProjectCreateCheckoutKeyOptions) (*ProjectCheckoutKey, error)
	ListCheckoutKeys(ctx context.Context, projectSlug string, options ProjectListCheckoutKeysOptions) (*ProjectCheckoutKeyList, error)
	GetCheckoutKey(ctx context.Context, projectSlug, fingerprint string) (*ProjectCheckoutKey, error)
	DeleteCheckoutKey(ctx context.Context, projectSlug, fingerprint string) error
	CreateVariable(ctx context.Context, projectSlug string, options ProjectCreateVariableOptions) (*ProjectVariable, error)
	ListVariables(ctx context.Context, projectSlug string, options ProjectListVariablesOptions) (*ProjectVariableList, error)
	DeleteVariable(ctx context.Context, projectSlug, name string) error
	GetVariable(ctx context.Context, projectSlug, name string) (*ProjectVariable, error)
	TriggerPipeline(ctx context.Context, projectSlug string, options ProjectTriggerPipelineOptions) (*Pipeline, error)
	ListPipelines(ctx context.Context, projectSlug string, options ProjectListPipelinesOptions) (*PipelineList, error)
	ListMyPipelines(ctx context.Context, projectSlug string, options ProjectListMyPipelinesOptions) (*PipelineList, error)
	GetPipeline(ctx context.Context, projectSlug string, pipelineNumber string) (*Pipeline, error)
}

type ReportingWindowType added in v0.3.0

type ReportingWindowType string
const (
	Last7Days   ReportingWindowType = "last-7-days"
	Last30Days  ReportingWindowType = "last-30-days"
	Last60Days  ReportingWindowType = "last-60-days"
	Last90Days  ReportingWindowType = "last-90-days"
	Last24Hours ReportingWindowType = "last-24-hours"
)

func ReportingWindow

func ReportingWindow(v ReportingWindowType) *ReportingWindowType

ReportingWindow returns a pointer to the given ReportingWindowType.

type Scope added in v0.7.0

type Scope struct {
	ID   string `json:"id"`
	Type string `json:"type"`
}

type SlowestTest

type SlowestTest struct {
	FailedRuns  int    `json:"failed_runs"`
	JobName     string `json:"job_name"`
	P95Duration int    `json:"p95_duration"`
	TestName    string `json:"test_name"`
	TotalRuns   int    `json:"total_runs"`
	Flaky       bool   `json:"flaky"`
}

type SummaryMetrics

type SummaryMetrics struct {
	Name        string    `json:"name"`
	WindowStart time.Time `json:"window_start"`
	WindowEnd   time.Time `json:"window_end"`
	Metrics     *Metrics  `json:"metrics"`
}

type SummaryMetricsList

type SummaryMetricsList struct {
	Items         []*SummaryMetrics `json:"items"`
	NextPageToken string            `json:"next_page_token"`
}

type TestCounts

type TestCounts struct {
	Error   int `json:"error"`
	Failure int `json:"failure"`
	Skipped int `json:"skipped"`
	Success int `json:"success"`
	Total   int `json:"total"`
}

type TestMetadata

type TestMetadata struct {
	Message   string `json:"message"`
	Source    string `json:"source"`
	RunTime   string `json:"run_time"`
	File      string `json:"file"`
	Result    string `json:"result"`
	Name      string `json:"name"`
	Classname string `json:"classname"`
}

type TestMetadataList

type TestMetadataList struct {
	Items         []*TestMetadata `json:"items"`
	NextPageToken string          `json:"next_page_token"`
}

type TestMetrics

type TestMetrics struct {
	AverageTestCount     int               `json:"average_test_count"`
	MostFailedTests      []*MostFailedTest `json:"most_failed_tests"`
	MostFailedTestsExtra int               `json:"most_failed_tests_extra"`
	SlowestTests         []*SlowestTest    `json:"slowest_tests"`
	SlowestTestsExtra    int               `json:"slowest_tests_extra"`
	TotalTestRuns        int               `json:"total_test_runs"`
	TestRuns             []*TestRun        `json:"test_runs"`
}

type TestRun

type TestRun struct {
	PipelineNumber int         `json:"pipeline_number"`
	WorkflowID     interface{} `json:"workflow_id"`
	SuccessRate    int         `json:"success_rate"`
	TestCounts     TestCounts  `json:"test_counts"`
}

type Trigger

type Trigger struct {
	Type       string    `json:"type"`
	ReceivedAt time.Time `json:"received_at"`
	Actor      *Actor    `json:"actor"`
}

type User

type User struct {
	ID    string `json:"id"`
	Login string `json:"login"`
	Name  string `json:"name"`
}

type Users

type Users interface {
	Me(ctx context.Context) (*User, error)
	Collaborations(ctx context.Context) ([]*Collaboration, error)
	GetUser(ctx context.Context, id string) (*User, error)
}

type VCS

type VCS struct {
	ProviderName        string  `json:"provider_name"`
	TargetRepositoryURL string  `json:"target_repository_url"`
	Branch              string  `json:"branch,omitempty"`
	ReviewID            string  `json:"review_id,omitempty"`
	ReviewURL           string  `json:"review_url,omitempty"`
	Revision            string  `json:"revision"`
	Tag                 string  `json:"tag,omitempty"`
	OriginRepositoryURL string  `json:"origin_repository_url"`
	Commit              *Commit `json:"commit"`
}

type VCSInfo

type VCSInfo struct {
	VCSURL        string `json:"vcs_url"`
	Provider      string `json:"provider"`
	DefaultBranch string `json:"default_branch"`
}

type Webhook added in v0.7.0

type Webhook struct {
	ID            string   `json:"id"`
	URL           string   `json:"url"`
	Name          string   `json:"name"`
	SigningSecret string   `json:"signing-secret"`
	Scope         Scope    `json:"scope"`
	Events        []string `json:"events"`
	VerifyTLS     bool     `json:"verify-tls"`
}

type WebhookCreateOptions added in v0.7.0

type WebhookCreateOptions struct {
	Name          *string  `json:"name"`
	Events        []*Event `json:"events"`
	URL           *string  `json:"url"`
	VerifyTLS     *bool    `json:"verify-tls"`
	SigningSecret *string  `json:"signing-secret"`
	Scope         *Scope   `json:"scope"`
}

type WebhookList added in v0.7.0

type WebhookList struct {
	Items         []*Webhook `json:"items"`
	NextPageToken string     `json:"next_page_token"`
}

type WebhookListOptions added in v0.7.0

type WebhookListOptions struct {
	ScopeID   *string `url:"scope-id,omitempty"`
	ScopeType *string `url:"scope-type,omitempty"`
}

type Webhooks added in v0.7.0

type Webhooks interface {
	Get(ctx context.Context, id string) (*Webhook, error)
	List(ctx context.Context, options WebhookListOptions) (*WebhookList, error)
	Create(ctx context.Context, options WebhookCreateOptions) (*Webhook, error)
}

type Workflow

type Workflow struct {
	PipelineID     string      `json:"pipeline_id"`
	CanceledBy     string      `json:"canceled_by"`
	ID             string      `json:"id"`
	Name           string      `json:"name"`
	ProjectSlug    string      `json:"project_slug"`
	ErroredBy      string      `json:"errored_by"`
	Tag            string      `json:"tag"`
	Status         interface{} `json:"status"`
	StartedBy      string      `json:"started_by"`
	PipelineNumber int64       `json:"pipeline_number"`
	CreatedAt      time.Time   `json:"created_at"`
	StoppedAt      time.Time   `json:"stopped_at"`
}

type WorkflowJob

type WorkflowJob struct {
	ID                string    `json:"id"`
	CanceledBy        string    `json:"canceled_by"`
	Dependencies      []*string `json:"dependencies"`
	JobNumber         int64     `json:"job_number"`
	Name              string    `json:"name"`
	ApprovedBy        string    `json:"approved_by"`
	ProjectSlug       string    `json:"project_slug"`
	Status            string    `json:"status"`
	Type              string    `json:"type"`
	StartedAt         time.Time `json:"started_at"`
	StoppedAt         time.Time `json:"stopped_at"`
	ApprovalRequestID string    `json:"approval_request_id"`
}

type WorkflowJobList

type WorkflowJobList struct {
	Items         []*WorkflowJob `json:"items"`
	NextPageToken string         `json:"next_page_token"`
}

type WorkflowList

type WorkflowList struct {
	Items         []*Workflow `json:"items"`
	NextPageToken string      `json:"next_page_token"`
}

type WorkflowRerunOptions

type WorkflowRerunOptions struct {
	Jobs       []*string `json:"jobs,omitempty"`
	FromFailed *bool     `json:"from_failed,omitempty"`
	SparseTree *bool     `json:"sparse_tree,omitempty"`
}

type WorkflowRun

type WorkflowRun struct {
	ID          string    `json:"id"`
	Branch      string    `json:"branch"`
	Duration    int       `json:"duration"`
	CreatedAt   time.Time `json:"created_at"`
	StoppedAt   time.Time `json:"stopped_at"`
	CreditsUsed int       `json:"credits_used"`
	Status      string    `json:"status"`
}

type WorkflowRunList

type WorkflowRunList struct {
	Items         []*WorkflowRun `json:"items"`
	NextPageToken string         `json:"next_page_token"`
}

type Workflows

type Workflows interface {
	Get(ctx context.Context, id string) (*Workflow, error)
	ApproveJob(ctx context.Context, id, approvalRequestID string) error
	Cancel(ctx context.Context, id string) error
	ListWorkflowJobs(ctx context.Context, id string) (*WorkflowJobList, error)
	Rerun(ctx context.Context, id string, options WorkflowRerunOptions) error
}

Directories

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

Jump to

Keyboard shortcuts

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