bamboo

package module
v0.0.0-...-7e9e969 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: MIT Imports: 13 Imported by: 1

README

Build Status GoDoc

Go-Bamboo

Go client library for communicating with an Atlassian Bamboo CI Server API.

go-github requires Go version 1.7 or greater.

Atlassian's Bamboo API documentation refers to endpoints as 'services'. This client library was modeled after go-github which also uses the term 'service' to describe an interface that implements all methods that interact with a certain endpoint group (the plan service implements plan related methods). As to not confuse the two, this documentation will refer to an API 'service' as a resource, i.e. go-bamboo exposes multiple services to communicate with the Bamboo API resources.

Table of Contents

Usage

import bamboo "github.com/rcarmstrong/go-bamboo"
Authenticaiton

At the moment, go-bamboo only supports simple credentials for authentication

bambooClient := bamboo.NewSimpleClient(nil, "myUsername", "myPassword")

// Optionally set a different connection URL for the bamboo client.
// Defaults to "http://localhost:8085/rest/api/latest/"
bambooClient.SetURL("https://my.bambooserver.com:8085/")

You may optionally pass in your own http client, replacing the nil above, to be used as the go-bamboo http client.

Bamboo Rest API Documentation

Atlassian Bamboo's Rest API documentation can be frustrating at time in how much it lacks in detail. With this project, I hope to save you from some of that frustration. The API documentation can be found here for those who are curious, with a more detailed but incomplete doc living here.

Permissions

Bamboo allows an admin to set access control on resources such as projects and plans. Most things have five levels of access:

  • View
  • Edit
  • Build
  • Clone
  • Admin

The expected strings for these permissions are defined as the constants ReadPermission, WritePermission, BuildPermission, ClonePermission, and AdminPermission. Read and Write are the same as View and Edit, the names just differ from the UI to the API.

Project Plan Permissions

Project plan permissions refers to the permissions a plan inherited for the project for a specific set of users, groups, or roles. The ProjectPlan service exposes the addition, removal, and changing of these permissions. Individual users, groups and the Logged In Users role can be given permission to view(read)/edit(write)/build/clone/administer(admin) the project's plans. Only the Anonymous Users role is restricted to only being able to have view permission.

Cloning a plan

Returns general info about the API.

-- TODO -- example

License

This software has been released under the MIT license. Have fun.

Documentation

Index

Constants

View Source
const AdminPermission string = "ADMINISTRATION"

AdminPermission is the sting the API expects for admin permissions. Allows a user to edit all aspects of the plan including permissions and stages.

View Source
const BuildPermission string = "BUILD"

BuildPermission the sting the API expects for build permissions. Allows a user to trigger a manual build, or suspend and resume the plan.

View Source
const ClonePermission string = "CLONE"

ClonePermission the sting the API expects for clone permissions. Allows a user to clone the plan.

View Source
const CreatePermission string = "CREATE"

CreatePermission is the string the API expects when allowing a user/group to create a resource

View Source
const CreateRepositoryPermission string = "CREATEREPOSITORY"

CreateRepositoryPermission is the string the API expects when allowing a user/group to create a repository

View Source
const DeploymentResource string = "deployment"

DeploymentResource is the URL piece when getting deployment permissions

View Source
const EnvironmentResource string = "environment"

EnvironmentResource is the URL piece when getting environment permissions

View Source
const GlobalResource string = "global"

GlobalResource is the URL piece when getting global permissions

View Source
const PausedState string = "PAUSED"

PausedState is the state of a paused Bamboo server

View Source
const PausingState string = "PAUSING"

PausingState is when the Bamboo server is in the process of being paused

View Source
const PlanResource string = "plan"

PlanResource is the URL piece when getting plan permissions

View Source
const PreparingForRestartState string = "PREPARING_FOR_RESTART"

PreparingForRestartState is the state of a Bamboo server preparing to be restarted

View Source
const ProjectPlanResource string = "projectplan"

ProjectPlanResource is the URL piece when getting projectplan permissions

View Source
const ProjectResource string = "project"

ProjectResource is the URL piece when getting project permissions

View Source
const ReadPermission string = "READ"

ReadPermission the sting the API expects for read permissions. Allows a user to view the plan and its builds.

View Source
const ReadyForRestartState string = "READY_FOR_RESTART"

ReadyForRestartState is the state of a Bamboo server ready to be restarted

View Source
const RepositoryResource string = "repository"

RepositoryResource is the URL piece when getting repository permissions

View Source
const RunningState string = "RUNNING"

RunningState is the state of a running Bamboo server

View Source
const WritePermission string = "WRITE"

WritePermission the sting the API expects for write permissions. Allows a user to view and edit the configuration of the plan and its jobs, not including permissions or stages.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authorizer

type Authorizer interface {
	Authorization() string
}

Authorizer is the interface that wraps the Authorization method Authorization returns the string to be used in the Authorization value of header

type Branch

type Branch struct {
	Description  string `json:"description"`
	ShortName    string `json:"shortName"`
	ShortKey     string `json:"shortKey"`
	Enabled      bool   `json:"enabled"`
	Link         *Link
	WorkflowType string `json:"workflowType"`
	*PlanKey
	Name string `json:"name,omitempty"`
}

Branch represents a single plan branch

type Branches

type Branches struct {
	*CollectionMetadata
	BranchList []*Branch `json:"branch"`
}

Branches is the collection of branches

type BranchesResponse

type BranchesResponse struct {
	*ResourceMetadata
	Branches *Branches `json:"branches"`
}

BranchesResponse encapsulates the information from requesting plan branch information

type BuildInfo

type BuildInfo struct {
	Version     string `json:"version,omitempty"`
	Edition     string `json:"edition,omitempty"`
	BuildDate   string `json:"buildDate,omitempty"`
	BuildNumber string `json:"buildNumber,omitempty"`
	State       string `json:"state,omitempty"`
}

BuildInfo represents the build information of the Bamboo server

type Change

type Change struct {
	Author      string `json:"author"`
	ChangeSetID string `json:"changesetId"`
}

Change represents the author and commit hash of a source code change

type ChangeSet

type ChangeSet struct {
	Set []Change `json:"change"`
}

ChangeSet represents a collection of type Change

type Client

type Client struct {
	BaseURL *url.URL

	// Services used for talking to different parts of the Bamboo API
	Info        *InfoService
	Plans       *PlanService
	Deploys     *DeployService
	Branches    *PlanBranchService
	Projects    *ProjectService
	Results     *ResultService
	Comments    *CommentService
	Labels      *LabelService
	Clone       *CloneService
	Server      *ServerService
	Permissions *Permissions
	// contains filtered or unexported fields
}

Client manages the communication with the Bamboo API

func NewClient

func NewClient(httpClient *http.Client, creds Authorizer) *Client

NewClient returns a new Bamboo API client. If a nil httpClient is provided, http.DefaultClient will be used.

func NewSimpleClient

func NewSimpleClient(httpClient *http.Client, username, password string) *Client

NewSimpleClient returns a new Bamboo API client. If a nil httpClient is provided, http.DefaultClient will be used. To use API methods which require authentication, provide an admin username/password

func NewTokenClient

func NewTokenClient(httpClient *http.Client, token string) *Client

NewSimpleClient returns a new Bamboo API client. If a nil httpClient is provided, http.DefaultClient will be used. To use API methods which require authentication, provide an admin username/password

func (*Client) Do

func (c *Client) Do(req *http.Request, v interface{}) (*http.Response, error)

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. If rate limit is exceeded and reset time is in the future, Do returns *RateLimitError immediately without making a network API call.

func (*Client) NewRequest

func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error)

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.

func (*Client) SetURL

func (c *Client) SetURL(desiredURL string) error

SetURL for the client to use for the Bamboo API

type CloneService

type CloneService service

CloneService handles the cloning of one Bamboo resource to another.

func (*CloneService) ClonePlan

func (c *CloneService) ClonePlan(srcKey, dstKey string) (*Plan, *http.Response, error)

ClonePlan clones a plan from one project to another given the full project-plan key for the source plan and the destination plan. The destination project does not need to be in the same project as the source plan. Returns a Plan struct of the resulting plan.

type CollectionMetadata

type CollectionMetadata struct {
	Size       int    `json:"size"`
	Expand     string `json:"expand"`
	StartIndex int    `json:"start-index"`
	MaxResult  int    `json:"max-result"`
}

CollectionMetadata holds metadata about a collection of Bamboo resources - Size: Number of resources - Expand: Element of the expand parameter used for the collection - StartIndex: Index from which to the request started gathering resources - MaxResult: The maximum number of returned resources for the request

type Comment

type Comment struct {
	Content   string `json:"content"`
	ResultKey string `json:"-"`
}

Comment is a single comment on a result

type CommentService

type CommentService service

CommentService handles communication with the comments on a plan result

func (*CommentService) AddComment

func (c *CommentService) AddComment(comment *Comment) (bool, *http.Response, error)

AddComment will add a comment to the given result.

type Deploy

type Deploy struct {
	ID           int                  `json:"id"`
	PlanKey      *PlanKey             `json:"planKey,omitempty"`
	Name         string               `json:"name,omitempty"`
	Description  string               `json:"description,omitempty"`
	Environments []*DeployEnvironment `json:"environments,omitempty"`
}

Deploy is a single Deploy definition

type DeployEnvironment

type DeployEnvironment struct {
	ID                  int    `json:"id"`
	Name                string `json:"name"`
	Description         string `json:"description,omitempty"`
	DeploymentProjectID int    `json:"deploymentProjectId,omitempty"`
}

DeployEnvironment is the information for an environment

type DeployEnvironmentResults

type DeployEnvironmentResults struct {
	Name    string          `json:"name"`
	ID      int             `json:"id"`
	Results []*DeployStatus `json:"results"`
}

DeployEnvironmentResults is the information for a single Deploy

type DeployResponse

type DeployResponse struct {
	*ResourceMetadata
}

DeployResponse is the REST response from the server

type DeployService

type DeployService service

DeployService handles communication with the deploy related methods

func (*DeployService) CreateDeployVersion

func (d *DeployService) CreateDeployVersion(deploymentProjectID int, planResultKey, versionName, nextVersionName string) (*DeployVersionResult, error)

CreateDeployVersion will take a deploy project id, plan result, version name and the next version name and create a release.

func (*DeployService) DeployEnvironmentResults

func (d *DeployService) DeployEnvironmentResults(id int) (*DeployEnvironmentResults, error)

DeployEnvironmentResults returns result information for the requested environment

func (*DeployService) DeployEnvironments

func (d *DeployService) DeployEnvironments(id int) (*DeployEnvironment, error)

DeployEnvironments returns information on the requested environment

func (*DeployService) DeployStatus

func (d *DeployService) DeployStatus(id int) (*DeployStatus, error)

DeployStatus returns information on the requested deploy

func (*DeployService) ListDeploys

func (d *DeployService) ListDeploys() (DeploysResponse, error)

ListDeploys lists all deployments

func (*DeployService) QueueDeploy

func (d *DeployService) QueueDeploy(environmentID, versionID int) (*QueueDeployRequest, error)

QueueDeploy adds a deploy of the specified version to the given environment.

type DeployStatus

type DeployStatus struct {
	DeploymentVersion     *DeploymentVersion `json:"deploymentVersion"`
	DeploymentVersionName string             `json:"deploymentVersionName"`
	DeploymentState       string             `json:"deploymentState"`
	LifeCycleState        string             `json:"lifeCycleState"`
	StartedDate           int                `json:"startedDate"`
}

DeployStatus contains deploy status information

type DeployVersionListResult

type DeployVersionListResult struct {
	Versions []*DeployVersionResult `json:"versions"`
}

DeployVersionListResult stores a list of deployment versions

type DeployVersionResult

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

DeployVersionResult will have the information for creating a new release/version for bamboo

type DeploymentVersion

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

DeploymentVersion contains version information for a deployment

type DeploysResponse

type DeploysResponse = []*Deploy

DeploysResponse is a collection of Deploy elements

type Group

type Group struct {
	Name        string   `json:"name"`
	Permissions []string `json:"permissions,omitempty"`
}

Group contains information about a group of Bamboo users

type InfoService

type InfoService service

InfoService retrieves server information

func (*InfoService) BuildInfo

func (i *InfoService) BuildInfo() (*BuildInfo, *http.Response, error)

BuildInfo fetches the build information of the Bamboo server

func (*InfoService) ServerInfo

func (i *InfoService) ServerInfo() (*ServerInfo, *http.Response, error)

ServerInfo fetches the Bamboo server information

type Label

type Label struct {
	Name      string `json:"name"`
	ResultKey string `json:"-"`
}

Label is a single label on a result

type LabelService

type LabelService service

LabelService handles communication with the labels on a plan result

func (*LabelService) AddLabel

func (c *LabelService) AddLabel(label *Label) (bool, *http.Response, error)

AddLabel will add a label to the given result.

type Link struct {
	HREF string `json:"href"`
	Rel  string `json:"rel"`
}

Link holds link information for the service - HREF: Relationship between link and element (defaults to "self") - Rel: URL for the project

type Pagination

type Pagination struct {
	Start int
	Limit int
}

Pagination used to specify the start and limit indexes of a paginated API resource

type Permissions

type Permissions service

Permissions is the container for all permissions related endpoints

func (*Permissions) AvailableGroupsPermissionsList

func (p *Permissions) AvailableGroupsPermissionsList(opts PermissionsOpts) ([]Group, *http.Response, error)

AvailableGroupsPermissionsList returns a list of groups which weren't explicitly granted any permissions to the resource. Leave Key blank when setting permissions globally.

func (*Permissions) AvailableUsersPermissionsList

func (p *Permissions) AvailableUsersPermissionsList(opts PermissionsOpts) ([]User, *http.Response, error)

AvailableUsersPermissionsList return a list of users which weren't explicitly granted any project plan permissions for the given project.

func (*Permissions) GroupPermissions

func (p *Permissions) GroupPermissions(group string, opts PermissionsOpts) ([]string, *http.Response, error)

GroupPermissions returns the group's permissions for the given resource. Leave Key blank when setting permissions globally.

func (*Permissions) GroupPermissionsList

func (p *Permissions) GroupPermissionsList(opts PermissionsOpts) ([]Group, *http.Response, error)

GroupPermissionsList returns a list of group permissions for the given resource. Leave Key blank when setting permissions globally.

func (*Permissions) RemoveAnonymousReadPermission

func (p *Permissions) RemoveAnonymousReadPermission(opts PermissionsOpts) (*http.Response, error)

RemoveAnonymousReadPermission removes the ability for anonymous users to view plans

func (*Permissions) RemoveGroupPermissions

func (p *Permissions) RemoveGroupPermissions(group string, permissions []string, opts PermissionsOpts) (*http.Response, error)

RemoveGroupPermissions removes the given permissions from the group's permissions for the given project's plans. Leave Key blank when setting permissions globally.

func (*Permissions) RemoveLoggedInUsersPermissions

func (p *Permissions) RemoveLoggedInUsersPermissions(permissions []string, opts PermissionsOpts) (*http.Response, error)

RemoveLoggedInUsersPermissions removes the given permissions from the logged in users role's permissions for the given project's plans

func (*Permissions) RemoveUserPermissions

func (p *Permissions) RemoveUserPermissions(username string, permissions []string, opts PermissionsOpts) (*http.Response, error)

RemoveUserPermissions removes the given permissions from the users permissions for the given project's plans

func (*Permissions) RolePermissionsList

func (p *Permissions) RolePermissionsList(opts PermissionsOpts) ([]Role, *http.Response, error)

RolePermissionsList returns the list of permissions for the roles on the given entity in the given resource

func (*Permissions) SetAnonymousReadPermission

func (p *Permissions) SetAnonymousReadPermission(opts PermissionsOpts) (*http.Response, error)

SetAnonymousReadPermission allows anonymous users to view plans

func (*Permissions) SetGroupPermissions

func (p *Permissions) SetGroupPermissions(group string, permissions []string, opts PermissionsOpts) (*http.Response, error)

SetGroupPermissions sets the group's permissions for the given resource. Leave Key blank when setting permissions globally.

func (*Permissions) SetLoggedInUsersPermissions

func (p *Permissions) SetLoggedInUsersPermissions(permissions []string, opts PermissionsOpts) (*http.Response, error)

SetLoggedInUsersPermissions sets the logged in users role's permissions for the given project's plans to the passed in permissions

func (*Permissions) SetUserPermissions

func (p *Permissions) SetUserPermissions(username string, permissions []string, opts PermissionsOpts) (*http.Response, error)

SetUserPermissions sets the users permissions for the given project's plans to the passed in permissions array

func (*Permissions) UserPermissions

func (p *Permissions) UserPermissions(username string, opts PermissionsOpts) (*User, *http.Response, error)

UserPermissions returns the permissions for the specified user on the given resource in the given service

func (*Permissions) UserPermissionsList

func (p *Permissions) UserPermissionsList(opts PermissionsOpts) ([]User, *http.Response, error)

UserPermissionsList returns a list of users and their permissions for the given resource key in the service

type PermissionsOpts

type PermissionsOpts struct {
	Resource string
	Key      string
}

PermissionsOpts holds the name of the resource that permissions are being retrieved from and the key for the specific object in that resource. -- LEAVE KEY BLANK FOR GLOBAL PERMISSIONS --

type Plan

type Plan struct {
	ShortName string   `json:"shortName,omitempty"`
	ShortKey  string   `json:"shortKey,omitempty"`
	Type      string   `json:"type,omitempty"`
	Enabled   bool     `json:"enabled,omitempty"`
	Link      *Link    `json:"link,omitempty"`
	Key       string   `json:"key,omitempty"`
	Name      string   `json:"name,omitempty"`
	PlanKey   *PlanKey `json:"planKey,omitempty"`
}

Plan is the definition of a single plan

type PlanBranchExpandOptions

type PlanBranchExpandOptions struct {
	Actions         bool
	Stages          bool
	Branches        bool
	VariableContext bool
}

PlanBranchExpandOptions are the optional parameters to a request for plan branch information.

type PlanBranchService

type PlanBranchService service

PlanBranchService is a derivative of the plan service to handle interacting with plan branches

func (*PlanBranchService) BranchInfo

func (pb *PlanBranchService) BranchInfo(planKey, branchName string) (*Branch, *http.Response, error)

BranchInfo retrieves the information from the given branch name

func (*PlanBranchService) ListPlanBranches

func (pb *PlanBranchService) ListPlanBranches(planKey string) ([]*Branch, *http.Response, error)

ListPlanBranches lists all plan branches for a given plan

func (*PlanBranchService) ListVCSBranches

func (pb *PlanBranchService) ListVCSBranches(planKey string) ([]string, *http.Response, error)

ListVCSBranches returns a list of all VCS branches

type PlanCreateBranchOptions

type PlanCreateBranchOptions struct {
	VCSBranch string
}

PlanCreateBranchOptions specifies the optional parameters for the CreatePlanBranch method

type PlanKey

type PlanKey struct {
	Key string `json:"key,omitempty"`
}

PlanKey holds the plan-key for a plan

type PlanResponse

type PlanResponse struct {
	*ResourceMetadata
	Plans *Plans `json:"plans"`
}

PlanResponse encapsultes a response from the plan service

type PlanService

type PlanService service

PlanService handles communication with the plan related methods

func (*PlanService) CreatePlanBranch

func (p *PlanService) CreatePlanBranch(planKey, branchName string, options *PlanCreateBranchOptions) (bool, *http.Response, error)

CreatePlanBranch will create a plan branch with the given branch name for the specified build

func (*PlanService) DisablePlan

func (p *PlanService) DisablePlan(planKey string) (*http.Response, error)

DisablePlan will disable a plan or plan branch

func (*PlanService) ListPlanKeys

func (p *PlanService) ListPlanKeys() ([]string, *http.Response, error)

ListPlanKeys get all the plan keys for all build plans on Bamboo

func (*PlanService) ListPlanNames

func (p *PlanService) ListPlanNames() ([]string, *http.Response, error)

ListPlanNames returns a list of ShortNames of all plans

func (*PlanService) ListPlans

func (p *PlanService) ListPlans() ([]*Plan, *http.Response, error)

ListPlans gets information on all plans

func (*PlanService) NumberOfPlans

func (p *PlanService) NumberOfPlans() (int, *http.Response, error)

NumberOfPlans returns the number of plans on the Bamboo server

func (*PlanService) PlanNameMap

func (p *PlanService) PlanNameMap() (map[string]string, *http.Response, error)

PlanNameMap returns a map[string]string where the PlanKey is the key and the ShortName is the value

type Plans

type Plans struct {
	*CollectionMetadata
	PlanList []*Plan `json:"plan"`
}

Plans is a collection of Plan objects

type Project

type Project struct {
	Key         string `json:"key,omitempty"`
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
	Link        *Link  `json:"link,omitempty"`
}

Project is a single project definition

type ProjectInformation

type ProjectInformation struct {
	Key         string                   `json:"key,omitempty"`
	Name        string                   `json:"name,omitempty"`
	Description string                   `json:"description,omitempty"`
	NumPlans    *ProjectPlansInformation `json:"plans"`
}

ProjectInformation is the information for a single project

type ProjectPlansInformation

type ProjectPlansInformation struct {
	Size int `json:"size,omitempty"`
}

ProjectPlansInformation holds the number of plans in a project

type ProjectResponse

type ProjectResponse struct {
	*ResourceMetadata
	Projects *Projects `json:"projects"`
}

ProjectResponse the REST response from the server

type ProjectService

type ProjectService service

ProjectService handles communication with the project related methods

func (*ProjectService) ListProjects

func (p *ProjectService) ListProjects() ([]*Project, *http.Response, error)

ListProjects lists all projects

func (*ProjectService) ProjectInfo

func (p *ProjectService) ProjectInfo(projectKey string) (*ProjectInformation, *http.Response, error)

ProjectInfo get the information on the specific project

func (*ProjectService) ProjectPlans

func (p *ProjectService) ProjectPlans(projectKey string) ([]*Plan, *http.Response, error)

ProjectPlans returns a list of plans for a given project

type Projects

type Projects struct {
	*CollectionMetadata
	ProjectList []*Project `json:"project"`
}

Projects is a collection of project elements

type QueueDeployRequest

type QueueDeployRequest struct {
	DeploymentResultID int   `json:"deploymentResultId"`
	Link               *Link `json:"link"`
}

QueueDeployRequest contains information from a queue deploy request

type ReindexState

type ReindexState struct {
	ReindexInProgress bool `json:"reindexInProgress"`
	ReindexPending    bool `json:"reindexPending"`
}

ReindexState represents the state of a server reindex. ReindexInProgress - true if a reindex is in progress otherwise false ReindexPending - reindex is required (i.e. it failed before or some upgrade task asked for it)

type ResourceMetadata

type ResourceMetadata struct {
	Expand string `json:"expand"`
	Link   *Link  `json:"link"`
}

ResourceMetadata holds metadata about the API service response - Expand: Element of the expand parameter used for the service - Link: See ServiceLink

type Result

type Result struct {
	ChangeSet              `json:"changes"`
	ID                     int    `json:"id"`
	PlanName               string `json:"planName"`
	ProjectName            string `json:"projectName"`
	BuildResultKey         string `json:"buildResultKey"`
	LifeCycleState         string `json:"lifeCycleState"`
	BuildStartedTime       string `json:"buildStartedTime"`
	BuildCompletedTime     string `json:"buildCompletedTime"`
	BuildDurationInSeconds int    `json:"buildDurationInSeconds"`
	VcsRevisionKey         string `json:"vcsRevisionKey"`
	BuildTestSummary       string `json:"buildTestSummary"`
	SuccessfulTestCount    int    `json:"successfulTestCount"`
	FailedTestCount        int    `json:"failedTestCount"`
	QuarantinedTestCount   int    `json:"quarantinedTestCount"`
	SkippedTestCount       int    `json:"skippedTestCount"`
	Finished               bool   `json:"finished"`
	Successful             bool   `json:"successful"`
	BuildReason            string `json:"buildReason"`
	ReasonSummary          string `json:"reasonSummary"`
	Key                    string `json:"key"`
	State                  string `json:"state"`
	BuildState             string `json:"buildState"`
	Number                 int    `json:"number"`
	BuildNumber            int    `json:"buildNumber"`
}

Result represents all the information associated with a build result

type ResultService

type ResultService service

ResultService handles communication with build results

func (*ResultService) LatestResult

func (r *ResultService) LatestResult(key string) (*Result, *http.Response, error)

LatestResult returns the latest result information for the given plan key

func (*ResultService) ListResults

func (r *ResultService) ListResults(key string) ([]*Result, *http.Response, error)

NumberedResult returns the result information for the given plan key which includes the build number of the desired result

func (*ResultService) NumberedResult

func (r *ResultService) NumberedResult(key string) (*Result, *http.Response, error)

NumberedResult returns the result information for the given plan key which includes the build number of the desired result

type Results

type Results struct {
	*CollectionMetadata
	ResultList []*Result `json:"result"`
}

Results is the collection of results

type ResultsResponse

type ResultsResponse struct {
	*ResourceMetadata
	Results *Results `json:"results"`
}

ResultsResponse encapsulates the information from requesting result information

type Role

type Role struct {
	Name        string   `json:"name"`
	Permissions []string `json:"permissions,omitempty"`
}

Role contains information about a role

type ServerInfo

type ServerInfo struct {
	State             string `json:"state"`
	ReindexInProgress bool   `json:"reindexInProgress"`
}

ServerInfo contains information on the Bamboo server

type ServerService

type ServerService service

ServerService exposes server operations

func (*ServerService) Pause

Pause will move the Bamboo server to the PAUSED state. The PAUSED state only prevents new builds from being scheduled. Change detection and other server operations will continue to run.

func (*ServerService) PrepareForRestart

func (s *ServerService) PrepareForRestart() (*TransitionStateInfo, *http.Response, error)

PrepareForRestart will move the Bamboo server to the PREPARING_FOR_RESTART state. Change detection, indexing, ec2 instance ordering etc. are stopped to allow for a server restart.

func (*ServerService) Reindex

func (s *ServerService) Reindex() (*ReindexState, *http.Response, error)

Reindex will start a server reindex

func (*ServerService) ReindexStatus

func (s *ServerService) ReindexStatus() (*ReindexState, *http.Response, error)

ReindexStatus will start a server reindex

func (*ServerService) Resume

Resume will move the Bamboo server to either the RUNNING or READY_FOR_RESTART state. The RUNNING state means the server was PAUSED and builds will resume. The READY_FOR_RESTART state means exactly what the name suggests and builds will not resume until the server is restarted.

type SimpleCredentials

type SimpleCredentials struct {
	Username string
	Password string
}

SimpleCredentials are the username and password used to communicate with the API

func (*SimpleCredentials) Authorization

func (sc *SimpleCredentials) Authorization() string

type TokenCredentials

type TokenCredentials struct {
	Token string
}

TokenCredentials are the token used to communicate with the API https://developer.atlassian.com/server/bamboo/using-the-bamboo-rest-apis/

func (*TokenCredentials) Authorization

func (tc *TokenCredentials) Authorization() string

type TransitionStateInfo

type TransitionStateInfo struct {
	ServerInfo
	SetByUser string `json:"setByUser"`
}

TransitionStateInfo represents the server state response after a server operation is preformed.

type User

type User struct {
	Name        string   `json:"name"`
	FullName    string   `json:"fullName"`
	Email       string   `json:"email"`
	Permissions []string `json:"permissions,omitempty"`
}

User contains information about a Bamboo user account

Jump to

Keyboard shortcuts

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