- 0.116.0 (latest)
- 0.115.1
- 0.114.0
- 0.113.0
- 0.112.2
- 0.111.0
- 0.110.10
- 0.109.0
- 0.108.0
- 0.107.0
- 0.106.0
- 0.105.0
- 0.104.0
- 0.103.0
- 0.102.1
- 0.101.1
- 0.100.2
- 0.99.0
- 0.98.0
- 0.97.0
- 0.96.0
- 0.95.0
- 0.94.1
- 0.93.3
- 0.92.3
- 0.91.1
- 0.90.0
- 0.89.0
- 0.88.0
- 0.87.0
- 0.86.0
- 0.85.0
- 0.84.0
- 0.83.0
- 0.82.0
- 0.81.0
- 0.80.0
- 0.79.0
- 0.78.0
- 0.77.0
- 0.76.0
- 0.75.0
Creates and manages builds on Google Cloud Platform.
Use of Context
The ctx passed to NewClient is used for authentication requests and for creating the underlying connection, but is not used for subsequent calls. Individual methods on the client use the ctx given to them.
To close the open connection, use the Close() method.
For information about setting deadlines, reusing contexts, and more please visit godoc.org/cloud.google.com/go.
Functions
func DefaultAuthScopes
func DefaultAuthScopes() []string
DefaultAuthScopes reports the default set of authentication scopes to use with this package.
BuildIterator
type BuildIterator struct {
// InternalFetch is for use by the Google Cloud Libraries only.
// It is not part of the stable interface of this package.
//
// InternalFetch returns results from a single call to the underlying RPC.
// The number of results is no greater than pageSize.
// If there are no more results, nextPageToken is empty and err is nil.
InternalFetch func(pageSize int, pageToken string) (results []*cloudbuildpb.Build, nextPageToken string, err error)
// contains filtered or unexported fields
}
BuildIterator manages a stream of *cloudbuildpb.Build.
func (*BuildIterator) Next
func (it *BuildIterator) Next() (*cloudbuildpb.Build, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*BuildIterator) PageInfo
func (it *BuildIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
CallOptions
type CallOptions struct {
CreateBuild []gax.CallOption
GetBuild []gax.CallOption
ListBuilds []gax.CallOption
CancelBuild []gax.CallOption
CreateBuildTrigger []gax.CallOption
GetBuildTrigger []gax.CallOption
ListBuildTriggers []gax.CallOption
DeleteBuildTrigger []gax.CallOption
UpdateBuildTrigger []gax.CallOption
RunBuildTrigger []gax.CallOption
RetryBuild []gax.CallOption
CreateWorkerPool []gax.CallOption
GetWorkerPool []gax.CallOption
DeleteWorkerPool []gax.CallOption
UpdateWorkerPool []gax.CallOption
ListWorkerPools []gax.CallOption
}
CallOptions contains the retry settings for each method of Client.
Client
type Client struct {
// The call options for this service.
CallOptions *CallOptions
// contains filtered or unexported fields
}
Client is a client for interacting with Cloud Build API.
Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
func NewClient
NewClient creates a new cloud build client.
Creates and manages builds on Google Cloud Platform.
The main concept used by this API is a Build, which describes the location of the source to build, how to build the source, and where to store the built artifacts, if any.
A user can list previously-requested builds or get builds by their ID to determine the status of the build.
Example
package main
import (
"context"
cloudbuild "cloud.google.com/go/cloudbuild/apiv1"
)
func main() {
ctx := context.Background()
c, err := cloudbuild.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use client.
_ = c
}
func (*Client) CancelBuild
func (c *Client) CancelBuild(ctx context.Context, req *cloudbuildpb.CancelBuildRequest, opts ...gax.CallOption) (*cloudbuildpb.Build, error)
CancelBuild cancels a build in progress.
Example
package main
import (
"context"
cloudbuild "cloud.google.com/go/cloudbuild/apiv1"
cloudbuildpb "google.golang.org/genproto/googleapis/devtools/cloudbuild/v1"
)
func main() {
ctx := context.Background()
c, err := cloudbuild.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &cloudbuildpb.CancelBuildRequest{
// TODO: Fill request struct fields.
}
resp, err := c.CancelBuild(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) Close
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*Client) Connection
func (c *Client) Connection() *grpc.ClientConn
Connection returns the client's connection to the API service.
func (*Client) CreateBuild
func (c *Client) CreateBuild(ctx context.Context, req *cloudbuildpb.CreateBuildRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
CreateBuild starts a build with the specified configuration.
This method returns a long-running Operation, which includes the build ID. Pass the build ID to GetBuild to determine the build status (such as SUCCESS or FAILURE).
Example
package main
import (
"context"
cloudbuild "cloud.google.com/go/cloudbuild/apiv1"
cloudbuildpb "google.golang.org/genproto/googleapis/devtools/cloudbuild/v1"
)
func main() {
ctx := context.Background()
c, err := cloudbuild.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &cloudbuildpb.CreateBuildRequest{
// TODO: Fill request struct fields.
}
resp, err := c.CreateBuild(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) CreateBuildTrigger
func (c *Client) CreateBuildTrigger(ctx context.Context, req *cloudbuildpb.CreateBuildTriggerRequest, opts ...gax.CallOption) (*cloudbuildpb.BuildTrigger, error)
CreateBuildTrigger creates a new BuildTrigger.
This API is experimental.
Example
package main
import (
"context"
cloudbuild "cloud.google.com/go/cloudbuild/apiv1"
cloudbuildpb "google.golang.org/genproto/googleapis/devtools/cloudbuild/v1"
)
func main() {
ctx := context.Background()
c, err := cloudbuild.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &cloudbuildpb.CreateBuildTriggerRequest{
// TODO: Fill request struct fields.
}
resp, err := c.CreateBuildTrigger(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) CreateWorkerPool
func (c *Client) CreateWorkerPool(ctx context.Context, req *cloudbuildpb.CreateWorkerPoolRequest, opts ...gax.CallOption) (*cloudbuildpb.WorkerPool, error)
CreateWorkerPool creates a WorkerPool to run the builds, and returns the new worker pool.
This API is experimental.
Example
package main
import (
"context"
cloudbuild "cloud.google.com/go/cloudbuild/apiv1"
cloudbuildpb "google.golang.org/genproto/googleapis/devtools/cloudbuild/v1"
)
func main() {
ctx := context.Background()
c, err := cloudbuild.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &cloudbuildpb.CreateWorkerPoolRequest{
// TODO: Fill request struct fields.
}
resp, err := c.CreateWorkerPool(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) DeleteBuildTrigger
func (c *Client) DeleteBuildTrigger(ctx context.Context, req *cloudbuildpb.DeleteBuildTriggerRequest, opts ...gax.CallOption) error
DeleteBuildTrigger deletes a BuildTrigger by its project ID and trigger ID.
This API is experimental.
Example
package main
import (
"context"
cloudbuild "cloud.google.com/go/cloudbuild/apiv1"
cloudbuildpb "google.golang.org/genproto/googleapis/devtools/cloudbuild/v1"
)
func main() {
ctx := context.Background()
c, err := cloudbuild.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &cloudbuildpb.DeleteBuildTriggerRequest{
// TODO: Fill request struct fields.
}
err = c.DeleteBuildTrigger(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*Client) DeleteWorkerPool
func (c *Client) DeleteWorkerPool(ctx context.Context, req *cloudbuildpb.DeleteWorkerPoolRequest, opts ...gax.CallOption) error
DeleteWorkerPool deletes a WorkerPool by its project ID and WorkerPool name.
This API is experimental.
Example
package main
import (
"context"
cloudbuild "cloud.google.com/go/cloudbuild/apiv1"
cloudbuildpb "google.golang.org/genproto/googleapis/devtools/cloudbuild/v1"
)
func main() {
ctx := context.Background()
c, err := cloudbuild.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &cloudbuildpb.DeleteWorkerPoolRequest{
// TODO: Fill request struct fields.
}
err = c.DeleteWorkerPool(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*Client) GetBuild
func (c *Client) GetBuild(ctx context.Context, req *cloudbuildpb.GetBuildRequest, opts ...gax.CallOption) (*cloudbuildpb.Build, error)
GetBuild returns information about a previously requested build.
The Build that is returned includes its status (such as SUCCESS, FAILURE, or WORKING), and timing information.
Example
package main
import (
"context"
cloudbuild "cloud.google.com/go/cloudbuild/apiv1"
cloudbuildpb "google.golang.org/genproto/googleapis/devtools/cloudbuild/v1"
)
func main() {
ctx := context.Background()
c, err := cloudbuild.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &cloudbuildpb.GetBuildRequest{
// TODO: Fill request struct fields.
}
resp, err := c.GetBuild(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) GetBuildTrigger
func (c *Client) GetBuildTrigger(ctx context.Context, req *cloudbuildpb.GetBuildTriggerRequest, opts ...gax.CallOption) (*cloudbuildpb.BuildTrigger, error)
GetBuildTrigger returns information about a BuildTrigger.
This API is experimental.
Example
package main
import (
"context"
cloudbuild "cloud.google.com/go/cloudbuild/apiv1"
cloudbuildpb "google.golang.org/genproto/googleapis/devtools/cloudbuild/v1"
)
func main() {
ctx := context.Background()
c, err := cloudbuild.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &cloudbuildpb.GetBuildTriggerRequest{
// TODO: Fill request struct fields.
}
resp, err := c.GetBuildTrigger(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) GetWorkerPool
func (c *Client) GetWorkerPool(ctx context.Context, req *cloudbuildpb.GetWorkerPoolRequest, opts ...gax.CallOption) (*cloudbuildpb.WorkerPool, error)
GetWorkerPool returns information about a WorkerPool.
This API is experimental.
Example
package main
import (
"context"
cloudbuild "cloud.google.com/go/cloudbuild/apiv1"
cloudbuildpb "google.golang.org/genproto/googleapis/devtools/cloudbuild/v1"
)
func main() {
ctx := context.Background()
c, err := cloudbuild.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &cloudbuildpb.GetWorkerPoolRequest{
// TODO: Fill request struct fields.
}
resp, err := c.GetWorkerPool(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) ListBuildTriggers
func (c *Client) ListBuildTriggers(ctx context.Context, req *cloudbuildpb.ListBuildTriggersRequest, opts ...gax.CallOption) (*cloudbuildpb.ListBuildTriggersResponse, error)
ListBuildTriggers lists existing BuildTriggers.
This API is experimental.
Example
package main
import (
"context"
cloudbuild "cloud.google.com/go/cloudbuild/apiv1"
cloudbuildpb "google.golang.org/genproto/googleapis/devtools/cloudbuild/v1"
)
func main() {
ctx := context.Background()
c, err := cloudbuild.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &cloudbuildpb.ListBuildTriggersRequest{
// TODO: Fill request struct fields.
}
resp, err := c.ListBuildTriggers(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) ListBuilds
func (c *Client) ListBuilds(ctx context.Context, req *cloudbuildpb.ListBuildsRequest, opts ...gax.CallOption) *BuildIterator
ListBuilds lists previously requested builds.
Previously requested builds may still be in-progress, or may have finished successfully or unsuccessfully.
Example
package main
import (
"context"
cloudbuild "cloud.google.com/go/cloudbuild/apiv1"
"google.golang.org/api/iterator"
cloudbuildpb "google.golang.org/genproto/googleapis/devtools/cloudbuild/v1"
)
func main() {
ctx := context.Background()
c, err := cloudbuild.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &cloudbuildpb.ListBuildsRequest{
// TODO: Fill request struct fields.
}
it := c.ListBuilds(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*Client) ListWorkerPools
func (c *Client) ListWorkerPools(ctx context.Context, req *cloudbuildpb.ListWorkerPoolsRequest, opts ...gax.CallOption) (*cloudbuildpb.ListWorkerPoolsResponse, error)
ListWorkerPools list project's WorkerPools.
This API is experimental.
Example
package main
import (
"context"
cloudbuild "cloud.google.com/go/cloudbuild/apiv1"
cloudbuildpb "google.golang.org/genproto/googleapis/devtools/cloudbuild/v1"
)
func main() {
ctx := context.Background()
c, err := cloudbuild.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &cloudbuildpb.ListWorkerPoolsRequest{
// TODO: Fill request struct fields.
}
resp, err := c.ListWorkerPools(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) RetryBuild
func (c *Client) RetryBuild(ctx context.Context, req *cloudbuildpb.RetryBuildRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
RetryBuild creates a new build based on the specified build.
This method creates a new build using the original build request, which may or may not result in an identical build.
For triggered builds:
Triggered builds resolve to a precise revision; therefore a retry of a triggered build will result in a build that uses the same revision.
For non-triggered builds that specify RepoSource:
If the original build built from the tip of a branch, the retried build will build from the tip of that branch, which may not be the same revision as the original build.
If the original build specified a commit sha or revision ID, the retried build will use the identical source.
For builds that specify StorageSource:
If the original build pulled source from Google Cloud Storage without specifying the generation of the object, the new build will use the current object, which may be different from the original build source.
If the original build pulled source from Cloud Storage and specified the generation of the object, the new build will attempt to use the same object, which may or may not be available depending on the bucket's lifecycle management settings.
Example
package main
import (
"context"
cloudbuild "cloud.google.com/go/cloudbuild/apiv1"
cloudbuildpb "google.golang.org/genproto/googleapis/devtools/cloudbuild/v1"
)
func main() {
ctx := context.Background()
c, err := cloudbuild.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &cloudbuildpb.RetryBuildRequest{
// TODO: Fill request struct fields.
}
resp, err := c.RetryBuild(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) RunBuildTrigger
func (c *Client) RunBuildTrigger(ctx context.Context, req *cloudbuildpb.RunBuildTriggerRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
RunBuildTrigger runs a BuildTrigger at a particular source revision.
Example
package main
import (
"context"
cloudbuild "cloud.google.com/go/cloudbuild/apiv1"
cloudbuildpb "google.golang.org/genproto/googleapis/devtools/cloudbuild/v1"
)
func main() {
ctx := context.Background()
c, err := cloudbuild.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &cloudbuildpb.RunBuildTriggerRequest{
// TODO: Fill request struct fields.
}
resp, err := c.RunBuildTrigger(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) UpdateBuildTrigger
func (c *Client) UpdateBuildTrigger(ctx context.Context, req *cloudbuildpb.UpdateBuildTriggerRequest, opts ...gax.CallOption) (*cloudbuildpb.BuildTrigger, error)
UpdateBuildTrigger updates a BuildTrigger by its project ID and trigger ID.
This API is experimental.
Example
package main
import (
"context"
cloudbuild "cloud.google.com/go/cloudbuild/apiv1"
cloudbuildpb "google.golang.org/genproto/googleapis/devtools/cloudbuild/v1"
)
func main() {
ctx := context.Background()
c, err := cloudbuild.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &cloudbuildpb.UpdateBuildTriggerRequest{
// TODO: Fill request struct fields.
}
resp, err := c.UpdateBuildTrigger(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) UpdateWorkerPool
func (c *Client) UpdateWorkerPool(ctx context.Context, req *cloudbuildpb.UpdateWorkerPoolRequest, opts ...gax.CallOption) (*cloudbuildpb.WorkerPool, error)
UpdateWorkerPool update a WorkerPool.
This API is experimental.
Example
package main
import (
"context"
cloudbuild "cloud.google.com/go/cloudbuild/apiv1"
cloudbuildpb "google.golang.org/genproto/googleapis/devtools/cloudbuild/v1"
)
func main() {
ctx := context.Background()
c, err := cloudbuild.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &cloudbuildpb.UpdateWorkerPoolRequest{
// TODO: Fill request struct fields.
}
resp, err := c.UpdateWorkerPool(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}