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-06 UTC."],[[["\u003cp\u003eThe latest version of the longrunning package is 0.120.0, and numerous earlier versions are also available for reference.\u003c/p\u003e\n"],["\u003cp\u003eThis package supports Long Running Operations within the Google Cloud Libraries, although typical users will interact with it indirectly through functions that return Operations.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eOperation\u003c/code\u003e struct represents a long-running API call, and it includes methods for cancellation, deletion, checking if it's done, and retrieving metadata.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003ePoll\u003c/code\u003e and \u003ccode\u003eWait\u003c/code\u003e methods are provided to check on the status and eventual outcome of a long running operation, with \u003ccode\u003eWait\u003c/code\u003e allowing for a custom polling \u003ccode\u003einterval\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThis package is considered experimental and may be subject to future modifications.\u003c/p\u003e\n"]]],[],null,["Version 0.102.1keyboard_arrow_down\n\n- [0.122.0 (latest)](/go/docs/reference/cloud.google.com/go/latest/longrunning)\n- [0.121.6](/go/docs/reference/cloud.google.com/go/0.121.6/longrunning)\n- [0.120.1](/go/docs/reference/cloud.google.com/go/0.120.1/longrunning)\n- [0.119.0](/go/docs/reference/cloud.google.com/go/0.119.0/longrunning)\n- [0.118.3](/go/docs/reference/cloud.google.com/go/0.118.3/longrunning)\n- [0.117.0](/go/docs/reference/cloud.google.com/go/0.117.0/longrunning)\n- [0.116.0](/go/docs/reference/cloud.google.com/go/0.116.0/longrunning)\n- [0.115.1](/go/docs/reference/cloud.google.com/go/0.115.1/longrunning)\n- [0.114.0](/go/docs/reference/cloud.google.com/go/0.114.0/longrunning)\n- [0.113.0](/go/docs/reference/cloud.google.com/go/0.113.0/longrunning)\n- [0.112.2](/go/docs/reference/cloud.google.com/go/0.112.2/longrunning)\n- [0.111.0](/go/docs/reference/cloud.google.com/go/0.111.0/longrunning)\n- [0.110.10](/go/docs/reference/cloud.google.com/go/0.110.10/longrunning)\n- [0.109.0](/go/docs/reference/cloud.google.com/go/0.109.0/longrunning)\n- [0.108.0](/go/docs/reference/cloud.google.com/go/0.108.0/longrunning)\n- [0.107.0](/go/docs/reference/cloud.google.com/go/0.107.0/longrunning)\n- [0.106.0](/go/docs/reference/cloud.google.com/go/0.106.0/longrunning)\n- [0.105.0](/go/docs/reference/cloud.google.com/go/0.105.0/longrunning)\n- [0.104.0](/go/docs/reference/cloud.google.com/go/0.104.0/longrunning)\n- [0.103.0](/go/docs/reference/cloud.google.com/go/0.103.0/longrunning)\n- [0.102.1](/go/docs/reference/cloud.google.com/go/0.102.1/longrunning)\n- [0.101.1](/go/docs/reference/cloud.google.com/go/0.101.1/longrunning)\n- [0.100.2](/go/docs/reference/cloud.google.com/go/0.100.2/longrunning)\n- [0.99.0](/go/docs/reference/cloud.google.com/go/0.99.0/longrunning)\n- [0.98.0](/go/docs/reference/cloud.google.com/go/0.98.0/longrunning)\n- [0.97.0](/go/docs/reference/cloud.google.com/go/0.97.0/longrunning)\n- [0.96.0](/go/docs/reference/cloud.google.com/go/0.96.0/longrunning)\n- [0.95.0](/go/docs/reference/cloud.google.com/go/0.95.0/longrunning)\n- [0.94.1](/go/docs/reference/cloud.google.com/go/0.94.1/longrunning)\n- [0.93.3](/go/docs/reference/cloud.google.com/go/0.93.3/longrunning)\n- [0.92.3](/go/docs/reference/cloud.google.com/go/0.92.3/longrunning)\n- [0.91.1](/go/docs/reference/cloud.google.com/go/0.91.1/longrunning)\n- [0.90.0](/go/docs/reference/cloud.google.com/go/0.90.0/longrunning)\n- [0.89.0](/go/docs/reference/cloud.google.com/go/0.89.0/longrunning)\n- [0.88.0](/go/docs/reference/cloud.google.com/go/0.88.0/longrunning)\n- [0.87.0](/go/docs/reference/cloud.google.com/go/0.87.0/longrunning)\n- [0.86.0](/go/docs/reference/cloud.google.com/go/0.86.0/longrunning)\n- [0.85.0](/go/docs/reference/cloud.google.com/go/0.85.0/longrunning)\n- [0.84.0](/go/docs/reference/cloud.google.com/go/0.84.0/longrunning)\n- [0.83.0](/go/docs/reference/cloud.google.com/go/0.83.0/longrunning)\n- [0.82.0](/go/docs/reference/cloud.google.com/go/0.82.0/longrunning)\n- [0.81.0](/go/docs/reference/cloud.google.com/go/0.81.0/longrunning)\n- [0.80.0](/go/docs/reference/cloud.google.com/go/0.80.0/longrunning)\n- [0.79.0](/go/docs/reference/cloud.google.com/go/0.79.0/longrunning)\n- [0.78.0](/go/docs/reference/cloud.google.com/go/0.78.0/longrunning)\n- [0.77.0](/go/docs/reference/cloud.google.com/go/0.77.0/longrunning)\n- [0.76.0](/go/docs/reference/cloud.google.com/go/0.76.0/longrunning)\n- [0.75.0](/go/docs/reference/cloud.google.com/go/0.75.0/longrunning) \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\nDefaultWaitInterval \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\nErrNoMetadata \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 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\nfunc InternalNewOperation \n\n func InternalNewOperation(inner */go/docs/reference/cloud.google.com/go/latest/longrunning/autogen./go/docs/reference/cloud.google.com/go/latest/longrunning/autogen#cloud_google_com_go_longrunning_autogen_OperationsClient, proto *https://pkg.go.dev/google.golang.org/genproto/googleapis/longrunning.https://pkg.go.dev/google.golang.org/genproto/googleapis/longrunning#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\nfunc (\\*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\nfunc (\\*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\nfunc (\\*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\nfunc (\\*Operation) Metadata \n\n func (op *#cloud_google_com_go_longrunning_Operation) Metadata(meta proto.Message) 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\nfunc (\\*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\nfunc (\\*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 proto.Message, 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\nfunc (\\*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 proto.Message, 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\nfunc (\\*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 proto.Message, 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."]]