djinn
v1.1.1
djinn-ci.com/integration/djinn
Documentation
pkg.go.dev ↗Variables
WebhookEvents
var WebhookEvents = []string{
"build.submitted",
"build.tagged",
"invite.sent",
"invite.accepted",
"invite.rejected",
"namespaces",
"cron",
"images",
"objects",
"variables",
"ssh_keys",
}
Types
Build
type Build struct {
ID int64 `json:"id"`
UserID int64 `json:"user_id"`
NamespaceID NullInt64 `json:"namespace_id"`
Number int64 `json:"number"`
Manifest string `json:"manifest"`
Status Status `json:"status"`
Output NullString `json:"output"`
Tags []string `json:"tags"`
CreatedAt Time `json:"created_at"`
StartedAt NullTime `json:"started_at"`
FinishedAt NullTime `json:"finished_at"`
URL URL `json:"url"`
ObjectsURL URL `json:"objects_url"`
VariablesURL URL `json:"variables_url"`
JobsURL URL `json:"jobs_url"`
ArtifactsURL URL `json:"artifacts_url"`
TagsURL URL `json:"tags_url"`
User *User `json:"user"`
Trigger *BuildTrigger `json:"trigger"`
Namespace *Namespace `json:"namespace"`
}
GetBuild
func GetBuild(cli *Client, owner string, number int64) (*Build, error)
SubmitBuild
func SubmitBuild(cli *Client, p BuildParams) (*Build, error)
Build.Get
func (b *Build) Get(cli *Client) error
Build.Kill
func (b *Build) Kill(cli *Client) error
Build.Tag
func (b *Build) Tag(cli *Client, tags ...string) ([]*BuildTag, error)
BuildParams
type BuildParams struct {
Manifest Manifest `json:"manifest"`
Comment string `json:"comment"`
Tags []string `json:"tags"`
}
BuildTag
type BuildTag struct {
ID int64 `json:"id"`
UserID int64 `json:"user_id"`
BuildID int64 `json:"build_id"`
Name string `json:"name"`
CreatedAt Time `json:"created_at"`
URL URL `json:"url"`
}
BuildTag.Delete
func (t *BuildTag) Delete(cli *Client) error
BuildTrigger
type BuildTrigger struct {
Type string `json:"type"`
Comment string `json:"comment"`
Data map[string]string `json:"data"`
}
Client
type Client struct {
// contains filtered or unexported fields
}
NewClient
func NewClient(tok, endpoint string) (*Client, error)
NewClientWithLogger
func NewClientWithLogger(tok, endpoint string, log Logger) (*Client, error)
Client.Delete
func (c *Client) Delete(url string) (*http.Response, error)
Client.Do
func (c *Client) Do(req *http.Request) (*http.Response, error)
Client.Get
func (c *Client) Get(url, accept string) (*http.Response, error)
Client.Patch
func (c *Client) Patch(url, contentType string, body io.Reader) (*http.Response, error)
Client.Post
func (c *Client) Post(url, contentType string, body io.Reader) (*http.Response, error)
Client.String
func (c *Client) String() string
String returns the string representation of the client, this will look something like &djinn.Client{endpoint: endpoint, tok: tok}. This would typically be used during logging.
Cron
type Cron struct {
ID int64 `json:"id"`
AuthorID int64 `json:"author_id"`
UserID int64 `json:"user_id"`
NamespaceID NullInt64 `json:"namespace_id"`
Name string `json:"name"`
Schedule Schedule `json:"schedule"`
Manifest Manifest `json:"manifest"`
NextRun Time `json:"next_run"`
CreatedAt Time `json:"created_at"`
URL URL `json:"url"`
}
CreateCron
func CreateCron(cli *Client, p CronParams) (*Cron, error)
Cron.Delete
func (c *Cron) Delete(cli *Client) error
Cron.Get
func (c *Cron) Get(cli *Client) error
Cron.Update
func (c *Cron) Update(cli *Client, p CronParams) error
CronParams
type CronParams struct {
Name string `json:"name"`
Schedule Schedule `json:"schedule"`
Manifest Manifest `json:"manifest"`
}
Driver
type Driver uint8
DriverSSH (3 declarations)
const ( DriverSSH Driver = iota // ssh DriverQEMU // qemu DriverDocker // docker )
Driver.MarshalJSON
func (d *Driver) MarshalJSON() ([]byte, error)
Driver.String
func (i Driver) String() string
Driver.UnmarshalJSON
func (d *Driver) UnmarshalJSON(p []byte) error
Duration
type Duration struct {
time.Duration
}
Duration.MarshalJSON
func (d *Duration) MarshalJSON() ([]byte, error)
Duration.UnmarshalJSON
func (d *Duration) UnmarshalJSON(p []byte) error
Error
type Error struct {
StatusCode int
Message string
Params map[string][]string
}
Error.Error
func (e *Error) Error() string
Image
type Image struct {
ID int64 `json:"id"`
AuthorID int64 `json:"author_id"`
UserID int64 `json:"user_id"`
NamespaceID NullInt64 `json:"namespace_id"`
Driver Driver `json:"driver"`
Name string `json:"name"`
CreatedAt Time `json:"created_at"`
URL URL `json:"url"`
Download *ImageDownload `json:"download"`
}
CreateImage
func CreateImage(cli *Client, p ImageParams) (*Image, error)
GetImage
func GetImage(cli *Client, id int64) (*Image, error)
Image.Data
func (i *Image) Data(cli *Client) (io.ReadCloser, error)
Image.Delete
func (i *Image) Delete(cli *Client) error
Image.Get
func (i *Image) Get(cli *Client) error
ImageDownload
type ImageDownload struct {
Source URL `json:"source"`
Error NullString `json:"error"`
CreatedAt Time `json:"created_at"`
StartedAt NullTime `json:"started_at"`
FinishedAt NullTime `json:"finished_at"`
}
ImageParams
type ImageParams struct {
Namespace string `json:"namespace"`
Image io.Reader `json:"-"`
Name string `json:"name"`
DownloadURL string `json:"download_url"`
}
Invite
type Invite struct {
ID int64 `json:"id"`
NamespaceID int64 `json:"namespace_id"`
InviteeID int64 `json:"invitee_id"`
InviterID int64 `json:"inviter_id"`
URL URL `json:"url"`
Invitee *User `json:"invitee"`
Inviter *User `json:"inviter"`
Namespace *Namespace `json:"namespace"`
}
Invite.Accept
func (i *Invite) Accept(cli *Client) error
Invite.Reject
func (i *Invite) Reject(cli *Client) error
Key
type Key struct {
ID int64 `json:"id"`
AuthorID int64 `json:"author_id"`
UserID int64 `json:"user_id"`
NamespaceID NullInt64 `json:"namespace_id"`
Name string `json:"name"`
Config string `json:"config"`
CreatedAt Time `json:"created_at"`
UpdatedAt Time `json:"updated_at"`
URL URL `json:"url"`
}
CreateKey
func CreateKey(cli *Client, p KeyParams) (*Key, error)
GetKey
func GetKey(cli *Client, id int64) (*Key, error)
Key.Delete
func (k *Key) Delete(cli *Client) error
Key.Get
func (k *Key) Get(cli *Client) error
Key.Update
func (k *Key) Update(cli *Client, p KeyParams) error
KeyParams
type KeyParams struct {
Namespace string `json:"namespace"`
Name string `json:"name"`
Key string `json:"key"`
Config string `json:"config"`
}
Logger
type Logger interface {
Log(args ...interface{})
}
Manifest
type Manifest struct {
Namespace string
Driver map[string]string
Env []string
Objects ManifestPassthrough
Sources []ManifestSource
Stages []string
AllowFailures []string `yaml:"allow_failures"`
Jobs []ManifestJob
}
Manifest.MarshalJSON
func (m Manifest) MarshalJSON() ([]byte, error)
Manifest.UnmarshalJSON
func (m *Manifest) UnmarshalJSON(p []byte) error
ManifestJob
type ManifestJob struct {
Stage string
Name string
Commands []string
Artifacts ManifestPassthrough
}
ManifestPassthrough
type ManifestPassthrough map[string]string
ManifestPassthrough.MarshalYAML
func (m ManifestPassthrough) MarshalYAML() (interface{}, error)
ManifestPassthrough.UnmarshalYAML
func (m *ManifestPassthrough) UnmarshalYAML(unmarshal func(interface{}) error) error
ManifestSource
type ManifestSource struct {
URL string
Ref string
Dir string
}
ManifestSource.MarshalYAML
func (s ManifestSource) MarshalYAML() (interface{}, error)
ManifestSource.UnmarshalYAML
func (s *ManifestSource) UnmarshalYAML(unmarshal func(interface{}) error) error
Namespace
type Namespace struct {
ID int64 `json:"id"`
UserID int64 `json:"user_id"`
RootID int64 `json:"root_id"`
ParentID NullInt64 `json:"parent_id"`
Name string `json:"name"`
Path string `json:"path"`
Description string `json:"description"`
Visibility Visibility `json:"visibility"`
CreatedAt Time `json:"created_at"`
URL URL `json:"url"`
BuildsURL URL `json:"builds_url"`
NamespacesURL URL `json:"namespaces_url"`
ImagesURL URL `json:"images_url"`
ObjectsURL URL `json:"objects_url"`
VariablesURL URL `json:"variables_url"`
KeysURL URL `json:"keys_url"`
InvitesURL URL `json:"invites_url"`
CollaboratorsURL URL `json:"collaborators_url"`
WebhooksURL URL `json:"webhooks_url"`
User *User `json:"user"`
Parent *Namespace `json:"parent"`
Build *Build `json:"build"`
}
CreateNamespace
func CreateNamespace(cli *Client, p NamespaceParams) (*Namespace, error)
GetNamespace
func GetNamespace(cli *Client, owner, path string) (*Namespace, error)
Namespace.CreateWebhook
func (n *Namespace) CreateWebhook(cli *Client, p WebhookParams) (*Webhook, error)
Namespace.Delete
func (n *Namespace) Delete(cli *Client) error
Namespace.DeleteCollaborator
func (n *Namespace) DeleteCollaborator(cli *Client, username string) error
Namespace.Get
func (n *Namespace) Get(cli *Client) error
Namespace.Invite
func (n *Namespace) Invite(cli *Client, handle string) (*Invite, error)
Namespace.Update
func (n *Namespace) Update(cli *Client, p NamespaceParams) error
NamespaceParams
type NamespaceParams struct {
Parent string `json:"parent"`
Name string `json:"name"`
Description string `json:"description"`
Visibility Visibility `json:"visibility"`
}
NullInt64
type NullInt64 struct {
Int64 int64
Valid bool
}
NullInt64.MarshalJSON
func (n *NullInt64) MarshalJSON() ([]byte, error)
NullInt64.UnmarshalJSON
func (n *NullInt64) UnmarshalJSON(p []byte) error
NullString
type NullString struct {
String string
Valid bool
}
NullString.MarshalJSON
func (n *NullString) MarshalJSON() ([]byte, error)
NullString.UnmarshalJSON
func (n *NullString) UnmarshalJSON(p []byte) error
NullTime
type NullTime struct {
Time Time
Valid bool
}
NullTime.MarshalJSON
func (n *NullTime) MarshalJSON() ([]byte, error)
NullTime.UnmarshalJSON
func (n *NullTime) UnmarshalJSON(p []byte) error
Object
type Object struct {
ID int64 `json:"id"`
AuthorID int64 `json:"author_id"`
UserID int64 `json:"user_id"`
NamespaceID NullInt64 `json:"namespace_id"`
Name string `json:"name"`
Type string `json:"type"`
Size int64 `json:"size"`
MD5 string `json:"md5"`
SHA256 string `json:"sha256"`
CreatedAt Time `json:"created_at"`
URL URL `json:"url"`
}
CreateObject
func CreateObject(cli *Client, p ObjectParams) (*Object, error)
Object.Data
func (o *Object) Data(cli *Client) (io.ReadCloser, error)
Object.Delete
func (o *Object) Delete(cli *Client) error
ObjectParams
type ObjectParams struct {
Namespace string `json:"-"`
Object io.Reader `json:"-"`
Name string `json:"-"`
}
Schedule
type Schedule uint
Daily (3 declarations)
const ( Daily Schedule = iota // daily Weekly // weekly Monthly // monthly )
Schedule.MarshalJSON
func (s Schedule) MarshalJSON() ([]byte, error)
Schedule.String
func (i Schedule) String() string
Schedule.UnmarshalJSON
func (s *Schedule) UnmarshalJSON(p []byte) error
Status
type Status uint8
Queued (7 declarations)
const ( Queued Status = iota // queued Running // running Passed // passed PassedWithFailures // passed_with_failures Failed // failed Killed // killed TimedOut // timed_out )
Status.String
func (i Status) String() string
Status.UnmarshalJSON
func (s *Status) UnmarshalJSON(p []byte) error
Time
type Time struct {
time.Time
}
Time.MarshalJSON
func (t *Time) MarshalJSON() ([]byte, error)
Time.UnmarshalJSON
func (t *Time) UnmarshalJSON(p []byte) error
URL
type URL struct {
*url.URL
}
URL.MarshalJSON
func (u *URL) MarshalJSON() ([]byte, error)
URL.UnmarshalJSON
func (u *URL) UnmarshalJSON(p []byte) error
User
type User struct {
ID int64 `json:"id"`
Email string `json:"email"`
Username string `json:"username"`
CreatedAt Time `json:"created_at"`
}
Variable
type Variable struct {
ID int64 `json:"id"`
AuthorID int64 `json:"author_id"`
UserID int64 `json:"user_id"`
NamespaceID NullInt64 `json:"namespace_id"`
Key string `json:"key"`
Value string `json:"value"`
CreatedAt Time `json:"created_at"`
URL URL `json:"url"`
Namespace *Namespace `json:"namespace"`
}
CreateVariable
func CreateVariable(cli *Client, p VariableParams) (*Variable, error)
Variable.Delete
func (v *Variable) Delete(cli *Client) error
Variable.Get
func (v *Variable) Get(cli *Client) error
VariableParams
type VariableParams struct {
Namespace string `json:"namespace"`
Key string `json:"key"`
Value string `json:"value"`
}
Visibility
type Visibility uint8
Private (3 declarations)
const ( Private Visibility = iota // private Internal // internal Public // public )
Visibility.MarshalJSON
func (v Visibility) MarshalJSON() ([]byte, error)
Visibility.String
func (i Visibility) String() string
Visibility.UnmarshalJSON
func (v *Visibility) UnmarshalJSON(p []byte) error
Webhook
type Webhook struct {
ID int64 `json:"id"`
AuthorID int64 `json:"author_id"`
UserID int64 `json:"user_id"`
NamespaceID NullInt64 `json:"namespace_id"`
PayloadURL URL `json:"payload_url"`
SSL bool `json:"ssl"`
Active bool `json:"active"`
URL URL `json:"url"`
Events []string `json:"events"`
LastResponse *WebhookResponse `json:"last_response"`
}
Webhook.Update
func (wh *Webhook) Update(cli *Client, p WebhookParams) error
WebhookParams
type WebhookParams struct {
PayloadURL string `json:"payload_url"`
Secret string `json:"secret"`
RemoveSecret bool `json:"remove_secret"`
SSL bool `json:"ssl"`
Active bool `json:"active"`
Events []string `json:"events"`
}
WebhookResponse
type WebhookResponse struct {
Error NullString `json:"error"`
Code int `json:"code"`
Duration Duration `json:"duration"`
CreatedAt Time `json:"created_at"`
}