buildssrht

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2023 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSSHInfo

func GetSSHInfo(client *gqlclient.Client, ctx context.Context, id int32) (job *Job, version *Version, err error)

Types

type AccessKind

type AccessKind string
const (
	AccessKindRo AccessKind = "RO"
	AccessKindRw AccessKind = "RW"
)

type AccessScope

type AccessScope string
const (
	AccessScopeProfile AccessScope = "PROFILE"
	AccessScopeJobs    AccessScope = "JOBS"
	AccessScopeLogs    AccessScope = "LOGS"
	AccessScopeSecrets AccessScope = "SECRETS"
)

type Artifact

type Artifact struct {
	Id      int32          `json:"id"`
	Created gqlclient.Time `json:"created"`
	// Original path in the guest
	Path string `json:"path"`
	// Size in bytes
	Size int32 `json:"size"`
	// URL at which the artifact may be downloaded, or null if pruned
	Url *string `json:"url,omitempty"`
}

type Binary

type Binary string

type Cursor

type Cursor string

type EmailTrigger

type EmailTrigger struct {
	Condition TriggerCondition `json:"condition"`
	To        string           `json:"to"`
	Cc        *string          `json:"cc,omitempty"`
	InReplyTo *string          `json:"inReplyTo,omitempty"`
}

type EmailTriggerInput

type EmailTriggerInput struct {
	To        string  `json:"to"`
	Cc        *string `json:"cc,omitempty"`
	InReplyTo *string `json:"inReplyTo,omitempty"`
}

type Entity

type Entity struct {
	Id      int32          `json:"id"`
	Created gqlclient.Time `json:"created"`
	Updated gqlclient.Time `json:"updated"`
	// The canonical name of this entity. For users, this is their username
	// prefixed with '~'. Additional entity types will be supported in the future.
	CanonicalName string `json:"canonicalName"`

	// Underlying value of the GraphQL interface
	Value EntityValue `json:"-"`
}

func (*Entity) UnmarshalJSON added in v0.4.0

func (base *Entity) UnmarshalJSON(b []byte) error

type EntityValue added in v0.4.0

type EntityValue interface {
	// contains filtered or unexported methods
}

EntityValue is one of: User

type File

type File string

type Job

type Job struct {
	Id         int32          `json:"id"`
	Created    gqlclient.Time `json:"created"`
	Updated    gqlclient.Time `json:"updated"`
	Status     JobStatus      `json:"status"`
	Manifest   string         `json:"manifest"`
	Note       *string        `json:"note,omitempty"`
	Tags       []string       `json:"tags"`
	Visibility Visibility     `json:"visibility"`
	// Name of the build image
	Image string `json:"image"`
	// Name of the build runner which picked up this job, or null if the job is
	// pending or queued.
	Runner    *string    `json:"runner,omitempty"`
	Owner     *Entity    `json:"owner"`
	Group     *JobGroup  `json:"group,omitempty"`
	Tasks     []Task     `json:"tasks"`
	Artifacts []Artifact `json:"artifacts"`
	// The job's top-level log file, not associated with any tasks
	Log *Log `json:"log,omitempty"`
	// List of secrets available to this job, or null if they were disabled
	Secrets []Secret `json:"secrets,omitempty"`
}

func Artifacts added in v0.3.0

func Artifacts(client *gqlclient.Client, ctx context.Context, id int32) (job *Job, err error)

func Cancel

func Cancel(client *gqlclient.Client, ctx context.Context, jobId int32) (cancel *Job, err error)

func Manifest

func Manifest(client *gqlclient.Client, ctx context.Context, id int32) (job *Job, err error)

func Monitor

func Monitor(client *gqlclient.Client, ctx context.Context, id int32) (job *Job, err error)

func Show

func Show(client *gqlclient.Client, ctx context.Context, id int32) (job *Job, err error)

func Submit

func Submit(client *gqlclient.Client, ctx context.Context, manifest string, tags []string, note *string, visibility *Visibility) (submit *Job, err error)

type JobCursor

type JobCursor struct {
	Results []Job   `json:"results"`
	Cursor  *Cursor `json:"cursor,omitempty"`
}

A cursor for enumerating a list of jobs

If there are additional results available, the cursor object may be passed back into the same endpoint to retrieve another page. If the cursor is null, there are no remaining results to return.

func ExportJobs added in v0.2.0

func ExportJobs(client *gqlclient.Client, ctx context.Context, cursor *Cursor) (jobs *JobCursor, err error)

func JobIDs

func JobIDs(client *gqlclient.Client, ctx context.Context) (jobs *JobCursor, err error)

func Jobs

func Jobs(client *gqlclient.Client, ctx context.Context, cursor *Cursor) (jobs *JobCursor, err error)

func RunningJobs

func RunningJobs(client *gqlclient.Client, ctx context.Context) (jobs *JobCursor, err error)

type JobEvent added in v0.3.0

type JobEvent struct {
	Uuid  string         `json:"uuid"`
	Event WebhookEvent   `json:"event"`
	Date  gqlclient.Time `json:"date"`
	Job   *Job           `json:"job"`
}

type JobGroup

type JobGroup struct {
	Id       int32          `json:"id"`
	Created  gqlclient.Time `json:"created"`
	Note     *string        `json:"note,omitempty"`
	Owner    *Entity        `json:"owner"`
	Jobs     []Job          `json:"jobs"`
	Triggers []Trigger      `json:"triggers"`
}

type JobStatus

type JobStatus string
const (
	JobStatusPending   JobStatus = "PENDING"
	JobStatusQueued    JobStatus = "QUEUED"
	JobStatusRunning   JobStatus = "RUNNING"
	JobStatusSuccess   JobStatus = "SUCCESS"
	JobStatusFailed    JobStatus = "FAILED"
	JobStatusTimeout   JobStatus = "TIMEOUT"
	JobStatusCancelled JobStatus = "CANCELLED"
)

func (JobStatus) Icon

func (status JobStatus) Icon() string

func (JobStatus) TermIcon added in v0.4.0

func (status JobStatus) TermIcon() string

func (JobStatus) TermString

func (status JobStatus) TermString() string

func (JobStatus) TermStyle

func (status JobStatus) TermStyle() termfmt.Style

type Log

type Log struct {
	// The most recently written 128 KiB of the build log.
	Last128KiB string `json:"last128KiB"`
	// The URL at which the full build log can be downloaded with an authenticated
	// GET request (text/plain).
	FullURL string `json:"fullURL"`
}

type OAuthClient added in v0.3.0

type OAuthClient struct {
	Uuid string `json:"uuid"`
}

type PGPKey

type PGPKey struct {
	Id         int32          `json:"id"`
	Created    gqlclient.Time `json:"created"`
	Uuid       string         `json:"uuid"`
	Name       *string        `json:"name,omitempty"`
	FromUser   *Entity        `json:"fromUser,omitempty"`
	PrivateKey Binary         `json:"privateKey"`
}

type SSHKey

type SSHKey struct {
	Id         int32          `json:"id"`
	Created    gqlclient.Time `json:"created"`
	Uuid       string         `json:"uuid"`
	Name       *string        `json:"name,omitempty"`
	FromUser   *Entity        `json:"fromUser,omitempty"`
	PrivateKey Binary         `json:"privateKey"`
}

type Secret

type Secret struct {
	Id      int32          `json:"id"`
	Created gqlclient.Time `json:"created"`
	Uuid    string         `json:"uuid"`
	Name    *string        `json:"name,omitempty"`
	// Set when this secret was copied from another user account
	FromUser *Entity `json:"fromUser,omitempty"`

	// Underlying value of the GraphQL interface
	Value SecretValue `json:"-"`
}

func ShareSecret added in v0.4.0

func ShareSecret(client *gqlclient.Client, ctx context.Context, uuid string, user string) (shareSecret *Secret, err error)

func (*Secret) UnmarshalJSON added in v0.4.0

func (base *Secret) UnmarshalJSON(b []byte) error

type SecretCursor

type SecretCursor struct {
	Results []Secret `json:"results"`
	Cursor  *Cursor  `json:"cursor,omitempty"`
}

A cursor for enumerating a list of secrets

If there are additional results available, the cursor object may be passed back into the same endpoint to retrieve another page. If the cursor is null, there are no remaining results to return.

func CompleteSecrets added in v0.4.0

func CompleteSecrets(client *gqlclient.Client, ctx context.Context) (secrets *SecretCursor, err error)

func Secrets

func Secrets(client *gqlclient.Client, ctx context.Context, cursor *Cursor) (secrets *SecretCursor, err error)

type SecretFile

type SecretFile struct {
	Id       int32          `json:"id"`
	Created  gqlclient.Time `json:"created"`
	Uuid     string         `json:"uuid"`
	Name     *string        `json:"name,omitempty"`
	FromUser *Entity        `json:"fromUser,omitempty"`
	Path     string         `json:"path"`
	Mode     int32          `json:"mode"`
	Data     Binary         `json:"data"`
}

type SecretValue added in v0.4.0

type SecretValue interface {
	// contains filtered or unexported methods
}

SecretValue is one of: SSHKey | PGPKey | SecretFile

type Settings

type Settings struct {
	SshUser      string `json:"sshUser"`
	BuildTimeout string `json:"buildTimeout"`
}

type Task

type Task struct {
	Id      int32          `json:"id"`
	Created gqlclient.Time `json:"created"`
	Updated gqlclient.Time `json:"updated"`
	Name    string         `json:"name"`
	Status  TaskStatus     `json:"status"`
	Log     *Log           `json:"log,omitempty"`
	Job     *Job           `json:"job"`
}

type TaskStatus

type TaskStatus string
const (
	TaskStatusPending TaskStatus = "PENDING"
	TaskStatusRunning TaskStatus = "RUNNING"
	TaskStatusSuccess TaskStatus = "SUCCESS"
	TaskStatusFailed  TaskStatus = "FAILED"
	TaskStatusSkipped TaskStatus = "SKIPPED"
)

func (TaskStatus) Icon

func (status TaskStatus) Icon() string

func (TaskStatus) TermIcon

func (status TaskStatus) TermIcon() string

func (TaskStatus) TermStyle

func (status TaskStatus) TermStyle() termfmt.Style

type Trigger

type Trigger struct {
	Condition TriggerCondition `json:"condition"`

	// Underlying value of the GraphQL interface
	Value TriggerValue `json:"-"`
}

Triggers run upon the completion of all of the jobs in a job group. Note that these triggers are distinct from the ones defined by an individual job's build manifest, but are similar in functionality.

func (*Trigger) UnmarshalJSON added in v0.4.0

func (base *Trigger) UnmarshalJSON(b []byte) error

type TriggerCondition

type TriggerCondition string
const (
	TriggerConditionSuccess TriggerCondition = "SUCCESS"
	TriggerConditionFailure TriggerCondition = "FAILURE"
	TriggerConditionAlways  TriggerCondition = "ALWAYS"
)

type TriggerInput

type TriggerInput struct {
	Type      TriggerType          `json:"type"`
	Condition TriggerCondition     `json:"condition"`
	Email     *EmailTriggerInput   `json:"email,omitempty"`
	Webhook   *WebhookTriggerInput `json:"webhook,omitempty"`
}

type TriggerType

type TriggerType string
const (
	TriggerTypeEmail   TriggerType = "EMAIL"
	TriggerTypeWebhook TriggerType = "WEBHOOK"
)

type TriggerValue added in v0.4.0

type TriggerValue interface {
	// contains filtered or unexported methods
}

TriggerValue is one of: EmailTrigger | WebhookTrigger

type User

type User struct {
	Id            int32          `json:"id"`
	Created       gqlclient.Time `json:"created"`
	Updated       gqlclient.Time `json:"updated"`
	CanonicalName string         `json:"canonicalName"`
	Username      string         `json:"username"`
	Email         string         `json:"email"`
	Url           *string        `json:"url,omitempty"`
	Location      *string        `json:"location,omitempty"`
	Bio           *string        `json:"bio,omitempty"`
	// Jobs submitted by this user.
	Jobs *JobCursor `json:"jobs"`
}

func JobsByUser added in v0.3.0

func JobsByUser(client *gqlclient.Client, ctx context.Context, username string, cursor *Cursor) (userByName *User, err error)

type UserWebhookInput added in v0.3.0

type UserWebhookInput struct {
	Url    string         `json:"url"`
	Events []WebhookEvent `json:"events"`
	Query  string         `json:"query"`
}

type UserWebhookSubscription added in v0.3.0

type UserWebhookSubscription struct {
	Id         int32                  `json:"id"`
	Events     []WebhookEvent         `json:"events"`
	Query      string                 `json:"query"`
	Url        string                 `json:"url"`
	Client     *OAuthClient           `json:"client,omitempty"`
	Deliveries *WebhookDeliveryCursor `json:"deliveries"`
	Sample     string                 `json:"sample"`
}

type Version

type Version struct {
	Major int32 `json:"major"`
	Minor int32 `json:"minor"`
	Patch int32 `json:"patch"`
	// If this API version is scheduled for deprecation, this is the date on which
	// it will stop working; or null if this API version is not scheduled for
	// deprecation.
	DeprecationDate gqlclient.Time `json:"deprecationDate,omitempty"`
	Settings        *Settings      `json:"settings"`
}

type Visibility added in v0.4.0

type Visibility string
const (
	VisibilityPublic   Visibility = "PUBLIC"
	VisibilityUnlisted Visibility = "UNLISTED"
	VisibilityPrivate  Visibility = "PRIVATE"
)

func ParseVisibility added in v0.4.0

func ParseVisibility(s string) (Visibility, error)

type WebhookDelivery added in v0.3.0

type WebhookDelivery struct {
	Uuid         string               `json:"uuid"`
	Date         gqlclient.Time       `json:"date"`
	Event        WebhookEvent         `json:"event"`
	Subscription *WebhookSubscription `json:"subscription"`
	RequestBody  string               `json:"requestBody"`
	// These details are provided only after a response is received from the
	// remote server. If a response is sent whose Content-Type is not text/*, or
	// cannot be decoded as UTF-8, the response body will be null. It will be
	// truncated after 64 KiB.
	ResponseBody    *string `json:"responseBody,omitempty"`
	ResponseHeaders *string `json:"responseHeaders,omitempty"`
	ResponseStatus  *int32  `json:"responseStatus,omitempty"`
}

type WebhookDeliveryCursor added in v0.3.0

type WebhookDeliveryCursor struct {
	Results []WebhookDelivery `json:"results"`
	Cursor  *Cursor           `json:"cursor,omitempty"`
}

A cursor for enumerating a list of webhook deliveries

If there are additional results available, the cursor object may be passed back into the same endpoint to retrieve another page. If the cursor is null, there are no remaining results to return.

type WebhookEvent added in v0.3.0

type WebhookEvent string
const (
	WebhookEventJobCreated WebhookEvent = "JOB_CREATED"
)

func ParseUserEvents added in v0.3.0

func ParseUserEvents(events []string) ([]WebhookEvent, error)

type WebhookPayload added in v0.3.0

type WebhookPayload struct {
	Uuid  string         `json:"uuid"`
	Event WebhookEvent   `json:"event"`
	Date  gqlclient.Time `json:"date"`

	// Underlying value of the GraphQL interface
	Value WebhookPayloadValue `json:"-"`
}

func (*WebhookPayload) UnmarshalJSON added in v0.4.0

func (base *WebhookPayload) UnmarshalJSON(b []byte) error

type WebhookPayloadValue added in v0.4.0

type WebhookPayloadValue interface {
	// contains filtered or unexported methods
}

WebhookPayloadValue is one of: JobEvent

type WebhookSubscription added in v0.3.0

type WebhookSubscription struct {
	Id     int32          `json:"id"`
	Events []WebhookEvent `json:"events"`
	Query  string         `json:"query"`
	Url    string         `json:"url"`
	// If this webhook was registered by an authorized OAuth 2.0 client, this
	// field is non-null.
	Client *OAuthClient `json:"client,omitempty"`
	// All deliveries which have been sent to this webhook.
	Deliveries *WebhookDeliveryCursor `json:"deliveries"`
	// Returns a sample payload for this subscription, for testing purposes
	Sample string `json:"sample"`

	// Underlying value of the GraphQL interface
	Value WebhookSubscriptionValue `json:"-"`
}

func CreateUserWebhook added in v0.3.0

func CreateUserWebhook(client *gqlclient.Client, ctx context.Context, config UserWebhookInput) (createUserWebhook *WebhookSubscription, err error)

func DeleteUserWebhook added in v0.3.0

func DeleteUserWebhook(client *gqlclient.Client, ctx context.Context, id int32) (deleteUserWebhook *WebhookSubscription, err error)

func (*WebhookSubscription) UnmarshalJSON added in v0.4.0

func (base *WebhookSubscription) UnmarshalJSON(b []byte) error

type WebhookSubscriptionCursor added in v0.3.0

type WebhookSubscriptionCursor struct {
	Results []WebhookSubscription `json:"results"`
	Cursor  *Cursor               `json:"cursor,omitempty"`
}

A cursor for enumerating a list of webhook subscriptions

If there are additional results available, the cursor object may be passed back into the same endpoint to retrieve another page. If the cursor is null, there are no remaining results to return.

func UserWebhooks added in v0.3.0

func UserWebhooks(client *gqlclient.Client, ctx context.Context, cursor *Cursor) (userWebhooks *WebhookSubscriptionCursor, err error)

type WebhookSubscriptionValue added in v0.4.0

type WebhookSubscriptionValue interface {
	// contains filtered or unexported methods
}

WebhookSubscriptionValue is one of: UserWebhookSubscription

type WebhookTrigger

type WebhookTrigger struct {
	Condition TriggerCondition `json:"condition"`
	Url       string           `json:"url"`
}

type WebhookTriggerInput

type WebhookTriggerInput struct {
	Url string `json:"url"`
}

Jump to

Keyboard shortcuts

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