longrunning

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2017 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package longrunning is an auto-generated package for the Google Long Running Operations API.

NOTE: This package is in alpha. It is not stable, and is likely to be subject to changes.

Use the client at cloud.google.com/go/longrunning in preference to this.

Index

Examples

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 OperationIterator

type OperationIterator struct {

	// InternalFetch is for use by the Google Cloud Libraries only.
	// It is not part of the stable interface of this package.
	//
	// InternalFetch returns results from a single call to the underlying RPC.
	// The number of results is no greater than pageSize.
	// If there are no more results, nextPageToken is empty and err is nil.
	InternalFetch func(pageSize int, pageToken string) (results []*longrunningpb.Operation, nextPageToken string, err error)
	// contains filtered or unexported fields
}

OperationIterator manages a stream of *longrunningpb.Operation.

func (*OperationIterator) Next

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

func (it *OperationIterator) PageInfo() *iterator.PageInfo

PageInfo supports pagination. See the google.golang.org/api/iterator package for details.

type OperationsCallOptions

type OperationsCallOptions struct {
	GetOperation    []gax.CallOption
	ListOperations  []gax.CallOption
	CancelOperation []gax.CallOption
	DeleteOperation []gax.CallOption
}

OperationsCallOptions contains the retry settings for each method of OperationsClient.

type OperationsClient

type OperationsClient struct {

	// The call options for this service.
	CallOptions *OperationsCallOptions

	// The metadata to be sent with each request.
	Metadata metadata.MD
	// contains filtered or unexported fields
}

OperationsClient is a client for interacting with Google Long Running Operations API.

func InternalFromConn

func InternalFromConn(conn *grpc.ClientConn) *OperationsClient

InternalFromConn is for use by the google Cloud Libraries only.

InternalFromConn creates OperationsClient from available connection.

func NewOperationsClient

func NewOperationsClient(ctx context.Context, opts ...option.ClientOption) (*OperationsClient, error)

NewOperationsClient creates a new operations client.

Manages long-running operations with an API service.

When an API method normally takes long time to complete, it can be designed to return [Operation][google.longrunning.Operation] to the client, and the client can use this interface to receive the real response asynchronously by polling the operation resource, or pass the operation resource to another API (such as Google Cloud Pub/Sub API) to receive the response. Any API service that returns long-running operations should implement the Operations interface so developers can have a consistent client experience.

Example
ctx := context.Background()
c, err := longrunning.NewOperationsClient(ctx)
if err != nil {
	// TODO: Handle error.
}
// TODO: Use client.
_ = c
Output:

func (*OperationsClient) CancelOperation

CancelOperation starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED. Clients can use [Operations.GetOperation][google.longrunning.Operations.GetOperation] or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an [Operation.error][google.longrunning.Operation.error] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to Code.CANCELLED.

Example
ctx := context.Background()
c, err := longrunning.NewOperationsClient(ctx)
if err != nil {
	// TODO: Handle error.
}

req := &longrunningpb.CancelOperationRequest{
	// TODO: Fill request struct fields.
}
err = c.CancelOperation(ctx, req)
if err != nil {
	// TODO: Handle error.
}
Output:

func (*OperationsClient) Close

func (c *OperationsClient) Close() error

Close closes the connection to the API service. The user should invoke this when the client is no longer required.

func (*OperationsClient) Connection

func (c *OperationsClient) Connection() *grpc.ClientConn

Connection returns the client's connection to the API service.

func (*OperationsClient) DeleteOperation

DeleteOperation deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED.

Example
ctx := context.Background()
c, err := longrunning.NewOperationsClient(ctx)
if err != nil {
	// TODO: Handle error.
}

req := &longrunningpb.DeleteOperationRequest{
	// TODO: Fill request struct fields.
}
err = c.DeleteOperation(ctx, req)
if err != nil {
	// TODO: Handle error.
}
Output:

func (*OperationsClient) GetOperation

GetOperation gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.

Example
ctx := context.Background()
c, err := longrunning.NewOperationsClient(ctx)
if err != nil {
	// TODO: Handle error.
}

req := &longrunningpb.GetOperationRequest{
	// TODO: Fill request struct fields.
}
resp, err := c.GetOperation(ctx, req)
if err != nil {
	// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
Output:

func (*OperationsClient) ListOperations

ListOperations lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED.

NOTE: the name binding below allows API services to override the binding to use different resource name schemes, such as users/*/operations.

Example
ctx := context.Background()
c, err := longrunning.NewOperationsClient(ctx)
if err != nil {
	// TODO: Handle error.
}

req := &longrunningpb.ListOperationsRequest{
	// TODO: Fill request struct fields.
}
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
}
Output:

func (*OperationsClient) SetGoogleClientInfo

func (c *OperationsClient) SetGoogleClientInfo(keyval ...string)

SetGoogleClientInfo sets the name and version of the application in the `x-goog-api-client` header passed on each request. Intended for use by Google-written clients.

Jump to

Keyboard shortcuts

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