Package longrunning supports Long Running Operations for the Google Cloud Libraries.
See google.golang.org/genproto/googleapis/longrunning for its service definition.
Users of the Google Cloud Libraries will typically not use this package directly.
Instead they will call functions returning Operations and call their methods.
This package is still experimental and subject to change.
InternalNewOperation is for use by the google Cloud Libraries only.
InternalNewOperation returns an long-running operation, abstracting the raw pb.Operation.
The conn parameter refers to a server that proto was received from.
Cancel 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
status.Code(err) == codes.Unimplemented. Clients can use
Poll 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, op.Poll returns an error
with code Canceled.
Delete 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, status.Code(err) == codes.Unimplemented.
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.
Poll fetches the latest state of a long-running operation.
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; if resp != nil, the response of the operation
is stored in resp.
WaitWithInterval blocks until the operation is completed.
If resp != nil, Wait stores the response in resp.
WaitWithInterval polls every interval, except initially
when it polls using exponential backoff.
See documentation of Poll for error-handling information.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[[["\u003cp\u003eThis package, \u003ccode\u003elongrunning\u003c/code\u003e, supports Long Running Operations for Google Cloud Libraries, though users typically interact with \u003ccode\u003eOperations\u003c/code\u003e returned by other functions rather than directly using this package.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eOperation\u003c/code\u003e type represents the result of an API call that may not be immediately ready, offering methods to check its status, cancel, or delete the operation.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eOperation\u003c/code\u003e has several key functions including \u003ccode\u003eCancel\u003c/code\u003e, \u003ccode\u003eDelete\u003c/code\u003e, \u003ccode\u003eDone\u003c/code\u003e, \u003ccode\u003eMetadata\u003c/code\u003e, \u003ccode\u003eName\u003c/code\u003e, \u003ccode\u003ePoll\u003c/code\u003e, and \u003ccode\u003eWait\u003c/code\u003e to manage long-running processes, check for its state and retrieve the result.\u003c/p\u003e\n"],["\u003cp\u003eThe latest version of the \u003ccode\u003elongrunning\u003c/code\u003e package is 0.6.6, and previous versions are available as listed.\u003c/p\u003e\n"],["\u003cp\u003eThis package is experimental and might change in the future.\u003c/p\u003e\n"]]],[],null,["# Package cloud.google.com/go/longrunning (v0.6.7)\n\nVersion latestkeyboard_arrow_down\n\n- [0.6.7 (latest)](/go/docs/reference/cloud.google.com/go/longrunning/latest)\n- [0.6.6](/go/docs/reference/cloud.google.com/go/longrunning/0.6.6)\n- [0.5.12](/go/docs/reference/cloud.google.com/go/longrunning/0.5.12)\n- [0.4.2](/go/docs/reference/cloud.google.com/go/longrunning/0.4.2)\n- [0.3.0](/go/docs/reference/cloud.google.com/go/longrunning/0.3.0)\n- [0.2.1](/go/docs/reference/cloud.google.com/go/longrunning/0.2.1)\n- [0.1.1](/go/docs/reference/cloud.google.com/go/longrunning/0.1.1) \n**Note:** To get more information about this package, such as access to older versions, view [this package on pkg.go.dev](https://pkg.go.dev/cloud.google.com/go/longrunning). \n\u003cbr /\u003e\n\nPackage longrunning supports Long Running Operations for the Google Cloud Libraries.\nSee google.golang.org/genproto/googleapis/longrunning for its service definition.\n\nUsers of the Google Cloud Libraries will typically not use this package directly.\nInstead they will call functions returning Operations and call their methods.\n\nThis package is still experimental and subject to change. \n\nConstants\n---------\n\n### DefaultWaitInterval\n\n const DefaultWaitInterval = 60 * https://pkg.go.dev/time.https://pkg.go.dev/time#Second\n\nDefaultWaitInterval is the polling interval used by Operation.Wait. \n\nVariables\n---------\n\n### ErrNoMetadata\n\n var ErrNoMetadata = https://pkg.go.dev/errors.https://pkg.go.dev/errors#New(\"operation contains no metadata\")\n\nErrNoMetadata is the error returned by Metadata if the operation contains no metadata. \n\nOperation\n---------\n\n type Operation struct {\n \t// contains filtered or unexported fields\n }\n\nOperation represents the result of an API call that may not be ready yet. \n\n### func InternalNewOperation\n\n func InternalNewOperation(inner */go/docs/reference/cloud.google.com/go/longrunning/latest/autogen./go/docs/reference/cloud.google.com/go/longrunning/latest/autogen#cloud_google_com_go_longrunning_autogen_OperationsClient, proto */go/docs/reference/cloud.google.com/go/longrunning/latest/autogen/longrunningpb./go/docs/reference/cloud.google.com/go/longrunning/latest/autogen/longrunningpb#cloud_google_com_go_longrunning_autogen_longrunningpb_Operation) *#cloud_google_com_go_longrunning_Operation\n\nInternalNewOperation is for use by the google Cloud Libraries only.\n\nInternalNewOperation returns an long-running operation, abstracting the raw pb.Operation.\nThe conn parameter refers to a server that proto was received from. \n\n### func (\\*Operation) Cancel\n\n func (op *#cloud_google_com_go_longrunning_Operation) Cancel(ctx https://pkg.go.dev/context.https://pkg.go.dev/context#Context, opts ...https://pkg.go.dev/github.com/googleapis/gax-go/v2.https://pkg.go.dev/github.com/googleapis/gax-go/v2#CallOption) https://pkg.go.dev/builtin#error\n\nCancel starts asynchronous cancellation on a long-running operation. The server\nmakes a best effort to cancel the operation, but success is not\nguaranteed. If the server doesn't support this method, it returns\nstatus.Code(err) == codes.Unimplemented. Clients can use\nPoll or other methods to check whether the cancellation succeeded or whether the\noperation completed despite cancellation. On successful cancellation,\nthe operation is not deleted; instead, op.Poll returns an error\nwith code Canceled. \n\n### func (\\*Operation) Delete\n\n func (op *#cloud_google_com_go_longrunning_Operation) Delete(ctx https://pkg.go.dev/context.https://pkg.go.dev/context#Context, opts ...https://pkg.go.dev/github.com/googleapis/gax-go/v2.https://pkg.go.dev/github.com/googleapis/gax-go/v2#CallOption) https://pkg.go.dev/builtin#error\n\nDelete deletes a long-running operation. This method indicates that the client is\nno longer interested in the operation result. It does not cancel the\noperation. If the server doesn't support this method, status.Code(err) == codes.Unimplemented. \n\n### func (\\*Operation) Done\n\n func (op *#cloud_google_com_go_longrunning_Operation) Done() https://pkg.go.dev/builtin#bool\n\nDone reports whether the long-running operation has completed. \n\n### func (\\*Operation) Metadata\n\n func (op *#cloud_google_com_go_longrunning_Operation) Metadata(meta https://pkg.go.dev/google.golang.org/protobuf/protoadapt.https://pkg.go.dev/google.golang.org/protobuf/protoadapt#MessageV1) https://pkg.go.dev/builtin#error\n\nMetadata unmarshals op's metadata into meta.\nIf op does not contain any metadata, Metadata returns ErrNoMetadata and meta is unmodified. \n\n### func (\\*Operation) Name\n\n func (op *#cloud_google_com_go_longrunning_Operation) Name() https://pkg.go.dev/builtin#string\n\nName returns the name of the long-running operation.\nThe name is assigned by the server and is unique within the service\nfrom which the operation is created. \n\n### func (\\*Operation) Poll\n\n func (op *#cloud_google_com_go_longrunning_Operation) Poll(ctx https://pkg.go.dev/context.https://pkg.go.dev/context#Context, resp https://pkg.go.dev/google.golang.org/protobuf/protoadapt.https://pkg.go.dev/google.golang.org/protobuf/protoadapt#MessageV1, opts ...https://pkg.go.dev/github.com/googleapis/gax-go/v2.https://pkg.go.dev/github.com/googleapis/gax-go/v2#CallOption) https://pkg.go.dev/builtin#error\n\nPoll fetches the latest state of a long-running operation.\n\nIf Poll fails, the error is returned and op is unmodified.\nIf Poll succeeds and the operation has completed with failure,\nthe error is returned and op.Done will return true.\nIf Poll succeeds and the operation has completed successfully,\nop.Done will return true; if resp != nil, the response of the operation\nis stored in resp. \n\n### func (\\*Operation) Wait\n\n func (op *#cloud_google_com_go_longrunning_Operation) Wait(ctx https://pkg.go.dev/context.https://pkg.go.dev/context#Context, resp https://pkg.go.dev/google.golang.org/protobuf/protoadapt.https://pkg.go.dev/google.golang.org/protobuf/protoadapt#MessageV1, opts ...https://pkg.go.dev/github.com/googleapis/gax-go/v2.https://pkg.go.dev/github.com/googleapis/gax-go/v2#CallOption) https://pkg.go.dev/builtin#error\n\nWait is equivalent to WaitWithInterval using DefaultWaitInterval. \n\n### func (\\*Operation) WaitWithInterval\n\n func (op *#cloud_google_com_go_longrunning_Operation) WaitWithInterval(ctx https://pkg.go.dev/context.https://pkg.go.dev/context#Context, resp https://pkg.go.dev/google.golang.org/protobuf/protoadapt.https://pkg.go.dev/google.golang.org/protobuf/protoadapt#MessageV1, interval https://pkg.go.dev/time.https://pkg.go.dev/time#Duration, opts ...https://pkg.go.dev/github.com/googleapis/gax-go/v2.https://pkg.go.dev/github.com/googleapis/gax-go/v2#CallOption) https://pkg.go.dev/builtin#error\n\nWaitWithInterval blocks until the operation is completed.\nIf resp != nil, Wait stores the response in resp.\nWaitWithInterval polls every interval, except initially\nwhen it polls using exponential backoff.\n\nSee documentation of Poll for error-handling information."]]