Package apikeys is an auto-generated package for the API Keys API.
Manages the API keys associated with developer projects.
NOTE: This package is in beta. It is not stable, and may be subject to changes.
General documentation
For information about setting deadlines, reusing contexts, and more please visit https://pkg.go.dev/cloud.google.com/go.
Example usage
To get started with this package, create a client.
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 := apikeys.NewClient(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.
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 := apikeys.NewClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &apikeyspb.CreateKeyRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/apikeys/apiv2/apikeyspb#CreateKeyRequest. } op, err := c.CreateKey(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp
Use of Context
The ctx passed to NewClient 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.
Functions
func DefaultAuthScopes
func DefaultAuthScopes() []string
DefaultAuthScopes reports the default set of authentication scopes to use with this package.
CallOptions
type CallOptions struct {
CreateKey []gax.CallOption
ListKeys []gax.CallOption
GetKey []gax.CallOption
GetKeyString []gax.CallOption
UpdateKey []gax.CallOption
DeleteKey []gax.CallOption
UndeleteKey []gax.CallOption
LookupKey []gax.CallOption
GetOperation []gax.CallOption
}
CallOptions contains the retry settings for each method of Client.
Client
type Client struct {
// The call options for this service.
CallOptions *CallOptions
// 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
}
Client is a client for interacting with API Keys API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Manages the API keys associated with projects.
func NewClient
NewClient creates a new api keys client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Manages the API keys associated with projects.
Example
package main
import (
"context"
apikeys "cloud.google.com/go/apikeys/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 := apikeys.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewRESTClient
NewRESTClient creates a new api keys rest client.
Manages the API keys associated with projects.
Example
package main
import (
"context"
apikeys "cloud.google.com/go/apikeys/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 := apikeys.NewRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*Client) Close
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*Client) Connection (deprecated)
func (c *Client) 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 (*Client) CreateKey
func (c *Client) CreateKey(ctx context.Context, req *apikeyspb.CreateKeyRequest, opts ...gax.CallOption) (*CreateKeyOperation, error)
CreateKey creates a new API key.
NOTE: Key is a global resource; hence the only supported value for location is global.
Example
package main
import (
"context"
apikeys "cloud.google.com/go/apikeys/apiv2"
apikeyspb "cloud.google.com/go/apikeys/apiv2/apikeyspb"
)
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 := apikeys.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apikeyspb.CreateKeyRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apikeys/apiv2/apikeyspb#CreateKeyRequest.
}
op, err := c.CreateKey(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) CreateKeyOperation
func (c *Client) CreateKeyOperation(name string) *CreateKeyOperation
CreateKeyOperation returns a new CreateKeyOperation from a given name. The name must be that of a previously created CreateKeyOperation, possibly from a different process.
func (*Client) DeleteKey
func (c *Client) DeleteKey(ctx context.Context, req *apikeyspb.DeleteKeyRequest, opts ...gax.CallOption) (*DeleteKeyOperation, error)
DeleteKey deletes an API key. Deleted key can be retrieved within 30 days of deletion. Afterward, key will be purged from the project.
NOTE: Key is a global resource; hence the only supported value for location is global.
Example
package main
import (
"context"
apikeys "cloud.google.com/go/apikeys/apiv2"
apikeyspb "cloud.google.com/go/apikeys/apiv2/apikeyspb"
)
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 := apikeys.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apikeyspb.DeleteKeyRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apikeys/apiv2/apikeyspb#DeleteKeyRequest.
}
op, err := c.DeleteKey(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) DeleteKeyOperation
func (c *Client) DeleteKeyOperation(name string) *DeleteKeyOperation
DeleteKeyOperation returns a new DeleteKeyOperation from a given name. The name must be that of a previously created DeleteKeyOperation, possibly from a different process.
func (*Client) GetKey
func (c *Client) GetKey(ctx context.Context, req *apikeyspb.GetKeyRequest, opts ...gax.CallOption) (*apikeyspb.Key, error)
GetKey gets the metadata for an API key. The key string of the API key isn’t included in the response.
NOTE: Key is a global resource; hence the only supported value for location is global.
Example
package main
import (
"context"
apikeys "cloud.google.com/go/apikeys/apiv2"
apikeyspb "cloud.google.com/go/apikeys/apiv2/apikeyspb"
)
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 := apikeys.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apikeyspb.GetKeyRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apikeys/apiv2/apikeyspb#GetKeyRequest.
}
resp, err := c.GetKey(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) GetKeyString
func (c *Client) GetKeyString(ctx context.Context, req *apikeyspb.GetKeyStringRequest, opts ...gax.CallOption) (*apikeyspb.GetKeyStringResponse, error)
GetKeyString get the key string for an API key.
NOTE: Key is a global resource; hence the only supported value for location is global.
Example
package main
import (
"context"
apikeys "cloud.google.com/go/apikeys/apiv2"
apikeyspb "cloud.google.com/go/apikeys/apiv2/apikeyspb"
)
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 := apikeys.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apikeyspb.GetKeyStringRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apikeys/apiv2/apikeyspb#GetKeyStringRequest.
}
resp, err := c.GetKeyString(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) GetOperation
func (c *Client) 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"
apikeys "cloud.google.com/go/apikeys/apiv2"
longrunningpb "google.golang.org/genproto/googleapis/longrunning"
)
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 := apikeys.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.GetOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/longrunning#GetOperationRequest.
}
resp, err := c.GetOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) ListKeys
func (c *Client) ListKeys(ctx context.Context, req *apikeyspb.ListKeysRequest, opts ...gax.CallOption) *KeyIterator
ListKeys lists the API keys owned by a project. The key string of the API key isn’t included in the response.
NOTE: Key is a global resource; hence the only supported value for location is global.
Example
package main
import (
"context"
apikeys "cloud.google.com/go/apikeys/apiv2"
apikeyspb "cloud.google.com/go/apikeys/apiv2/apikeyspb"
"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 := apikeys.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apikeyspb.ListKeysRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apikeys/apiv2/apikeyspb#ListKeysRequest.
}
it := c.ListKeys(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*Client) LookupKey
func (c *Client) LookupKey(ctx context.Context, req *apikeyspb.LookupKeyRequest, opts ...gax.CallOption) (*apikeyspb.LookupKeyResponse, error)
LookupKey find the parent project and resource name of the API key that matches the key string in the request. If the API key has been purged, resource name will not be set. The service account must have the apikeys.keys.lookup permission on the parent project.
Example
package main
import (
"context"
apikeys "cloud.google.com/go/apikeys/apiv2"
apikeyspb "cloud.google.com/go/apikeys/apiv2/apikeyspb"
)
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 := apikeys.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apikeyspb.LookupKeyRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apikeys/apiv2/apikeyspb#LookupKeyRequest.
}
resp, err := c.LookupKey(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) UndeleteKey
func (c *Client) UndeleteKey(ctx context.Context, req *apikeyspb.UndeleteKeyRequest, opts ...gax.CallOption) (*UndeleteKeyOperation, error)
UndeleteKey undeletes an API key which was deleted within 30 days.
NOTE: Key is a global resource; hence the only supported value for location is global.
Example
package main
import (
"context"
apikeys "cloud.google.com/go/apikeys/apiv2"
apikeyspb "cloud.google.com/go/apikeys/apiv2/apikeyspb"
)
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 := apikeys.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apikeyspb.UndeleteKeyRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apikeys/apiv2/apikeyspb#UndeleteKeyRequest.
}
op, err := c.UndeleteKey(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) UndeleteKeyOperation
func (c *Client) UndeleteKeyOperation(name string) *UndeleteKeyOperation
UndeleteKeyOperation returns a new UndeleteKeyOperation from a given name. The name must be that of a previously created UndeleteKeyOperation, possibly from a different process.
func (*Client) UpdateKey
func (c *Client) UpdateKey(ctx context.Context, req *apikeyspb.UpdateKeyRequest, opts ...gax.CallOption) (*UpdateKeyOperation, error)
UpdateKey patches the modifiable fields of an API key. The key string of the API key isn’t included in the response.
NOTE: Key is a global resource; hence the only supported value for location is global.
Example
package main
import (
"context"
apikeys "cloud.google.com/go/apikeys/apiv2"
apikeyspb "cloud.google.com/go/apikeys/apiv2/apikeyspb"
)
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 := apikeys.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &apikeyspb.UpdateKeyRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/apikeys/apiv2/apikeyspb#UpdateKeyRequest.
}
op, err := c.UpdateKey(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) UpdateKeyOperation
func (c *Client) UpdateKeyOperation(name string) *UpdateKeyOperation
UpdateKeyOperation returns a new UpdateKeyOperation from a given name. The name must be that of a previously created UpdateKeyOperation, possibly from a different process.
CreateKeyOperation
type CreateKeyOperation struct {
// contains filtered or unexported fields
}
CreateKeyOperation manages a long-running operation from CreateKey.
func (*CreateKeyOperation) Done
func (op *CreateKeyOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*CreateKeyOperation) Metadata
func (op *CreateKeyOperation) Metadata() (*emptypb.Empty, 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 (*CreateKeyOperation) Name
func (op *CreateKeyOperation) 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 (*CreateKeyOperation) Poll
func (op *CreateKeyOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*apikeyspb.Key, 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 (*CreateKeyOperation) Wait
func (op *CreateKeyOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*apikeyspb.Key, 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.
DeleteKeyOperation
type DeleteKeyOperation struct {
// contains filtered or unexported fields
}
DeleteKeyOperation manages a long-running operation from DeleteKey.
func (*DeleteKeyOperation) Done
func (op *DeleteKeyOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*DeleteKeyOperation) Metadata
func (op *DeleteKeyOperation) Metadata() (*emptypb.Empty, 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 (*DeleteKeyOperation) Name
func (op *DeleteKeyOperation) 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 (*DeleteKeyOperation) Poll
func (op *DeleteKeyOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*apikeyspb.Key, 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 (*DeleteKeyOperation) Wait
func (op *DeleteKeyOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*apikeyspb.Key, 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.
KeyIterator
type KeyIterator 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 []*apikeyspb.Key, nextPageToken string, err error)
// contains filtered or unexported fields
}
KeyIterator manages a stream of *apikeyspb.Key.
func (*KeyIterator) Next
func (it *KeyIterator) Next() (*apikeyspb.Key, 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 (*KeyIterator) PageInfo
func (it *KeyIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
UndeleteKeyOperation
type UndeleteKeyOperation struct {
// contains filtered or unexported fields
}
UndeleteKeyOperation manages a long-running operation from UndeleteKey.
func (*UndeleteKeyOperation) Done
func (op *UndeleteKeyOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*UndeleteKeyOperation) Metadata
func (op *UndeleteKeyOperation) Metadata() (*emptypb.Empty, 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 (*UndeleteKeyOperation) Name
func (op *UndeleteKeyOperation) 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 (*UndeleteKeyOperation) Poll
func (op *UndeleteKeyOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*apikeyspb.Key, 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 (*UndeleteKeyOperation) Wait
func (op *UndeleteKeyOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*apikeyspb.Key, 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.
UpdateKeyOperation
type UpdateKeyOperation struct {
// contains filtered or unexported fields
}
UpdateKeyOperation manages a long-running operation from UpdateKey.
func (*UpdateKeyOperation) Done
func (op *UpdateKeyOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*UpdateKeyOperation) Metadata
func (op *UpdateKeyOperation) Metadata() (*emptypb.Empty, 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 (*UpdateKeyOperation) Name
func (op *UpdateKeyOperation) 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 (*UpdateKeyOperation) Poll
func (op *UpdateKeyOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*apikeyspb.Key, 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 (*UpdateKeyOperation) Wait
func (op *UpdateKeyOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*apikeyspb.Key, 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.