Cloud Run Admin API v2 - Package cloud.google.com/go/run/apiv2 (v1.12.1) Stay organized with collections Save and categorize content based on your preferences.
Package run is an auto-generated package for theCloud Run Admin API.
Deploy and manage user provided container images that scale automaticallybased on incoming requests. The Cloud Run Admin API v1 follows the KnativeServing API specification, while v2 is aligned with Google Cloud AIP-basedAPI standards, as described inhttps://google.aip.dev/ (athttps://google.aip.dev/).
General documentation
For information that is relevant for all client libraries please referencehttps://pkg.go.dev/cloud.google.com/go#pkg-overview. Some information on thispage includes:
- Authentication and Authorization
- Timeouts and Cancellation
- Testing against Client Libraries
- Debugging Client Libraries
- Inspecting errors
Example usage
To get started with this package, create a client.
// go get cloud.google.com/go/run/apiv2@latestctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewBuildsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()
The client will use your default application credentials. Clients should be reused instead of created as needed.The methods of Client are safe for concurrent use by multiple goroutines.The returned client must be Closed when it is done being used.
Using the Client
The following is an example of making an API call with the newly created client, mentioned above.
req:=&runpb.SubmitBuildRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/run/apiv2/runpb#SubmitBuildRequest.}resp,err:=c.SubmitBuild(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp
Use of Context
The ctx passed to NewBuildsClient 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.
Functions
func DefaultAuthScopes
funcDefaultAuthScopes()[]stringDefaultAuthScopes reports the default set of authentication scopes to use with this package.
BuildsCallOptions
typeBuildsCallOptionsstruct{SubmitBuild[]gax.CallOptionDeleteOperation[]gax.CallOptionGetOperation[]gax.CallOptionListOperations[]gax.CallOptionWaitOperation[]gax.CallOption}BuildsCallOptions contains the retry settings for each method of BuildsClient.
BuildsClient
typeBuildsClientstruct{// The call options for this service.CallOptions*BuildsCallOptions// contains filtered or unexported fields}BuildsClient is a client for interacting with Cloud Run Admin API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Cloud Run Build Control Plane API
func NewBuildsClient
funcNewBuildsClient(ctxcontext.Context,opts...option.ClientOption)(*BuildsClient,error)NewBuildsClient creates a new builds client based on gRPC.The returned client must be Closed when it is done being used to clean up its underlying connections.
Cloud Run Build Control Plane API
Example
packagemainimport("context"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewBuildsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func NewBuildsRESTClient
funcNewBuildsRESTClient(ctxcontext.Context,opts...option.ClientOption)(*BuildsClient,error)NewBuildsRESTClient creates a new builds rest client.
Cloud Run Build Control Plane API
Example
packagemainimport("context"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewBuildsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*BuildsClient) Close
func(c*BuildsClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*BuildsClient) Connection (deprecated)
func(c*BuildsClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*BuildsClient) DeleteOperation
func(c*BuildsClient)DeleteOperation(ctxcontext.Context,req*longrunningpb.DeleteOperationRequest,opts...gax.CallOption)errorDeleteOperation is a utility method from google.longrunning.Operations.
Example
packagemainimport("context"longrunningpb"cloud.google.com/go/longrunning/autogen/longrunningpb"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewBuildsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&longrunningpb.DeleteOperationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest.}err=c.DeleteOperation(ctx,req)iferr!=nil{// TODO: Handle error.}}func (*BuildsClient) GetOperation
func(c*BuildsClient)GetOperation(ctxcontext.Context,req*longrunningpb.GetOperationRequest,opts...gax.CallOption)(*longrunningpb.Operation,error)GetOperation is a utility method from google.longrunning.Operations.
Example
packagemainimport("context"longrunningpb"cloud.google.com/go/longrunning/autogen/longrunningpb"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewBuildsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&longrunningpb.GetOperationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.}resp,err:=c.GetOperation(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*BuildsClient) ListOperations
func(c*BuildsClient)ListOperations(ctxcontext.Context,req*longrunningpb.ListOperationsRequest,opts...gax.CallOption)*OperationIteratorListOperations is a utility method from google.longrunning.Operations.
Examples
packagemainimport("context"longrunningpb"cloud.google.com/go/longrunning/autogen/longrunningpb"run"cloud.google.com/go/run/apiv2""google.golang.org/api/iterator")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewBuildsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&longrunningpb.ListOperationsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.}it:=c.ListOperations(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp// If you need to access the underlying RPC response,// you can do so by casting the `Response` as below.// Otherwise, remove this line. Only populated after// first call to Next(). Not safe for concurrent access._=it.Response.(*longrunningpb.ListOperationsResponse)}}all
packagemainimport("context"longrunningpb"cloud.google.com/go/longrunning/autogen/longrunningpb"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewBuildsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&longrunningpb.ListOperationsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.}forresp,err:=rangec.ListOperations(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*BuildsClient) SubmitBuild
func(c*BuildsClient)SubmitBuild(ctxcontext.Context,req*runpb.SubmitBuildRequest,opts...gax.CallOption)(*runpb.SubmitBuildResponse,error)SubmitBuild submits a build in a given project.
Example
packagemainimport("context"run"cloud.google.com/go/run/apiv2"runpb"cloud.google.com/go/run/apiv2/runpb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewBuildsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&runpb.SubmitBuildRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/run/apiv2/runpb#SubmitBuildRequest.}resp,err:=c.SubmitBuild(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*BuildsClient) WaitOperation
func(c*BuildsClient)WaitOperation(ctxcontext.Context,req*longrunningpb.WaitOperationRequest,opts...gax.CallOption)(*longrunningpb.Operation,error)WaitOperation is a utility method from google.longrunning.Operations.
Example
packagemainimport("context"longrunningpb"cloud.google.com/go/longrunning/autogen/longrunningpb"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewBuildsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&longrunningpb.WaitOperationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#WaitOperationRequest.}resp,err:=c.WaitOperation(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}CancelExecutionOperation
typeCancelExecutionOperationstruct{// contains filtered or unexported fields}CancelExecutionOperation manages a long-running operation from CancelExecution.
func (*CancelExecutionOperation) Done
func(op*CancelExecutionOperation)Done()boolDone reports whether the long-running operation has completed.
func (*CancelExecutionOperation) Metadata
func(op*CancelExecutionOperation)Metadata()(*runpb.Execution,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 (*CancelExecutionOperation) Name
func(op*CancelExecutionOperation)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 (*CancelExecutionOperation) Poll
func(op*CancelExecutionOperation)Poll(ctxcontext.Context,opts...gax.CallOption)(*runpb.Execution,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 (*CancelExecutionOperation) Wait
func(op*CancelExecutionOperation)Wait(ctxcontext.Context,opts...gax.CallOption)(*runpb.Execution,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.
CreateJobOperation
typeCreateJobOperationstruct{// contains filtered or unexported fields}CreateJobOperation manages a long-running operation from CreateJob.
func (*CreateJobOperation) Done
func(op*CreateJobOperation)Done()boolDone reports whether the long-running operation has completed.
func (*CreateJobOperation) Metadata
func(op*CreateJobOperation)Metadata()(*runpb.Job,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 (*CreateJobOperation) Name
func(op*CreateJobOperation)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 (*CreateJobOperation) Poll
func(op*CreateJobOperation)Poll(ctxcontext.Context,opts...gax.CallOption)(*runpb.Job,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 (*CreateJobOperation) Wait
func(op*CreateJobOperation)Wait(ctxcontext.Context,opts...gax.CallOption)(*runpb.Job,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.
CreateServiceOperation
typeCreateServiceOperationstruct{// contains filtered or unexported fields}CreateServiceOperation manages a long-running operation from CreateService.
func (*CreateServiceOperation) Done
func(op*CreateServiceOperation)Done()boolDone reports whether the long-running operation has completed.
func (*CreateServiceOperation) Metadata
func(op*CreateServiceOperation)Metadata()(*runpb.Service,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 (*CreateServiceOperation) Name
func(op*CreateServiceOperation)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 (*CreateServiceOperation) Poll
func(op*CreateServiceOperation)Poll(ctxcontext.Context,opts...gax.CallOption)(*runpb.Service,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 (*CreateServiceOperation) Wait
func(op*CreateServiceOperation)Wait(ctxcontext.Context,opts...gax.CallOption)(*runpb.Service,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.
CreateWorkerPoolOperation
typeCreateWorkerPoolOperationstruct{// contains filtered or unexported fields}CreateWorkerPoolOperation manages a long-running operation from CreateWorkerPool.
func (*CreateWorkerPoolOperation) Done
func(op*CreateWorkerPoolOperation)Done()boolDone reports whether the long-running operation has completed.
func (*CreateWorkerPoolOperation) Metadata
func(op*CreateWorkerPoolOperation)Metadata()(*runpb.WorkerPool,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
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
func(op*CreateWorkerPoolOperation)Poll(ctxcontext.Context,opts...gax.CallOption)(*runpb.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
func(op*CreateWorkerPoolOperation)Wait(ctxcontext.Context,opts...gax.CallOption)(*runpb.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.
DeleteExecutionOperation
typeDeleteExecutionOperationstruct{// contains filtered or unexported fields}DeleteExecutionOperation manages a long-running operation from DeleteExecution.
func (*DeleteExecutionOperation) Done
func(op*DeleteExecutionOperation)Done()boolDone reports whether the long-running operation has completed.
func (*DeleteExecutionOperation) Metadata
func(op*DeleteExecutionOperation)Metadata()(*runpb.Execution,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 (*DeleteExecutionOperation) Name
func(op*DeleteExecutionOperation)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 (*DeleteExecutionOperation) Poll
func(op*DeleteExecutionOperation)Poll(ctxcontext.Context,opts...gax.CallOption)(*runpb.Execution,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 (*DeleteExecutionOperation) Wait
func(op*DeleteExecutionOperation)Wait(ctxcontext.Context,opts...gax.CallOption)(*runpb.Execution,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.
DeleteJobOperation
typeDeleteJobOperationstruct{// contains filtered or unexported fields}DeleteJobOperation manages a long-running operation from DeleteJob.
func (*DeleteJobOperation) Done
func(op*DeleteJobOperation)Done()boolDone reports whether the long-running operation has completed.
func (*DeleteJobOperation) Metadata
func(op*DeleteJobOperation)Metadata()(*runpb.Job,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 (*DeleteJobOperation) Name
func(op*DeleteJobOperation)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 (*DeleteJobOperation) Poll
func(op*DeleteJobOperation)Poll(ctxcontext.Context,opts...gax.CallOption)(*runpb.Job,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 (*DeleteJobOperation) Wait
func(op*DeleteJobOperation)Wait(ctxcontext.Context,opts...gax.CallOption)(*runpb.Job,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.
DeleteRevisionOperation
typeDeleteRevisionOperationstruct{// contains filtered or unexported fields}DeleteRevisionOperation manages a long-running operation from DeleteRevision.
func (*DeleteRevisionOperation) Done
func(op*DeleteRevisionOperation)Done()boolDone reports whether the long-running operation has completed.
func (*DeleteRevisionOperation) Metadata
func(op*DeleteRevisionOperation)Metadata()(*runpb.Revision,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 (*DeleteRevisionOperation) Name
func(op*DeleteRevisionOperation)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 (*DeleteRevisionOperation) Poll
func(op*DeleteRevisionOperation)Poll(ctxcontext.Context,opts...gax.CallOption)(*runpb.Revision,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 (*DeleteRevisionOperation) Wait
func(op*DeleteRevisionOperation)Wait(ctxcontext.Context,opts...gax.CallOption)(*runpb.Revision,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.
DeleteServiceOperation
typeDeleteServiceOperationstruct{// contains filtered or unexported fields}DeleteServiceOperation manages a long-running operation from DeleteService.
func (*DeleteServiceOperation) Done
func(op*DeleteServiceOperation)Done()boolDone reports whether the long-running operation has completed.
func (*DeleteServiceOperation) Metadata
func(op*DeleteServiceOperation)Metadata()(*runpb.Service,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 (*DeleteServiceOperation) Name
func(op*DeleteServiceOperation)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 (*DeleteServiceOperation) Poll
func(op*DeleteServiceOperation)Poll(ctxcontext.Context,opts...gax.CallOption)(*runpb.Service,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 (*DeleteServiceOperation) Wait
func(op*DeleteServiceOperation)Wait(ctxcontext.Context,opts...gax.CallOption)(*runpb.Service,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.
DeleteWorkerPoolOperation
typeDeleteWorkerPoolOperationstruct{// contains filtered or unexported fields}DeleteWorkerPoolOperation manages a long-running operation from DeleteWorkerPool.
func (*DeleteWorkerPoolOperation) Done
func(op*DeleteWorkerPoolOperation)Done()boolDone reports whether the long-running operation has completed.
func (*DeleteWorkerPoolOperation) Metadata
func(op*DeleteWorkerPoolOperation)Metadata()(*runpb.WorkerPool,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 (*DeleteWorkerPoolOperation) Name
func(op*DeleteWorkerPoolOperation)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 (*DeleteWorkerPoolOperation) Poll
func(op*DeleteWorkerPoolOperation)Poll(ctxcontext.Context,opts...gax.CallOption)(*runpb.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 (*DeleteWorkerPoolOperation) Wait
func(op*DeleteWorkerPoolOperation)Wait(ctxcontext.Context,opts...gax.CallOption)(*runpb.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.
ExecutionIterator
typeExecutionIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// 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[]*runpb.Execution,nextPageTokenstring,errerror)// contains filtered or unexported fields}ExecutionIterator manages a stream of *runpb.Execution.
func (*ExecutionIterator) All
func(it*ExecutionIterator)All()iter.Seq2[*runpb.Execution,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*ExecutionIterator) Next
func(it*ExecutionIterator)Next()(*runpb.Execution,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 (*ExecutionIterator) PageInfo
func(it*ExecutionIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
ExecutionsCallOptions
typeExecutionsCallOptionsstruct{GetExecution[]gax.CallOptionListExecutions[]gax.CallOptionDeleteExecution[]gax.CallOptionCancelExecution[]gax.CallOptionDeleteOperation[]gax.CallOptionGetOperation[]gax.CallOptionListOperations[]gax.CallOptionWaitOperation[]gax.CallOption}ExecutionsCallOptions contains the retry settings for each method of ExecutionsClient.
ExecutionsClient
typeExecutionsClientstruct{// The call options for this service.CallOptions*ExecutionsCallOptions// 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}ExecutionsClient is a client for interacting with Cloud Run Admin API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Cloud Run Execution Control Plane API.
func NewExecutionsClient
funcNewExecutionsClient(ctxcontext.Context,opts...option.ClientOption)(*ExecutionsClient,error)NewExecutionsClient creates a new executions client based on gRPC.The returned client must be Closed when it is done being used to clean up its underlying connections.
Cloud Run Execution Control Plane API.
Example
packagemainimport("context"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewExecutionsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func NewExecutionsRESTClient
funcNewExecutionsRESTClient(ctxcontext.Context,opts...option.ClientOption)(*ExecutionsClient,error)NewExecutionsRESTClient creates a new executions rest client.
Cloud Run Execution Control Plane API.
Example
packagemainimport("context"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewExecutionsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*ExecutionsClient) CancelExecution
func(c*ExecutionsClient)CancelExecution(ctxcontext.Context,req*runpb.CancelExecutionRequest,opts...gax.CallOption)(*CancelExecutionOperation,error)CancelExecution cancels an Execution.
Example
packagemainimport("context"run"cloud.google.com/go/run/apiv2"runpb"cloud.google.com/go/run/apiv2/runpb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewExecutionsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&runpb.CancelExecutionRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/run/apiv2/runpb#CancelExecutionRequest.}op,err:=c.CancelExecution(ctx,req)iferr!=nil{// TODO: Handle error.}resp,err:=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*ExecutionsClient) CancelExecutionOperation
func(c*ExecutionsClient)CancelExecutionOperation(namestring)*CancelExecutionOperationCancelExecutionOperation returns a new CancelExecutionOperation from a given name.The name must be that of a previously created CancelExecutionOperation, possibly from a different process.
func (*ExecutionsClient) Close
func(c*ExecutionsClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*ExecutionsClient) Connection (deprecated)
func(c*ExecutionsClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*ExecutionsClient) DeleteExecution
func(c*ExecutionsClient)DeleteExecution(ctxcontext.Context,req*runpb.DeleteExecutionRequest,opts...gax.CallOption)(*DeleteExecutionOperation,error)DeleteExecution deletes an Execution.
Example
packagemainimport("context"run"cloud.google.com/go/run/apiv2"runpb"cloud.google.com/go/run/apiv2/runpb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewExecutionsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&runpb.DeleteExecutionRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/run/apiv2/runpb#DeleteExecutionRequest.}op,err:=c.DeleteExecution(ctx,req)iferr!=nil{// TODO: Handle error.}resp,err:=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*ExecutionsClient) DeleteExecutionOperation
func(c*ExecutionsClient)DeleteExecutionOperation(namestring)*DeleteExecutionOperationDeleteExecutionOperation returns a new DeleteExecutionOperation from a given name.The name must be that of a previously created DeleteExecutionOperation, possibly from a different process.
func (*ExecutionsClient) DeleteOperation
func(c*ExecutionsClient)DeleteOperation(ctxcontext.Context,req*longrunningpb.DeleteOperationRequest,opts...gax.CallOption)errorDeleteOperation is a utility method from google.longrunning.Operations.
Example
packagemainimport("context"longrunningpb"cloud.google.com/go/longrunning/autogen/longrunningpb"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewExecutionsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&longrunningpb.DeleteOperationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest.}err=c.DeleteOperation(ctx,req)iferr!=nil{// TODO: Handle error.}}func (*ExecutionsClient) GetExecution
func(c*ExecutionsClient)GetExecution(ctxcontext.Context,req*runpb.GetExecutionRequest,opts...gax.CallOption)(*runpb.Execution,error)GetExecution gets information about an Execution.
Example
packagemainimport("context"run"cloud.google.com/go/run/apiv2"runpb"cloud.google.com/go/run/apiv2/runpb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewExecutionsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&runpb.GetExecutionRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/run/apiv2/runpb#GetExecutionRequest.}resp,err:=c.GetExecution(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*ExecutionsClient) GetOperation
func(c*ExecutionsClient)GetOperation(ctxcontext.Context,req*longrunningpb.GetOperationRequest,opts...gax.CallOption)(*longrunningpb.Operation,error)GetOperation is a utility method from google.longrunning.Operations.
Example
packagemainimport("context"longrunningpb"cloud.google.com/go/longrunning/autogen/longrunningpb"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewExecutionsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&longrunningpb.GetOperationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.}resp,err:=c.GetOperation(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*ExecutionsClient) ListExecutions
func(c*ExecutionsClient)ListExecutions(ctxcontext.Context,req*runpb.ListExecutionsRequest,opts...gax.CallOption)*ExecutionIteratorListExecutions lists Executions from a Job. Results are sorted by creation time,descending.
Examples
packagemainimport("context"run"cloud.google.com/go/run/apiv2"runpb"cloud.google.com/go/run/apiv2/runpb""google.golang.org/api/iterator")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewExecutionsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&runpb.ListExecutionsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/run/apiv2/runpb#ListExecutionsRequest.}it:=c.ListExecutions(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp// If you need to access the underlying RPC response,// you can do so by casting the `Response` as below.// Otherwise, remove this line. Only populated after// first call to Next(). Not safe for concurrent access._=it.Response.(*runpb.ListExecutionsResponse)}}all
packagemainimport("context"run"cloud.google.com/go/run/apiv2"runpb"cloud.google.com/go/run/apiv2/runpb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewExecutionsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&runpb.ListExecutionsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/run/apiv2/runpb#ListExecutionsRequest.}forresp,err:=rangec.ListExecutions(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*ExecutionsClient) ListOperations
func(c*ExecutionsClient)ListOperations(ctxcontext.Context,req*longrunningpb.ListOperationsRequest,opts...gax.CallOption)*OperationIteratorListOperations is a utility method from google.longrunning.Operations.
Examples
packagemainimport("context"longrunningpb"cloud.google.com/go/longrunning/autogen/longrunningpb"run"cloud.google.com/go/run/apiv2""google.golang.org/api/iterator")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewExecutionsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&longrunningpb.ListOperationsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.}it:=c.ListOperations(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp// If you need to access the underlying RPC response,// you can do so by casting the `Response` as below.// Otherwise, remove this line. Only populated after// first call to Next(). Not safe for concurrent access._=it.Response.(*longrunningpb.ListOperationsResponse)}}all
packagemainimport("context"longrunningpb"cloud.google.com/go/longrunning/autogen/longrunningpb"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewExecutionsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&longrunningpb.ListOperationsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.}forresp,err:=rangec.ListOperations(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*ExecutionsClient) WaitOperation
func(c*ExecutionsClient)WaitOperation(ctxcontext.Context,req*longrunningpb.WaitOperationRequest,opts...gax.CallOption)(*longrunningpb.Operation,error)WaitOperation is a utility method from google.longrunning.Operations.
Example
packagemainimport("context"longrunningpb"cloud.google.com/go/longrunning/autogen/longrunningpb"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewExecutionsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&longrunningpb.WaitOperationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#WaitOperationRequest.}resp,err:=c.WaitOperation(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}JobIterator
typeJobIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// 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[]*runpb.Job,nextPageTokenstring,errerror)// contains filtered or unexported fields}JobIterator manages a stream of *runpb.Job.
func (*JobIterator) All
func(it*JobIterator)All()iter.Seq2[*runpb.Job,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*JobIterator) Next
func(it*JobIterator)Next()(*runpb.Job,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 (*JobIterator) PageInfo
func(it*JobIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
JobsCallOptions
typeJobsCallOptionsstruct{CreateJob[]gax.CallOptionGetJob[]gax.CallOptionListJobs[]gax.CallOptionUpdateJob[]gax.CallOptionDeleteJob[]gax.CallOptionRunJob[]gax.CallOptionGetIamPolicy[]gax.CallOptionSetIamPolicy[]gax.CallOptionTestIamPermissions[]gax.CallOptionDeleteOperation[]gax.CallOptionGetOperation[]gax.CallOptionListOperations[]gax.CallOptionWaitOperation[]gax.CallOption}JobsCallOptions contains the retry settings for each method of JobsClient.
JobsClient
typeJobsClientstruct{// The call options for this service.CallOptions*JobsCallOptions// 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}JobsClient is a client for interacting with Cloud Run Admin API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Cloud Run Job Control Plane API.
func NewJobsClient
funcNewJobsClient(ctxcontext.Context,opts...option.ClientOption)(*JobsClient,error)NewJobsClient creates a new jobs client based on gRPC.The returned client must be Closed when it is done being used to clean up its underlying connections.
Cloud Run Job Control Plane API.
Example
packagemainimport("context"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewJobsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func NewJobsRESTClient
funcNewJobsRESTClient(ctxcontext.Context,opts...option.ClientOption)(*JobsClient,error)NewJobsRESTClient creates a new jobs rest client.
Cloud Run Job Control Plane API.
Example
packagemainimport("context"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewJobsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*JobsClient) Close
func(c*JobsClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*JobsClient) Connection (deprecated)
func(c*JobsClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*JobsClient) CreateJob
func(c*JobsClient)CreateJob(ctxcontext.Context,req*runpb.CreateJobRequest,opts...gax.CallOption)(*CreateJobOperation,error)CreateJob creates a Job.
Example
packagemainimport("context"run"cloud.google.com/go/run/apiv2"runpb"cloud.google.com/go/run/apiv2/runpb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewJobsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&runpb.CreateJobRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/run/apiv2/runpb#CreateJobRequest.}op,err:=c.CreateJob(ctx,req)iferr!=nil{// TODO: Handle error.}resp,err:=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*JobsClient) CreateJobOperation
func(c*JobsClient)CreateJobOperation(namestring)*CreateJobOperationCreateJobOperation returns a new CreateJobOperation from a given name.The name must be that of a previously created CreateJobOperation, possibly from a different process.
func (*JobsClient) DeleteJob
func(c*JobsClient)DeleteJob(ctxcontext.Context,req*runpb.DeleteJobRequest,opts...gax.CallOption)(*DeleteJobOperation,error)DeleteJob deletes a Job.
Example
packagemainimport("context"run"cloud.google.com/go/run/apiv2"runpb"cloud.google.com/go/run/apiv2/runpb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewJobsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&runpb.DeleteJobRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/run/apiv2/runpb#DeleteJobRequest.}op,err:=c.DeleteJob(ctx,req)iferr!=nil{// TODO: Handle error.}resp,err:=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*JobsClient) DeleteJobOperation
func(c*JobsClient)DeleteJobOperation(namestring)*DeleteJobOperationDeleteJobOperation returns a new DeleteJobOperation from a given name.The name must be that of a previously created DeleteJobOperation, possibly from a different process.
func (*JobsClient) DeleteOperation
func(c*JobsClient)DeleteOperation(ctxcontext.Context,req*longrunningpb.DeleteOperationRequest,opts...gax.CallOption)errorDeleteOperation is a utility method from google.longrunning.Operations.
Example
packagemainimport("context"longrunningpb"cloud.google.com/go/longrunning/autogen/longrunningpb"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewJobsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&longrunningpb.DeleteOperationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest.}err=c.DeleteOperation(ctx,req)iferr!=nil{// TODO: Handle error.}}func (*JobsClient) GetIamPolicy
func(c*JobsClient)GetIamPolicy(ctxcontext.Context,req*iampb.GetIamPolicyRequest,opts...gax.CallOption)(*iampb.Policy,error)GetIamPolicy gets the IAM Access Control policy currently in effect for the given Job.This result does not include any inherited policies.
Example
packagemainimport("context"iampb"cloud.google.com/go/iam/apiv1/iampb"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewJobsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&iampb.GetIamPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#GetIamPolicyRequest.}resp,err:=c.GetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*JobsClient) GetJob
func(c*JobsClient)GetJob(ctxcontext.Context,req*runpb.GetJobRequest,opts...gax.CallOption)(*runpb.Job,error)GetJob gets information about a Job.
Example
packagemainimport("context"run"cloud.google.com/go/run/apiv2"runpb"cloud.google.com/go/run/apiv2/runpb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewJobsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&runpb.GetJobRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/run/apiv2/runpb#GetJobRequest.}resp,err:=c.GetJob(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*JobsClient) GetOperation
func(c*JobsClient)GetOperation(ctxcontext.Context,req*longrunningpb.GetOperationRequest,opts...gax.CallOption)(*longrunningpb.Operation,error)GetOperation is a utility method from google.longrunning.Operations.
Example
packagemainimport("context"longrunningpb"cloud.google.com/go/longrunning/autogen/longrunningpb"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewJobsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&longrunningpb.GetOperationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.}resp,err:=c.GetOperation(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*JobsClient) ListJobs
func(c*JobsClient)ListJobs(ctxcontext.Context,req*runpb.ListJobsRequest,opts...gax.CallOption)*JobIteratorListJobs lists Jobs. Results are sorted by creation time, descending.
Examples
packagemainimport("context"run"cloud.google.com/go/run/apiv2"runpb"cloud.google.com/go/run/apiv2/runpb""google.golang.org/api/iterator")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewJobsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&runpb.ListJobsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/run/apiv2/runpb#ListJobsRequest.}it:=c.ListJobs(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp// If you need to access the underlying RPC response,// you can do so by casting the `Response` as below.// Otherwise, remove this line. Only populated after// first call to Next(). Not safe for concurrent access._=it.Response.(*runpb.ListJobsResponse)}}all
packagemainimport("context"run"cloud.google.com/go/run/apiv2"runpb"cloud.google.com/go/run/apiv2/runpb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewJobsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&runpb.ListJobsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/run/apiv2/runpb#ListJobsRequest.}forresp,err:=rangec.ListJobs(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*JobsClient) ListOperations
func(c*JobsClient)ListOperations(ctxcontext.Context,req*longrunningpb.ListOperationsRequest,opts...gax.CallOption)*OperationIteratorListOperations is a utility method from google.longrunning.Operations.
Examples
packagemainimport("context"longrunningpb"cloud.google.com/go/longrunning/autogen/longrunningpb"run"cloud.google.com/go/run/apiv2""google.golang.org/api/iterator")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewJobsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&longrunningpb.ListOperationsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.}it:=c.ListOperations(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp// If you need to access the underlying RPC response,// you can do so by casting the `Response` as below.// Otherwise, remove this line. Only populated after// first call to Next(). Not safe for concurrent access._=it.Response.(*longrunningpb.ListOperationsResponse)}}all
packagemainimport("context"longrunningpb"cloud.google.com/go/longrunning/autogen/longrunningpb"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewJobsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&longrunningpb.ListOperationsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.}forresp,err:=rangec.ListOperations(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*JobsClient) RunJob
func(c*JobsClient)RunJob(ctxcontext.Context,req*runpb.RunJobRequest,opts...gax.CallOption)(*RunJobOperation,error)RunJob triggers creation of a new Execution of this Job.
Example
packagemainimport("context"run"cloud.google.com/go/run/apiv2"runpb"cloud.google.com/go/run/apiv2/runpb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewJobsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&runpb.RunJobRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/run/apiv2/runpb#RunJobRequest.}op,err:=c.RunJob(ctx,req)iferr!=nil{// TODO: Handle error.}resp,err:=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*JobsClient) RunJobOperation
func(c*JobsClient)RunJobOperation(namestring)*RunJobOperationRunJobOperation returns a new RunJobOperation from a given name.The name must be that of a previously created RunJobOperation, possibly from a different process.
func (*JobsClient) SetIamPolicy
func(c*JobsClient)SetIamPolicy(ctxcontext.Context,req*iampb.SetIamPolicyRequest,opts...gax.CallOption)(*iampb.Policy,error)SetIamPolicy sets the IAM Access control policy for the specified Job. Overwritesany existing policy.
Example
packagemainimport("context"iampb"cloud.google.com/go/iam/apiv1/iampb"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewJobsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&iampb.SetIamPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#SetIamPolicyRequest.}resp,err:=c.SetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*JobsClient) TestIamPermissions
func(c*JobsClient)TestIamPermissions(ctxcontext.Context,req*iampb.TestIamPermissionsRequest,opts...gax.CallOption)(*iampb.TestIamPermissionsResponse,error)TestIamPermissions returns permissions that a caller has on the specified Project.
There are no permissions required for making this API call.
Example
packagemainimport("context"iampb"cloud.google.com/go/iam/apiv1/iampb"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewJobsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&iampb.TestIamPermissionsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#TestIamPermissionsRequest.}resp,err:=c.TestIamPermissions(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*JobsClient) UpdateJob
func(c*JobsClient)UpdateJob(ctxcontext.Context,req*runpb.UpdateJobRequest,opts...gax.CallOption)(*UpdateJobOperation,error)UpdateJob updates a Job.
Example
packagemainimport("context"run"cloud.google.com/go/run/apiv2"runpb"cloud.google.com/go/run/apiv2/runpb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewJobsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&runpb.UpdateJobRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/run/apiv2/runpb#UpdateJobRequest.}op,err:=c.UpdateJob(ctx,req)iferr!=nil{// TODO: Handle error.}resp,err:=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*JobsClient) UpdateJobOperation
func(c*JobsClient)UpdateJobOperation(namestring)*UpdateJobOperationUpdateJobOperation returns a new UpdateJobOperation from a given name.The name must be that of a previously created UpdateJobOperation, possibly from a different process.
func (*JobsClient) WaitOperation
func(c*JobsClient)WaitOperation(ctxcontext.Context,req*longrunningpb.WaitOperationRequest,opts...gax.CallOption)(*longrunningpb.Operation,error)WaitOperation is a utility method from google.longrunning.Operations.
Example
packagemainimport("context"longrunningpb"cloud.google.com/go/longrunning/autogen/longrunningpb"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewJobsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&longrunningpb.WaitOperationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#WaitOperationRequest.}resp,err:=c.WaitOperation(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}LocationIterator
typeLocationIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// 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[]*locationpb.Location,nextPageTokenstring,errerror)// contains filtered or unexported fields}LocationIterator manages a stream of *locationpb.Location.
func (*LocationIterator) Next
func(it*LocationIterator)Next()(*locationpb.Location,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 (*LocationIterator) PageInfo
func(it*LocationIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the google.golang.org/api/iterator package for details.
LocationsCallOptions
typeLocationsCallOptionsstruct{ListLocations[]gax.CallOptionGetLocation[]gax.CallOptionDeleteOperation[]gax.CallOptionGetOperation[]gax.CallOptionListOperations[]gax.CallOptionWaitOperation[]gax.CallOption}LocationsCallOptions contains the retry settings for each method of LocationsClient.
LocationsClient
typeLocationsClientstruct{// The call options for this service.CallOptions*LocationsCallOptions// contains filtered or unexported fields}LocationsClient is a client for interacting with Cloud Run Admin API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
An abstract interface that provides location-related information fora service. Service-specific metadata is provided through theLocation.metadata field.
func NewLocationsClient
funcNewLocationsClient(ctxcontext.Context,opts...option.ClientOption)(*LocationsClient,error)NewLocationsClient creates a new locations client based on gRPC.The returned client must be Closed when it is done being used to clean up its underlying connections.
An abstract interface that provides location-related information fora service. Service-specific metadata is provided through theLocation.metadata field.
func NewLocationsRESTClient
funcNewLocationsRESTClient(ctxcontext.Context,opts...option.ClientOption)(*LocationsClient,error)NewLocationsRESTClient creates a new locations rest client.
An abstract interface that provides location-related information fora service. Service-specific metadata is provided through theLocation.metadata field.
func (*LocationsClient) Close
func(c*LocationsClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*LocationsClient) Connection (deprecated)
func(c*LocationsClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*LocationsClient) DeleteOperation
func(c*LocationsClient)DeleteOperation(ctxcontext.Context,req*longrunningpb.DeleteOperationRequest,opts...gax.CallOption)errorDeleteOperation is a utility method from google.longrunning.Operations.
func (*LocationsClient) GetLocation
func(c*LocationsClient)GetLocation(ctxcontext.Context,req*locationpb.GetLocationRequest,opts...gax.CallOption)(*locationpb.Location,error)GetLocation gets information about a location.
func (*LocationsClient) GetOperation
func(c*LocationsClient)GetOperation(ctxcontext.Context,req*longrunningpb.GetOperationRequest,opts...gax.CallOption)(*longrunningpb.Operation,error)GetOperation is a utility method from google.longrunning.Operations.
func (*LocationsClient) ListLocations
func(c*LocationsClient)ListLocations(ctxcontext.Context,req*locationpb.ListLocationsRequest,opts...gax.CallOption)*LocationIteratorListLocations lists information about the supported locations for this service.
func (*LocationsClient) ListOperations
func(c*LocationsClient)ListOperations(ctxcontext.Context,req*longrunningpb.ListOperationsRequest,opts...gax.CallOption)*OperationIteratorListOperations is a utility method from google.longrunning.Operations.
func (*LocationsClient) WaitOperation
func(c*LocationsClient)WaitOperation(ctxcontext.Context,req*longrunningpb.WaitOperationRequest,opts...gax.CallOption)(*longrunningpb.Operation,error)WaitOperation is a utility method from google.longrunning.Operations.
OperationIterator
typeOperationIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// 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[]*longrunningpb.Operation,nextPageTokenstring,errerror)// contains filtered or unexported fields}OperationIterator manages a stream of *longrunningpb.Operation.
func (*OperationIterator) All
func(it*OperationIterator)All()iter.Seq2[*longrunningpb.Operation,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*OperationIterator) Next
func(it*OperationIterator)Next()(*longrunningpb.Operation,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 (*OperationIterator) PageInfo
func(it*OperationIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
RevisionIterator
typeRevisionIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// 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[]*runpb.Revision,nextPageTokenstring,errerror)// contains filtered or unexported fields}RevisionIterator manages a stream of *runpb.Revision.
func (*RevisionIterator) All
func(it*RevisionIterator)All()iter.Seq2[*runpb.Revision,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*RevisionIterator) Next
func(it*RevisionIterator)Next()(*runpb.Revision,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 (*RevisionIterator) PageInfo
func(it*RevisionIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
RevisionsCallOptions
typeRevisionsCallOptionsstruct{GetRevision[]gax.CallOptionListRevisions[]gax.CallOptionDeleteRevision[]gax.CallOptionDeleteOperation[]gax.CallOptionGetOperation[]gax.CallOptionListOperations[]gax.CallOptionWaitOperation[]gax.CallOption}RevisionsCallOptions contains the retry settings for each method of RevisionsClient.
RevisionsClient
typeRevisionsClientstruct{// The call options for this service.CallOptions*RevisionsCallOptions// 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}RevisionsClient is a client for interacting with Cloud Run Admin API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Cloud Run Revision Control Plane API.
func NewRevisionsClient
funcNewRevisionsClient(ctxcontext.Context,opts...option.ClientOption)(*RevisionsClient,error)NewRevisionsClient creates a new revisions client based on gRPC.The returned client must be Closed when it is done being used to clean up its underlying connections.
Cloud Run Revision Control Plane API.
Example
packagemainimport("context"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewRevisionsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func NewRevisionsRESTClient
funcNewRevisionsRESTClient(ctxcontext.Context,opts...option.ClientOption)(*RevisionsClient,error)NewRevisionsRESTClient creates a new revisions rest client.
Cloud Run Revision Control Plane API.
Example
packagemainimport("context"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewRevisionsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*RevisionsClient) Close
func(c*RevisionsClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*RevisionsClient) Connection (deprecated)
func(c*RevisionsClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*RevisionsClient) DeleteOperation
func(c*RevisionsClient)DeleteOperation(ctxcontext.Context,req*longrunningpb.DeleteOperationRequest,opts...gax.CallOption)errorDeleteOperation is a utility method from google.longrunning.Operations.
Example
packagemainimport("context"longrunningpb"cloud.google.com/go/longrunning/autogen/longrunningpb"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewRevisionsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&longrunningpb.DeleteOperationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest.}err=c.DeleteOperation(ctx,req)iferr!=nil{// TODO: Handle error.}}func (*RevisionsClient) DeleteRevision
func(c*RevisionsClient)DeleteRevision(ctxcontext.Context,req*runpb.DeleteRevisionRequest,opts...gax.CallOption)(*DeleteRevisionOperation,error)DeleteRevision deletes a Revision.
Example
packagemainimport("context"run"cloud.google.com/go/run/apiv2"runpb"cloud.google.com/go/run/apiv2/runpb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewRevisionsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&runpb.DeleteRevisionRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/run/apiv2/runpb#DeleteRevisionRequest.}op,err:=c.DeleteRevision(ctx,req)iferr!=nil{// TODO: Handle error.}resp,err:=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RevisionsClient) DeleteRevisionOperation
func(c*RevisionsClient)DeleteRevisionOperation(namestring)*DeleteRevisionOperationDeleteRevisionOperation returns a new DeleteRevisionOperation from a given name.The name must be that of a previously created DeleteRevisionOperation, possibly from a different process.
func (*RevisionsClient) GetOperation
func(c*RevisionsClient)GetOperation(ctxcontext.Context,req*longrunningpb.GetOperationRequest,opts...gax.CallOption)(*longrunningpb.Operation,error)GetOperation is a utility method from google.longrunning.Operations.
Example
packagemainimport("context"longrunningpb"cloud.google.com/go/longrunning/autogen/longrunningpb"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewRevisionsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&longrunningpb.GetOperationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.}resp,err:=c.GetOperation(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RevisionsClient) GetRevision
func(c*RevisionsClient)GetRevision(ctxcontext.Context,req*runpb.GetRevisionRequest,opts...gax.CallOption)(*runpb.Revision,error)GetRevision gets information about a Revision.
Example
packagemainimport("context"run"cloud.google.com/go/run/apiv2"runpb"cloud.google.com/go/run/apiv2/runpb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewRevisionsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&runpb.GetRevisionRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/run/apiv2/runpb#GetRevisionRequest.}resp,err:=c.GetRevision(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*RevisionsClient) ListOperations
func(c*RevisionsClient)ListOperations(ctxcontext.Context,req*longrunningpb.ListOperationsRequest,opts...gax.CallOption)*OperationIteratorListOperations is a utility method from google.longrunning.Operations.
Examples
packagemainimport("context"longrunningpb"cloud.google.com/go/longrunning/autogen/longrunningpb"run"cloud.google.com/go/run/apiv2""google.golang.org/api/iterator")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewRevisionsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&longrunningpb.ListOperationsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.}it:=c.ListOperations(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp// If you need to access the underlying RPC response,// you can do so by casting the `Response` as below.// Otherwise, remove this line. Only populated after// first call to Next(). Not safe for concurrent access._=it.Response.(*longrunningpb.ListOperationsResponse)}}all
packagemainimport("context"longrunningpb"cloud.google.com/go/longrunning/autogen/longrunningpb"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewRevisionsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&longrunningpb.ListOperationsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.}forresp,err:=rangec.ListOperations(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*RevisionsClient) ListRevisions
func(c*RevisionsClient)ListRevisions(ctxcontext.Context,req*runpb.ListRevisionsRequest,opts...gax.CallOption)*RevisionIteratorListRevisions lists Revisions from a given Service, or from a given location. Resultsare sorted by creation time, descending.
Examples
packagemainimport("context"run"cloud.google.com/go/run/apiv2"runpb"cloud.google.com/go/run/apiv2/runpb""google.golang.org/api/iterator")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewRevisionsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&runpb.ListRevisionsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/run/apiv2/runpb#ListRevisionsRequest.}it:=c.ListRevisions(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp// If you need to access the underlying RPC response,// you can do so by casting the `Response` as below.// Otherwise, remove this line. Only populated after// first call to Next(). Not safe for concurrent access._=it.Response.(*runpb.ListRevisionsResponse)}}all
packagemainimport("context"run"cloud.google.com/go/run/apiv2"runpb"cloud.google.com/go/run/apiv2/runpb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewRevisionsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&runpb.ListRevisionsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/run/apiv2/runpb#ListRevisionsRequest.}forresp,err:=rangec.ListRevisions(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*RevisionsClient) WaitOperation
func(c*RevisionsClient)WaitOperation(ctxcontext.Context,req*longrunningpb.WaitOperationRequest,opts...gax.CallOption)(*longrunningpb.Operation,error)WaitOperation is a utility method from google.longrunning.Operations.
Example
packagemainimport("context"longrunningpb"cloud.google.com/go/longrunning/autogen/longrunningpb"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewRevisionsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&longrunningpb.WaitOperationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#WaitOperationRequest.}resp,err:=c.WaitOperation(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}RunJobOperation
typeRunJobOperationstruct{// contains filtered or unexported fields}RunJobOperation manages a long-running operation from RunJob.
func (*RunJobOperation) Done
func(op*RunJobOperation)Done()boolDone reports whether the long-running operation has completed.
func (*RunJobOperation) Metadata
func(op*RunJobOperation)Metadata()(*runpb.Execution,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 (*RunJobOperation) Name
func(op*RunJobOperation)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 (*RunJobOperation) Poll
func(op*RunJobOperation)Poll(ctxcontext.Context,opts...gax.CallOption)(*runpb.Execution,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 (*RunJobOperation) Wait
func(op*RunJobOperation)Wait(ctxcontext.Context,opts...gax.CallOption)(*runpb.Execution,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.
ServiceIterator
typeServiceIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// 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[]*runpb.Service,nextPageTokenstring,errerror)// contains filtered or unexported fields}ServiceIterator manages a stream of *runpb.Service.
func (*ServiceIterator) All
func(it*ServiceIterator)All()iter.Seq2[*runpb.Service,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*ServiceIterator) Next
func(it*ServiceIterator)Next()(*runpb.Service,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 (*ServiceIterator) PageInfo
func(it*ServiceIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
ServicesCallOptions
typeServicesCallOptionsstruct{CreateService[]gax.CallOptionGetService[]gax.CallOptionListServices[]gax.CallOptionUpdateService[]gax.CallOptionDeleteService[]gax.CallOptionGetIamPolicy[]gax.CallOptionSetIamPolicy[]gax.CallOptionTestIamPermissions[]gax.CallOptionDeleteOperation[]gax.CallOptionGetOperation[]gax.CallOptionListOperations[]gax.CallOptionWaitOperation[]gax.CallOption}ServicesCallOptions contains the retry settings for each method of ServicesClient.
ServicesClient
typeServicesClientstruct{// The call options for this service.CallOptions*ServicesCallOptions// 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}ServicesClient is a client for interacting with Cloud Run Admin API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Cloud Run Service Control Plane API
func NewServicesClient
funcNewServicesClient(ctxcontext.Context,opts...option.ClientOption)(*ServicesClient,error)NewServicesClient creates a new services client based on gRPC.The returned client must be Closed when it is done being used to clean up its underlying connections.
Cloud Run Service Control Plane API
Example
packagemainimport("context"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewServicesClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func NewServicesRESTClient
funcNewServicesRESTClient(ctxcontext.Context,opts...option.ClientOption)(*ServicesClient,error)NewServicesRESTClient creates a new services rest client.
Cloud Run Service Control Plane API
Example
packagemainimport("context"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewServicesRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*ServicesClient) Close
func(c*ServicesClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*ServicesClient) Connection (deprecated)
func(c*ServicesClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*ServicesClient) CreateService
func(c*ServicesClient)CreateService(ctxcontext.Context,req*runpb.CreateServiceRequest,opts...gax.CallOption)(*CreateServiceOperation,error)CreateService creates a new Service in a given project and location.
Example
packagemainimport("context"run"cloud.google.com/go/run/apiv2"runpb"cloud.google.com/go/run/apiv2/runpb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewServicesClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&runpb.CreateServiceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/run/apiv2/runpb#CreateServiceRequest.}op,err:=c.CreateService(ctx,req)iferr!=nil{// TODO: Handle error.}resp,err:=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*ServicesClient) CreateServiceOperation
func(c*ServicesClient)CreateServiceOperation(namestring)*CreateServiceOperationCreateServiceOperation returns a new CreateServiceOperation from a given name.The name must be that of a previously created CreateServiceOperation, possibly from a different process.
func (*ServicesClient) DeleteOperation
func(c*ServicesClient)DeleteOperation(ctxcontext.Context,req*longrunningpb.DeleteOperationRequest,opts...gax.CallOption)errorDeleteOperation is a utility method from google.longrunning.Operations.
Example
packagemainimport("context"longrunningpb"cloud.google.com/go/longrunning/autogen/longrunningpb"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewServicesClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&longrunningpb.DeleteOperationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest.}err=c.DeleteOperation(ctx,req)iferr!=nil{// TODO: Handle error.}}func (*ServicesClient) DeleteService
func(c*ServicesClient)DeleteService(ctxcontext.Context,req*runpb.DeleteServiceRequest,opts...gax.CallOption)(*DeleteServiceOperation,error)DeleteService deletes a Service.This will cause the Service to stop serving traffic and will delete allrevisions.
Example
packagemainimport("context"run"cloud.google.com/go/run/apiv2"runpb"cloud.google.com/go/run/apiv2/runpb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewServicesClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&runpb.DeleteServiceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/run/apiv2/runpb#DeleteServiceRequest.}op,err:=c.DeleteService(ctx,req)iferr!=nil{// TODO: Handle error.}resp,err:=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*ServicesClient) DeleteServiceOperation
func(c*ServicesClient)DeleteServiceOperation(namestring)*DeleteServiceOperationDeleteServiceOperation returns a new DeleteServiceOperation from a given name.The name must be that of a previously created DeleteServiceOperation, possibly from a different process.
func (*ServicesClient) GetIamPolicy
func(c*ServicesClient)GetIamPolicy(ctxcontext.Context,req*iampb.GetIamPolicyRequest,opts...gax.CallOption)(*iampb.Policy,error)GetIamPolicy gets the IAM Access Control policy currently in effect for the givenCloud Run Service. This result does not include any inherited policies.
Example
packagemainimport("context"iampb"cloud.google.com/go/iam/apiv1/iampb"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewServicesClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&iampb.GetIamPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#GetIamPolicyRequest.}resp,err:=c.GetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*ServicesClient) GetOperation
func(c*ServicesClient)GetOperation(ctxcontext.Context,req*longrunningpb.GetOperationRequest,opts...gax.CallOption)(*longrunningpb.Operation,error)GetOperation is a utility method from google.longrunning.Operations.
Example
packagemainimport("context"longrunningpb"cloud.google.com/go/longrunning/autogen/longrunningpb"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewServicesClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&longrunningpb.GetOperationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.}resp,err:=c.GetOperation(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*ServicesClient) GetService
func(c*ServicesClient)GetService(ctxcontext.Context,req*runpb.GetServiceRequest,opts...gax.CallOption)(*runpb.Service,error)GetService gets information about a Service.
Example
packagemainimport("context"run"cloud.google.com/go/run/apiv2"runpb"cloud.google.com/go/run/apiv2/runpb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewServicesClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&runpb.GetServiceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/run/apiv2/runpb#GetServiceRequest.}resp,err:=c.GetService(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*ServicesClient) ListOperations
func(c*ServicesClient)ListOperations(ctxcontext.Context,req*longrunningpb.ListOperationsRequest,opts...gax.CallOption)*OperationIteratorListOperations is a utility method from google.longrunning.Operations.
Examples
packagemainimport("context"longrunningpb"cloud.google.com/go/longrunning/autogen/longrunningpb"run"cloud.google.com/go/run/apiv2""google.golang.org/api/iterator")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewServicesClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&longrunningpb.ListOperationsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.}it:=c.ListOperations(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp// If you need to access the underlying RPC response,// you can do so by casting the `Response` as below.// Otherwise, remove this line. Only populated after// first call to Next(). Not safe for concurrent access._=it.Response.(*longrunningpb.ListOperationsResponse)}}all
packagemainimport("context"longrunningpb"cloud.google.com/go/longrunning/autogen/longrunningpb"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewServicesClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&longrunningpb.ListOperationsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.}forresp,err:=rangec.ListOperations(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*ServicesClient) ListServices
func(c*ServicesClient)ListServices(ctxcontext.Context,req*runpb.ListServicesRequest,opts...gax.CallOption)*ServiceIteratorListServices lists Services. Results are sorted by creation time, descending.
Examples
packagemainimport("context"run"cloud.google.com/go/run/apiv2"runpb"cloud.google.com/go/run/apiv2/runpb""google.golang.org/api/iterator")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewServicesClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&runpb.ListServicesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/run/apiv2/runpb#ListServicesRequest.}it:=c.ListServices(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp// If you need to access the underlying RPC response,// you can do so by casting the `Response` as below.// Otherwise, remove this line. Only populated after// first call to Next(). Not safe for concurrent access._=it.Response.(*runpb.ListServicesResponse)}}all
packagemainimport("context"run"cloud.google.com/go/run/apiv2"runpb"cloud.google.com/go/run/apiv2/runpb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewServicesClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&runpb.ListServicesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/run/apiv2/runpb#ListServicesRequest.}forresp,err:=rangec.ListServices(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*ServicesClient) SetIamPolicy
func(c*ServicesClient)SetIamPolicy(ctxcontext.Context,req*iampb.SetIamPolicyRequest,opts...gax.CallOption)(*iampb.Policy,error)SetIamPolicy sets the IAM Access control policy for the specified Service. Overwritesany existing policy.
Example
packagemainimport("context"iampb"cloud.google.com/go/iam/apiv1/iampb"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewServicesClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&iampb.SetIamPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#SetIamPolicyRequest.}resp,err:=c.SetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*ServicesClient) TestIamPermissions
func(c*ServicesClient)TestIamPermissions(ctxcontext.Context,req*iampb.TestIamPermissionsRequest,opts...gax.CallOption)(*iampb.TestIamPermissionsResponse,error)TestIamPermissions returns permissions that a caller has on the specified Project.
There are no permissions required for making this API call.
Example
packagemainimport("context"iampb"cloud.google.com/go/iam/apiv1/iampb"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewServicesClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&iampb.TestIamPermissionsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#TestIamPermissionsRequest.}resp,err:=c.TestIamPermissions(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*ServicesClient) UpdateService
func(c*ServicesClient)UpdateService(ctxcontext.Context,req*runpb.UpdateServiceRequest,opts...gax.CallOption)(*UpdateServiceOperation,error)UpdateService updates a Service.
Example
packagemainimport("context"run"cloud.google.com/go/run/apiv2"runpb"cloud.google.com/go/run/apiv2/runpb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewServicesClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&runpb.UpdateServiceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/run/apiv2/runpb#UpdateServiceRequest.}op,err:=c.UpdateService(ctx,req)iferr!=nil{// TODO: Handle error.}resp,err:=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*ServicesClient) UpdateServiceOperation
func(c*ServicesClient)UpdateServiceOperation(namestring)*UpdateServiceOperationUpdateServiceOperation returns a new UpdateServiceOperation from a given name.The name must be that of a previously created UpdateServiceOperation, possibly from a different process.
func (*ServicesClient) WaitOperation
func(c*ServicesClient)WaitOperation(ctxcontext.Context,req*longrunningpb.WaitOperationRequest,opts...gax.CallOption)(*longrunningpb.Operation,error)WaitOperation is a utility method from google.longrunning.Operations.
Example
packagemainimport("context"longrunningpb"cloud.google.com/go/longrunning/autogen/longrunningpb"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewServicesClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&longrunningpb.WaitOperationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#WaitOperationRequest.}resp,err:=c.WaitOperation(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}TaskIterator
typeTaskIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// 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[]*runpb.Task,nextPageTokenstring,errerror)// contains filtered or unexported fields}TaskIterator manages a stream of *runpb.Task.
func (*TaskIterator) All
func(it*TaskIterator)All()iter.Seq2[*runpb.Task,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*TaskIterator) Next
func(it*TaskIterator)Next()(*runpb.Task,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 (*TaskIterator) PageInfo
func(it*TaskIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
TasksCallOptions
typeTasksCallOptionsstruct{GetTask[]gax.CallOptionListTasks[]gax.CallOptionDeleteOperation[]gax.CallOptionGetOperation[]gax.CallOptionListOperations[]gax.CallOptionWaitOperation[]gax.CallOption}TasksCallOptions contains the retry settings for each method of TasksClient.
TasksClient
typeTasksClientstruct{// The call options for this service.CallOptions*TasksCallOptions// contains filtered or unexported fields}TasksClient is a client for interacting with Cloud Run Admin API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Cloud Run Task Control Plane API.
func NewTasksClient
funcNewTasksClient(ctxcontext.Context,opts...option.ClientOption)(*TasksClient,error)NewTasksClient creates a new tasks client based on gRPC.The returned client must be Closed when it is done being used to clean up its underlying connections.
Cloud Run Task Control Plane API.
Example
packagemainimport("context"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewTasksClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func NewTasksRESTClient
funcNewTasksRESTClient(ctxcontext.Context,opts...option.ClientOption)(*TasksClient,error)NewTasksRESTClient creates a new tasks rest client.
Cloud Run Task Control Plane API.
Example
packagemainimport("context"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewTasksRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*TasksClient) Close
func(c*TasksClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*TasksClient) Connection (deprecated)
func(c*TasksClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*TasksClient) DeleteOperation
func(c*TasksClient)DeleteOperation(ctxcontext.Context,req*longrunningpb.DeleteOperationRequest,opts...gax.CallOption)errorDeleteOperation is a utility method from google.longrunning.Operations.
Example
packagemainimport("context"longrunningpb"cloud.google.com/go/longrunning/autogen/longrunningpb"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewTasksClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&longrunningpb.DeleteOperationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest.}err=c.DeleteOperation(ctx,req)iferr!=nil{// TODO: Handle error.}}func (*TasksClient) GetOperation
func(c*TasksClient)GetOperation(ctxcontext.Context,req*longrunningpb.GetOperationRequest,opts...gax.CallOption)(*longrunningpb.Operation,error)GetOperation is a utility method from google.longrunning.Operations.
Example
packagemainimport("context"longrunningpb"cloud.google.com/go/longrunning/autogen/longrunningpb"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewTasksClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&longrunningpb.GetOperationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.}resp,err:=c.GetOperation(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*TasksClient) GetTask
func(c*TasksClient)GetTask(ctxcontext.Context,req*runpb.GetTaskRequest,opts...gax.CallOption)(*runpb.Task,error)GetTask gets information about a Task.
Example
packagemainimport("context"run"cloud.google.com/go/run/apiv2"runpb"cloud.google.com/go/run/apiv2/runpb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewTasksClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&runpb.GetTaskRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/run/apiv2/runpb#GetTaskRequest.}resp,err:=c.GetTask(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*TasksClient) ListOperations
func(c*TasksClient)ListOperations(ctxcontext.Context,req*longrunningpb.ListOperationsRequest,opts...gax.CallOption)*OperationIteratorListOperations is a utility method from google.longrunning.Operations.
Examples
packagemainimport("context"longrunningpb"cloud.google.com/go/longrunning/autogen/longrunningpb"run"cloud.google.com/go/run/apiv2""google.golang.org/api/iterator")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewTasksClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&longrunningpb.ListOperationsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.}it:=c.ListOperations(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp// If you need to access the underlying RPC response,// you can do so by casting the `Response` as below.// Otherwise, remove this line. Only populated after// first call to Next(). Not safe for concurrent access._=it.Response.(*longrunningpb.ListOperationsResponse)}}all
packagemainimport("context"longrunningpb"cloud.google.com/go/longrunning/autogen/longrunningpb"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewTasksClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&longrunningpb.ListOperationsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.}forresp,err:=rangec.ListOperations(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*TasksClient) ListTasks
func(c*TasksClient)ListTasks(ctxcontext.Context,req*runpb.ListTasksRequest,opts...gax.CallOption)*TaskIteratorListTasks lists Tasks from an Execution of a Job.
Examples
packagemainimport("context"run"cloud.google.com/go/run/apiv2"runpb"cloud.google.com/go/run/apiv2/runpb""google.golang.org/api/iterator")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewTasksClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&runpb.ListTasksRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/run/apiv2/runpb#ListTasksRequest.}it:=c.ListTasks(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp// If you need to access the underlying RPC response,// you can do so by casting the `Response` as below.// Otherwise, remove this line. Only populated after// first call to Next(). Not safe for concurrent access._=it.Response.(*runpb.ListTasksResponse)}}all
packagemainimport("context"run"cloud.google.com/go/run/apiv2"runpb"cloud.google.com/go/run/apiv2/runpb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewTasksClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&runpb.ListTasksRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/run/apiv2/runpb#ListTasksRequest.}forresp,err:=rangec.ListTasks(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*TasksClient) WaitOperation
func(c*TasksClient)WaitOperation(ctxcontext.Context,req*longrunningpb.WaitOperationRequest,opts...gax.CallOption)(*longrunningpb.Operation,error)WaitOperation is a utility method from google.longrunning.Operations.
Example
packagemainimport("context"longrunningpb"cloud.google.com/go/longrunning/autogen/longrunningpb"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewTasksClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&longrunningpb.WaitOperationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#WaitOperationRequest.}resp,err:=c.WaitOperation(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}UpdateJobOperation
typeUpdateJobOperationstruct{// contains filtered or unexported fields}UpdateJobOperation manages a long-running operation from UpdateJob.
func (*UpdateJobOperation) Done
func(op*UpdateJobOperation)Done()boolDone reports whether the long-running operation has completed.
func (*UpdateJobOperation) Metadata
func(op*UpdateJobOperation)Metadata()(*runpb.Job,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 (*UpdateJobOperation) Name
func(op*UpdateJobOperation)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 (*UpdateJobOperation) Poll
func(op*UpdateJobOperation)Poll(ctxcontext.Context,opts...gax.CallOption)(*runpb.Job,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 (*UpdateJobOperation) Wait
func(op*UpdateJobOperation)Wait(ctxcontext.Context,opts...gax.CallOption)(*runpb.Job,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.
UpdateServiceOperation
typeUpdateServiceOperationstruct{// contains filtered or unexported fields}UpdateServiceOperation manages a long-running operation from UpdateService.
func (*UpdateServiceOperation) Done
func(op*UpdateServiceOperation)Done()boolDone reports whether the long-running operation has completed.
func (*UpdateServiceOperation) Metadata
func(op*UpdateServiceOperation)Metadata()(*runpb.Service,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 (*UpdateServiceOperation) Name
func(op*UpdateServiceOperation)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 (*UpdateServiceOperation) Poll
func(op*UpdateServiceOperation)Poll(ctxcontext.Context,opts...gax.CallOption)(*runpb.Service,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 (*UpdateServiceOperation) Wait
func(op*UpdateServiceOperation)Wait(ctxcontext.Context,opts...gax.CallOption)(*runpb.Service,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
typeUpdateWorkerPoolOperationstruct{// contains filtered or unexported fields}UpdateWorkerPoolOperation manages a long-running operation from UpdateWorkerPool.
func (*UpdateWorkerPoolOperation) Done
func(op*UpdateWorkerPoolOperation)Done()boolDone reports whether the long-running operation has completed.
func (*UpdateWorkerPoolOperation) Metadata
func(op*UpdateWorkerPoolOperation)Metadata()(*runpb.WorkerPool,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
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
func(op*UpdateWorkerPoolOperation)Poll(ctxcontext.Context,opts...gax.CallOption)(*runpb.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
func(op*UpdateWorkerPoolOperation)Wait(ctxcontext.Context,opts...gax.CallOption)(*runpb.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.
WorkerPoolIterator
typeWorkerPoolIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// 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[]*runpb.WorkerPool,nextPageTokenstring,errerror)// contains filtered or unexported fields}WorkerPoolIterator manages a stream of *runpb.WorkerPool.
func (*WorkerPoolIterator) All
func(it*WorkerPoolIterator)All()iter.Seq2[*runpb.WorkerPool,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*WorkerPoolIterator) Next
func(it*WorkerPoolIterator)Next()(*runpb.WorkerPool,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 (*WorkerPoolIterator) PageInfo
func(it*WorkerPoolIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
WorkerPoolsCallOptions
typeWorkerPoolsCallOptionsstruct{CreateWorkerPool[]gax.CallOptionGetWorkerPool[]gax.CallOptionListWorkerPools[]gax.CallOptionUpdateWorkerPool[]gax.CallOptionDeleteWorkerPool[]gax.CallOptionGetIamPolicy[]gax.CallOptionSetIamPolicy[]gax.CallOptionTestIamPermissions[]gax.CallOptionDeleteOperation[]gax.CallOptionGetOperation[]gax.CallOptionListOperations[]gax.CallOptionWaitOperation[]gax.CallOption}WorkerPoolsCallOptions contains the retry settings for each method of WorkerPoolsClient.
WorkerPoolsClient
typeWorkerPoolsClientstruct{// The call options for this service.CallOptions*WorkerPoolsCallOptions// 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}WorkerPoolsClient is a client for interacting with Cloud Run Admin API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Cloud Run WorkerPool Control Plane API.
func NewWorkerPoolsClient
funcNewWorkerPoolsClient(ctxcontext.Context,opts...option.ClientOption)(*WorkerPoolsClient,error)NewWorkerPoolsClient creates a new worker pools client based on gRPC.The returned client must be Closed when it is done being used to clean up its underlying connections.
Cloud Run WorkerPool Control Plane API.
Example
packagemainimport("context"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewWorkerPoolsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func NewWorkerPoolsRESTClient
funcNewWorkerPoolsRESTClient(ctxcontext.Context,opts...option.ClientOption)(*WorkerPoolsClient,error)NewWorkerPoolsRESTClient creates a new worker pools rest client.
Cloud Run WorkerPool Control Plane API.
Example
packagemainimport("context"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewWorkerPoolsRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*WorkerPoolsClient) Close
func(c*WorkerPoolsClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*WorkerPoolsClient) Connection (deprecated)
func(c*WorkerPoolsClient)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*WorkerPoolsClient) CreateWorkerPool
func(c*WorkerPoolsClient)CreateWorkerPool(ctxcontext.Context,req*runpb.CreateWorkerPoolRequest,opts...gax.CallOption)(*CreateWorkerPoolOperation,error)CreateWorkerPool creates a new WorkerPool in a given project and location.
Example
packagemainimport("context"run"cloud.google.com/go/run/apiv2"runpb"cloud.google.com/go/run/apiv2/runpb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewWorkerPoolsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&runpb.CreateWorkerPoolRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/run/apiv2/runpb#CreateWorkerPoolRequest.}op,err:=c.CreateWorkerPool(ctx,req)iferr!=nil{// TODO: Handle error.}resp,err:=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*WorkerPoolsClient) CreateWorkerPoolOperation
func(c*WorkerPoolsClient)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 (*WorkerPoolsClient) DeleteOperation
func(c*WorkerPoolsClient)DeleteOperation(ctxcontext.Context,req*longrunningpb.DeleteOperationRequest,opts...gax.CallOption)errorDeleteOperation is a utility method from google.longrunning.Operations.
Example
packagemainimport("context"longrunningpb"cloud.google.com/go/longrunning/autogen/longrunningpb"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewWorkerPoolsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&longrunningpb.DeleteOperationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest.}err=c.DeleteOperation(ctx,req)iferr!=nil{// TODO: Handle error.}}func (*WorkerPoolsClient) DeleteWorkerPool
func(c*WorkerPoolsClient)DeleteWorkerPool(ctxcontext.Context,req*runpb.DeleteWorkerPoolRequest,opts...gax.CallOption)(*DeleteWorkerPoolOperation,error)DeleteWorkerPool deletes a WorkerPool.
Example
packagemainimport("context"run"cloud.google.com/go/run/apiv2"runpb"cloud.google.com/go/run/apiv2/runpb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewWorkerPoolsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&runpb.DeleteWorkerPoolRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/run/apiv2/runpb#DeleteWorkerPoolRequest.}op,err:=c.DeleteWorkerPool(ctx,req)iferr!=nil{// TODO: Handle error.}resp,err:=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*WorkerPoolsClient) DeleteWorkerPoolOperation
func(c*WorkerPoolsClient)DeleteWorkerPoolOperation(namestring)*DeleteWorkerPoolOperationDeleteWorkerPoolOperation returns a new DeleteWorkerPoolOperation from a given name.The name must be that of a previously created DeleteWorkerPoolOperation, possibly from a different process.
func (*WorkerPoolsClient) GetIamPolicy
func(c*WorkerPoolsClient)GetIamPolicy(ctxcontext.Context,req*iampb.GetIamPolicyRequest,opts...gax.CallOption)(*iampb.Policy,error)GetIamPolicy gets the IAM Access Control policy currently in effect for the givenCloud Run WorkerPool. This result does not include any inherited policies.
Example
packagemainimport("context"iampb"cloud.google.com/go/iam/apiv1/iampb"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewWorkerPoolsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&iampb.GetIamPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#GetIamPolicyRequest.}resp,err:=c.GetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*WorkerPoolsClient) GetOperation
func(c*WorkerPoolsClient)GetOperation(ctxcontext.Context,req*longrunningpb.GetOperationRequest,opts...gax.CallOption)(*longrunningpb.Operation,error)GetOperation is a utility method from google.longrunning.Operations.
Example
packagemainimport("context"longrunningpb"cloud.google.com/go/longrunning/autogen/longrunningpb"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewWorkerPoolsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&longrunningpb.GetOperationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.}resp,err:=c.GetOperation(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*WorkerPoolsClient) GetWorkerPool
func(c*WorkerPoolsClient)GetWorkerPool(ctxcontext.Context,req*runpb.GetWorkerPoolRequest,opts...gax.CallOption)(*runpb.WorkerPool,error)GetWorkerPool gets information about a WorkerPool.
Example
packagemainimport("context"run"cloud.google.com/go/run/apiv2"runpb"cloud.google.com/go/run/apiv2/runpb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewWorkerPoolsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&runpb.GetWorkerPoolRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/run/apiv2/runpb#GetWorkerPoolRequest.}resp,err:=c.GetWorkerPool(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*WorkerPoolsClient) ListOperations
func(c*WorkerPoolsClient)ListOperations(ctxcontext.Context,req*longrunningpb.ListOperationsRequest,opts...gax.CallOption)*OperationIteratorListOperations is a utility method from google.longrunning.Operations.
Examples
packagemainimport("context"longrunningpb"cloud.google.com/go/longrunning/autogen/longrunningpb"run"cloud.google.com/go/run/apiv2""google.golang.org/api/iterator")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewWorkerPoolsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&longrunningpb.ListOperationsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.}it:=c.ListOperations(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp// If you need to access the underlying RPC response,// you can do so by casting the `Response` as below.// Otherwise, remove this line. Only populated after// first call to Next(). Not safe for concurrent access._=it.Response.(*longrunningpb.ListOperationsResponse)}}all
packagemainimport("context"longrunningpb"cloud.google.com/go/longrunning/autogen/longrunningpb"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewWorkerPoolsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&longrunningpb.ListOperationsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.}forresp,err:=rangec.ListOperations(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*WorkerPoolsClient) ListWorkerPools
func(c*WorkerPoolsClient)ListWorkerPools(ctxcontext.Context,req*runpb.ListWorkerPoolsRequest,opts...gax.CallOption)*WorkerPoolIteratorListWorkerPools lists WorkerPools. Results are sorted by creation time, descending.
Examples
packagemainimport("context"run"cloud.google.com/go/run/apiv2"runpb"cloud.google.com/go/run/apiv2/runpb""google.golang.org/api/iterator")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewWorkerPoolsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&runpb.ListWorkerPoolsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/run/apiv2/runpb#ListWorkerPoolsRequest.}it:=c.ListWorkerPools(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp// If you need to access the underlying RPC response,// you can do so by casting the `Response` as below.// Otherwise, remove this line. Only populated after// first call to Next(). Not safe for concurrent access._=it.Response.(*runpb.ListWorkerPoolsResponse)}}all
packagemainimport("context"run"cloud.google.com/go/run/apiv2"runpb"cloud.google.com/go/run/apiv2/runpb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewWorkerPoolsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&runpb.ListWorkerPoolsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/run/apiv2/runpb#ListWorkerPoolsRequest.}forresp,err:=rangec.ListWorkerPools(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*WorkerPoolsClient) SetIamPolicy
func(c*WorkerPoolsClient)SetIamPolicy(ctxcontext.Context,req*iampb.SetIamPolicyRequest,opts...gax.CallOption)(*iampb.Policy,error)SetIamPolicy sets the IAM Access control policy for the specified WorkerPool. Overwritesany existing policy.
Example
packagemainimport("context"iampb"cloud.google.com/go/iam/apiv1/iampb"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewWorkerPoolsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&iampb.SetIamPolicyRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#SetIamPolicyRequest.}resp,err:=c.SetIamPolicy(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*WorkerPoolsClient) TestIamPermissions
func(c*WorkerPoolsClient)TestIamPermissions(ctxcontext.Context,req*iampb.TestIamPermissionsRequest,opts...gax.CallOption)(*iampb.TestIamPermissionsResponse,error)TestIamPermissions returns permissions that a caller has on the specified Project.
There are no permissions required for making this API call.
Example
packagemainimport("context"iampb"cloud.google.com/go/iam/apiv1/iampb"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewWorkerPoolsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&iampb.TestIamPermissionsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#TestIamPermissionsRequest.}resp,err:=c.TestIamPermissions(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*WorkerPoolsClient) UpdateWorkerPool
func(c*WorkerPoolsClient)UpdateWorkerPool(ctxcontext.Context,req*runpb.UpdateWorkerPoolRequest,opts...gax.CallOption)(*UpdateWorkerPoolOperation,error)UpdateWorkerPool updates a WorkerPool.
Example
packagemainimport("context"run"cloud.google.com/go/run/apiv2"runpb"cloud.google.com/go/run/apiv2/runpb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewWorkerPoolsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&runpb.UpdateWorkerPoolRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/run/apiv2/runpb#UpdateWorkerPoolRequest.}op,err:=c.UpdateWorkerPool(ctx,req)iferr!=nil{// TODO: Handle error.}resp,err:=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*WorkerPoolsClient) UpdateWorkerPoolOperation
func(c*WorkerPoolsClient)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.
func (*WorkerPoolsClient) WaitOperation
func(c*WorkerPoolsClient)WaitOperation(ctxcontext.Context,req*longrunningpb.WaitOperationRequest,opts...gax.CallOption)(*longrunningpb.Operation,error)WaitOperation is a utility method from google.longrunning.Operations.
Example
packagemainimport("context"longrunningpb"cloud.google.com/go/longrunning/autogen/longrunningpb"run"cloud.google.com/go/run/apiv2")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=run.NewWorkerPoolsClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&longrunningpb.WaitOperationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#WaitOperationRequest.}resp,err:=c.WaitOperation(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}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.