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 BasicAuthTransport
- type Build
- type BuildsListOptions
- type BuildsService
- func (as *BuildsService) Get(org string, project 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) ListByProject(org string, project string, opt *BuildsListOptions) ([]Build, *Response, error)
- type Client
- type Emoji
- type ErrorResponse
- type Job
- type ListOptions
- type Organization
- type OrganizationListOptions
- type OrganizationsService
- type Project
- type ProjectListOptions
- type ProjectsService
- 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 = "1.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"` 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"` CreatedAt *Timestamp `json:"created_at,omitempty"` // the user which created the agent Creator *User `json:"creator,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 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]string `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"` // jobs run during the build Jobs []*Job `json:"jobs,omitempty"` // the project this build is associated with Project *Project `json:"project,omitempty"` }
Build represents a build which has run in buildkite
type BuildsListOptions ¶
type BuildsListOptions struct { // State of builds to list. Possible values are: running, scheduled, passed, // failed, canceled, skipped and not_run. Default is "". State string `url:"state,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) 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) ListByProject ¶
func (bs *BuildsService) ListByProject(org string, project string, opt *BuildsListOptions) ([]Build, *Response, error)
ListByProject lists the builds for a project within the specified originisation.
buildkite API docs: https://buildkite.com/docs/api/builds#list-builds-for-a-project
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 Builds *BuildsService Organizations *OrganizationsService Projects *ProjectsService 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 ErrorResponse ¶
type ErrorResponse struct { Response *http.Response // HTTP response that caused this error Message string `json:"message"` // error message }
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"` }
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"` ProjectsURL *string `json:"projects_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 Project ¶
type Project 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"` 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 featured when you view the project FeaturedBuild *Build `json:"featured_build,omitempty"` // build steps Steps []*Step `json:"steps,omitempty"` }
Project represents a buildkite project.
type ProjectListOptions ¶
type ProjectListOptions struct {
ListOptions
}
ProjectListOptions specifies the optional parameters to the ProjectsService.List method.
type ProjectsService ¶
type ProjectsService struct {
// contains filtered or unexported fields
}
ProjectsService handles communication with the project related methods of the buildkite API.
buildkite API docs: https://buildkite.com/docs/api/projects
func (*ProjectsService) List ¶
func (ps *ProjectsService) List(org string, opt *ProjectListOptions) ([]Project, *Response, error)
List the projects for a given orginisation.
buildkite API docs: https://buildkite.com/docs/api/projects#list-projects
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 ¶
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
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