globalentry

package module
v0.0.0-...-c661577 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2024 License: MIT Imports: 13 Imported by: 0

README

GlobalEntry is an (unofficial) Concourse CI API Client Go Reference

DEPRECATED: This project has been renamed. See github.com/crhntr/glide.

https://concourse-ci.org

Documentation

Overview

Example
package main

import (
	"context"
	"fmt"
	"log"

	"github.com/crhntr/globalentry"
)

func main() {
	concourse := globalentry.Client{}
	ctx := context.Background()
	const teamName = "main"
	teams, err := concourse.Teams(ctx)
	if err != nil {
		log.Fatal(err)
	}
	for _, team := range teams {
		pipelines, err := concourse.Pipelines(ctx, team.Name)
		if err != nil {
			log.Fatal(err)
		}
		for _, p := range pipelines {
			jobs, err := concourse.Jobs(ctx, teamName, p.Name)
			if err != nil {
				log.Fatal(err)
			}
			fmt.Printf("%#v\n", p)
			for _, j := range jobs {
				fmt.Printf("\t%#v\n", j)
			}
		}
	}
}
Output:

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Build

type Build struct {
	ID           int          `json:"id"`
	Name         string       `json:"name"`
	Status       string       `json:"status"`
	StartTime    int64        `json:"start_time"`
	EndTime      int64        `json:"end_time"`
	TeamName     string       `json:"team_name"`
	PipelineID   int          `json:"pipeline_id"`
	PipelineName string       `json:"pipeline_name"`
	JobName      string       `json:"job_name"`
	Inputs       []BuildInput `bson:"inputs"`
	URL          string       `json:"api_url"`
	CreatedBy    string       `json:"created_by,omitempty"`
}

type BuildEvent

type BuildEvent struct {
	Data  BuildEventData `json:"data"`
	Event string         `json:"event"`
}

type BuildEventData

type BuildEventData struct {
	Payload string          `json:"payload"`
	Time    int64           `json:"time"`
	Origin  json.RawMessage `json:"origin"`
	Message string          `json:"message"`
}

type BuildInput

type BuildInput struct {
	Name     string `json:"name"`
	Resource string `json:"resource"`
	Trigger  bool   `json:"trigger"`
}

type Client

type Client struct {
	Client http.Client

	URL      string
	Username string
	Password string
	// contains filtered or unexported fields
}

func (*Client) APIPath

func (client *Client) APIPath(segments ...string) string

func (*Client) BuildEvents

func (client *Client) BuildEvents(ctx context.Context, buildID int) (<-chan BuildEvent, error)

func (*Client) Do

func (client *Client) Do(req *http.Request) (*http.Response, error)

func (*Client) JobBuilds

func (client *Client) JobBuilds(ctx context.Context, team, pipeline, job string) ([]Build, error)

func (*Client) JobBuildsWithResourceVersion

func (client *Client) JobBuildsWithResourceVersion(ctx context.Context, team, pipeline, resource string, versionID int) ([]Build, error)

func (*Client) Jobs

func (client *Client) Jobs(ctx context.Context, team, pipeline string) ([]Job, error)

func (*Client) Pipelines

func (client *Client) Pipelines(ctx context.Context, team string) ([]Pipeline, error)

func (*Client) ResourceVersions

func (client *Client) ResourceVersions(ctx context.Context, team, pipeline, resource string) ([]ResourceVersion, error)

func (*Client) Resources

func (client *Client) Resources(ctx context.Context, team, pipeline string) ([]Resource, error)

func (*Client) Teams

func (client *Client) Teams(ctx context.Context) ([]Team, error)

func (*Client) Token

func (client *Client) Token() (*oauth2.Token, error)

type Job

type Job struct {
	ID              int      `json:"id"`
	Name            string   `json:"name"`
	TeamName        string   `json:"team_name"`
	PipelineID      int      `json:"pipeline_id"`
	PipelineName    string   `json:"pipeline_name"`
	FinishedBuild   Build    `json:"finished_build"`
	TransitionBuild Build    `json:"transition_build"`
	Groups          []string `json:"groups"`
	HasNewInputs    bool     `json:"has_new_inputs"`
}

type Pipeline

type Pipeline struct {
	ID          int    `json:"id"`
	Name        string `json:"name"`
	Paused      bool   `json:"paused"`
	Public      bool   `json:"public"`
	Archived    bool   `json:"archived"`
	TeamName    string `json:"team_name"`
	LastUpdated int64  `json:"last_updated"`
}

func (Pipeline) LastUpdatedTime

func (pipeline Pipeline) LastUpdatedTime() time.Time

type Resource

type Resource struct {
	Name         string `json:"name"`
	Type         string `json:"type"`
	PipelineID   int    `json:"pipeline_id"`
	PipelineName string `json:"pipeline_name"`
	TeamName     string `json:"team_name"`
	LastChecked  int    `json:"last_checked"`
	Build        struct {
		ID           int    `json:"id"`
		Name         string `json:"name"`
		Status       string `json:"status"`
		StartTime    int    `json:"start_time"`
		EndTime      int    `json:"end_time"`
		TeamName     string `json:"team_name"`
		PipelineId   int    `json:"pipeline_id"`
		PipelineName string `json:"pipeline_name"`
		Plan         struct {
			ID    string `json:"id"`
			Check struct {
				Name string `json:"name"`
				Type string `json:"type"`
			} `json:"check"`
		} `json:"plan"`
	} `json:"build"`
}

type ResourceVersion

type ResourceVersion struct {
	ID      int             `json:"id"`
	Version json.RawMessage `json:"version"`
	Enabled bool            `json:"enabled"`
}

type Team

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

Jump to

Keyboard shortcuts

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