Package cloud.google.com/go/cloudbuild/apiv1 (v1.23.1) Stay organized with collections Save and categorize content based on your preferences.
Creates and manages builds on Google Cloud Platform.
Use of Context
The ctx passed to NewClient is used for authentication requests andfor 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 moreplease visit godoc.org/cloud.google.com/go.
Deprecated: Please use cloud.google.com/go/cloudbuild/apiv1/v2.
Functions
func DefaultAuthScopes (deprecated)
funcDefaultAuthScopes()[]stringDefaultAuthScopes reports the default set of authentication scopes to use with this package.
BuildIterator (deprecated)
typeBuildIteratorstruct{// 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.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*cloudbuildpb.Build,nextPageTokenstring,errerror)// contains filtered or unexported fields}BuildIterator manages a stream of *cloudbuildpb.Build.
func (*BuildIterator) Next (deprecated)
func(it*BuildIterator)Next()(*cloudbuildpb.Build,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*BuildIterator) PageInfo (deprecated)
func(it*BuildIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the google.golang.org/api/iterator package for details.
CallOptions (deprecated)
typeCallOptionsstruct{CreateBuild[]gax.CallOptionGetBuild[]gax.CallOptionListBuilds[]gax.CallOptionCancelBuild[]gax.CallOptionCreateBuildTrigger[]gax.CallOptionGetBuildTrigger[]gax.CallOptionListBuildTriggers[]gax.CallOptionDeleteBuildTrigger[]gax.CallOptionUpdateBuildTrigger[]gax.CallOptionRunBuildTrigger[]gax.CallOptionRetryBuild[]gax.CallOptionCreateWorkerPool[]gax.CallOptionGetWorkerPool[]gax.CallOptionDeleteWorkerPool[]gax.CallOptionUpdateWorkerPool[]gax.CallOptionListWorkerPools[]gax.CallOption}CallOptions contains the retry settings for each method of Client.
Client (deprecated)
typeClientstruct{// The call options for this service.CallOptions*CallOptions// LROClient is used internally to handle long-running operations.// It is exposed so that its CallOptions can be modified if required.// Users should not Close this client.LROClient*lroauto.OperationsClient// 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 (deprecated)
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 locationof the source to build, how to build the source, and where to store thebuilt artifacts, if any.
A user can list previously-requested builds or get builds by their ID todetermine the status of the build.
Example
packagemainimport("context"cloudbuild"cloud.google.com/go/cloudbuild/apiv1")funcmain(){ctx:=context.Background()c,err:=cloudbuild.NewClient(ctx)iferr!=nil{// TODO: Handle error.}// TODO: Use client._=c}func (*Client) CancelBuild (deprecated)
func(c*Client)CancelBuild(ctxcontext.Context,req*cloudbuildpb.CancelBuildRequest,opts...gax.CallOption)(*cloudbuildpb.Build,error)CancelBuild cancels a build in progress.
Example
packagemainimport("context"cloudbuild"cloud.google.com/go/cloudbuild/apiv1""cloud.google.com/go/cloudbuild/apiv1/v2/cloudbuildpb")funcmain(){ctx:=context.Background()c,err:=cloudbuild.NewClient(ctx)iferr!=nil{// TODO: Handle error.}req:=&cloudbuildpb.CancelBuildRequest{// TODO: Fill request struct fields.}resp,err:=c.CancelBuild(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*Client) Close (deprecated)
Close closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*Client) Connection (deprecated)
func(c*Client)Connection()*grpc.ClientConnConnection returns the client's connection to the API service.
func (*Client) CreateBuild (deprecated)
func(c*Client)CreateBuild(ctxcontext.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 buildID. Pass the build ID to GetBuild to determine the build status (such asSUCCESS or FAILURE).
Example
packagemainimport("context"cloudbuild"cloud.google.com/go/cloudbuild/apiv1""cloud.google.com/go/cloudbuild/apiv1/v2/cloudbuildpb")funcmain(){ctx:=context.Background()c,err:=cloudbuild.NewClient(ctx)iferr!=nil{// TODO: Handle error.}req:=&cloudbuildpb.CreateBuildRequest{// TODO: Fill request struct fields.}resp,err:=c.CreateBuild(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*Client) CreateBuildTrigger (deprecated)
func(c*Client)CreateBuildTrigger(ctxcontext.Context,req*cloudbuildpb.CreateBuildTriggerRequest,opts...gax.CallOption)(*cloudbuildpb.BuildTrigger,error)CreateBuildTrigger creates a new BuildTrigger.
This API is experimental.
Example
packagemainimport("context"cloudbuild"cloud.google.com/go/cloudbuild/apiv1""cloud.google.com/go/cloudbuild/apiv1/v2/cloudbuildpb")funcmain(){ctx:=context.Background()c,err:=cloudbuild.NewClient(ctx)iferr!=nil{// TODO: Handle error.}req:=&cloudbuildpb.CreateBuildTriggerRequest{// TODO: Fill request struct fields.}resp,err:=c.CreateBuildTrigger(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*Client) CreateWorkerPool (deprecated)
func(c*Client)CreateWorkerPool(ctxcontext.Context,req*cloudbuildpb.CreateWorkerPoolRequest,opts...gax.CallOption)(*CreateWorkerPoolOperation,error)CreateWorkerPool creates a WorkerPool to run the builds, and returns the new worker pool.
This API is experimental.
Example
packagemainimport("context"cloudbuild"cloud.google.com/go/cloudbuild/apiv1""cloud.google.com/go/cloudbuild/apiv1/v2/cloudbuildpb")funcmain(){ctx:=context.Background()c,err:=cloudbuild.NewClient(ctx)iferr!=nil{// TODO: Handle error.}req:=&cloudbuildpb.CreateWorkerPoolRequest{// TODO: Fill request struct fields.}resp,err:=c.CreateWorkerPool(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*Client) CreateWorkerPoolOperation (deprecated)
func(c*Client)CreateWorkerPoolOperation(namestring)*CreateWorkerPoolOperationCreateWorkerPoolOperation returns a new CreateWorkerPoolOperation from a given name.The name must be that of a previously created CreateWorkerPoolOperation, possibly from a different process.
func (*Client) DeleteBuildTrigger (deprecated)
func(c*Client)DeleteBuildTrigger(ctxcontext.Context,req*cloudbuildpb.DeleteBuildTriggerRequest,opts...gax.CallOption)errorDeleteBuildTrigger deletes a BuildTrigger by its project ID and trigger ID.
This API is experimental.
Example
packagemainimport("context"cloudbuild"cloud.google.com/go/cloudbuild/apiv1""cloud.google.com/go/cloudbuild/apiv1/v2/cloudbuildpb")funcmain(){ctx:=context.Background()c,err:=cloudbuild.NewClient(ctx)iferr!=nil{// TODO: Handle error.}req:=&cloudbuildpb.DeleteBuildTriggerRequest{// TODO: Fill request struct fields.}err=c.DeleteBuildTrigger(ctx,req)iferr!=nil{// TODO: Handle error.}}func (*Client) DeleteWorkerPool (deprecated)
func(c*Client)DeleteWorkerPool(ctxcontext.Context,req*cloudbuildpb.DeleteWorkerPoolRequest,opts...gax.CallOption)errorDeleteWorkerPool deletes a WorkerPool by its project ID and WorkerPool name.
This API is experimental.
Example
packagemainimport("context"cloudbuild"cloud.google.com/go/cloudbuild/apiv1""cloud.google.com/go/cloudbuild/apiv1/v2/cloudbuildpb")funcmain(){ctx:=context.Background()c,err:=cloudbuild.NewClient(ctx)iferr!=nil{// TODO: Handle error.}req:=&cloudbuildpb.DeleteWorkerPoolRequest{// TODO: Fill request struct fields.}err=c.DeleteWorkerPool(ctx,req)iferr!=nil{// TODO: Handle error.}}func (*Client) GetBuild (deprecated)
func(c*Client)GetBuild(ctxcontext.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
packagemainimport("context"cloudbuild"cloud.google.com/go/cloudbuild/apiv1""cloud.google.com/go/cloudbuild/apiv1/v2/cloudbuildpb")funcmain(){ctx:=context.Background()c,err:=cloudbuild.NewClient(ctx)iferr!=nil{// TODO: Handle error.}req:=&cloudbuildpb.GetBuildRequest{// TODO: Fill request struct fields.}resp,err:=c.GetBuild(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*Client) GetBuildTrigger (deprecated)
func(c*Client)GetBuildTrigger(ctxcontext.Context,req*cloudbuildpb.GetBuildTriggerRequest,opts...gax.CallOption)(*cloudbuildpb.BuildTrigger,error)GetBuildTrigger returns information about a BuildTrigger.
This API is experimental.
Example
packagemainimport("context"cloudbuild"cloud.google.com/go/cloudbuild/apiv1""cloud.google.com/go/cloudbuild/apiv1/v2/cloudbuildpb")funcmain(){ctx:=context.Background()c,err:=cloudbuild.NewClient(ctx)iferr!=nil{// TODO: Handle error.}req:=&cloudbuildpb.GetBuildTriggerRequest{// TODO: Fill request struct fields.}resp,err:=c.GetBuildTrigger(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*Client) GetWorkerPool (deprecated)
func(c*Client)GetWorkerPool(ctxcontext.Context,req*cloudbuildpb.GetWorkerPoolRequest,opts...gax.CallOption)(*cloudbuildpb.WorkerPool,error)GetWorkerPool returns information about a WorkerPool.
This API is experimental.
Example
packagemainimport("context"cloudbuild"cloud.google.com/go/cloudbuild/apiv1""cloud.google.com/go/cloudbuild/apiv1/v2/cloudbuildpb")funcmain(){ctx:=context.Background()c,err:=cloudbuild.NewClient(ctx)iferr!=nil{// TODO: Handle error.}req:=&cloudbuildpb.GetWorkerPoolRequest{// TODO: Fill request struct fields.}resp,err:=c.GetWorkerPool(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*Client) ListBuildTriggers (deprecated)
func(c*Client)ListBuildTriggers(ctxcontext.Context,req*cloudbuildpb.ListBuildTriggersRequest,opts...gax.CallOption)(*cloudbuildpb.ListBuildTriggersResponse,error)ListBuildTriggers lists existing BuildTriggers.
This API is experimental.
Example
packagemainimport("context"cloudbuild"cloud.google.com/go/cloudbuild/apiv1""cloud.google.com/go/cloudbuild/apiv1/v2/cloudbuildpb")funcmain(){ctx:=context.Background()c,err:=cloudbuild.NewClient(ctx)iferr!=nil{// TODO: Handle error.}req:=&cloudbuildpb.ListBuildTriggersRequest{// TODO: Fill request struct fields.}resp,err:=c.ListBuildTriggers(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*Client) ListBuilds (deprecated)
func(c*Client)ListBuilds(ctxcontext.Context,req*cloudbuildpb.ListBuildsRequest,opts...gax.CallOption)*BuildIteratorListBuilds lists previously requested builds.
Previously requested builds may still be in-progress, or may have finishedsuccessfully or unsuccessfully.
Example
packagemainimport("context"cloudbuild"cloud.google.com/go/cloudbuild/apiv1""cloud.google.com/go/cloudbuild/apiv1/v2/cloudbuildpb""google.golang.org/api/iterator")funcmain(){ctx:=context.Background()c,err:=cloudbuild.NewClient(ctx)iferr!=nil{// TODO: Handle error.}req:=&cloudbuildpb.ListBuildsRequest{// TODO: Fill request struct fields.}it:=c.ListBuilds(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}}func (*Client) ListWorkerPools (deprecated)
func(c*Client)ListWorkerPools(ctxcontext.Context,req*cloudbuildpb.ListWorkerPoolsRequest,opts...gax.CallOption)(*cloudbuildpb.ListWorkerPoolsResponse,error)ListWorkerPools list project's WorkerPools.
This API is experimental.
Example
packagemainimport("context"cloudbuild"cloud.google.com/go/cloudbuild/apiv1""cloud.google.com/go/cloudbuild/apiv1/v2/cloudbuildpb")funcmain(){ctx:=context.Background()c,err:=cloudbuild.NewClient(ctx)iferr!=nil{// TODO: Handle error.}req:=&cloudbuildpb.ListWorkerPoolsRequest{// TODO: Fill request struct fields.}resp,err:=c.ListWorkerPools(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*Client) RetryBuild (deprecated)
func(c*Client)RetryBuild(ctxcontext.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 mayor may not result in an identical build.
For triggered builds:
Triggered builds resolve to a precise revision; therefore a retry of atriggered 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 buildwill build from the tip of that branch, which may not be the same revisionas the original build.If the original build specified a commit sha or revision ID, the retriedbuild will use the identical source.For builds that specify StorageSource:
If the original build pulled source from Google Cloud Storage withoutspecifying the generation of the object, the new build will use the currentobject, which may be different from the original build source.If the original build pulled source from Cloud Storage and specified thegeneration of the object, the new build will attempt to use the sameobject, which may or may not be available depending on the bucket'slifecycle management settings.Example
packagemainimport("context"cloudbuild"cloud.google.com/go/cloudbuild/apiv1""cloud.google.com/go/cloudbuild/apiv1/v2/cloudbuildpb")funcmain(){ctx:=context.Background()c,err:=cloudbuild.NewClient(ctx)iferr!=nil{// TODO: Handle error.}req:=&cloudbuildpb.RetryBuildRequest{// TODO: Fill request struct fields.}resp,err:=c.RetryBuild(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*Client) RunBuildTrigger (deprecated)
func(c*Client)RunBuildTrigger(ctxcontext.Context,req*cloudbuildpb.RunBuildTriggerRequest,opts...gax.CallOption)(*longrunningpb.Operation,error)RunBuildTrigger runs a BuildTrigger at a particular source revision.
Example
packagemainimport("context"cloudbuild"cloud.google.com/go/cloudbuild/apiv1""cloud.google.com/go/cloudbuild/apiv1/v2/cloudbuildpb")funcmain(){ctx:=context.Background()c,err:=cloudbuild.NewClient(ctx)iferr!=nil{// TODO: Handle error.}req:=&cloudbuildpb.RunBuildTriggerRequest{// TODO: Fill request struct fields.}resp,err:=c.RunBuildTrigger(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*Client) UpdateBuildTrigger (deprecated)
func(c*Client)UpdateBuildTrigger(ctxcontext.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
packagemainimport("context"cloudbuild"cloud.google.com/go/cloudbuild/apiv1""cloud.google.com/go/cloudbuild/apiv1/v2/cloudbuildpb")funcmain(){ctx:=context.Background()c,err:=cloudbuild.NewClient(ctx)iferr!=nil{// TODO: Handle error.}req:=&cloudbuildpb.UpdateBuildTriggerRequest{// TODO: Fill request struct fields.}resp,err:=c.UpdateBuildTrigger(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*Client) UpdateWorkerPool (deprecated)
func(c*Client)UpdateWorkerPool(ctxcontext.Context,req*cloudbuildpb.UpdateWorkerPoolRequest,opts...gax.CallOption)(*UpdateWorkerPoolOperation,error)UpdateWorkerPool update a WorkerPool.
This API is experimental.
Example
packagemainimport("context"cloudbuild"cloud.google.com/go/cloudbuild/apiv1""cloud.google.com/go/cloudbuild/apiv1/v2/cloudbuildpb")funcmain(){ctx:=context.Background()c,err:=cloudbuild.NewClient(ctx)iferr!=nil{// TODO: Handle error.}req:=&cloudbuildpb.UpdateWorkerPoolRequest{// TODO: Fill request struct fields.}resp,err:=c.UpdateWorkerPool(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*Client) UpdateWorkerPoolOperation (deprecated)
func(c*Client)UpdateWorkerPoolOperation(namestring)*UpdateWorkerPoolOperationUpdateWorkerPoolOperation returns a new UpdateWorkerPoolOperation from a given name.The name must be that of a previously created UpdateWorkerPoolOperation, possibly from a different process.
CreateWorkerPoolOperation (deprecated)
typeCreateWorkerPoolOperationstruct{// contains filtered or unexported fields}CreateWorkerPoolOperation manages a long-running operation from CreateWorkerPool.
func (*CreateWorkerPoolOperation) Done (deprecated)
func(op*CreateWorkerPoolOperation)Done()boolDone reports whether the long-running operation has completed.
func (*CreateWorkerPoolOperation) Metadata (deprecated)
func(op*CreateWorkerPoolOperation)Metadata()(*cloudbuildpb.CreateWorkerPoolOperationMetadata,error)Metadata returns metadata associated with the long-running operation.Metadata itself does not contact the server, but Poll does.To get the latest metadata, call this method after a successful call to Poll.If the metadata is not available, the returned metadata and error are both nil.
func (*CreateWorkerPoolOperation) Name (deprecated)
func(op*CreateWorkerPoolOperation)Name()stringName returns the name of the long-running operation.The name is assigned by the server and is unique within the service from which the operation is created.
func (*CreateWorkerPoolOperation) Poll (deprecated)
func(op*CreateWorkerPoolOperation)Poll(ctxcontext.Context,opts...gax.CallOption)(*cloudbuildpb.WorkerPool,error)Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds andthe operation has completed with failure, the error is returned and op.Done will return true.If Poll succeeds and the operation has completed successfully,op.Done will return true, and the response of the operation is returned.If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*CreateWorkerPoolOperation) Wait (deprecated)
func(op*CreateWorkerPoolOperation)Wait(ctxcontext.Context,opts...gax.CallOption)(*cloudbuildpb.WorkerPool,error)Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
UpdateWorkerPoolOperation (deprecated)
typeUpdateWorkerPoolOperationstruct{// contains filtered or unexported fields}UpdateWorkerPoolOperation manages a long-running operation from UpdateWorkerPool.
func (*UpdateWorkerPoolOperation) Done (deprecated)
func(op*UpdateWorkerPoolOperation)Done()boolDone reports whether the long-running operation has completed.
func (*UpdateWorkerPoolOperation) Metadata (deprecated)
func(op*UpdateWorkerPoolOperation)Metadata()(*cloudbuildpb.UpdateWorkerPoolOperationMetadata,error)Metadata returns metadata associated with the long-running operation.Metadata itself does not contact the server, but Poll does.To get the latest metadata, call this method after a successful call to Poll.If the metadata is not available, the returned metadata and error are both nil.
func (*UpdateWorkerPoolOperation) Name (deprecated)
func(op*UpdateWorkerPoolOperation)Name()stringName returns the name of the long-running operation.The name is assigned by the server and is unique within the service from which the operation is created.
func (*UpdateWorkerPoolOperation) Poll (deprecated)
func(op*UpdateWorkerPoolOperation)Poll(ctxcontext.Context,opts...gax.CallOption)(*cloudbuildpb.WorkerPool,error)Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds andthe operation has completed with failure, the error is returned and op.Done will return true.If Poll succeeds and the operation has completed successfully,op.Done will return true, and the response of the operation is returned.If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*UpdateWorkerPoolOperation) Wait (deprecated)
func(op*UpdateWorkerPoolOperation)Wait(ctxcontext.Context,opts...gax.CallOption)(*cloudbuildpb.WorkerPool,error)Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-10-30 UTC.