Documentation
¶
Overview ¶
Package run is an auto-generated package for the Cloud Run Admin API.
Deploy and manage user provided container images that scale automatically based on incoming requests. The Cloud Run Admin API v1 follows the Knative Serving API specification, while v2 is aligned with Google Cloud AIP-based API standards, as described in https://google.aip.dev/ (at https://google.aip.dev/).
General documentation ¶
For information that is relevant for all client libraries please reference https://pkg.go.dev/cloud.google.com/go#pkg-overview. Some information on this page 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@latest 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_Options c, err := run.NewBuildsClient(ctx) if err != nil { // TODO: Handle error. } defer c.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) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp
Use of Context ¶
The ctx passed to NewBuildsClient is used for authentication requests and for creating the underlying connection, but is not used for subsequent calls. Individual methods on the client use the ctx given to them.
To close the open connection, use the Close() method.
Index ¶
- func DefaultAuthScopes() []string
- type BuildsCallOptions
- type BuildsClient
- func (c *BuildsClient) Close() error
- func (c *BuildsClient) Connection() *grpc.ClientConndeprecated
- func (c *BuildsClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, ...) error
- func (c *BuildsClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, ...) (*longrunningpb.Operation, error)
- func (c *BuildsClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, ...) *OperationIterator
- func (c *BuildsClient) SubmitBuild(ctx context.Context, req *runpb.SubmitBuildRequest, opts ...gax.CallOption) (*runpb.SubmitBuildResponse, error)
- func (c *BuildsClient) WaitOperation(ctx context.Context, req *longrunningpb.WaitOperationRequest, ...) (*longrunningpb.Operation, error)
- type CancelExecutionOperation
- func (op *CancelExecutionOperation) Done() bool
- func (op *CancelExecutionOperation) Metadata() (*runpb.Execution, error)
- func (op *CancelExecutionOperation) Name() string
- func (op *CancelExecutionOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*runpb.Execution, error)
- func (op *CancelExecutionOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*runpb.Execution, error)
- type CreateJobOperation
- func (op *CreateJobOperation) Done() bool
- func (op *CreateJobOperation) Metadata() (*runpb.Job, error)
- func (op *CreateJobOperation) Name() string
- func (op *CreateJobOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*runpb.Job, error)
- func (op *CreateJobOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*runpb.Job, error)
- type CreateServiceOperation
- func (op *CreateServiceOperation) Done() bool
- func (op *CreateServiceOperation) Metadata() (*runpb.Service, error)
- func (op *CreateServiceOperation) Name() string
- func (op *CreateServiceOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*runpb.Service, error)
- func (op *CreateServiceOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*runpb.Service, error)
- type DeleteExecutionOperation
- func (op *DeleteExecutionOperation) Done() bool
- func (op *DeleteExecutionOperation) Metadata() (*runpb.Execution, error)
- func (op *DeleteExecutionOperation) Name() string
- func (op *DeleteExecutionOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*runpb.Execution, error)
- func (op *DeleteExecutionOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*runpb.Execution, error)
- type DeleteJobOperation
- func (op *DeleteJobOperation) Done() bool
- func (op *DeleteJobOperation) Metadata() (*runpb.Job, error)
- func (op *DeleteJobOperation) Name() string
- func (op *DeleteJobOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*runpb.Job, error)
- func (op *DeleteJobOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*runpb.Job, error)
- type DeleteRevisionOperation
- func (op *DeleteRevisionOperation) Done() bool
- func (op *DeleteRevisionOperation) Metadata() (*runpb.Revision, error)
- func (op *DeleteRevisionOperation) Name() string
- func (op *DeleteRevisionOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*runpb.Revision, error)
- func (op *DeleteRevisionOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*runpb.Revision, error)
- type DeleteServiceOperation
- func (op *DeleteServiceOperation) Done() bool
- func (op *DeleteServiceOperation) Metadata() (*runpb.Service, error)
- func (op *DeleteServiceOperation) Name() string
- func (op *DeleteServiceOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*runpb.Service, error)
- func (op *DeleteServiceOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*runpb.Service, error)
- type ExecutionIterator
- type ExecutionsCallOptions
- type ExecutionsClient
- func (c *ExecutionsClient) CancelExecution(ctx context.Context, req *runpb.CancelExecutionRequest, opts ...gax.CallOption) (*CancelExecutionOperation, error)
- func (c *ExecutionsClient) CancelExecutionOperation(name string) *CancelExecutionOperation
- func (c *ExecutionsClient) Close() error
- func (c *ExecutionsClient) Connection() *grpc.ClientConndeprecated
- func (c *ExecutionsClient) DeleteExecution(ctx context.Context, req *runpb.DeleteExecutionRequest, opts ...gax.CallOption) (*DeleteExecutionOperation, error)
- func (c *ExecutionsClient) DeleteExecutionOperation(name string) *DeleteExecutionOperation
- func (c *ExecutionsClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, ...) error
- func (c *ExecutionsClient) GetExecution(ctx context.Context, req *runpb.GetExecutionRequest, opts ...gax.CallOption) (*runpb.Execution, error)
- func (c *ExecutionsClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, ...) (*longrunningpb.Operation, error)
- func (c *ExecutionsClient) ListExecutions(ctx context.Context, req *runpb.ListExecutionsRequest, opts ...gax.CallOption) *ExecutionIterator
- func (c *ExecutionsClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, ...) *OperationIterator
- func (c *ExecutionsClient) WaitOperation(ctx context.Context, req *longrunningpb.WaitOperationRequest, ...) (*longrunningpb.Operation, error)
- type JobIterator
- type JobsCallOptions
- type JobsClient
- func (c *JobsClient) Close() error
- func (c *JobsClient) Connection() *grpc.ClientConndeprecated
- func (c *JobsClient) CreateJob(ctx context.Context, req *runpb.CreateJobRequest, opts ...gax.CallOption) (*CreateJobOperation, error)
- func (c *JobsClient) CreateJobOperation(name string) *CreateJobOperation
- func (c *JobsClient) DeleteJob(ctx context.Context, req *runpb.DeleteJobRequest, opts ...gax.CallOption) (*DeleteJobOperation, error)
- func (c *JobsClient) DeleteJobOperation(name string) *DeleteJobOperation
- func (c *JobsClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, ...) error
- func (c *JobsClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)
- func (c *JobsClient) GetJob(ctx context.Context, req *runpb.GetJobRequest, opts ...gax.CallOption) (*runpb.Job, error)
- func (c *JobsClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, ...) (*longrunningpb.Operation, error)
- func (c *JobsClient) ListJobs(ctx context.Context, req *runpb.ListJobsRequest, opts ...gax.CallOption) *JobIterator
- func (c *JobsClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, ...) *OperationIterator
- func (c *JobsClient) RunJob(ctx context.Context, req *runpb.RunJobRequest, opts ...gax.CallOption) (*RunJobOperation, error)
- func (c *JobsClient) RunJobOperation(name string) *RunJobOperation
- func (c *JobsClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)
- func (c *JobsClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, ...) (*iampb.TestIamPermissionsResponse, error)
- func (c *JobsClient) UpdateJob(ctx context.Context, req *runpb.UpdateJobRequest, opts ...gax.CallOption) (*UpdateJobOperation, error)
- func (c *JobsClient) UpdateJobOperation(name string) *UpdateJobOperation
- func (c *JobsClient) WaitOperation(ctx context.Context, req *longrunningpb.WaitOperationRequest, ...) (*longrunningpb.Operation, error)
- type LocationIterator
- type LocationsCallOptions
- type LocationsClient
- func (c *LocationsClient) Close() error
- func (c *LocationsClient) Connection() *grpc.ClientConndeprecated
- func (c *LocationsClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, ...) error
- func (c *LocationsClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, ...) (*locationpb.Location, error)
- func (c *LocationsClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, ...) (*longrunningpb.Operation, error)
- func (c *LocationsClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, ...) *LocationIterator
- func (c *LocationsClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, ...) *OperationIterator
- func (c *LocationsClient) WaitOperation(ctx context.Context, req *longrunningpb.WaitOperationRequest, ...) (*longrunningpb.Operation, error)
- type OperationIterator
- type RevisionIterator
- type RevisionsCallOptions
- type RevisionsClient
- func (c *RevisionsClient) Close() error
- func (c *RevisionsClient) Connection() *grpc.ClientConndeprecated
- func (c *RevisionsClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, ...) error
- func (c *RevisionsClient) DeleteRevision(ctx context.Context, req *runpb.DeleteRevisionRequest, opts ...gax.CallOption) (*DeleteRevisionOperation, error)
- func (c *RevisionsClient) DeleteRevisionOperation(name string) *DeleteRevisionOperation
- func (c *RevisionsClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, ...) (*longrunningpb.Operation, error)
- func (c *RevisionsClient) GetRevision(ctx context.Context, req *runpb.GetRevisionRequest, opts ...gax.CallOption) (*runpb.Revision, error)
- func (c *RevisionsClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, ...) *OperationIterator
- func (c *RevisionsClient) ListRevisions(ctx context.Context, req *runpb.ListRevisionsRequest, opts ...gax.CallOption) *RevisionIterator
- func (c *RevisionsClient) WaitOperation(ctx context.Context, req *longrunningpb.WaitOperationRequest, ...) (*longrunningpb.Operation, error)
- type RunJobOperation
- func (op *RunJobOperation) Done() bool
- func (op *RunJobOperation) Metadata() (*runpb.Execution, error)
- func (op *RunJobOperation) Name() string
- func (op *RunJobOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*runpb.Execution, error)
- func (op *RunJobOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*runpb.Execution, error)
- type ServiceIterator
- type ServicesCallOptions
- type ServicesClient
- func (c *ServicesClient) Close() error
- func (c *ServicesClient) Connection() *grpc.ClientConndeprecated
- func (c *ServicesClient) CreateService(ctx context.Context, req *runpb.CreateServiceRequest, opts ...gax.CallOption) (*CreateServiceOperation, error)
- func (c *ServicesClient) CreateServiceOperation(name string) *CreateServiceOperation
- func (c *ServicesClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, ...) error
- func (c *ServicesClient) DeleteService(ctx context.Context, req *runpb.DeleteServiceRequest, opts ...gax.CallOption) (*DeleteServiceOperation, error)
- func (c *ServicesClient) DeleteServiceOperation(name string) *DeleteServiceOperation
- func (c *ServicesClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)
- func (c *ServicesClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, ...) (*longrunningpb.Operation, error)
- func (c *ServicesClient) GetService(ctx context.Context, req *runpb.GetServiceRequest, opts ...gax.CallOption) (*runpb.Service, error)
- func (c *ServicesClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, ...) *OperationIterator
- func (c *ServicesClient) ListServices(ctx context.Context, req *runpb.ListServicesRequest, opts ...gax.CallOption) *ServiceIterator
- func (c *ServicesClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)
- func (c *ServicesClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, ...) (*iampb.TestIamPermissionsResponse, error)
- func (c *ServicesClient) UpdateService(ctx context.Context, req *runpb.UpdateServiceRequest, opts ...gax.CallOption) (*UpdateServiceOperation, error)
- func (c *ServicesClient) UpdateServiceOperation(name string) *UpdateServiceOperation
- func (c *ServicesClient) WaitOperation(ctx context.Context, req *longrunningpb.WaitOperationRequest, ...) (*longrunningpb.Operation, error)
- type TaskIterator
- type TasksCallOptions
- type TasksClient
- func (c *TasksClient) Close() error
- func (c *TasksClient) Connection() *grpc.ClientConndeprecated
- func (c *TasksClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, ...) error
- func (c *TasksClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, ...) (*longrunningpb.Operation, error)
- func (c *TasksClient) GetTask(ctx context.Context, req *runpb.GetTaskRequest, opts ...gax.CallOption) (*runpb.Task, error)
- func (c *TasksClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, ...) *OperationIterator
- func (c *TasksClient) ListTasks(ctx context.Context, req *runpb.ListTasksRequest, opts ...gax.CallOption) *TaskIterator
- func (c *TasksClient) WaitOperation(ctx context.Context, req *longrunningpb.WaitOperationRequest, ...) (*longrunningpb.Operation, error)
- type UpdateJobOperation
- func (op *UpdateJobOperation) Done() bool
- func (op *UpdateJobOperation) Metadata() (*runpb.Job, error)
- func (op *UpdateJobOperation) Name() string
- func (op *UpdateJobOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*runpb.Job, error)
- func (op *UpdateJobOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*runpb.Job, error)
- type UpdateServiceOperation
- func (op *UpdateServiceOperation) Done() bool
- func (op *UpdateServiceOperation) Metadata() (*runpb.Service, error)
- func (op *UpdateServiceOperation) Name() string
- func (op *UpdateServiceOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*runpb.Service, error)
- func (op *UpdateServiceOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*runpb.Service, error)
Examples ¶
- BuildsClient.DeleteOperation
- BuildsClient.GetOperation
- BuildsClient.ListOperations
- BuildsClient.ListOperations (All)
- BuildsClient.SubmitBuild
- BuildsClient.WaitOperation
- ExecutionsClient.CancelExecution
- ExecutionsClient.DeleteExecution
- ExecutionsClient.DeleteOperation
- ExecutionsClient.GetExecution
- ExecutionsClient.GetOperation
- ExecutionsClient.ListExecutions
- ExecutionsClient.ListExecutions (All)
- ExecutionsClient.ListOperations
- ExecutionsClient.ListOperations (All)
- ExecutionsClient.WaitOperation
- JobsClient.CreateJob
- JobsClient.DeleteJob
- JobsClient.DeleteOperation
- JobsClient.GetIamPolicy
- JobsClient.GetJob
- JobsClient.GetOperation
- JobsClient.ListJobs
- JobsClient.ListJobs (All)
- JobsClient.ListOperations
- JobsClient.ListOperations (All)
- JobsClient.RunJob
- JobsClient.SetIamPolicy
- JobsClient.TestIamPermissions
- JobsClient.UpdateJob
- JobsClient.WaitOperation
- NewBuildsClient
- NewBuildsRESTClient
- NewExecutionsClient
- NewExecutionsRESTClient
- NewJobsClient
- NewJobsRESTClient
- NewRevisionsClient
- NewRevisionsRESTClient
- NewServicesClient
- NewServicesRESTClient
- NewTasksClient
- NewTasksRESTClient
- RevisionsClient.DeleteOperation
- RevisionsClient.DeleteRevision
- RevisionsClient.GetOperation
- RevisionsClient.GetRevision
- RevisionsClient.ListOperations
- RevisionsClient.ListOperations (All)
- RevisionsClient.ListRevisions
- RevisionsClient.ListRevisions (All)
- RevisionsClient.WaitOperation
- ServicesClient.CreateService
- ServicesClient.DeleteOperation
- ServicesClient.DeleteService
- ServicesClient.GetIamPolicy
- ServicesClient.GetOperation
- ServicesClient.GetService
- ServicesClient.ListOperations
- ServicesClient.ListOperations (All)
- ServicesClient.ListServices
- ServicesClient.ListServices (All)
- ServicesClient.SetIamPolicy
- ServicesClient.TestIamPermissions
- ServicesClient.UpdateService
- ServicesClient.WaitOperation
- TasksClient.DeleteOperation
- TasksClient.GetOperation
- TasksClient.GetTask
- TasksClient.ListOperations
- TasksClient.ListOperations (All)
- TasksClient.ListTasks
- TasksClient.ListTasks (All)
- TasksClient.WaitOperation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultAuthScopes ¶
func DefaultAuthScopes() []string
DefaultAuthScopes reports the default set of authentication scopes to use with this package.
Types ¶
type BuildsCallOptions ¶ added in v1.6.0
type BuildsCallOptions struct { SubmitBuild []gax.CallOption DeleteOperation []gax.CallOption GetOperation []gax.CallOption ListOperations []gax.CallOption WaitOperation []gax.CallOption }
BuildsCallOptions contains the retry settings for each method of BuildsClient.
type BuildsClient ¶ added in v1.6.0
type BuildsClient struct { // 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 ¶ added in v1.6.0
func NewBuildsClient(ctx context.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 ¶
package main import ( "context" run "cloud.google.com/go/run/apiv2" ) func main() { 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_Options c, err := run.NewBuildsClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
Output:
func NewBuildsRESTClient ¶ added in v1.6.0
func NewBuildsRESTClient(ctx context.Context, opts ...option.ClientOption) (*BuildsClient, error)
NewBuildsRESTClient creates a new builds rest client.
Cloud Run Build Control Plane API
Example ¶
package main import ( "context" run "cloud.google.com/go/run/apiv2" ) func main() { 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_Options c, err := run.NewBuildsRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
Output:
func (*BuildsClient) Close ¶ added in v1.6.0
func (c *BuildsClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*BuildsClient) Connection
deprecated
added in
v1.6.0
func (c *BuildsClient) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not always return the same resource.
func (*BuildsClient) DeleteOperation ¶ added in v1.6.0
func (c *BuildsClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error
DeleteOperation is a utility method from google.longrunning.Operations.
Example ¶
package main import ( "context" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" run "cloud.google.com/go/run/apiv2" ) func main() { 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_Options c, err := run.NewBuildsClient(ctx) if err != nil { // TODO: Handle error. } defer c.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) if err != nil { // TODO: Handle error. } }
Output:
func (*BuildsClient) GetOperation ¶ added in v1.6.0
func (c *BuildsClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
GetOperation is a utility method from google.longrunning.Operations.
Example ¶
package main import ( "context" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" run "cloud.google.com/go/run/apiv2" ) func main() { 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_Options c, err := run.NewBuildsClient(ctx) if err != nil { // TODO: Handle error. } defer c.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) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*BuildsClient) ListOperations ¶ added in v1.6.0
func (c *BuildsClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Example ¶
package main import ( "context" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" run "cloud.google.com/go/run/apiv2" "google.golang.org/api/iterator" ) func main() { 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_Options c, err := run.NewBuildsClient(ctx) if err != nil { // TODO: Handle error. } defer c.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() if err == iterator.Done { break } if err != 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) } }
Output:
Example (All) ¶
package main import ( "context" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" run "cloud.google.com/go/run/apiv2" ) func main() { 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_Options c, err := run.NewBuildsClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } for resp, err := range c.ListOperations(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } }
Output:
func (*BuildsClient) SubmitBuild ¶ added in v1.6.0
func (c *BuildsClient) SubmitBuild(ctx context.Context, req *runpb.SubmitBuildRequest, opts ...gax.CallOption) (*runpb.SubmitBuildResponse, error)
SubmitBuild submits a build in a given project.
Example ¶
package main import ( "context" run "cloud.google.com/go/run/apiv2" runpb "cloud.google.com/go/run/apiv2/runpb" ) func main() { 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_Options c, err := run.NewBuildsClient(ctx) if err != nil { // TODO: Handle error. } defer c.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) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*BuildsClient) WaitOperation ¶ added in v1.6.0
func (c *BuildsClient) WaitOperation(ctx context.Context, req *longrunningpb.WaitOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
WaitOperation is a utility method from google.longrunning.Operations.
Example ¶
package main import ( "context" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" run "cloud.google.com/go/run/apiv2" ) func main() { 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_Options c, err := run.NewBuildsClient(ctx) if err != nil { // TODO: Handle error. } defer c.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) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
type CancelExecutionOperation ¶ added in v1.3.0
type CancelExecutionOperation struct {
// contains filtered or unexported fields
}
CancelExecutionOperation manages a long-running operation from CancelExecution.
func (*CancelExecutionOperation) Done ¶ added in v1.3.0
func (op *CancelExecutionOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*CancelExecutionOperation) Metadata ¶ added in v1.3.0
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 ¶ added in v1.3.0
func (op *CancelExecutionOperation) Name() string
Name 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 ¶ added in v1.3.0
func (op *CancelExecutionOperation) Poll(ctx context.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 and the 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 ¶ added in v1.3.0
func (op *CancelExecutionOperation) Wait(ctx context.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.
type CreateJobOperation ¶ added in v0.4.0
type CreateJobOperation struct {
// contains filtered or unexported fields
}
CreateJobOperation manages a long-running operation from CreateJob.
func (*CreateJobOperation) Done ¶ added in v0.4.0
func (op *CreateJobOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*CreateJobOperation) Metadata ¶ added in v0.4.0
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 ¶ added in v0.4.0
func (op *CreateJobOperation) Name() string
Name 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 ¶ added in v0.4.0
func (op *CreateJobOperation) Poll(ctx context.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 and the 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 ¶ added in v0.4.0
func (op *CreateJobOperation) Wait(ctx context.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.
type CreateServiceOperation ¶
type CreateServiceOperation struct {
// contains filtered or unexported fields
}
CreateServiceOperation manages a long-running operation from CreateService.
func (*CreateServiceOperation) Done ¶
func (op *CreateServiceOperation) Done() bool
Done 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() string
Name 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(ctx context.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 and the 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(ctx context.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.
type DeleteExecutionOperation ¶ added in v0.4.0
type DeleteExecutionOperation struct {
// contains filtered or unexported fields
}
DeleteExecutionOperation manages a long-running operation from DeleteExecution.
func (*DeleteExecutionOperation) Done ¶ added in v0.4.0
func (op *DeleteExecutionOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*DeleteExecutionOperation) Metadata ¶ added in v0.4.0
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 ¶ added in v0.4.0
func (op *DeleteExecutionOperation) Name() string
Name 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 ¶ added in v0.4.0
func (op *DeleteExecutionOperation) Poll(ctx context.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 and the 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 ¶ added in v0.4.0
func (op *DeleteExecutionOperation) Wait(ctx context.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.
type DeleteJobOperation ¶ added in v0.4.0
type DeleteJobOperation struct {
// contains filtered or unexported fields
}
DeleteJobOperation manages a long-running operation from DeleteJob.
func (*DeleteJobOperation) Done ¶ added in v0.4.0
func (op *DeleteJobOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*DeleteJobOperation) Metadata ¶ added in v0.4.0
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 ¶ added in v0.4.0
func (op *DeleteJobOperation) Name() string
Name 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 ¶ added in v0.4.0
func (op *DeleteJobOperation) Poll(ctx context.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 and the 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 ¶ added in v0.4.0
func (op *DeleteJobOperation) Wait(ctx context.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.
type DeleteRevisionOperation ¶
type DeleteRevisionOperation struct {
// contains filtered or unexported fields
}
DeleteRevisionOperation manages a long-running operation from DeleteRevision.
func (*DeleteRevisionOperation) Done ¶
func (op *DeleteRevisionOperation) Done() bool
Done 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() string
Name 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(ctx context.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 and the 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(ctx context.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.
type DeleteServiceOperation ¶
type DeleteServiceOperation struct {
// contains filtered or unexported fields
}
DeleteServiceOperation manages a long-running operation from DeleteService.
func (*DeleteServiceOperation) Done ¶
func (op *DeleteServiceOperation) Done() bool
Done 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() string
Name 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(ctx context.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 and the 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(ctx context.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.
type ExecutionIterator ¶ added in v0.4.0
type ExecutionIterator struct { // 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. Response interface{} // InternalFetch is for use by the Google Cloud Libraries only. // It is not part of the stable interface of this package. // // InternalFetch returns results from a single call to the underlying RPC. // The number of results is no greater than pageSize. // If there are no more results, nextPageToken is empty and err is nil. InternalFetch func(pageSize int, pageToken string) (results []*runpb.Execution, nextPageToken string, err error) // contains filtered or unexported fields }
ExecutionIterator manages a stream of *runpb.Execution.
func (*ExecutionIterator) All ¶ added in v1.5.1
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*ExecutionIterator) Next ¶ added in v0.4.0
func (it *ExecutionIterator) Next() (*runpb.Execution, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*ExecutionIterator) PageInfo ¶ added in v0.4.0
func (it *ExecutionIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type ExecutionsCallOptions ¶ added in v0.4.0
type ExecutionsCallOptions struct { GetExecution []gax.CallOption ListExecutions []gax.CallOption DeleteExecution []gax.CallOption CancelExecution []gax.CallOption DeleteOperation []gax.CallOption GetOperation []gax.CallOption ListOperations []gax.CallOption WaitOperation []gax.CallOption }
ExecutionsCallOptions contains the retry settings for each method of ExecutionsClient.
type ExecutionsClient ¶ added in v0.4.0
type ExecutionsClient struct { // 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 ¶ added in v0.4.0
func NewExecutionsClient(ctx context.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 ¶
package main import ( "context" run "cloud.google.com/go/run/apiv2" ) func main() { 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_Options c, err := run.NewExecutionsClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
Output:
func NewExecutionsRESTClient ¶ added in v0.5.0
func NewExecutionsRESTClient(ctx context.Context, opts ...option.ClientOption) (*ExecutionsClient, error)
NewExecutionsRESTClient creates a new executions rest client.
Cloud Run Execution Control Plane API.
Example ¶
package main import ( "context" run "cloud.google.com/go/run/apiv2" ) func main() { 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_Options c, err := run.NewExecutionsRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
Output:
func (*ExecutionsClient) CancelExecution ¶ added in v1.3.0
func (c *ExecutionsClient) CancelExecution(ctx context.Context, req *runpb.CancelExecutionRequest, opts ...gax.CallOption) (*CancelExecutionOperation, error)
CancelExecution cancels an Execution.
Example ¶
package main import ( "context" run "cloud.google.com/go/run/apiv2" runpb "cloud.google.com/go/run/apiv2/runpb" ) func main() { 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_Options c, err := run.NewExecutionsClient(ctx) if err != nil { // TODO: Handle error. } defer c.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) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*ExecutionsClient) CancelExecutionOperation ¶ added in v1.3.0
func (c *ExecutionsClient) CancelExecutionOperation(name string) *CancelExecutionOperation
CancelExecutionOperation 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 ¶ added in v0.4.0
func (c *ExecutionsClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*ExecutionsClient) Connection
deprecated
added in
v0.4.0
func (c *ExecutionsClient) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not always return the same resource.
func (*ExecutionsClient) DeleteExecution ¶ added in v0.4.0
func (c *ExecutionsClient) DeleteExecution(ctx context.Context, req *runpb.DeleteExecutionRequest, opts ...gax.CallOption) (*DeleteExecutionOperation, error)
DeleteExecution deletes an Execution.
Example ¶
package main import ( "context" run "cloud.google.com/go/run/apiv2" runpb "cloud.google.com/go/run/apiv2/runpb" ) func main() { 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_Options c, err := run.NewExecutionsClient(ctx) if err != nil { // TODO: Handle error. } defer c.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) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*ExecutionsClient) DeleteExecutionOperation ¶ added in v0.4.0
func (c *ExecutionsClient) DeleteExecutionOperation(name string) *DeleteExecutionOperation
DeleteExecutionOperation 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 ¶ added in v0.4.0
func (c *ExecutionsClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error
DeleteOperation is a utility method from google.longrunning.Operations.
Example ¶
package main import ( "context" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" run "cloud.google.com/go/run/apiv2" ) func main() { 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_Options c, err := run.NewExecutionsClient(ctx) if err != nil { // TODO: Handle error. } defer c.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) if err != nil { // TODO: Handle error. } }
Output:
func (*ExecutionsClient) GetExecution ¶ added in v0.4.0
func (c *ExecutionsClient) GetExecution(ctx context.Context, req *runpb.GetExecutionRequest, opts ...gax.CallOption) (*runpb.Execution, error)
GetExecution gets information about an Execution.
Example ¶
package main import ( "context" run "cloud.google.com/go/run/apiv2" runpb "cloud.google.com/go/run/apiv2/runpb" ) func main() { 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_Options c, err := run.NewExecutionsClient(ctx) if err != nil { // TODO: Handle error. } defer c.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) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*ExecutionsClient) GetOperation ¶ added in v0.4.0
func (c *ExecutionsClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
GetOperation is a utility method from google.longrunning.Operations.
Example ¶
package main import ( "context" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" run "cloud.google.com/go/run/apiv2" ) func main() { 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_Options c, err := run.NewExecutionsClient(ctx) if err != nil { // TODO: Handle error. } defer c.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) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*ExecutionsClient) ListExecutions ¶ added in v0.4.0
func (c *ExecutionsClient) ListExecutions(ctx context.Context, req *runpb.ListExecutionsRequest, opts ...gax.CallOption) *ExecutionIterator
ListExecutions lists Executions from a Job. Results are sorted by creation time, descending.
Example ¶
package main import ( "context" run "cloud.google.com/go/run/apiv2" runpb "cloud.google.com/go/run/apiv2/runpb" "google.golang.org/api/iterator" ) func main() { 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_Options c, err := run.NewExecutionsClient(ctx) if err != nil { // TODO: Handle error. } defer c.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() if err == iterator.Done { break } if err != 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) } }
Output:
Example (All) ¶
package main import ( "context" run "cloud.google.com/go/run/apiv2" runpb "cloud.google.com/go/run/apiv2/runpb" ) func main() { 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_Options c, err := run.NewExecutionsClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &runpb.ListExecutionsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/run/apiv2/runpb#ListExecutionsRequest. } for resp, err := range c.ListExecutions(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } }
Output:
func (*ExecutionsClient) ListOperations ¶ added in v0.4.0
func (c *ExecutionsClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Example ¶
package main import ( "context" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" run "cloud.google.com/go/run/apiv2" "google.golang.org/api/iterator" ) func main() { 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_Options c, err := run.NewExecutionsClient(ctx) if err != nil { // TODO: Handle error. } defer c.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() if err == iterator.Done { break } if err != 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) } }
Output:
Example (All) ¶
package main import ( "context" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" run "cloud.google.com/go/run/apiv2" ) func main() { 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_Options c, err := run.NewExecutionsClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } for resp, err := range c.ListOperations(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } }
Output:
func (*ExecutionsClient) WaitOperation ¶ added in v0.8.0
func (c *ExecutionsClient) WaitOperation(ctx context.Context, req *longrunningpb.WaitOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
WaitOperation is a utility method from google.longrunning.Operations.
Example ¶
package main import ( "context" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" run "cloud.google.com/go/run/apiv2" ) func main() { 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_Options c, err := run.NewExecutionsClient(ctx) if err != nil { // TODO: Handle error. } defer c.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) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
type JobIterator ¶ added in v0.4.0
type JobIterator struct { // 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. Response interface{} // InternalFetch is for use by the Google Cloud Libraries only. // It is not part of the stable interface of this package. // // InternalFetch returns results from a single call to the underlying RPC. // The number of results is no greater than pageSize. // If there are no more results, nextPageToken is empty and err is nil. InternalFetch func(pageSize int, pageToken string) (results []*runpb.Job, nextPageToken string, err error) // contains filtered or unexported fields }
JobIterator manages a stream of *runpb.Job.
func (*JobIterator) All ¶ added in v1.5.1
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*JobIterator) Next ¶ added in v0.4.0
func (it *JobIterator) Next() (*runpb.Job, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*JobIterator) PageInfo ¶ added in v0.4.0
func (it *JobIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type JobsCallOptions ¶ added in v0.4.0
type JobsCallOptions struct { CreateJob []gax.CallOption GetJob []gax.CallOption ListJobs []gax.CallOption UpdateJob []gax.CallOption DeleteJob []gax.CallOption RunJob []gax.CallOption GetIamPolicy []gax.CallOption SetIamPolicy []gax.CallOption TestIamPermissions []gax.CallOption DeleteOperation []gax.CallOption GetOperation []gax.CallOption ListOperations []gax.CallOption WaitOperation []gax.CallOption }
JobsCallOptions contains the retry settings for each method of JobsClient.
type JobsClient ¶ added in v0.4.0
type JobsClient struct { // 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 ¶ added in v0.4.0
func NewJobsClient(ctx context.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 ¶
package main import ( "context" run "cloud.google.com/go/run/apiv2" ) func main() { 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_Options c, err := run.NewJobsClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
Output:
func NewJobsRESTClient ¶ added in v0.5.0
func NewJobsRESTClient(ctx context.Context, opts ...option.ClientOption) (*JobsClient, error)
NewJobsRESTClient creates a new jobs rest client.
Cloud Run Job Control Plane API.
Example ¶
package main import ( "context" run "cloud.google.com/go/run/apiv2" ) func main() { 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_Options c, err := run.NewJobsRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
Output:
func (*JobsClient) Close ¶ added in v0.4.0
func (c *JobsClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*JobsClient) Connection
deprecated
added in
v0.4.0
func (c *JobsClient) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not always return the same resource.
func (*JobsClient) CreateJob ¶ added in v0.4.0
func (c *JobsClient) CreateJob(ctx context.Context, req *runpb.CreateJobRequest, opts ...gax.CallOption) (*CreateJobOperation, error)
CreateJob creates a Job.
Example ¶
package main import ( "context" run "cloud.google.com/go/run/apiv2" runpb "cloud.google.com/go/run/apiv2/runpb" ) func main() { 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_Options c, err := run.NewJobsClient(ctx) if err != nil { // TODO: Handle error. } defer c.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) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*JobsClient) CreateJobOperation ¶ added in v0.4.0
func (c *JobsClient) CreateJobOperation(name string) *CreateJobOperation
CreateJobOperation 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 ¶ added in v0.4.0
func (c *JobsClient) DeleteJob(ctx context.Context, req *runpb.DeleteJobRequest, opts ...gax.CallOption) (*DeleteJobOperation, error)
DeleteJob deletes a Job.
Example ¶
package main import ( "context" run "cloud.google.com/go/run/apiv2" runpb "cloud.google.com/go/run/apiv2/runpb" ) func main() { 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_Options c, err := run.NewJobsClient(ctx) if err != nil { // TODO: Handle error. } defer c.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) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*JobsClient) DeleteJobOperation ¶ added in v0.4.0
func (c *JobsClient) DeleteJobOperation(name string) *DeleteJobOperation
DeleteJobOperation 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 ¶ added in v0.4.0
func (c *JobsClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error
DeleteOperation is a utility method from google.longrunning.Operations.
Example ¶
package main import ( "context" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" run "cloud.google.com/go/run/apiv2" ) func main() { 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_Options c, err := run.NewJobsClient(ctx) if err != nil { // TODO: Handle error. } defer c.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) if err != nil { // TODO: Handle error. } }
Output:
func (*JobsClient) GetIamPolicy ¶ added in v0.4.0
func (c *JobsClient) GetIamPolicy(ctx context.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 ¶
package main import ( "context" iampb "cloud.google.com/go/iam/apiv1/iampb" run "cloud.google.com/go/run/apiv2" ) func main() { 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_Options c, err := run.NewJobsClient(ctx) if err != nil { // TODO: Handle error. } defer c.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) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*JobsClient) GetJob ¶ added in v0.4.0
func (c *JobsClient) GetJob(ctx context.Context, req *runpb.GetJobRequest, opts ...gax.CallOption) (*runpb.Job, error)
GetJob gets information about a Job.
Example ¶
package main import ( "context" run "cloud.google.com/go/run/apiv2" runpb "cloud.google.com/go/run/apiv2/runpb" ) func main() { 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_Options c, err := run.NewJobsClient(ctx) if err != nil { // TODO: Handle error. } defer c.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) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*JobsClient) GetOperation ¶ added in v0.4.0
func (c *JobsClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
GetOperation is a utility method from google.longrunning.Operations.
Example ¶
package main import ( "context" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" run "cloud.google.com/go/run/apiv2" ) func main() { 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_Options c, err := run.NewJobsClient(ctx) if err != nil { // TODO: Handle error. } defer c.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) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*JobsClient) ListJobs ¶ added in v0.4.0
func (c *JobsClient) ListJobs(ctx context.Context, req *runpb.ListJobsRequest, opts ...gax.CallOption) *JobIterator
ListJobs lists Jobs. Results are sorted by creation time, descending.
Example ¶
package main import ( "context" run "cloud.google.com/go/run/apiv2" runpb "cloud.google.com/go/run/apiv2/runpb" "google.golang.org/api/iterator" ) func main() { 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_Options c, err := run.NewJobsClient(ctx) if err != nil { // TODO: Handle error. } defer c.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() if err == iterator.Done { break } if err != 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) } }
Output:
Example (All) ¶
package main import ( "context" run "cloud.google.com/go/run/apiv2" runpb "cloud.google.com/go/run/apiv2/runpb" ) func main() { 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_Options c, err := run.NewJobsClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &runpb.ListJobsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/run/apiv2/runpb#ListJobsRequest. } for resp, err := range c.ListJobs(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } }
Output:
func (*JobsClient) ListOperations ¶ added in v0.4.0
func (c *JobsClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Example ¶
package main import ( "context" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" run "cloud.google.com/go/run/apiv2" "google.golang.org/api/iterator" ) func main() { 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_Options c, err := run.NewJobsClient(ctx) if err != nil { // TODO: Handle error. } defer c.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() if err == iterator.Done { break } if err != 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) } }
Output:
Example (All) ¶
package main import ( "context" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" run "cloud.google.com/go/run/apiv2" ) func main() { 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_Options c, err := run.NewJobsClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } for resp, err := range c.ListOperations(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } }
Output:
func (*JobsClient) RunJob ¶ added in v0.4.0
func (c *JobsClient) RunJob(ctx context.Context, req *runpb.RunJobRequest, opts ...gax.CallOption) (*RunJobOperation, error)
RunJob triggers creation of a new Execution of this Job.
Example ¶
package main import ( "context" run "cloud.google.com/go/run/apiv2" runpb "cloud.google.com/go/run/apiv2/runpb" ) func main() { 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_Options c, err := run.NewJobsClient(ctx) if err != nil { // TODO: Handle error. } defer c.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) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*JobsClient) RunJobOperation ¶ added in v0.4.0
func (c *JobsClient) RunJobOperation(name string) *RunJobOperation
RunJobOperation 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 ¶ added in v0.4.0
func (c *JobsClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)
SetIamPolicy sets the IAM Access control policy for the specified Job. Overwrites any existing policy.
Example ¶
package main import ( "context" iampb "cloud.google.com/go/iam/apiv1/iampb" run "cloud.google.com/go/run/apiv2" ) func main() { 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_Options c, err := run.NewJobsClient(ctx) if err != nil { // TODO: Handle error. } defer c.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) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*JobsClient) TestIamPermissions ¶ added in v0.4.0
func (c *JobsClient) TestIamPermissions(ctx context.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 ¶
package main import ( "context" iampb "cloud.google.com/go/iam/apiv1/iampb" run "cloud.google.com/go/run/apiv2" ) func main() { 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_Options c, err := run.NewJobsClient(ctx) if err != nil { // TODO: Handle error. } defer c.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) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*JobsClient) UpdateJob ¶ added in v0.4.0
func (c *JobsClient) UpdateJob(ctx context.Context, req *runpb.UpdateJobRequest, opts ...gax.CallOption) (*UpdateJobOperation, error)
UpdateJob updates a Job.
Example ¶
package main import ( "context" run "cloud.google.com/go/run/apiv2" runpb "cloud.google.com/go/run/apiv2/runpb" ) func main() { 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_Options c, err := run.NewJobsClient(ctx) if err != nil { // TODO: Handle error. } defer c.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) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*JobsClient) UpdateJobOperation ¶ added in v0.4.0
func (c *JobsClient) UpdateJobOperation(name string) *UpdateJobOperation
UpdateJobOperation 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 ¶ added in v0.8.0
func (c *JobsClient) WaitOperation(ctx context.Context, req *longrunningpb.WaitOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
WaitOperation is a utility method from google.longrunning.Operations.
Example ¶
package main import ( "context" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" run "cloud.google.com/go/run/apiv2" ) func main() { 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_Options c, err := run.NewJobsClient(ctx) if err != nil { // TODO: Handle error. } defer c.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) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
type LocationIterator ¶ added in v0.9.0
type LocationIterator struct { // 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. Response interface{} // InternalFetch is for use by the Google Cloud Libraries only. // It is not part of the stable interface of this package. // // InternalFetch returns results from a single call to the underlying RPC. // The number of results is no greater than pageSize. // If there are no more results, nextPageToken is empty and err is nil. InternalFetch func(pageSize int, pageToken string) (results []*locationpb.Location, nextPageToken string, err error) // contains filtered or unexported fields }
LocationIterator manages a stream of *locationpb.Location.
func (*LocationIterator) Next ¶ added in v0.9.0
func (it *LocationIterator) Next() (*locationpb.Location, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*LocationIterator) PageInfo ¶ added in v0.9.0
func (it *LocationIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type LocationsCallOptions ¶ added in v0.9.0
type LocationsCallOptions struct { ListLocations []gax.CallOption GetLocation []gax.CallOption DeleteOperation []gax.CallOption GetOperation []gax.CallOption ListOperations []gax.CallOption WaitOperation []gax.CallOption }
LocationsCallOptions contains the retry settings for each method of LocationsClient.
type LocationsClient ¶ added in v0.9.0
type LocationsClient struct { // 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 for a service. Service-specific metadata is provided through the Location.metadata field.
func NewLocationsClient ¶ added in v0.9.0
func NewLocationsClient(ctx context.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 for a service. Service-specific metadata is provided through the Location.metadata field.
func NewLocationsRESTClient ¶ added in v0.9.0
func NewLocationsRESTClient(ctx context.Context, opts ...option.ClientOption) (*LocationsClient, error)
NewLocationsRESTClient creates a new locations rest client.
An abstract interface that provides location-related information for a service. Service-specific metadata is provided through the Location.metadata field.
func (*LocationsClient) Close ¶ added in v0.9.0
func (c *LocationsClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*LocationsClient) Connection
deprecated
added in
v0.9.0
func (c *LocationsClient) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not always return the same resource.
func (*LocationsClient) DeleteOperation ¶ added in v0.9.0
func (c *LocationsClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error
DeleteOperation is a utility method from google.longrunning.Operations.
func (*LocationsClient) GetLocation ¶ added in v0.9.0
func (c *LocationsClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error)
GetLocation gets information about a location.
func (*LocationsClient) GetOperation ¶ added in v0.9.0
func (c *LocationsClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
GetOperation is a utility method from google.longrunning.Operations.
func (*LocationsClient) ListLocations ¶ added in v0.9.0
func (c *LocationsClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator
ListLocations lists information about the supported locations for this service.
func (*LocationsClient) ListOperations ¶ added in v0.9.0
func (c *LocationsClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
func (*LocationsClient) WaitOperation ¶ added in v0.9.0
func (c *LocationsClient) WaitOperation(ctx context.Context, req *longrunningpb.WaitOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
WaitOperation is a utility method from google.longrunning.Operations.
type OperationIterator ¶ added in v0.2.0
type OperationIterator struct { // 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. Response interface{} // InternalFetch is for use by the Google Cloud Libraries only. // It is not part of the stable interface of this package. // // InternalFetch returns results from a single call to the underlying RPC. // The number of results is no greater than pageSize. // If there are no more results, nextPageToken is empty and err is nil. InternalFetch func(pageSize int, pageToken string) (results []*longrunningpb.Operation, nextPageToken string, err error) // contains filtered or unexported fields }
OperationIterator manages a stream of *longrunningpb.Operation.
func (*OperationIterator) All ¶ added in v1.5.1
func (it *OperationIterator) All() iter.Seq2[*longrunningpb.Operation, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*OperationIterator) Next ¶ added in v0.2.0
func (it *OperationIterator) Next() (*longrunningpb.Operation, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*OperationIterator) PageInfo ¶ added in v0.2.0
func (it *OperationIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type RevisionIterator ¶
type RevisionIterator struct { // 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. Response interface{} // InternalFetch is for use by the Google Cloud Libraries only. // It is not part of the stable interface of this package. // // InternalFetch returns results from a single call to the underlying RPC. // The number of results is no greater than pageSize. // If there are no more results, nextPageToken is empty and err is nil. InternalFetch func(pageSize int, pageToken string) (results []*runpb.Revision, nextPageToken string, err error) // contains filtered or unexported fields }
RevisionIterator manages a stream of *runpb.Revision.
func (*RevisionIterator) All ¶ added in v1.5.1
All returns an iterator. If an error is returned by the iterator, the iterator 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 more results. Once Next returns Done, all subsequent calls will return Done.
func (*RevisionIterator) PageInfo ¶
func (it *RevisionIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type RevisionsCallOptions ¶
type RevisionsCallOptions struct { GetRevision []gax.CallOption ListRevisions []gax.CallOption DeleteRevision []gax.CallOption DeleteOperation []gax.CallOption GetOperation []gax.CallOption ListOperations []gax.CallOption WaitOperation []gax.CallOption }
RevisionsCallOptions contains the retry settings for each method of RevisionsClient.
type RevisionsClient ¶
type RevisionsClient struct { // 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 ¶
func NewRevisionsClient(ctx context.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 ¶
package main import ( "context" run "cloud.google.com/go/run/apiv2" ) func main() { 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_Options c, err := run.NewRevisionsClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
Output:
func NewRevisionsRESTClient ¶ added in v0.5.0
func NewRevisionsRESTClient(ctx context.Context, opts ...option.ClientOption) (*RevisionsClient, error)
NewRevisionsRESTClient creates a new revisions rest client.
Cloud Run Revision Control Plane API.
Example ¶
package main import ( "context" run "cloud.google.com/go/run/apiv2" ) func main() { 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_Options c, err := run.NewRevisionsRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
Output:
func (*RevisionsClient) Close ¶
func (c *RevisionsClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*RevisionsClient) Connection
deprecated
func (c *RevisionsClient) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not always return the same resource.
func (*RevisionsClient) DeleteOperation ¶ added in v0.2.0
func (c *RevisionsClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error
DeleteOperation is a utility method from google.longrunning.Operations.
Example ¶
package main import ( "context" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" run "cloud.google.com/go/run/apiv2" ) func main() { 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_Options c, err := run.NewRevisionsClient(ctx) if err != nil { // TODO: Handle error. } defer c.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) if err != nil { // TODO: Handle error. } }
Output:
func (*RevisionsClient) DeleteRevision ¶
func (c *RevisionsClient) DeleteRevision(ctx context.Context, req *runpb.DeleteRevisionRequest, opts ...gax.CallOption) (*DeleteRevisionOperation, error)
DeleteRevision deletes a Revision.
Example ¶
package main import ( "context" run "cloud.google.com/go/run/apiv2" runpb "cloud.google.com/go/run/apiv2/runpb" ) func main() { 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_Options c, err := run.NewRevisionsClient(ctx) if err != nil { // TODO: Handle error. } defer c.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) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*RevisionsClient) DeleteRevisionOperation ¶
func (c *RevisionsClient) DeleteRevisionOperation(name string) *DeleteRevisionOperation
DeleteRevisionOperation 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 ¶ added in v0.2.0
func (c *RevisionsClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
GetOperation is a utility method from google.longrunning.Operations.
Example ¶
package main import ( "context" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" run "cloud.google.com/go/run/apiv2" ) func main() { 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_Options c, err := run.NewRevisionsClient(ctx) if err != nil { // TODO: Handle error. } defer c.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) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*RevisionsClient) GetRevision ¶
func (c *RevisionsClient) GetRevision(ctx context.Context, req *runpb.GetRevisionRequest, opts ...gax.CallOption) (*runpb.Revision, error)
GetRevision gets information about a Revision.
Example ¶
package main import ( "context" run "cloud.google.com/go/run/apiv2" runpb "cloud.google.com/go/run/apiv2/runpb" ) func main() { 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_Options c, err := run.NewRevisionsClient(ctx) if err != nil { // TODO: Handle error. } defer c.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) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*RevisionsClient) ListOperations ¶ added in v0.2.0
func (c *RevisionsClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Example ¶
package main import ( "context" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" run "cloud.google.com/go/run/apiv2" "google.golang.org/api/iterator" ) func main() { 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_Options c, err := run.NewRevisionsClient(ctx) if err != nil { // TODO: Handle error. } defer c.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() if err == iterator.Done { break } if err != 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) } }
Output:
Example (All) ¶
package main import ( "context" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" run "cloud.google.com/go/run/apiv2" ) func main() { 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_Options c, err := run.NewRevisionsClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } for resp, err := range c.ListOperations(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } }
Output:
func (*RevisionsClient) ListRevisions ¶
func (c *RevisionsClient) ListRevisions(ctx context.Context, req *runpb.ListRevisionsRequest, opts ...gax.CallOption) *RevisionIterator
ListRevisions lists Revisions from a given Service, or from a given location. Results are sorted by creation time, descending.
Example ¶
package main import ( "context" run "cloud.google.com/go/run/apiv2" runpb "cloud.google.com/go/run/apiv2/runpb" "google.golang.org/api/iterator" ) func main() { 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_Options c, err := run.NewRevisionsClient(ctx) if err != nil { // TODO: Handle error. } defer c.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() if err == iterator.Done { break } if err != 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) } }
Output:
Example (All) ¶
package main import ( "context" run "cloud.google.com/go/run/apiv2" runpb "cloud.google.com/go/run/apiv2/runpb" ) func main() { 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_Options c, err := run.NewRevisionsClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &runpb.ListRevisionsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/run/apiv2/runpb#ListRevisionsRequest. } for resp, err := range c.ListRevisions(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } }
Output:
func (*RevisionsClient) WaitOperation ¶ added in v0.8.0
func (c *RevisionsClient) WaitOperation(ctx context.Context, req *longrunningpb.WaitOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
WaitOperation is a utility method from google.longrunning.Operations.
Example ¶
package main import ( "context" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" run "cloud.google.com/go/run/apiv2" ) func main() { 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_Options c, err := run.NewRevisionsClient(ctx) if err != nil { // TODO: Handle error. } defer c.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) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
type RunJobOperation ¶ added in v0.4.0
type RunJobOperation struct {
// contains filtered or unexported fields
}
RunJobOperation manages a long-running operation from RunJob.
func (*RunJobOperation) Done ¶ added in v0.4.0
func (op *RunJobOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*RunJobOperation) Metadata ¶ added in v0.4.0
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 ¶ added in v0.4.0
func (op *RunJobOperation) Name() string
Name 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 ¶ added in v0.4.0
func (op *RunJobOperation) Poll(ctx context.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 and the 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 ¶ added in v0.4.0
func (op *RunJobOperation) Wait(ctx context.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.
type ServiceIterator ¶
type ServiceIterator struct { // 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. Response interface{} // InternalFetch is for use by the Google Cloud Libraries only. // It is not part of the stable interface of this package. // // InternalFetch returns results from a single call to the underlying RPC. // The number of results is no greater than pageSize. // If there are no more results, nextPageToken is empty and err is nil. InternalFetch func(pageSize int, pageToken string) (results []*runpb.Service, nextPageToken string, err error) // contains filtered or unexported fields }
ServiceIterator manages a stream of *runpb.Service.
func (*ServiceIterator) All ¶ added in v1.5.1
All returns an iterator. If an error is returned by the iterator, the iterator 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 more results. Once Next returns Done, all subsequent calls will return Done.
func (*ServiceIterator) PageInfo ¶
func (it *ServiceIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type ServicesCallOptions ¶
type ServicesCallOptions struct { CreateService []gax.CallOption GetService []gax.CallOption ListServices []gax.CallOption UpdateService []gax.CallOption DeleteService []gax.CallOption GetIamPolicy []gax.CallOption SetIamPolicy []gax.CallOption TestIamPermissions []gax.CallOption DeleteOperation []gax.CallOption GetOperation []gax.CallOption ListOperations []gax.CallOption WaitOperation []gax.CallOption }
ServicesCallOptions contains the retry settings for each method of ServicesClient.
type ServicesClient ¶
type ServicesClient struct { // 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 ¶
func NewServicesClient(ctx context.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 ¶
package main import ( "context" run "cloud.google.com/go/run/apiv2" ) func main() { 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_Options c, err := run.NewServicesClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
Output:
func NewServicesRESTClient ¶ added in v0.5.0
func NewServicesRESTClient(ctx context.Context, opts ...option.ClientOption) (*ServicesClient, error)
NewServicesRESTClient creates a new services rest client.
Cloud Run Service Control Plane API
Example ¶
package main import ( "context" run "cloud.google.com/go/run/apiv2" ) func main() { 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_Options c, err := run.NewServicesRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
Output:
func (*ServicesClient) Close ¶
func (c *ServicesClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*ServicesClient) Connection
deprecated
func (c *ServicesClient) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not always return the same resource.
func (*ServicesClient) CreateService ¶
func (c *ServicesClient) CreateService(ctx context.Context, req *runpb.CreateServiceRequest, opts ...gax.CallOption) (*CreateServiceOperation, error)
CreateService creates a new Service in a given project and location.
Example ¶
package main import ( "context" run "cloud.google.com/go/run/apiv2" runpb "cloud.google.com/go/run/apiv2/runpb" ) func main() { 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_Options c, err := run.NewServicesClient(ctx) if err != nil { // TODO: Handle error. } defer c.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) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*ServicesClient) CreateServiceOperation ¶
func (c *ServicesClient) CreateServiceOperation(name string) *CreateServiceOperation
CreateServiceOperation 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 ¶ added in v0.2.0
func (c *ServicesClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error
DeleteOperation is a utility method from google.longrunning.Operations.
Example ¶
package main import ( "context" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" run "cloud.google.com/go/run/apiv2" ) func main() { 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_Options c, err := run.NewServicesClient(ctx) if err != nil { // TODO: Handle error. } defer c.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) if err != nil { // TODO: Handle error. } }
Output:
func (*ServicesClient) DeleteService ¶
func (c *ServicesClient) DeleteService(ctx context.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 all revisions.
Example ¶
package main import ( "context" run "cloud.google.com/go/run/apiv2" runpb "cloud.google.com/go/run/apiv2/runpb" ) func main() { 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_Options c, err := run.NewServicesClient(ctx) if err != nil { // TODO: Handle error. } defer c.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) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*ServicesClient) DeleteServiceOperation ¶
func (c *ServicesClient) DeleteServiceOperation(name string) *DeleteServiceOperation
DeleteServiceOperation 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(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)
GetIamPolicy gets the IAM Access Control policy currently in effect for the given Cloud Run Service. This result does not include any inherited policies.
Example ¶
package main import ( "context" iampb "cloud.google.com/go/iam/apiv1/iampb" run "cloud.google.com/go/run/apiv2" ) func main() { 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_Options c, err := run.NewServicesClient(ctx) if err != nil { // TODO: Handle error. } defer c.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) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*ServicesClient) GetOperation ¶ added in v0.2.0
func (c *ServicesClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
GetOperation is a utility method from google.longrunning.Operations.
Example ¶
package main import ( "context" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" run "cloud.google.com/go/run/apiv2" ) func main() { 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_Options c, err := run.NewServicesClient(ctx) if err != nil { // TODO: Handle error. } defer c.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) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*ServicesClient) GetService ¶
func (c *ServicesClient) GetService(ctx context.Context, req *runpb.GetServiceRequest, opts ...gax.CallOption) (*runpb.Service, error)
GetService gets information about a Service.
Example ¶
package main import ( "context" run "cloud.google.com/go/run/apiv2" runpb "cloud.google.com/go/run/apiv2/runpb" ) func main() { 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_Options c, err := run.NewServicesClient(ctx) if err != nil { // TODO: Handle error. } defer c.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) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*ServicesClient) ListOperations ¶ added in v0.2.0
func (c *ServicesClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Example ¶
package main import ( "context" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" run "cloud.google.com/go/run/apiv2" "google.golang.org/api/iterator" ) func main() { 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_Options c, err := run.NewServicesClient(ctx) if err != nil { // TODO: Handle error. } defer c.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() if err == iterator.Done { break } if err != 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) } }
Output:
Example (All) ¶
package main import ( "context" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" run "cloud.google.com/go/run/apiv2" ) func main() { 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_Options c, err := run.NewServicesClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } for resp, err := range c.ListOperations(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } }
Output:
func (*ServicesClient) ListServices ¶
func (c *ServicesClient) ListServices(ctx context.Context, req *runpb.ListServicesRequest, opts ...gax.CallOption) *ServiceIterator
ListServices lists Services. Results are sorted by creation time, descending.
Example ¶
package main import ( "context" run "cloud.google.com/go/run/apiv2" runpb "cloud.google.com/go/run/apiv2/runpb" "google.golang.org/api/iterator" ) func main() { 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_Options c, err := run.NewServicesClient(ctx) if err != nil { // TODO: Handle error. } defer c.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() if err == iterator.Done { break } if err != 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) } }
Output:
Example (All) ¶
package main import ( "context" run "cloud.google.com/go/run/apiv2" runpb "cloud.google.com/go/run/apiv2/runpb" ) func main() { 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_Options c, err := run.NewServicesClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &runpb.ListServicesRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/run/apiv2/runpb#ListServicesRequest. } for resp, err := range c.ListServices(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } }
Output:
func (*ServicesClient) SetIamPolicy ¶
func (c *ServicesClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)
SetIamPolicy sets the IAM Access control policy for the specified Service. Overwrites any existing policy.
Example ¶
package main import ( "context" iampb "cloud.google.com/go/iam/apiv1/iampb" run "cloud.google.com/go/run/apiv2" ) func main() { 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_Options c, err := run.NewServicesClient(ctx) if err != nil { // TODO: Handle error. } defer c.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) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*ServicesClient) TestIamPermissions ¶
func (c *ServicesClient) TestIamPermissions(ctx context.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 ¶
package main import ( "context" iampb "cloud.google.com/go/iam/apiv1/iampb" run "cloud.google.com/go/run/apiv2" ) func main() { 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_Options c, err := run.NewServicesClient(ctx) if err != nil { // TODO: Handle error. } defer c.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) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*ServicesClient) UpdateService ¶
func (c *ServicesClient) UpdateService(ctx context.Context, req *runpb.UpdateServiceRequest, opts ...gax.CallOption) (*UpdateServiceOperation, error)
UpdateService updates a Service.
Example ¶
package main import ( "context" run "cloud.google.com/go/run/apiv2" runpb "cloud.google.com/go/run/apiv2/runpb" ) func main() { 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_Options c, err := run.NewServicesClient(ctx) if err != nil { // TODO: Handle error. } defer c.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) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*ServicesClient) UpdateServiceOperation ¶
func (c *ServicesClient) UpdateServiceOperation(name string) *UpdateServiceOperation
UpdateServiceOperation 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 ¶ added in v0.8.0
func (c *ServicesClient) WaitOperation(ctx context.Context, req *longrunningpb.WaitOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
WaitOperation is a utility method from google.longrunning.Operations.
Example ¶
package main import ( "context" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" run "cloud.google.com/go/run/apiv2" ) func main() { 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_Options c, err := run.NewServicesClient(ctx) if err != nil { // TODO: Handle error. } defer c.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) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
type TaskIterator ¶ added in v0.4.0
type TaskIterator struct { // 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. Response interface{} // InternalFetch is for use by the Google Cloud Libraries only. // It is not part of the stable interface of this package. // // InternalFetch returns results from a single call to the underlying RPC. // The number of results is no greater than pageSize. // If there are no more results, nextPageToken is empty and err is nil. InternalFetch func(pageSize int, pageToken string) (results []*runpb.Task, nextPageToken string, err error) // contains filtered or unexported fields }
TaskIterator manages a stream of *runpb.Task.
func (*TaskIterator) All ¶ added in v1.5.1
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*TaskIterator) Next ¶ added in v0.4.0
func (it *TaskIterator) Next() (*runpb.Task, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*TaskIterator) PageInfo ¶ added in v0.4.0
func (it *TaskIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type TasksCallOptions ¶ added in v0.4.0
type TasksCallOptions struct { GetTask []gax.CallOption ListTasks []gax.CallOption DeleteOperation []gax.CallOption GetOperation []gax.CallOption ListOperations []gax.CallOption WaitOperation []gax.CallOption }
TasksCallOptions contains the retry settings for each method of TasksClient.
type TasksClient ¶ added in v0.4.0
type TasksClient struct { // 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 ¶ added in v0.4.0
func NewTasksClient(ctx context.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 ¶
package main import ( "context" run "cloud.google.com/go/run/apiv2" ) func main() { 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_Options c, err := run.NewTasksClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
Output:
func NewTasksRESTClient ¶ added in v0.5.0
func NewTasksRESTClient(ctx context.Context, opts ...option.ClientOption) (*TasksClient, error)
NewTasksRESTClient creates a new tasks rest client.
Cloud Run Task Control Plane API.
Example ¶
package main import ( "context" run "cloud.google.com/go/run/apiv2" ) func main() { 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_Options c, err := run.NewTasksRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
Output:
func (*TasksClient) Close ¶ added in v0.4.0
func (c *TasksClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*TasksClient) Connection
deprecated
added in
v0.4.0
func (c *TasksClient) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not always return the same resource.
func (*TasksClient) DeleteOperation ¶ added in v0.4.0
func (c *TasksClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error
DeleteOperation is a utility method from google.longrunning.Operations.
Example ¶
package main import ( "context" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" run "cloud.google.com/go/run/apiv2" ) func main() { 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_Options c, err := run.NewTasksClient(ctx) if err != nil { // TODO: Handle error. } defer c.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) if err != nil { // TODO: Handle error. } }
Output:
func (*TasksClient) GetOperation ¶ added in v0.4.0
func (c *TasksClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
GetOperation is a utility method from google.longrunning.Operations.
Example ¶
package main import ( "context" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" run "cloud.google.com/go/run/apiv2" ) func main() { 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_Options c, err := run.NewTasksClient(ctx) if err != nil { // TODO: Handle error. } defer c.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) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*TasksClient) GetTask ¶ added in v0.4.0
func (c *TasksClient) GetTask(ctx context.Context, req *runpb.GetTaskRequest, opts ...gax.CallOption) (*runpb.Task, error)
GetTask gets information about a Task.
Example ¶
package main import ( "context" run "cloud.google.com/go/run/apiv2" runpb "cloud.google.com/go/run/apiv2/runpb" ) func main() { 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_Options c, err := run.NewTasksClient(ctx) if err != nil { // TODO: Handle error. } defer c.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) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*TasksClient) ListOperations ¶ added in v0.4.0
func (c *TasksClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Example ¶
package main import ( "context" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" run "cloud.google.com/go/run/apiv2" "google.golang.org/api/iterator" ) func main() { 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_Options c, err := run.NewTasksClient(ctx) if err != nil { // TODO: Handle error. } defer c.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() if err == iterator.Done { break } if err != 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) } }
Output:
Example (All) ¶
package main import ( "context" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" run "cloud.google.com/go/run/apiv2" ) func main() { 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_Options c, err := run.NewTasksClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } for resp, err := range c.ListOperations(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } }
Output:
func (*TasksClient) ListTasks ¶ added in v0.4.0
func (c *TasksClient) ListTasks(ctx context.Context, req *runpb.ListTasksRequest, opts ...gax.CallOption) *TaskIterator
ListTasks lists Tasks from an Execution of a Job.
Example ¶
package main import ( "context" run "cloud.google.com/go/run/apiv2" runpb "cloud.google.com/go/run/apiv2/runpb" "google.golang.org/api/iterator" ) func main() { 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_Options c, err := run.NewTasksClient(ctx) if err != nil { // TODO: Handle error. } defer c.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() if err == iterator.Done { break } if err != 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) } }
Output:
Example (All) ¶
package main import ( "context" run "cloud.google.com/go/run/apiv2" runpb "cloud.google.com/go/run/apiv2/runpb" ) func main() { 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_Options c, err := run.NewTasksClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &runpb.ListTasksRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/run/apiv2/runpb#ListTasksRequest. } for resp, err := range c.ListTasks(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } }
Output:
func (*TasksClient) WaitOperation ¶ added in v0.8.0
func (c *TasksClient) WaitOperation(ctx context.Context, req *longrunningpb.WaitOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
WaitOperation is a utility method from google.longrunning.Operations.
Example ¶
package main import ( "context" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" run "cloud.google.com/go/run/apiv2" ) func main() { 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_Options c, err := run.NewTasksClient(ctx) if err != nil { // TODO: Handle error. } defer c.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) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
type UpdateJobOperation ¶ added in v0.4.0
type UpdateJobOperation struct {
// contains filtered or unexported fields
}
UpdateJobOperation manages a long-running operation from UpdateJob.
func (*UpdateJobOperation) Done ¶ added in v0.4.0
func (op *UpdateJobOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*UpdateJobOperation) Metadata ¶ added in v0.4.0
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 ¶ added in v0.4.0
func (op *UpdateJobOperation) Name() string
Name 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 ¶ added in v0.4.0
func (op *UpdateJobOperation) Poll(ctx context.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 and the 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 ¶ added in v0.4.0
func (op *UpdateJobOperation) Wait(ctx context.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.
type UpdateServiceOperation ¶
type UpdateServiceOperation struct {
// contains filtered or unexported fields
}
UpdateServiceOperation manages a long-running operation from UpdateService.
func (*UpdateServiceOperation) Done ¶
func (op *UpdateServiceOperation) Done() bool
Done 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() string
Name 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(ctx context.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 and the 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(ctx context.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.