Documentation ¶
Index ¶
- Constants
- func Int(v int) *int
- func SetHttpDebug(flag bool)
- func String(v string) *string
- type Agent
- type AgentListOptions
- type AgentsService
- func (as *AgentsService) Create(org string, agent *Agent) (*Agent, *Response, error)
- func (as *AgentsService) Delete(org string, id string) (*Response, error)
- func (as *AgentsService) Get(org string, id string) (*Agent, *Response, error)
- func (as *AgentsService) List(org string, opt *AgentListOptions) ([]Agent, *Response, error)
- type Artifact
- type ArtifactListOptions
- type ArtifactsService
- type Author
- type BasicAuthTransport
- type Build
- type BuildsListOptions
- type BuildsService
- func (as *BuildsService) Create(org string, pipeline string, b *CreateBuild) (*Build, *Response, error)
- func (as *BuildsService) Get(org string, pipeline string, id string) (*Build, *Response, error)
- func (bs *BuildsService) List(opt *BuildsListOptions) ([]Build, *Response, error)
- func (bs *BuildsService) ListByOrg(org string, opt *BuildsListOptions) ([]Build, *Response, error)
- func (bs *BuildsService) ListByPipeline(org string, pipeline string, opt *BuildsListOptions) ([]Build, *Response, error)
- type Client
- type CreateBuild
- type Creator
- type Emoji
- type ErrorResponse
- type Job
- type ListOptions
- type Organization
- type OrganizationListOptions
- type OrganizationsService
- type Pipeline
- type PipelineListOptions
- type PipelinesService
- type Provider
- type Response
- type Step
- type Timestamp
- type Token
- type TokenAuthTransport
- type User
- type UserService
Constants ¶
const BuildKiteDateFormat = time.RFC3339Nano
BuildKiteDateFormat is the format of the dates used throughout the api, note this odd string is used to parse/format dates in go
const Version = "2.0.0"
Version the library version number
Variables ¶
This section is empty.
Functions ¶
func Int ¶
Int is a helper routine that allocates a new int value to store v and returns a pointer to it, but unlike Int its argument value is an int.
func SetHttpDebug ¶
func SetHttpDebug(flag bool)
SetHttpDebug this enables global http request/response dumping for this API
Types ¶
type Agent ¶
type Agent struct { ID *string `json:"id,omitempty"` URL *string `json:"url,omitempty"` WebURL *string `json:"web_url,omitempty"` Name *string `json:"name,omitempty"` ConnectedState *string `json:"connection_state,omitempty"` AgentToken *string `json:"access_token,omitempty"` Hostname *string `json:"hostname,omitempty"` IPAddress *string `json:"ip_address,omitempty"` UserAgent *string `json:"user_agent,omitempty"` Version *string `json:"version,omitempty"` CreatedAt *Timestamp `json:"created_at,omitempty"` LastJobFinishedAt *Timestamp `json:"last_job_finished_at,omitempty"` Priority *int `json:"priority,omitempty"` Metadata []string `json:"meta_data,omitempty"` // the user that created the agent Creator *User `json:"creator,omitempty"` Job *Job `json:"job,omitempty"` }
Agent represents a buildkite build agent.
type AgentListOptions ¶
type AgentListOptions struct {
ListOptions
}
AgentListOptions specifies the optional parameters to the AgentService.List method.
type AgentsService ¶
type AgentsService struct {
// contains filtered or unexported fields
}
AgentsService handles communication with the agent related methods of the buildkite API.
buildkite API docs: https://buildkite.com/docs/api/agents
func (*AgentsService) Create ¶
Create a new buildkite agent.
buildkite API docs: https://buildkite.com/docs/api/agents#create-an-agent
func (*AgentsService) Delete ¶
func (as *AgentsService) Delete(org string, id string) (*Response, error)
Delete an agent.
buildkite API docs: https://buildkite.com/docs/api/agents#delete-an-agent
func (*AgentsService) Get ¶
Get fetches an agent.
buildkite API docs: https://buildkite.com/docs/api/agents#get-an-agent
func (*AgentsService) List ¶
func (as *AgentsService) List(org string, opt *AgentListOptions) ([]Agent, *Response, error)
List the agents for a given orginisation.
buildkite API docs: https://buildkite.com/docs/api/agents#list-agents
type Artifact ¶
type Artifact struct { ID *string `json:"id,omitempty"` JobID *string `json:"job_id,omitempty"` URL *string `json:"url,omitempty"` DownloadURL *string `json:"download_url,omitempty"` State *string `json:"state,omitempty"` Path *string `json:"path,omitempty"` Dirname *string `json:"dirname,omitempty"` Filename *string `json:"filename,omitempty"` MimeType *string `json:"mime_type,omitempty"` FileSize *int64 `json:"file_size,omitempty"` GlobPath *string `json:"glob_path,omitempty"` OriginalPath *string `json:"original_path,omitempty"` SHA1 *string `json:"sha1sum,omitempty"` }
Artifact represents an artifact which has been stored from a build
type ArtifactListOptions ¶
type ArtifactListOptions struct {
ListOptions
}
ArtifactListOptions specifies the optional parameters to the ArtifactsService.List method.
type ArtifactsService ¶
type ArtifactsService struct {
// contains filtered or unexported fields
}
ArtifactsService handles communication with the artifact related methods of the buildkite API.
buildkite API docs: https://buildkite.com/docs/api/artifacts
func (*ArtifactsService) DownloadArtifactByURL ¶
ListByBuild gets artifacts for a specific build
buildkite API docs: https://buildkite.com/docs/api/artifacts#list-artifacts-for-a-build
func (*ArtifactsService) ListByBuild ¶
func (as *ArtifactsService) ListByBuild(org string, pipeline string, build string, opt *ArtifactListOptions) ([]Artifact, *Response, error)
ListByBuild gets artifacts for a specific build
buildkite API docs: https://buildkite.com/docs/api/artifacts#list-artifacts-for-a-build
type BasicAuthTransport ¶
BasicAuthTransport manages injection of the authorization header
func NewBasicConfig ¶
func NewBasicConfig(username string, password string) (*BasicAuthTransport, error)
NewBasicConfig configure authentication using the supplied credentials
func (*BasicAuthTransport) Client ¶
func (bat *BasicAuthTransport) Client() *http.Client
Client builds a new http client.
type Build ¶
type Build struct { ID *string `json:"id,omitempty"` URL *string `json:"url,omitempty"` WebURL *string `json:"web_url,omitempty"` Number *int `json:"number,omitempty"` State *string `json:"state,omitempty"` Message *string `json:"message,omitempty"` Commit *string `json:"commit,omitempty"` Branch *string `json:"branch,omitempty"` Env map[string]interface{} `json:"env,omitempty"` CreatedAt *Timestamp `json:"created_at,omitempty"` ScheduledAt *Timestamp `json:"scheduled_at,omitempty"` StartedAt *Timestamp `json:"started_at,omitempty"` FinishedAt *Timestamp `json:"finished_at,omitempty"` MetaData interface{} `json:"meta_data,omitempty"` Creator *Creator `json:"creator,omitempty"` // jobs run during the build Jobs []*Job `json:"jobs,omitempty"` // the pipeline this build is associated with Pipeline *Pipeline `json:"pipeline,omitempty"` }
Build represents a build which has run in buildkite
type BuildsListOptions ¶
type BuildsListOptions struct { // Filters the results by the user who created the build Creator string `url:"creator,omitempty"` // Filters the results by builds created on or after the given time CreatedFrom time.Time `url:"created_from,omitempty"` // Filters the results by builds created before the given time CreatedTo time.Time `url:"created_to,omitempty"` // Filters the results by builds finished on or after the given time FinishedFrom time.Time `url:"finished_from,omitempty"` // State of builds to list. Possible values are: running, scheduled, passed, // failed, canceled, skipped and not_run. Default is "". State []string `url:"state,brackets,omitempty"` // Branch filter by the name of the branch. Default is "". Branch string `url:"branch,omitempty"` ListOptions }
BuildsListOptions specifies the optional parameters to the BuildsService.List method.
type BuildsService ¶
type BuildsService struct {
// contains filtered or unexported fields
}
BuildsService handles communication with the build related methods of the buildkite API.
buildkite API docs: https://buildkite.com/docs/api/builds
func (*BuildsService) Create ¶
func (as *BuildsService) Create(org string, pipeline string, b *CreateBuild) (*Build, *Response, error)
func (*BuildsService) Get ¶
Get fetches a build.
buildkite API docs: https://buildkite.com/docs/api/builds#get-a-build
func (*BuildsService) List ¶
func (bs *BuildsService) List(opt *BuildsListOptions) ([]Build, *Response, error)
List the builds for the current user.
buildkite API docs: https://buildkite.com/docs/api/builds#list-all-builds
func (*BuildsService) ListByOrg ¶
func (bs *BuildsService) ListByOrg(org string, opt *BuildsListOptions) ([]Build, *Response, error)
ListByOrg lists the builds within the specified orginisation.
buildkite API docs: https://buildkite.com/docs/api/builds#list-builds-for-an-organization
func (*BuildsService) ListByPipeline ¶
func (bs *BuildsService) ListByPipeline(org string, pipeline string, opt *BuildsListOptions) ([]Build, *Response, error)
ListByPipeline lists the builds for a pipeline within the specified originisation.
buildkite API docs: https://buildkite.com/docs/api/builds#list-builds-for-a-pipeline
type Client ¶
type Client struct { // Base URL for API requests. Defaults to the public buildkite API. BaseURL should // always be specified with a trailing slash. BaseURL *url.URL // User agent used when communicating with the buildkite API. UserAgent string // Services used for talking to different parts of the buildkite API. Agents *AgentsService Artifacts *ArtifactsService Builds *BuildsService Organizations *OrganizationsService Pipelines *PipelinesService User *UserService // contains filtered or unexported fields }
A Client manages communication with the buildkite API.
func NewClient ¶
NewClient returns a new buildkite API client. As API calls require authentication you MUST supply a client which provides the required API key.
func (*Client) Do ¶
Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, the raw response body will be written to v, without attempting to first decode it.
func (*Client) ListEmojis ¶
ListEmojis list all the emojis for a given account, including custom emojis and aliases.
buildkite API docs: https://buildkite.com/docs/api/emojis
func (*Client) NewRequest ¶
NewRequest creates an API request. A relative URL can be provided in urlStr, in which case it is resolved relative to the BaseURL of the Client. Relative URLs should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included as the request body.
type CreateBuild ¶
type CreateBuild struct { Commit string `json:"commit"` Branch string `json:"branch"` Message string `json:"message"` // Optional fields Author Author `json:"author,omitempty"` Env map[string]string `json:"env,omitempty"` MetaData map[string]string `json:"meta_data,omitempty"` IgnorePipelineBranchFilters bool `json:"ignore_pipeline_branch_filters,omitempty"` }
Create a build.
type Creator ¶
type Creator struct { AvatarURL string `json:"avatar_url"` CreatedAt *Timestamp `json:"created_at"` Email string `json:"email"` ID string `json:"id"` Name string `json:"name"` }
Creator represents who created a build
type ErrorResponse ¶
type ErrorResponse struct { Response *http.Response // HTTP response that caused this error Message string `json:"message"` // error message RawBody []byte `json:"-"` // Raw Response Body }
ErrorResponse provides a message.
func (*ErrorResponse) Error ¶
func (r *ErrorResponse) Error() string
type Job ¶
type Job struct { ID *string `json:"id,omitempty"` Type *string `json:"type,omitempty"` Name *string `json:"name,omitempty"` State *string `json:"state,omitempty"` LogsURL *string `json:"logs_url,omitempty"` RawLogsURL *string `json:"raw_log_url,omitempty"` Command *string `json:"command,omitempty"` ExitStatus *int `json:"exit_status,omitempty"` ArtifactPaths *string `json:"artifact_paths,omitempty"` CreatedAt *Timestamp `json:"created_at,omitempty"` ScheduledAt *Timestamp `json:"scheduled_at,omitempty"` StartedAt *Timestamp `json:"started_at,omitempty"` FinishedAt *Timestamp `json:"finished_at,omitempty"` Agent Agent `json:"agent,omitempty"` AgentQueryRules []string `json:"agent_query_rules,omitempty"` WebURL string `json:"web_url"` }
Job represents a job run during a build in buildkite
type ListOptions ¶
type ListOptions struct { // For paginated result sets, page of results to retrieve. Page int `url:"page,omitempty"` // For paginated result sets, the number of results to include per page. PerPage int `url:"per_page,omitempty"` }
ListOptions specifies the optional parameters to various List methods that support pagination.
type Organization ¶
type Organization struct { ID *string `json:"id,omitempty"` URL *string `json:"url,omitempty"` WebURL *string `json:"web_url,omitempty"` Name *string `json:"name,omitempty"` Slug *string `json:"slug,omitempty"` Repository *string `json:"repository,omitempty"` PipelinesURL *string `json:"pipelines_url,omitempty"` AgentsURL *string `json:"agents_url,omitempty"` CreatedAt *Timestamp `json:"created_at,omitempty"` }
Organization represents a buildkite organization.
type OrganizationListOptions ¶
type OrganizationListOptions struct {
ListOptions
}
OrganizationListOptions specifies the optional parameters to the OrganizationsService.List method.
type OrganizationsService ¶
type OrganizationsService struct {
// contains filtered or unexported fields
}
OrganizationsService handles communication with the organization related methods of the buildkite API.
buildkite API docs: https://buildkite.com/docs/api/organizations
func (*OrganizationsService) Get ¶
func (os *OrganizationsService) Get(slug string) (*Organization, *Response, error)
Get fetches an organization
buildkite API docs: https://buildkite.com/docs/api/organizations#get-an-organization
func (*OrganizationsService) List ¶
func (os *OrganizationsService) List(opt *OrganizationListOptions) ([]Organization, *Response, error)
List the organizations for the current user.
buildkite API docs: https://buildkite.com/docs/api/organizations#list-organizations
type Pipeline ¶
type Pipeline struct { ID *string `json:"id,omitempty"` URL *string `json:"url,omitempty"` WebURL *string `json:"web_url,omitempty"` Name *string `json:"name,omitempty"` Slug *string `json:"slug,omitempty"` Repository *string `json:"repository,omitempty"` BuildsURL *string `json:"builds_url,omitempty"` BadgeURL *string `json:"badge_url,omitempty"` CreatedAt *Timestamp `json:"created_at,omitempty"` ScheduledBuildsCount *int `json:"scheduled_builds_count,omitempty"` RunningBuildsCount *int `json:"running_builds_count,omitempty"` ScheduledJobsCount *int `json:"scheduled_jobs_count,omitempty"` RunningJobsCount *int `json:"running_jobs_count,omitempty"` WaitingJobsCount *int `json:"waiting_jobs_count,omitempty"` // the provider of sources Provider *Provider `json:"provider,omitempty"` // build steps Steps []*Step `json:"steps,omitempty"` }
Pipeline represents a buildkite pipeline.
type PipelineListOptions ¶
type PipelineListOptions struct {
ListOptions
}
PipelineListOptions specifies the optional parameters to the PipelinesService.List method.
type PipelinesService ¶
type PipelinesService struct {
// contains filtered or unexported fields
}
PipelinesService handles communication with the pipeline related methods of the buildkite API.
buildkite API docs: https://buildkite.com/docs/api/pipelines
func (*PipelinesService) List ¶
func (ps *PipelinesService) List(org string, opt *PipelineListOptions) ([]Pipeline, *Response, error)
List the pipelines for a given orginisation.
buildkite API docs: https://buildkite.com/docs/api/pipelines#list-pipelines
type Provider ¶
type Provider struct { ID *string `json:"id,omitempty"` WebhookURL *string `json:"webhook_url,omitempty"` }
Provider represents a source code provider.
type Response ¶
Response is a buildkite API response. This wraps the standard http.Response returned from buildkite and provides convenient access to things like pagination links.
type Step ¶
type Step struct { Type *string `json:"type,omitempty"` Name *string `json:"name,omitempty"` Command *string `json:"command,omitempty"` ArtifactPaths *string `json:"artifact_paths,omitempty"` BranchConfiguration *string `json:"branch_configuration,omitempty"` Env map[string]string `json:"env,omitempty"` TimeoutInMinutes interface{} `json:"timeout_in_minutes,omitempty"` // *shrug* AgentQueryRules interface{} `json:"agent_query_rules,omitempty"` // *shrug* }
Step represents a build step in buildkites build pipeline
type Timestamp ¶
Timestamp custom timestamp to support buildkite api timestamps
func NewTimestamp ¶
NewTimestamp make a new timestamp using the time suplied.
func (Timestamp) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface.
func (*Timestamp) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
type Token ¶
type Token struct { AccessToken *string `json:"access_token,omitempty"` Type *string `json:"token_type,omitempty"` }
Token an oauth access token for the buildkite service
type TokenAuthTransport ¶
type TokenAuthTransport struct { APIToken string APIHost string Transport http.RoundTripper }
TokenAuthTransport manages injection of the API token for each request
func NewTokenConfig ¶
func NewTokenConfig(apiToken string, debug bool) (*TokenAuthTransport, error)
NewTokenConfig configure authentication using an API token NOTE: the debug flag is not used anymore.
func (*TokenAuthTransport) Client ¶
func (t *TokenAuthTransport) Client() *http.Client
Client builds a new http client.
type User ¶
type User struct { ID *string `json:"id,omitempty"` Name *string `json:"name,omitempty"` Email *string `json:"email,omitempty"` CreatedAt *Timestamp `json:"created_at,omitempty"` }
User represents a buildkite user.
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
UserService handles communication with the user related methods of the buildkite API.
buildkite API docs: https://buildkite.com/docs/api
func (*UserService) Get ¶
func (os *UserService) Get() (*User, *Response, error)
Get the current user.
buildkite API docs: https://buildkite.com/docs/api