buildbucket

package
v0.0.0-...-03780a1 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 21 Imported by: 15

Documentation

Overview

Package buildbucket provides access to the Build Bucket Service.

Creating a client

Usage example:

import "go.chromium.org/luci/common/api/buildbucket/buildbucket/v1"
...
ctx := context.Background()
buildbucketService, err := buildbucket.NewService(ctx)

In this example, Google Application Default Credentials are used for authentication.

For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.

Other authentication options

To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:

buildbucketService, err := buildbucket.NewService(ctx, option.WithAPIKey("AIza..."))

To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:

config := &oauth2.Config{...}
// ...
token, err := config.Exchange(ctx, ...)
buildbucketService, err := buildbucket.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))

See https://godoc.org/google.golang.org/api/option/ for details on options.

Index

Constants

View Source
const (
	// StatusScheduled means a build was created, but did not start or
	// complete.
	// The initial state of a build.
	StatusScheduled = "SCHEDULED"
	// StatusStarted means a build has started.
	StatusStarted = "STARTED"
	// StatusCompleted means a build has completed. See its Result.
	StatusCompleted = "COMPLETED"
)

Build statuses.

View Source
const (
	// ResultFailure means a build has failed, with or without an infra-failure.
	ResultFailure = "FAILURE"
	// ResultSuccess means a build has succeeded.
	ResultSuccess = "SUCCESS"
	// ResultCanceled means a build was cancelled or timed out.
	ResultCanceled = "CANCELED"
)
View Source
const (
	// TagBuilder is the key of builder name tag.
	TagBuilder = "builder"
	// TagBuildAddress is the key of the build address tag.
	// See also Build.Address().
	TagBuildAddress = "build_address"
	// TagBuildSet is a key of a tag used to group related builds.
	// See also ParseBuildSet.
	// When a build triggers a new build, the buildset tag must be copied.
	TagBuildSet = "buildset"
)
View Source
const (
	// ReasonNotFound means the given build ID was not found on the BuildBucket service.
	ReasonNotFound = "BUILD_NOT_FOUND"
)
View Source
const (
	// StatusFilterIncomplete matches StatusScheduled or StatusStarted.
	StatusFilterIncomplete = "INCOMPLETE"
)

Build status filters. Can be used only when searching. A build cannot have any of these statuses.

Any build status defined above can be used as a status filter too.

View Source
const (
	// https://www.googleapis.com/auth/userinfo.email
	UserinfoEmailScope = "https://www.googleapis.com/auth/userinfo.email"
)

OAuth2 scopes used by this API.

Variables

This section is empty.

Functions

func BucketNameToV2

func BucketNameToV2(v1Bucket string) (project string, bucket string)

BucketNameToV2 converts a v1 Bucket name to the v2 constituent parts. The difference between the bucket name is that v2 uses short names, for example: v1: luci.chromium.try v2: try "luci" is dropped, "chromium" is recorded as the project, "try" is the name. If the bucket does not conform to this convention, or if it is not a luci bucket, then this return and empty string for both project and bucket.

func FormatBuildAddress

func FormatBuildAddress(id int64, bucket, builder string, number int) string

FormatBuildAddress returns a value for TagBuildAddress tag. If number is positive, returns "<bucket>/<builder>/<number>", otherwise returns "<id>"

See also ParseBuildAddress.

func FormatTimestamp

func FormatTimestamp(t time.Time) int64

FormatTimestamp converts t to a buildbucket timestamp.

func ParseBuildAddress

func ParseBuildAddress(address string) (id int64, project, bucket, builder string, number int, err error)

ParseBuildAddress parses a value of a TagBuildAddress tag. See also FormatBuildAddress.

If id is non-zero, project, bucket and builder are zero. If bucket is non-zero, id is zero.

func ParseTimestamp

func ParseTimestamp(usec int64) time.Time

ParseTimestamp parses a buildbucket timestamp.

func ProjectFromBucket

func ProjectFromBucket(bucket string) string

ProjectFromBucket tries to retrieve project id from bucket name. Returns "" on failure.

func ValidateBuildAddress

func ValidateBuildAddress(address string) error

ValidateBuildAddress returns an error if the build address is invalid.

Types

type CancelCall

type CancelCall struct {
	// contains filtered or unexported fields
}

func (*CancelCall) Context

func (c *CancelCall) Context(ctx context.Context) *CancelCall

Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled.

func (*CancelCall) Do

Do executes the "buildbucket.cancel" call. Exactly one of *LegacyApiBuildResponseMessage or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *LegacyApiBuildResponseMessage.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.

func (*CancelCall) Fields

func (c *CancelCall) Fields(s ...googleapi.Field) *CancelCall

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.

func (*CancelCall) Header

func (c *CancelCall) Header() http.Header

Header returns an http.Header that can be modified by the caller to add HTTP headers to the request.

type FailCall

type FailCall struct {
	// contains filtered or unexported fields
}

func (*FailCall) Context

func (c *FailCall) Context(ctx context.Context) *FailCall

Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled.

func (*FailCall) Do

Do executes the "buildbucket.fail" call. Exactly one of *LegacyApiBuildResponseMessage or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *LegacyApiBuildResponseMessage.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.

func (*FailCall) Fields

func (c *FailCall) Fields(s ...googleapi.Field) *FailCall

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.

func (*FailCall) Header

func (c *FailCall) Header() http.Header

Header returns an http.Header that can be modified by the caller to add HTTP headers to the request.

type GetCall

type GetCall struct {
	// contains filtered or unexported fields
}

func (*GetCall) Context

func (c *GetCall) Context(ctx context.Context) *GetCall

Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled.

func (*GetCall) Do

Do executes the "buildbucket.get" call. Exactly one of *LegacyApiBuildResponseMessage or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *LegacyApiBuildResponseMessage.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.

func (*GetCall) Fields

func (c *GetCall) Fields(s ...googleapi.Field) *GetCall

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.

func (*GetCall) Header

func (c *GetCall) Header() http.Header

Header returns an http.Header that can be modified by the caller to add HTTP headers to the request.

func (*GetCall) IfNoneMatch

func (c *GetCall) IfNoneMatch(entityTag string) *GetCall

IfNoneMatch sets the optional parameter which makes the operation fail if the object's ETag matches the given value. This is useful for getting updates only after the object has changed since the last request. Use googleapi.IsNotModified to check whether the response error from Do is the result of In-None-Match.

type HeartbeatBatchCall

type HeartbeatBatchCall struct {
	// contains filtered or unexported fields
}

func (*HeartbeatBatchCall) Context

Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled.

func (*HeartbeatBatchCall) Do

Do executes the "buildbucket.heartbeat_batch" call. Exactly one of *LegacyApiHeartbeatBatchResponseMessage or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *LegacyApiHeartbeatBatchResponseMessage.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.

func (*HeartbeatBatchCall) Fields

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.

func (*HeartbeatBatchCall) Header

func (c *HeartbeatBatchCall) Header() http.Header

Header returns an http.Header that can be modified by the caller to add HTTP headers to the request.

type HeartbeatCall

type HeartbeatCall struct {
	// contains filtered or unexported fields
}

func (*HeartbeatCall) Context

func (c *HeartbeatCall) Context(ctx context.Context) *HeartbeatCall

Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled.

func (*HeartbeatCall) Do

Do executes the "buildbucket.heartbeat" call. Exactly one of *LegacyApiBuildResponseMessage or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *LegacyApiBuildResponseMessage.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.

func (*HeartbeatCall) Fields

func (c *HeartbeatCall) Fields(s ...googleapi.Field) *HeartbeatCall

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.

func (*HeartbeatCall) Header

func (c *HeartbeatCall) Header() http.Header

Header returns an http.Header that can be modified by the caller to add HTTP headers to the request.

type LeaseCall

type LeaseCall struct {
	// contains filtered or unexported fields
}

func (*LeaseCall) Context

func (c *LeaseCall) Context(ctx context.Context) *LeaseCall

Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled.

func (*LeaseCall) Do

Do executes the "buildbucket.lease" call. Exactly one of *LegacyApiBuildResponseMessage or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *LegacyApiBuildResponseMessage.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.

func (*LeaseCall) Fields

func (c *LeaseCall) Fields(s ...googleapi.Field) *LeaseCall

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.

func (*LeaseCall) Header

func (c *LeaseCall) Header() http.Header

Header returns an http.Header that can be modified by the caller to add HTTP headers to the request.

type LegacyApiBuildResponseMessage

type LegacyApiBuildResponseMessage struct {
	// Build: Describes model.Build, see its docstring.
	Build *LegacyApiCommonBuildMessage `json:"build,omitempty"`

	Error *LegacyApiErrorMessage `json:"error,omitempty"`

	// ServerResponse contains the HTTP response code and headers from the
	// server.
	googleapi.ServerResponse `json:"-"`

	// ForceSendFields is a list of field names (e.g. "Build") to
	// unconditionally include in API requests. By default, fields with
	// empty or default values are omitted from API requests. However, any
	// non-pointer, non-interface field appearing in ForceSendFields will be
	// sent to the server regardless of whether the field is empty or not.
	// This may be used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "Build") to include in API
	// requests with the JSON null value. By default, fields with empty
	// values are omitted from API requests. However, any field with an
	// empty value appearing in NullFields will be sent to the server as
	// null. It is an error if a field in this list has a non-empty value.
	// This may be used to include null fields in Patch requests.
	NullFields []string `json:"-"`
}

func (*LegacyApiBuildResponseMessage) MarshalJSON

func (s *LegacyApiBuildResponseMessage) MarshalJSON() ([]byte, error)

type LegacyApiCancelRequestBodyMessage

type LegacyApiCancelRequestBodyMessage struct {
	ResultDetailsJson string `json:"result_details_json,omitempty"`

	// ForceSendFields is a list of field names (e.g. "ResultDetailsJson")
	// to unconditionally include in API requests. By default, fields with
	// empty or default values are omitted from API requests. However, any
	// non-pointer, non-interface field appearing in ForceSendFields will be
	// sent to the server regardless of whether the field is empty or not.
	// This may be used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "ResultDetailsJson") to
	// include in API requests with the JSON null value. By default, fields
	// with empty values are omitted from API requests. However, any field
	// with an empty value appearing in NullFields will be sent to the
	// server as null. It is an error if a field in this list has a
	// non-empty value. This may be used to include null fields in Patch
	// requests.
	NullFields []string `json:"-"`
}

func (*LegacyApiCancelRequestBodyMessage) MarshalJSON

func (s *LegacyApiCancelRequestBodyMessage) MarshalJSON() ([]byte, error)

type LegacyApiCommonBuildMessage

type LegacyApiCommonBuildMessage struct {
	Bucket string `json:"bucket,omitempty"`

	Canary bool `json:"canary,omitempty"`

	// Possible values:
	//   "AUTO"
	//   "CANARY"
	//   "PROD"
	CanaryPreference string `json:"canary_preference,omitempty"`

	// Possible values:
	//   "CANCELED_EXPLICITLY"
	//   "TIMEOUT"
	//   "UNSET"
	CancelationReason string `json:"cancelation_reason,omitempty"`

	CompletedTs int64 `json:"completed_ts,omitempty,string"`

	CreatedBy string `json:"created_by,omitempty"`

	CreatedTs int64 `json:"created_ts,omitempty,string"`

	Experimental bool `json:"experimental,omitempty"`

	// Possible values:
	//   "BUILDBUCKET_FAILURE"
	//   "BUILD_FAILURE"
	//   "INFRA_FAILURE"
	//   "INVALID_BUILD_DEFINITION"
	//   "UNSET"
	FailureReason string `json:"failure_reason,omitempty"`

	Id int64 `json:"id,omitempty,string"`

	LeaseExpirationTs int64 `json:"lease_expiration_ts,omitempty,string"`

	LeaseKey int64 `json:"lease_key,omitempty,string"`

	ParametersJson string `json:"parameters_json,omitempty"`

	Project string `json:"project,omitempty"`

	// Possible values:
	//   "CANCELED"
	//   "FAILURE"
	//   "SUCCESS"
	//   "UNSET"
	Result string `json:"result,omitempty"`

	ResultDetailsJson string `json:"result_details_json,omitempty"`

	RetryOf int64 `json:"retry_of,omitempty,string"`

	ServiceAccount string `json:"service_account,omitempty"`

	StartedTs int64 `json:"started_ts,omitempty,string"`

	// Possible values:
	//   "COMPLETED"
	//   "SCHEDULED"
	//   "STARTED"
	//   "UNSET"
	Status string `json:"status,omitempty"`

	StatusChangedTs int64 `json:"status_changed_ts,omitempty,string"`

	Tags []string `json:"tags,omitempty"`

	UpdatedTs int64 `json:"updated_ts,omitempty,string"`

	Url string `json:"url,omitempty"`

	UtcnowTs int64 `json:"utcnow_ts,omitempty,string"`

	// ForceSendFields is a list of field names (e.g. "Bucket") to
	// unconditionally include in API requests. By default, fields with
	// empty or default values are omitted from API requests. However, any
	// non-pointer, non-interface field appearing in ForceSendFields will be
	// sent to the server regardless of whether the field is empty or not.
	// This may be used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "Bucket") to include in API
	// requests with the JSON null value. By default, fields with empty
	// values are omitted from API requests. However, any field with an
	// empty value appearing in NullFields will be sent to the server as
	// null. It is an error if a field in this list has a non-empty value.
	// This may be used to include null fields in Patch requests.
	NullFields []string `json:"-"`
}

LegacyApiCommonBuildMessage: Describes model.Build, see its docstring.

func GetByAddress

func GetByAddress(ctx context.Context, client *Service, address string) (*LegacyApiCommonBuildMessage, error)

GetByAddress fetches a build by its address. Returns (nil, nil) if build is not found.

func (*LegacyApiCommonBuildMessage) MarshalJSON

func (s *LegacyApiCommonBuildMessage) MarshalJSON() ([]byte, error)

type LegacyApiErrorMessage

type LegacyApiErrorMessage struct {
	Message string `json:"message,omitempty"`

	// Possible values:
	//   "BUILDER_NOT_FOUND"
	//   "BUILD_IS_COMPLETED"
	//   "BUILD_NOT_FOUND"
	//   "CANNOT_LEASE_BUILD"
	//   "INVALID_BUILD_STATE"
	//   "INVALID_INPUT"
	//   "LEASE_EXPIRED"
	Reason string `json:"reason,omitempty"`

	// ForceSendFields is a list of field names (e.g. "Message") to
	// unconditionally include in API requests. By default, fields with
	// empty or default values are omitted from API requests. However, any
	// non-pointer, non-interface field appearing in ForceSendFields will be
	// sent to the server regardless of whether the field is empty or not.
	// This may be used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "Message") to include in
	// API requests with the JSON null value. By default, fields with empty
	// values are omitted from API requests. However, any field with an
	// empty value appearing in NullFields will be sent to the server as
	// null. It is an error if a field in this list has a non-empty value.
	// This may be used to include null fields in Patch requests.
	NullFields []string `json:"-"`
}

func (*LegacyApiErrorMessage) MarshalJSON

func (s *LegacyApiErrorMessage) MarshalJSON() ([]byte, error)

type LegacyApiFailRequestBodyMessage

type LegacyApiFailRequestBodyMessage struct {
	// Possible values:
	//   "BUILDBUCKET_FAILURE"
	//   "BUILD_FAILURE"
	//   "INFRA_FAILURE"
	//   "INVALID_BUILD_DEFINITION"
	//   "UNSET"
	FailureReason string `json:"failure_reason,omitempty"`

	LeaseKey int64 `json:"lease_key,omitempty,string"`

	NewTags []string `json:"new_tags,omitempty"`

	ResultDetailsJson string `json:"result_details_json,omitempty"`

	Url string `json:"url,omitempty"`

	// ForceSendFields is a list of field names (e.g. "FailureReason") to
	// unconditionally include in API requests. By default, fields with
	// empty or default values are omitted from API requests. However, any
	// non-pointer, non-interface field appearing in ForceSendFields will be
	// sent to the server regardless of whether the field is empty or not.
	// This may be used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "FailureReason") to include
	// in API requests with the JSON null value. By default, fields with
	// empty values are omitted from API requests. However, any field with
	// an empty value appearing in NullFields will be sent to the server as
	// null. It is an error if a field in this list has a non-empty value.
	// This may be used to include null fields in Patch requests.
	NullFields []string `json:"-"`
}

func (*LegacyApiFailRequestBodyMessage) MarshalJSON

func (s *LegacyApiFailRequestBodyMessage) MarshalJSON() ([]byte, error)

type LegacyApiHeartbeatBatchRequestMessage

type LegacyApiHeartbeatBatchRequestMessage struct {
	Heartbeats []*LegacyApiHeartbeatBatchRequestMessageOneHeartbeat `json:"heartbeats,omitempty"`

	// ForceSendFields is a list of field names (e.g. "Heartbeats") to
	// unconditionally include in API requests. By default, fields with
	// empty or default values are omitted from API requests. However, any
	// non-pointer, non-interface field appearing in ForceSendFields will be
	// sent to the server regardless of whether the field is empty or not.
	// This may be used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "Heartbeats") to include in
	// API requests with the JSON null value. By default, fields with empty
	// values are omitted from API requests. However, any field with an
	// empty value appearing in NullFields will be sent to the server as
	// null. It is an error if a field in this list has a non-empty value.
	// This may be used to include null fields in Patch requests.
	NullFields []string `json:"-"`
}

func (*LegacyApiHeartbeatBatchRequestMessage) MarshalJSON

func (s *LegacyApiHeartbeatBatchRequestMessage) MarshalJSON() ([]byte, error)

type LegacyApiHeartbeatBatchRequestMessageOneHeartbeat

type LegacyApiHeartbeatBatchRequestMessageOneHeartbeat struct {
	BuildId int64 `json:"build_id,omitempty,string"`

	LeaseExpirationTs int64 `json:"lease_expiration_ts,omitempty,string"`

	LeaseKey int64 `json:"lease_key,omitempty,string"`

	// ForceSendFields is a list of field names (e.g. "BuildId") to
	// unconditionally include in API requests. By default, fields with
	// empty or default values are omitted from API requests. However, any
	// non-pointer, non-interface field appearing in ForceSendFields will be
	// sent to the server regardless of whether the field is empty or not.
	// This may be used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "BuildId") to include in
	// API requests with the JSON null value. By default, fields with empty
	// values are omitted from API requests. However, any field with an
	// empty value appearing in NullFields will be sent to the server as
	// null. It is an error if a field in this list has a non-empty value.
	// This may be used to include null fields in Patch requests.
	NullFields []string `json:"-"`
}

func (*LegacyApiHeartbeatBatchRequestMessageOneHeartbeat) MarshalJSON

type LegacyApiHeartbeatBatchResponseMessage

type LegacyApiHeartbeatBatchResponseMessage struct {
	Error *LegacyApiErrorMessage `json:"error,omitempty"`

	Results []*LegacyApiHeartbeatBatchResponseMessageOneHeartbeatResult `json:"results,omitempty"`

	// ServerResponse contains the HTTP response code and headers from the
	// server.
	googleapi.ServerResponse `json:"-"`

	// ForceSendFields is a list of field names (e.g. "Error") to
	// unconditionally include in API requests. By default, fields with
	// empty or default values are omitted from API requests. However, any
	// non-pointer, non-interface field appearing in ForceSendFields will be
	// sent to the server regardless of whether the field is empty or not.
	// This may be used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "Error") to include in API
	// requests with the JSON null value. By default, fields with empty
	// values are omitted from API requests. However, any field with an
	// empty value appearing in NullFields will be sent to the server as
	// null. It is an error if a field in this list has a non-empty value.
	// This may be used to include null fields in Patch requests.
	NullFields []string `json:"-"`
}

func (*LegacyApiHeartbeatBatchResponseMessage) MarshalJSON

func (s *LegacyApiHeartbeatBatchResponseMessage) MarshalJSON() ([]byte, error)

type LegacyApiHeartbeatBatchResponseMessageOneHeartbeatResult

type LegacyApiHeartbeatBatchResponseMessageOneHeartbeatResult struct {
	BuildId int64 `json:"build_id,omitempty,string"`

	Error *LegacyApiErrorMessage `json:"error,omitempty"`

	LeaseExpirationTs int64 `json:"lease_expiration_ts,omitempty,string"`

	// ForceSendFields is a list of field names (e.g. "BuildId") to
	// unconditionally include in API requests. By default, fields with
	// empty or default values are omitted from API requests. However, any
	// non-pointer, non-interface field appearing in ForceSendFields will be
	// sent to the server regardless of whether the field is empty or not.
	// This may be used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "BuildId") to include in
	// API requests with the JSON null value. By default, fields with empty
	// values are omitted from API requests. However, any field with an
	// empty value appearing in NullFields will be sent to the server as
	// null. It is an error if a field in this list has a non-empty value.
	// This may be used to include null fields in Patch requests.
	NullFields []string `json:"-"`
}

func (*LegacyApiHeartbeatBatchResponseMessageOneHeartbeatResult) MarshalJSON

type LegacyApiHeartbeatRequestBodyMessage

type LegacyApiHeartbeatRequestBodyMessage struct {
	LeaseExpirationTs int64 `json:"lease_expiration_ts,omitempty,string"`

	LeaseKey int64 `json:"lease_key,omitempty,string"`

	// ForceSendFields is a list of field names (e.g. "LeaseExpirationTs")
	// to unconditionally include in API requests. By default, fields with
	// empty or default values are omitted from API requests. However, any
	// non-pointer, non-interface field appearing in ForceSendFields will be
	// sent to the server regardless of whether the field is empty or not.
	// This may be used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "LeaseExpirationTs") to
	// include in API requests with the JSON null value. By default, fields
	// with empty values are omitted from API requests. However, any field
	// with an empty value appearing in NullFields will be sent to the
	// server as null. It is an error if a field in this list has a
	// non-empty value. This may be used to include null fields in Patch
	// requests.
	NullFields []string `json:"-"`
}

func (*LegacyApiHeartbeatRequestBodyMessage) MarshalJSON

func (s *LegacyApiHeartbeatRequestBodyMessage) MarshalJSON() ([]byte, error)

type LegacyApiLeaseRequestBodyMessage

type LegacyApiLeaseRequestBodyMessage struct {
	LeaseExpirationTs int64 `json:"lease_expiration_ts,omitempty,string"`

	// ForceSendFields is a list of field names (e.g. "LeaseExpirationTs")
	// to unconditionally include in API requests. By default, fields with
	// empty or default values are omitted from API requests. However, any
	// non-pointer, non-interface field appearing in ForceSendFields will be
	// sent to the server regardless of whether the field is empty or not.
	// This may be used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "LeaseExpirationTs") to
	// include in API requests with the JSON null value. By default, fields
	// with empty values are omitted from API requests. However, any field
	// with an empty value appearing in NullFields will be sent to the
	// server as null. It is an error if a field in this list has a
	// non-empty value. This may be used to include null fields in Patch
	// requests.
	NullFields []string `json:"-"`
}

func (*LegacyApiLeaseRequestBodyMessage) MarshalJSON

func (s *LegacyApiLeaseRequestBodyMessage) MarshalJSON() ([]byte, error)

type LegacyApiPubSubCallbackMessage

type LegacyApiPubSubCallbackMessage struct {
	AuthToken string `json:"auth_token,omitempty"`

	Topic string `json:"topic,omitempty"`

	UserData string `json:"user_data,omitempty"`

	// ForceSendFields is a list of field names (e.g. "AuthToken") to
	// unconditionally include in API requests. By default, fields with
	// empty or default values are omitted from API requests. However, any
	// non-pointer, non-interface field appearing in ForceSendFields will be
	// sent to the server regardless of whether the field is empty or not.
	// This may be used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "AuthToken") to include in
	// API requests with the JSON null value. By default, fields with empty
	// values are omitted from API requests. However, any field with an
	// empty value appearing in NullFields will be sent to the server as
	// null. It is an error if a field in this list has a non-empty value.
	// This may be used to include null fields in Patch requests.
	NullFields []string `json:"-"`
}

func (*LegacyApiPubSubCallbackMessage) MarshalJSON

func (s *LegacyApiPubSubCallbackMessage) MarshalJSON() ([]byte, error)

type LegacyApiPutRequestMessage

type LegacyApiPutRequestMessage struct {
	Bucket string `json:"bucket,omitempty"`

	// Possible values:
	//   "AUTO"
	//   "CANARY"
	//   "PROD"
	CanaryPreference string `json:"canary_preference,omitempty"`

	ClientOperationId string `json:"client_operation_id,omitempty"`

	Experimental bool `json:"experimental,omitempty"`

	LeaseExpirationTs int64 `json:"lease_expiration_ts,omitempty,string"`

	ParametersJson string `json:"parameters_json,omitempty"`

	PubsubCallback *LegacyApiPubSubCallbackMessage `json:"pubsub_callback,omitempty"`

	Tags []string `json:"tags,omitempty"`

	// ForceSendFields is a list of field names (e.g. "Bucket") to
	// unconditionally include in API requests. By default, fields with
	// empty or default values are omitted from API requests. However, any
	// non-pointer, non-interface field appearing in ForceSendFields will be
	// sent to the server regardless of whether the field is empty or not.
	// This may be used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "Bucket") to include in API
	// requests with the JSON null value. By default, fields with empty
	// values are omitted from API requests. However, any field with an
	// empty value appearing in NullFields will be sent to the server as
	// null. It is an error if a field in this list has a non-empty value.
	// This may be used to include null fields in Patch requests.
	NullFields []string `json:"-"`
}

func (*LegacyApiPutRequestMessage) MarshalJSON

func (s *LegacyApiPutRequestMessage) MarshalJSON() ([]byte, error)

type LegacyApiSearchResponseMessage

type LegacyApiSearchResponseMessage struct {
	// Builds: Describes model.Build, see its docstring.
	Builds []*LegacyApiCommonBuildMessage `json:"builds,omitempty"`

	Error *LegacyApiErrorMessage `json:"error,omitempty"`

	NextCursor string `json:"next_cursor,omitempty"`

	// ServerResponse contains the HTTP response code and headers from the
	// server.
	googleapi.ServerResponse `json:"-"`

	// ForceSendFields is a list of field names (e.g. "Builds") to
	// unconditionally include in API requests. By default, fields with
	// empty or default values are omitted from API requests. However, any
	// non-pointer, non-interface field appearing in ForceSendFields will be
	// sent to the server regardless of whether the field is empty or not.
	// This may be used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "Builds") to include in API
	// requests with the JSON null value. By default, fields with empty
	// values are omitted from API requests. However, any field with an
	// empty value appearing in NullFields will be sent to the server as
	// null. It is an error if a field in this list has a non-empty value.
	// This may be used to include null fields in Patch requests.
	NullFields []string `json:"-"`
}

func (*LegacyApiSearchResponseMessage) MarshalJSON

func (s *LegacyApiSearchResponseMessage) MarshalJSON() ([]byte, error)

type LegacyApiStartRequestBodyMessage

type LegacyApiStartRequestBodyMessage struct {
	LeaseKey int64 `json:"lease_key,omitempty,string"`

	Url string `json:"url,omitempty"`

	// ForceSendFields is a list of field names (e.g. "LeaseKey") to
	// unconditionally include in API requests. By default, fields with
	// empty or default values are omitted from API requests. However, any
	// non-pointer, non-interface field appearing in ForceSendFields will be
	// sent to the server regardless of whether the field is empty or not.
	// This may be used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "LeaseKey") to include in
	// API requests with the JSON null value. By default, fields with empty
	// values are omitted from API requests. However, any field with an
	// empty value appearing in NullFields will be sent to the server as
	// null. It is an error if a field in this list has a non-empty value.
	// This may be used to include null fields in Patch requests.
	NullFields []string `json:"-"`
}

func (*LegacyApiStartRequestBodyMessage) MarshalJSON

func (s *LegacyApiStartRequestBodyMessage) MarshalJSON() ([]byte, error)

type LegacyApiSucceedRequestBodyMessage

type LegacyApiSucceedRequestBodyMessage struct {
	LeaseKey int64 `json:"lease_key,omitempty,string"`

	NewTags []string `json:"new_tags,omitempty"`

	ResultDetailsJson string `json:"result_details_json,omitempty"`

	Url string `json:"url,omitempty"`

	// ForceSendFields is a list of field names (e.g. "LeaseKey") to
	// unconditionally include in API requests. By default, fields with
	// empty or default values are omitted from API requests. However, any
	// non-pointer, non-interface field appearing in ForceSendFields will be
	// sent to the server regardless of whether the field is empty or not.
	// This may be used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "LeaseKey") to include in
	// API requests with the JSON null value. By default, fields with empty
	// values are omitted from API requests. However, any field with an
	// empty value appearing in NullFields will be sent to the server as
	// null. It is an error if a field in this list has a non-empty value.
	// This may be used to include null fields in Patch requests.
	NullFields []string `json:"-"`
}

func (*LegacyApiSucceedRequestBodyMessage) MarshalJSON

func (s *LegacyApiSucceedRequestBodyMessage) MarshalJSON() ([]byte, error)

type PeekCall

type PeekCall struct {
	// contains filtered or unexported fields
}

func (*PeekCall) Bucket

func (c *PeekCall) Bucket(bucket ...string) *PeekCall

Bucket sets the optional parameter "bucket":

func (*PeekCall) Context

func (c *PeekCall) Context(ctx context.Context) *PeekCall

Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled.

func (*PeekCall) Do

Do executes the "buildbucket.peek" call. Exactly one of *LegacyApiSearchResponseMessage or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *LegacyApiSearchResponseMessage.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.

func (*PeekCall) Fields

func (c *PeekCall) Fields(s ...googleapi.Field) *PeekCall

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.

func (*PeekCall) Header

func (c *PeekCall) Header() http.Header

Header returns an http.Header that can be modified by the caller to add HTTP headers to the request.

func (*PeekCall) IfNoneMatch

func (c *PeekCall) IfNoneMatch(entityTag string) *PeekCall

IfNoneMatch sets the optional parameter which makes the operation fail if the object's ETag matches the given value. This is useful for getting updates only after the object has changed since the last request. Use googleapi.IsNotModified to check whether the response error from Do is the result of In-None-Match.

func (*PeekCall) MaxBuilds

func (c *PeekCall) MaxBuilds(maxBuilds int64) *PeekCall

MaxBuilds sets the optional parameter "max_builds":

func (*PeekCall) StartCursor

func (c *PeekCall) StartCursor(startCursor string) *PeekCall

StartCursor sets the optional parameter "start_cursor":

type PutCall

type PutCall struct {
	// contains filtered or unexported fields
}

func (*PutCall) Context

func (c *PutCall) Context(ctx context.Context) *PutCall

Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled.

func (*PutCall) Do

Do executes the "buildbucket.put" call. Exactly one of *LegacyApiBuildResponseMessage or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *LegacyApiBuildResponseMessage.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.

func (*PutCall) Fields

func (c *PutCall) Fields(s ...googleapi.Field) *PutCall

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.

func (*PutCall) Header

func (c *PutCall) Header() http.Header

Header returns an http.Header that can be modified by the caller to add HTTP headers to the request.

type SearchCall

type SearchCall struct {
	// contains filtered or unexported fields
}

func (*SearchCall) Bucket

func (c *SearchCall) Bucket(bucket ...string) *SearchCall

Bucket sets the optional parameter "bucket":

func (*SearchCall) Canary

func (c *SearchCall) Canary(canary bool) *SearchCall

Canary sets the optional parameter "canary":

func (*SearchCall) CancelationReason

func (c *SearchCall) CancelationReason(cancelationReason string) *SearchCall

CancelationReason sets the optional parameter "cancelation_reason":

Possible values:

"CANCELED_EXPLICITLY"
"TIMEOUT"
"UNSET"

func (*SearchCall) Context

func (c *SearchCall) Context(ctx context.Context) *SearchCall

Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled.

func (*SearchCall) CreatedBy

func (c *SearchCall) CreatedBy(createdBy string) *SearchCall

CreatedBy sets the optional parameter "created_by":

func (*SearchCall) CreationTsHigh

func (c *SearchCall) CreationTsHigh(creationTsHigh int64) *SearchCall

CreationTsHigh sets the optional parameter "creation_ts_high":

func (*SearchCall) CreationTsLow

func (c *SearchCall) CreationTsLow(creationTsLow int64) *SearchCall

CreationTsLow sets the optional parameter "creation_ts_low":

func (*SearchCall) Do

Do executes the "buildbucket.search" call. Exactly one of *LegacyApiSearchResponseMessage or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *LegacyApiSearchResponseMessage.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.

func (*SearchCall) FailureReason

func (c *SearchCall) FailureReason(failureReason string) *SearchCall

FailureReason sets the optional parameter "failure_reason":

Possible values:

"BUILDBUCKET_FAILURE"
"BUILD_FAILURE"
"INFRA_FAILURE"
"INVALID_BUILD_DEFINITION"
"UNSET"

func (*SearchCall) Fetch

func (c *SearchCall) Fetch(limit int, ret retry.Factory) ([]*LegacyApiCommonBuildMessage, string, error)

Fetch fetches builds matching the search criteria. It stops when all builds are found or when context is cancelled. The order of returned builds is from most-recently-created to least-recently-created.

c.MaxBuilds value is used as a result page size, defaults to 100. limit, if >0, specifies the maximum number of builds to return.

If ret is nil, retries transient errors with exponential back-off. Logs errors on retries.

Returns nil only if the search results are exhausted. May return context.Canceled.

func (*SearchCall) Fields

func (c *SearchCall) Fields(s ...googleapi.Field) *SearchCall

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.

func (*SearchCall) Header

func (c *SearchCall) Header() http.Header

Header returns an http.Header that can be modified by the caller to add HTTP headers to the request.

func (*SearchCall) IfNoneMatch

func (c *SearchCall) IfNoneMatch(entityTag string) *SearchCall

IfNoneMatch sets the optional parameter which makes the operation fail if the object's ETag matches the given value. This is useful for getting updates only after the object has changed since the last request. Use googleapi.IsNotModified to check whether the response error from Do is the result of In-None-Match.

func (*SearchCall) IncludeExperimental

func (c *SearchCall) IncludeExperimental(includeExperimental bool) *SearchCall

IncludeExperimental sets the optional parameter "include_experimental":

func (*SearchCall) MaxBuilds

func (c *SearchCall) MaxBuilds(maxBuilds int64) *SearchCall

MaxBuilds sets the optional parameter "max_builds":

func (*SearchCall) Result

func (c *SearchCall) Result(result string) *SearchCall

Result sets the optional parameter "result":

Possible values:

"CANCELED"
"FAILURE"
"SUCCESS"
"UNSET"

func (*SearchCall) RetryOf

func (c *SearchCall) RetryOf(retryOf int64) *SearchCall

RetryOf sets the optional parameter "retry_of":

func (*SearchCall) Run

func (c *SearchCall) Run(builds chan<- *LegacyApiCommonBuildMessage, limit int, ret retry.Factory) (cursor string, err error)

Run is like Fetch, but sends results to a channel and the default page size is defined by the server (10 as of Sep 2017).

Run blocks on sending.

func (*SearchCall) StartCursor

func (c *SearchCall) StartCursor(startCursor string) *SearchCall

StartCursor sets the optional parameter "start_cursor":

func (*SearchCall) Status

func (c *SearchCall) Status(status string) *SearchCall

Status sets the optional parameter "status":

Possible values:

"COMPLETED"
"INCOMPLETE"
"SCHEDULED"
"STARTED"

func (*SearchCall) Tag

func (c *SearchCall) Tag(tag ...string) *SearchCall

Tag sets the optional parameter "tag":

type Service

type Service struct {
	BasePath  string // API endpoint base URL
	UserAgent string // optional additional User-Agent fragment
	// contains filtered or unexported fields
}

func New deprecated

func New(client *http.Client) (*Service, error)

New creates a new Service. It uses the provided http.Client for requests.

Deprecated: please use NewService instead. To provide a custom HTTP client, use option.WithHTTPClient. If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.

func NewService

func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error)

NewService creates a new Service.

func (*Service) Cancel

func (s *Service) Cancel(id int64, legacyapicancelrequestbodymessage *LegacyApiCancelRequestBodyMessage) *CancelCall

Cancel: Cancels a build.

- id: .

func (*Service) Fail

func (s *Service) Fail(id int64, legacyapifailrequestbodymessage *LegacyApiFailRequestBodyMessage) *FailCall

Fail: Marks a build as failed.

- id: .

func (*Service) Get

func (s *Service) Get(id int64) *GetCall

Get: Returns a build by id.

- id: .

func (*Service) Heartbeat

func (s *Service) Heartbeat(id int64, legacyapiheartbeatrequestbodymessage *LegacyApiHeartbeatRequestBodyMessage) *HeartbeatCall

Heartbeat: Updates build lease.

- id: .

func (*Service) HeartbeatBatch

func (s *Service) HeartbeatBatch(legacyapiheartbeatbatchrequestmessage *LegacyApiHeartbeatBatchRequestMessage) *HeartbeatBatchCall

HeartbeatBatch: Updates multiple build leases.

func (*Service) Lease

func (s *Service) Lease(id int64, legacyapileaserequestbodymessage *LegacyApiLeaseRequestBodyMessage) *LeaseCall

Lease: Leases a build. Response may contain an error.

- id: .

func (*Service) Peek

func (s *Service) Peek() *PeekCall

Peek: Returns available builds.

func (*Service) Put

func (s *Service) Put(legacyapiputrequestmessage *LegacyApiPutRequestMessage) *PutCall

Put: Creates a new build.

func (*Service) Search

func (s *Service) Search() *SearchCall

Search: Searches for builds.

func (*Service) Start

func (s *Service) Start(id int64, legacyapistartrequestbodymessage *LegacyApiStartRequestBodyMessage) *StartCall

Start: Marks a build as started.

- id: .

func (*Service) Succeed

func (s *Service) Succeed(id int64, legacyapisucceedrequestbodymessage *LegacyApiSucceedRequestBodyMessage) *SucceedCall

Succeed: Marks a build as succeeded.

- id: .

type StartCall

type StartCall struct {
	// contains filtered or unexported fields
}

func (*StartCall) Context

func (c *StartCall) Context(ctx context.Context) *StartCall

Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled.

func (*StartCall) Do

Do executes the "buildbucket.start" call. Exactly one of *LegacyApiBuildResponseMessage or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *LegacyApiBuildResponseMessage.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.

func (*StartCall) Fields

func (c *StartCall) Fields(s ...googleapi.Field) *StartCall

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.

func (*StartCall) Header

func (c *StartCall) Header() http.Header

Header returns an http.Header that can be modified by the caller to add HTTP headers to the request.

type SucceedCall

type SucceedCall struct {
	// contains filtered or unexported fields
}

func (*SucceedCall) Context

func (c *SucceedCall) Context(ctx context.Context) *SucceedCall

Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled.

func (*SucceedCall) Do

Do executes the "buildbucket.succeed" call. Exactly one of *LegacyApiBuildResponseMessage or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *LegacyApiBuildResponseMessage.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.

func (*SucceedCall) Fields

func (c *SucceedCall) Fields(s ...googleapi.Field) *SucceedCall

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.

func (*SucceedCall) Header

func (c *SucceedCall) Header() http.Header

Header returns an http.Header that can be modified by the caller to add HTTP headers to the request.

Jump to

Keyboard shortcuts

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