diff --git a/storage/internal/apiv1/gapic_metadata.json b/storage/internal/apiv1/gapic_metadata.json index d7b93b754de..b3a8f901993 100644 --- a/storage/internal/apiv1/gapic_metadata.json +++ b/storage/internal/apiv1/gapic_metadata.json @@ -1,292 +1,292 @@ { - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", - "language": "go", - "protoPackage": "google.storage.v1", - "libraryPackage": "cloud.google.com/go/storage/internal/apiv1", - "services": { - "Storage": { - "clients": { - "grpc": { - "libraryClient": "Client", - "rpcs": { - "ComposeObject": { - "methods": [ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods.", + "language": "go", + "protoPackage": "google.storage.v1", + "libraryPackage": "cloud.google.com/go/storage/internal/apiv1", + "services": { + "Storage": { + "clients": { + "grpc": { + "libraryClient": "Client", + "rpcs": { + "ComposeObject": { + "methods": [ "ComposeObject" ] }, - "CopyObject": { - "methods": [ + "CopyObject": { + "methods": [ "CopyObject" ] }, - "CreateHmacKey": { - "methods": [ + "CreateHmacKey": { + "methods": [ "CreateHmacKey" ] }, - "DeleteBucket": { - "methods": [ + "DeleteBucket": { + "methods": [ "DeleteBucket" ] }, - "DeleteBucketAccessControl": { - "methods": [ + "DeleteBucketAccessControl": { + "methods": [ "DeleteBucketAccessControl" ] }, - "DeleteDefaultObjectAccessControl": { - "methods": [ + "DeleteDefaultObjectAccessControl": { + "methods": [ "DeleteDefaultObjectAccessControl" ] }, - "DeleteHmacKey": { - "methods": [ + "DeleteHmacKey": { + "methods": [ "DeleteHmacKey" ] }, - "DeleteNotification": { - "methods": [ + "DeleteNotification": { + "methods": [ "DeleteNotification" ] }, - "DeleteObject": { - "methods": [ + "DeleteObject": { + "methods": [ "DeleteObject" ] }, - "DeleteObjectAccessControl": { - "methods": [ + "DeleteObjectAccessControl": { + "methods": [ "DeleteObjectAccessControl" ] }, - "GetBucket": { - "methods": [ + "GetBucket": { + "methods": [ "GetBucket" ] }, - "GetBucketAccessControl": { - "methods": [ + "GetBucketAccessControl": { + "methods": [ "GetBucketAccessControl" ] }, - "GetBucketIamPolicy": { - "methods": [ + "GetBucketIamPolicy": { + "methods": [ "GetBucketIamPolicy" ] }, - "GetDefaultObjectAccessControl": { - "methods": [ + "GetDefaultObjectAccessControl": { + "methods": [ "GetDefaultObjectAccessControl" ] }, - "GetHmacKey": { - "methods": [ + "GetHmacKey": { + "methods": [ "GetHmacKey" ] }, - "GetNotification": { - "methods": [ + "GetNotification": { + "methods": [ "GetNotification" ] }, - "GetObject": { - "methods": [ + "GetObject": { + "methods": [ "GetObject" ] }, - "GetObjectAccessControl": { - "methods": [ + "GetObjectAccessControl": { + "methods": [ "GetObjectAccessControl" ] }, - "GetObjectIamPolicy": { - "methods": [ + "GetObjectIamPolicy": { + "methods": [ "GetObjectIamPolicy" ] }, - "GetObjectMedia": { - "methods": [ + "GetObjectMedia": { + "methods": [ "GetObjectMedia" ] }, - "GetServiceAccount": { - "methods": [ + "GetServiceAccount": { + "methods": [ "GetServiceAccount" ] }, - "InsertBucket": { - "methods": [ + "InsertBucket": { + "methods": [ "InsertBucket" ] }, - "InsertBucketAccessControl": { - "methods": [ + "InsertBucketAccessControl": { + "methods": [ "InsertBucketAccessControl" ] }, - "InsertDefaultObjectAccessControl": { - "methods": [ + "InsertDefaultObjectAccessControl": { + "methods": [ "InsertDefaultObjectAccessControl" ] }, - "InsertNotification": { - "methods": [ + "InsertNotification": { + "methods": [ "InsertNotification" ] }, - "InsertObject": { - "methods": [ + "InsertObject": { + "methods": [ "InsertObject" ] }, - "InsertObjectAccessControl": { - "methods": [ + "InsertObjectAccessControl": { + "methods": [ "InsertObjectAccessControl" ] }, - "ListBucketAccessControls": { - "methods": [ + "ListBucketAccessControls": { + "methods": [ "ListBucketAccessControls" ] }, - "ListBuckets": { - "methods": [ + "ListBuckets": { + "methods": [ "ListBuckets" ] }, - "ListChannels": { - "methods": [ + "ListChannels": { + "methods": [ "ListChannels" ] }, - "ListDefaultObjectAccessControls": { - "methods": [ + "ListDefaultObjectAccessControls": { + "methods": [ "ListDefaultObjectAccessControls" ] }, - "ListHmacKeys": { - "methods": [ + "ListHmacKeys": { + "methods": [ "ListHmacKeys" ] }, - "ListNotifications": { - "methods": [ + "ListNotifications": { + "methods": [ "ListNotifications" ] }, - "ListObjectAccessControls": { - "methods": [ + "ListObjectAccessControls": { + "methods": [ "ListObjectAccessControls" ] }, - "ListObjects": { - "methods": [ + "ListObjects": { + "methods": [ "ListObjects" ] }, - "LockBucketRetentionPolicy": { - "methods": [ + "LockBucketRetentionPolicy": { + "methods": [ "LockBucketRetentionPolicy" ] }, - "PatchBucket": { - "methods": [ + "PatchBucket": { + "methods": [ "PatchBucket" ] }, - "PatchBucketAccessControl": { - "methods": [ + "PatchBucketAccessControl": { + "methods": [ "PatchBucketAccessControl" ] }, - "PatchDefaultObjectAccessControl": { - "methods": [ + "PatchDefaultObjectAccessControl": { + "methods": [ "PatchDefaultObjectAccessControl" ] }, - "PatchObject": { - "methods": [ + "PatchObject": { + "methods": [ "PatchObject" ] }, - "PatchObjectAccessControl": { - "methods": [ + "PatchObjectAccessControl": { + "methods": [ "PatchObjectAccessControl" ] }, - "QueryWriteStatus": { - "methods": [ + "QueryWriteStatus": { + "methods": [ "QueryWriteStatus" ] }, - "RewriteObject": { - "methods": [ + "RewriteObject": { + "methods": [ "RewriteObject" ] }, - "SetBucketIamPolicy": { - "methods": [ + "SetBucketIamPolicy": { + "methods": [ "SetBucketIamPolicy" ] }, - "SetObjectIamPolicy": { - "methods": [ + "SetObjectIamPolicy": { + "methods": [ "SetObjectIamPolicy" ] }, - "StartResumableWrite": { - "methods": [ + "StartResumableWrite": { + "methods": [ "StartResumableWrite" ] }, - "StopChannel": { - "methods": [ + "StopChannel": { + "methods": [ "StopChannel" ] }, - "TestBucketIamPermissions": { - "methods": [ + "TestBucketIamPermissions": { + "methods": [ "TestBucketIamPermissions" ] }, - "TestObjectIamPermissions": { - "methods": [ + "TestObjectIamPermissions": { + "methods": [ "TestObjectIamPermissions" ] }, - "UpdateBucket": { - "methods": [ + "UpdateBucket": { + "methods": [ "UpdateBucket" ] }, - "UpdateBucketAccessControl": { - "methods": [ + "UpdateBucketAccessControl": { + "methods": [ "UpdateBucketAccessControl" ] }, - "UpdateDefaultObjectAccessControl": { - "methods": [ + "UpdateDefaultObjectAccessControl": { + "methods": [ "UpdateDefaultObjectAccessControl" ] }, - "UpdateHmacKey": { - "methods": [ + "UpdateHmacKey": { + "methods": [ "UpdateHmacKey" ] }, - "UpdateObject": { - "methods": [ + "UpdateObject": { + "methods": [ "UpdateObject" ] }, - "UpdateObjectAccessControl": { - "methods": [ + "UpdateObjectAccessControl": { + "methods": [ "UpdateObjectAccessControl" ] }, - "WatchAllObjects": { - "methods": [ + "WatchAllObjects": { + "methods": [ "WatchAllObjects" ] } diff --git a/storage/internal/apiv1/storage_client.go b/storage/internal/apiv1/storage_client.go index 2f4c597dd9a..994ed4556f9 100644 --- a/storage/internal/apiv1/storage_client.go +++ b/storage/internal/apiv1/storage_client.go @@ -100,6 +100,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultMTLSEndpoint("storage.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://storage.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), @@ -848,18 +849,391 @@ type internalClient interface { // Client is a client for interacting with Cloud Storage API. // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +// +// Manages Google Cloud Storage resources. type Client struct { // The internal transport-dependent client. - internalClient + internalClient internalClient // The call options for this service. CallOptions *CallOptions } -// GRPCClient is a client for interacting with Cloud Storage API over gRPC transport. +// Wrapper methods routed to the internal client. + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *Client) Close() error { + return c.internalClient.Close() +} + +// 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. +func (c *Client) setGoogleClientInfo(keyval ...string) { + c.internalClient.setGoogleClientInfo(keyval...) +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *Client) Connection() *grpc.ClientConn { + return c.internalClient.Connection() +} + +// DeleteBucketAccessControl permanently deletes the ACL entry for the specified entity on the specified +// bucket. +func (c *Client) DeleteBucketAccessControl(ctx context.Context, req *storagepb.DeleteBucketAccessControlRequest, opts ...gax.CallOption) error { + return c.internalClient.DeleteBucketAccessControl(ctx, req, opts...) +} + +// GetBucketAccessControl returns the ACL entry for the specified entity on the specified bucket. +func (c *Client) GetBucketAccessControl(ctx context.Context, req *storagepb.GetBucketAccessControlRequest, opts ...gax.CallOption) (*storagepb.BucketAccessControl, error) { + return c.internalClient.GetBucketAccessControl(ctx, req, opts...) +} + +// InsertBucketAccessControl creates a new ACL entry on the specified bucket. +func (c *Client) InsertBucketAccessControl(ctx context.Context, req *storagepb.InsertBucketAccessControlRequest, opts ...gax.CallOption) (*storagepb.BucketAccessControl, error) { + return c.internalClient.InsertBucketAccessControl(ctx, req, opts...) +} + +// ListBucketAccessControls retrieves ACL entries on the specified bucket. +func (c *Client) ListBucketAccessControls(ctx context.Context, req *storagepb.ListBucketAccessControlsRequest, opts ...gax.CallOption) (*storagepb.ListBucketAccessControlsResponse, error) { + return c.internalClient.ListBucketAccessControls(ctx, req, opts...) +} + +// UpdateBucketAccessControl updates an ACL entry on the specified bucket. Equivalent to +// PatchBucketAccessControl, but all unspecified fields will be +// reset to their default values. +func (c *Client) UpdateBucketAccessControl(ctx context.Context, req *storagepb.UpdateBucketAccessControlRequest, opts ...gax.CallOption) (*storagepb.BucketAccessControl, error) { + return c.internalClient.UpdateBucketAccessControl(ctx, req, opts...) +} + +// PatchBucketAccessControl updates an ACL entry on the specified bucket. +func (c *Client) PatchBucketAccessControl(ctx context.Context, req *storagepb.PatchBucketAccessControlRequest, opts ...gax.CallOption) (*storagepb.BucketAccessControl, error) { + return c.internalClient.PatchBucketAccessControl(ctx, req, opts...) +} + +// DeleteBucket permanently deletes an empty bucket. +func (c *Client) DeleteBucket(ctx context.Context, req *storagepb.DeleteBucketRequest, opts ...gax.CallOption) error { + return c.internalClient.DeleteBucket(ctx, req, opts...) +} + +// GetBucket returns metadata for the specified bucket. +func (c *Client) GetBucket(ctx context.Context, req *storagepb.GetBucketRequest, opts ...gax.CallOption) (*storagepb.Bucket, error) { + return c.internalClient.GetBucket(ctx, req, opts...) +} + +// InsertBucket creates a new bucket. +func (c *Client) InsertBucket(ctx context.Context, req *storagepb.InsertBucketRequest, opts ...gax.CallOption) (*storagepb.Bucket, error) { + return c.internalClient.InsertBucket(ctx, req, opts...) +} + +// ListChannels list active object change notification channels for this bucket. +func (c *Client) ListChannels(ctx context.Context, req *storagepb.ListChannelsRequest, opts ...gax.CallOption) (*storagepb.ListChannelsResponse, error) { + return c.internalClient.ListChannels(ctx, req, opts...) +} + +// ListBuckets retrieves a list of buckets for a given project. +func (c *Client) ListBuckets(ctx context.Context, req *storagepb.ListBucketsRequest, opts ...gax.CallOption) (*storagepb.ListBucketsResponse, error) { + return c.internalClient.ListBuckets(ctx, req, opts...) +} + +// LockBucketRetentionPolicy locks retention policy on a bucket. +func (c *Client) LockBucketRetentionPolicy(ctx context.Context, req *storagepb.LockRetentionPolicyRequest, opts ...gax.CallOption) (*storagepb.Bucket, error) { + return c.internalClient.LockBucketRetentionPolicy(ctx, req, opts...) +} + +// GetBucketIamPolicy gets the IAM policy for the specified bucket. +func (c *Client) GetBucketIamPolicy(ctx context.Context, req *storagepb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { + return c.internalClient.GetBucketIamPolicy(ctx, req, opts...) +} + +// SetBucketIamPolicy updates an IAM policy for the specified bucket. +func (c *Client) SetBucketIamPolicy(ctx context.Context, req *storagepb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { + return c.internalClient.SetBucketIamPolicy(ctx, req, opts...) +} + +// TestBucketIamPermissions tests a set of permissions on the given bucket to see which, if +// any, are held by the caller. +func (c *Client) TestBucketIamPermissions(ctx context.Context, req *storagepb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) { + return c.internalClient.TestBucketIamPermissions(ctx, req, opts...) +} + +// PatchBucket updates a bucket. Changes to the bucket will be readable immediately after +// writing, but configuration changes may take time to propagate. +func (c *Client) PatchBucket(ctx context.Context, req *storagepb.PatchBucketRequest, opts ...gax.CallOption) (*storagepb.Bucket, error) { + return c.internalClient.PatchBucket(ctx, req, opts...) +} + +// UpdateBucket updates a bucket. Equivalent to PatchBucket, but always replaces all +// mutatable fields of the bucket with new values, reverting all +// unspecified fields to their default values. +// Like PatchBucket, Changes to the bucket will be readable immediately after +// writing, but configuration changes may take time to propagate. +func (c *Client) UpdateBucket(ctx context.Context, req *storagepb.UpdateBucketRequest, opts ...gax.CallOption) (*storagepb.Bucket, error) { + return c.internalClient.UpdateBucket(ctx, req, opts...) +} + +// StopChannel halts “Object Change Notification” push messagages. +// See https://cloud.google.com/storage/docs/object-change-notification (at https://cloud.google.com/storage/docs/object-change-notification) +// Note: this is not related to the newer “Notifications” resource, which +// are stopped using DeleteNotification. +func (c *Client) StopChannel(ctx context.Context, req *storagepb.StopChannelRequest, opts ...gax.CallOption) error { + return c.internalClient.StopChannel(ctx, req, opts...) +} + +// DeleteDefaultObjectAccessControl permanently deletes the default object ACL entry for the specified entity +// on the specified bucket. +func (c *Client) DeleteDefaultObjectAccessControl(ctx context.Context, req *storagepb.DeleteDefaultObjectAccessControlRequest, opts ...gax.CallOption) error { + return c.internalClient.DeleteDefaultObjectAccessControl(ctx, req, opts...) +} + +// GetDefaultObjectAccessControl returns the default object ACL entry for the specified entity on the +// specified bucket. +func (c *Client) GetDefaultObjectAccessControl(ctx context.Context, req *storagepb.GetDefaultObjectAccessControlRequest, opts ...gax.CallOption) (*storagepb.ObjectAccessControl, error) { + return c.internalClient.GetDefaultObjectAccessControl(ctx, req, opts...) +} + +// InsertDefaultObjectAccessControl creates a new default object ACL entry on the specified bucket. +func (c *Client) InsertDefaultObjectAccessControl(ctx context.Context, req *storagepb.InsertDefaultObjectAccessControlRequest, opts ...gax.CallOption) (*storagepb.ObjectAccessControl, error) { + return c.internalClient.InsertDefaultObjectAccessControl(ctx, req, opts...) +} + +// ListDefaultObjectAccessControls retrieves default object ACL entries on the specified bucket. +func (c *Client) ListDefaultObjectAccessControls(ctx context.Context, req *storagepb.ListDefaultObjectAccessControlsRequest, opts ...gax.CallOption) (*storagepb.ListObjectAccessControlsResponse, error) { + return c.internalClient.ListDefaultObjectAccessControls(ctx, req, opts...) +} + +// PatchDefaultObjectAccessControl updates a default object ACL entry on the specified bucket. +func (c *Client) PatchDefaultObjectAccessControl(ctx context.Context, req *storagepb.PatchDefaultObjectAccessControlRequest, opts ...gax.CallOption) (*storagepb.ObjectAccessControl, error) { + return c.internalClient.PatchDefaultObjectAccessControl(ctx, req, opts...) +} + +// UpdateDefaultObjectAccessControl updates a default object ACL entry on the specified bucket. Equivalent to +// PatchDefaultObjectAccessControl, but modifies all unspecified fields to +// their default values. +func (c *Client) UpdateDefaultObjectAccessControl(ctx context.Context, req *storagepb.UpdateDefaultObjectAccessControlRequest, opts ...gax.CallOption) (*storagepb.ObjectAccessControl, error) { + return c.internalClient.UpdateDefaultObjectAccessControl(ctx, req, opts...) +} + +// DeleteNotification permanently deletes a notification subscription. +// Note: Older, “Object Change Notification” push subscriptions should be +// deleted using StopChannel instead. +func (c *Client) DeleteNotification(ctx context.Context, req *storagepb.DeleteNotificationRequest, opts ...gax.CallOption) error { + return c.internalClient.DeleteNotification(ctx, req, opts...) +} + +// GetNotification view a notification configuration. +func (c *Client) GetNotification(ctx context.Context, req *storagepb.GetNotificationRequest, opts ...gax.CallOption) (*storagepb.Notification, error) { + return c.internalClient.GetNotification(ctx, req, opts...) +} + +// InsertNotification creates a notification subscription for a given bucket. +// These notifications, when triggered, publish messages to the specified +// Cloud Pub/Sub topics. +// See https://cloud.google.com/storage/docs/pubsub-notifications (at https://cloud.google.com/storage/docs/pubsub-notifications). +func (c *Client) InsertNotification(ctx context.Context, req *storagepb.InsertNotificationRequest, opts ...gax.CallOption) (*storagepb.Notification, error) { + return c.internalClient.InsertNotification(ctx, req, opts...) +} + +// ListNotifications retrieves a list of notification subscriptions for a given bucket. +func (c *Client) ListNotifications(ctx context.Context, req *storagepb.ListNotificationsRequest, opts ...gax.CallOption) (*storagepb.ListNotificationsResponse, error) { + return c.internalClient.ListNotifications(ctx, req, opts...) +} + +// DeleteObjectAccessControl permanently deletes the ACL entry for the specified entity on the specified +// object. +func (c *Client) DeleteObjectAccessControl(ctx context.Context, req *storagepb.DeleteObjectAccessControlRequest, opts ...gax.CallOption) error { + return c.internalClient.DeleteObjectAccessControl(ctx, req, opts...) +} + +// GetObjectAccessControl returns the ACL entry for the specified entity on the specified object. +func (c *Client) GetObjectAccessControl(ctx context.Context, req *storagepb.GetObjectAccessControlRequest, opts ...gax.CallOption) (*storagepb.ObjectAccessControl, error) { + return c.internalClient.GetObjectAccessControl(ctx, req, opts...) +} + +// InsertObjectAccessControl creates a new ACL entry on the specified object. +func (c *Client) InsertObjectAccessControl(ctx context.Context, req *storagepb.InsertObjectAccessControlRequest, opts ...gax.CallOption) (*storagepb.ObjectAccessControl, error) { + return c.internalClient.InsertObjectAccessControl(ctx, req, opts...) +} + +// ListObjectAccessControls retrieves ACL entries on the specified object. +func (c *Client) ListObjectAccessControls(ctx context.Context, req *storagepb.ListObjectAccessControlsRequest, opts ...gax.CallOption) (*storagepb.ListObjectAccessControlsResponse, error) { + return c.internalClient.ListObjectAccessControls(ctx, req, opts...) +} + +// PatchObjectAccessControl patches an ACL entry on the specified object. Patch is similar to update, +// but only applies or appends the specified fields in the +// object_access_control object. Other fields are unaffected. +func (c *Client) PatchObjectAccessControl(ctx context.Context, req *storagepb.PatchObjectAccessControlRequest, opts ...gax.CallOption) (*storagepb.ObjectAccessControl, error) { + return c.internalClient.PatchObjectAccessControl(ctx, req, opts...) +} + +// UpdateObjectAccessControl updates an ACL entry on the specified object. +func (c *Client) UpdateObjectAccessControl(ctx context.Context, req *storagepb.UpdateObjectAccessControlRequest, opts ...gax.CallOption) (*storagepb.ObjectAccessControl, error) { + return c.internalClient.UpdateObjectAccessControl(ctx, req, opts...) +} + +// ComposeObject concatenates a list of existing objects into a new object in the same +// bucket. +func (c *Client) ComposeObject(ctx context.Context, req *storagepb.ComposeObjectRequest, opts ...gax.CallOption) (*storagepb.Object, error) { + return c.internalClient.ComposeObject(ctx, req, opts...) +} + +// CopyObject copies a source object to a destination object. Optionally overrides +// metadata. +func (c *Client) CopyObject(ctx context.Context, req *storagepb.CopyObjectRequest, opts ...gax.CallOption) (*storagepb.Object, error) { + return c.internalClient.CopyObject(ctx, req, opts...) +} + +// DeleteObject deletes an object and its metadata. Deletions are permanent if versioning +// is not enabled for the bucket, or if the generation parameter +// is used. +func (c *Client) DeleteObject(ctx context.Context, req *storagepb.DeleteObjectRequest, opts ...gax.CallOption) error { + return c.internalClient.DeleteObject(ctx, req, opts...) +} + +// GetObject retrieves an object’s metadata. +func (c *Client) GetObject(ctx context.Context, req *storagepb.GetObjectRequest, opts ...gax.CallOption) (*storagepb.Object, error) { + return c.internalClient.GetObject(ctx, req, opts...) +} + +// GetObjectMedia reads an object’s data. +func (c *Client) GetObjectMedia(ctx context.Context, req *storagepb.GetObjectMediaRequest, opts ...gax.CallOption) (storagepb.Storage_GetObjectMediaClient, error) { + return c.internalClient.GetObjectMedia(ctx, req, opts...) +} + +// InsertObject stores a new object and metadata. +// +// An object can be written either in a single message stream or in a +// resumable sequence of message streams. To write using a single stream, +// the client should include in the first message of the stream an +// InsertObjectSpec describing the destination bucket, object, and any +// preconditions. Additionally, the final message must set ‘finish_write’ to +// true, or else it is an error. +// +// For a resumable write, the client should instead call +// StartResumableWrite() and provide that method an InsertObjectSpec. +// They should then attach the returned upload_id to the first message of +// each following call to Insert. If there is an error or the connection is +// broken during the resumable Insert(), the client should check the status +// of the Insert() by calling QueryWriteStatus() and continue writing from +// the returned committed_size. This may be less than the amount of data the +// client previously sent. +// +// The service will not view the object as complete until the client has +// sent an Insert with finish_write set to true. Sending any +// requests on a stream after sending a request with finish_write set to +// true will cause an error. The client should check the +// Object it receives to determine how much data the service was +// able to commit and whether the service views the object as complete. +func (c *Client) InsertObject(ctx context.Context, opts ...gax.CallOption) (storagepb.Storage_InsertObjectClient, error) { + return c.internalClient.InsertObject(ctx, opts...) +} + +// ListObjects retrieves a list of objects matching the criteria. +func (c *Client) ListObjects(ctx context.Context, req *storagepb.ListObjectsRequest, opts ...gax.CallOption) (*storagepb.ListObjectsResponse, error) { + return c.internalClient.ListObjects(ctx, req, opts...) +} + +// RewriteObject rewrites a source object to a destination object. Optionally overrides +// metadata. +func (c *Client) RewriteObject(ctx context.Context, req *storagepb.RewriteObjectRequest, opts ...gax.CallOption) (*storagepb.RewriteResponse, error) { + return c.internalClient.RewriteObject(ctx, req, opts...) +} + +// StartResumableWrite starts a resumable write. How long the write operation remains valid, and +// what happens when the write operation becomes invalid, are +// service-dependent. +func (c *Client) StartResumableWrite(ctx context.Context, req *storagepb.StartResumableWriteRequest, opts ...gax.CallOption) (*storagepb.StartResumableWriteResponse, error) { + return c.internalClient.StartResumableWrite(ctx, req, opts...) +} + +// QueryWriteStatus determines the committed_size for an object that is being written, which +// can then be used as the write_offset for the next Write() call. +// +// If the object does not exist (i.e., the object has been deleted, or the +// first Write() has not yet reached the service), this method returns the +// error NOT_FOUND. +// +// The client may call QueryWriteStatus() at any time to determine how +// much data has been processed for this object. This is useful if the +// client is buffering data and needs to know which data can be safely +// evicted. For any sequence of QueryWriteStatus() calls for a given +// object name, the sequence of returned committed_size values will be +// non-decreasing. +func (c *Client) QueryWriteStatus(ctx context.Context, req *storagepb.QueryWriteStatusRequest, opts ...gax.CallOption) (*storagepb.QueryWriteStatusResponse, error) { + return c.internalClient.QueryWriteStatus(ctx, req, opts...) +} + +// PatchObject updates an object’s metadata. +func (c *Client) PatchObject(ctx context.Context, req *storagepb.PatchObjectRequest, opts ...gax.CallOption) (*storagepb.Object, error) { + return c.internalClient.PatchObject(ctx, req, opts...) +} + +// UpdateObject updates an object’s metadata. Equivalent to PatchObject, but always +// replaces all mutatable fields of the bucket with new values, reverting all +// unspecified fields to their default values. +func (c *Client) UpdateObject(ctx context.Context, req *storagepb.UpdateObjectRequest, opts ...gax.CallOption) (*storagepb.Object, error) { + return c.internalClient.UpdateObject(ctx, req, opts...) +} + +// GetObjectIamPolicy gets the IAM policy for the specified object. +func (c *Client) GetObjectIamPolicy(ctx context.Context, req *storagepb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { + return c.internalClient.GetObjectIamPolicy(ctx, req, opts...) +} + +// SetObjectIamPolicy updates an IAM policy for the specified object. +func (c *Client) SetObjectIamPolicy(ctx context.Context, req *storagepb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { + return c.internalClient.SetObjectIamPolicy(ctx, req, opts...) +} + +// TestObjectIamPermissions tests a set of permissions on the given object to see which, if +// any, are held by the caller. +func (c *Client) TestObjectIamPermissions(ctx context.Context, req *storagepb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) { + return c.internalClient.TestObjectIamPermissions(ctx, req, opts...) +} + +// WatchAllObjects watch for changes on all objects in a bucket. +func (c *Client) WatchAllObjects(ctx context.Context, req *storagepb.WatchAllObjectsRequest, opts ...gax.CallOption) (*storagepb.Channel, error) { + return c.internalClient.WatchAllObjects(ctx, req, opts...) +} + +// GetServiceAccount retrieves the name of a project’s Google Cloud Storage service account. +func (c *Client) GetServiceAccount(ctx context.Context, req *storagepb.GetProjectServiceAccountRequest, opts ...gax.CallOption) (*storagepb.ServiceAccount, error) { + return c.internalClient.GetServiceAccount(ctx, req, opts...) +} + +// CreateHmacKey creates a new HMAC key for the given service account. +func (c *Client) CreateHmacKey(ctx context.Context, req *storagepb.CreateHmacKeyRequest, opts ...gax.CallOption) (*storagepb.CreateHmacKeyResponse, error) { + return c.internalClient.CreateHmacKey(ctx, req, opts...) +} + +// DeleteHmacKey deletes a given HMAC key. Key must be in an INACTIVE state. +func (c *Client) DeleteHmacKey(ctx context.Context, req *storagepb.DeleteHmacKeyRequest, opts ...gax.CallOption) error { + return c.internalClient.DeleteHmacKey(ctx, req, opts...) +} + +// GetHmacKey gets an existing HMAC key metadata for the given id. +func (c *Client) GetHmacKey(ctx context.Context, req *storagepb.GetHmacKeyRequest, opts ...gax.CallOption) (*storagepb.HmacKeyMetadata, error) { + return c.internalClient.GetHmacKey(ctx, req, opts...) +} + +// ListHmacKeys lists HMAC keys under a given project with the additional filters provided. +func (c *Client) ListHmacKeys(ctx context.Context, req *storagepb.ListHmacKeysRequest, opts ...gax.CallOption) (*storagepb.ListHmacKeysResponse, error) { + return c.internalClient.ListHmacKeys(ctx, req, opts...) +} + +// UpdateHmacKey updates a given HMAC key state between ACTIVE and INACTIVE. +func (c *Client) UpdateHmacKey(ctx context.Context, req *storagepb.UpdateHmacKeyRequest, opts ...gax.CallOption) (*storagepb.HmacKeyMetadata, error) { + return c.internalClient.UpdateHmacKey(ctx, req, opts...) +} + +// gRPCClient is a client for interacting with Cloud Storage API over gRPC transport. // // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. -type GRPCClient struct { +type gRPCClient struct { // Connection pool of gRPC connections to the service. connPool gtransport.ConnPool @@ -877,6 +1251,7 @@ type GRPCClient struct { } // NewClient creates a new storage client based on gRPC. +// The returned client must be Closed when it is done being used to clean up its underlying connections. // // Manages Google Cloud Storage resources. func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { @@ -900,7 +1275,7 @@ func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error } client := Client{CallOptions: defaultCallOptions()} - c := &GRPCClient{ + c := &gRPCClient{ connPool: connPool, disableDeadlines: disableDeadlines, client: storagepb.NewStorageClient(connPool), @@ -916,14 +1291,14 @@ func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error // Connection returns a connection to the API service. // // Deprecated. -func (c *GRPCClient) Connection() *grpc.ClientConn { +func (c *gRPCClient) Connection() *grpc.ClientConn { return c.connPool.Conn() } // 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. -func (c *GRPCClient) setGoogleClientInfo(keyval ...string) { +func (c *gRPCClient) setGoogleClientInfo(keyval ...string) { kv := append([]string{"gl-go", versionGo()}, keyval...) kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) @@ -931,13 +1306,11 @@ func (c *GRPCClient) setGoogleClientInfo(keyval ...string) { // Close closes the connection to the API service. The user should invoke this when // the client is no longer required. -func (c *GRPCClient) Close() error { +func (c *gRPCClient) Close() error { return c.connPool.Close() } -// DeleteBucketAccessControl permanently deletes the ACL entry for the specified entity on the specified -// bucket. -func (c *GRPCClient) DeleteBucketAccessControl(ctx context.Context, req *storagepb.DeleteBucketAccessControlRequest, opts ...gax.CallOption) error { +func (c *gRPCClient) DeleteBucketAccessControl(ctx context.Context, req *storagepb.DeleteBucketAccessControlRequest, opts ...gax.CallOption) error { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -953,8 +1326,7 @@ func (c *GRPCClient) DeleteBucketAccessControl(ctx context.Context, req *storage return err } -// GetBucketAccessControl returns the ACL entry for the specified entity on the specified bucket. -func (c *GRPCClient) GetBucketAccessControl(ctx context.Context, req *storagepb.GetBucketAccessControlRequest, opts ...gax.CallOption) (*storagepb.BucketAccessControl, error) { +func (c *gRPCClient) GetBucketAccessControl(ctx context.Context, req *storagepb.GetBucketAccessControlRequest, opts ...gax.CallOption) (*storagepb.BucketAccessControl, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -974,8 +1346,7 @@ func (c *GRPCClient) GetBucketAccessControl(ctx context.Context, req *storagepb. return resp, nil } -// InsertBucketAccessControl creates a new ACL entry on the specified bucket. -func (c *GRPCClient) InsertBucketAccessControl(ctx context.Context, req *storagepb.InsertBucketAccessControlRequest, opts ...gax.CallOption) (*storagepb.BucketAccessControl, error) { +func (c *gRPCClient) InsertBucketAccessControl(ctx context.Context, req *storagepb.InsertBucketAccessControlRequest, opts ...gax.CallOption) (*storagepb.BucketAccessControl, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -995,8 +1366,7 @@ func (c *GRPCClient) InsertBucketAccessControl(ctx context.Context, req *storage return resp, nil } -// ListBucketAccessControls retrieves ACL entries on the specified bucket. -func (c *GRPCClient) ListBucketAccessControls(ctx context.Context, req *storagepb.ListBucketAccessControlsRequest, opts ...gax.CallOption) (*storagepb.ListBucketAccessControlsResponse, error) { +func (c *gRPCClient) ListBucketAccessControls(ctx context.Context, req *storagepb.ListBucketAccessControlsRequest, opts ...gax.CallOption) (*storagepb.ListBucketAccessControlsResponse, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -1016,10 +1386,7 @@ func (c *GRPCClient) ListBucketAccessControls(ctx context.Context, req *storagep return resp, nil } -// UpdateBucketAccessControl updates an ACL entry on the specified bucket. Equivalent to -// PatchBucketAccessControl, but all unspecified fields will be -// reset to their default values. -func (c *GRPCClient) UpdateBucketAccessControl(ctx context.Context, req *storagepb.UpdateBucketAccessControlRequest, opts ...gax.CallOption) (*storagepb.BucketAccessControl, error) { +func (c *gRPCClient) UpdateBucketAccessControl(ctx context.Context, req *storagepb.UpdateBucketAccessControlRequest, opts ...gax.CallOption) (*storagepb.BucketAccessControl, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -1039,8 +1406,7 @@ func (c *GRPCClient) UpdateBucketAccessControl(ctx context.Context, req *storage return resp, nil } -// PatchBucketAccessControl updates an ACL entry on the specified bucket. -func (c *GRPCClient) PatchBucketAccessControl(ctx context.Context, req *storagepb.PatchBucketAccessControlRequest, opts ...gax.CallOption) (*storagepb.BucketAccessControl, error) { +func (c *gRPCClient) PatchBucketAccessControl(ctx context.Context, req *storagepb.PatchBucketAccessControlRequest, opts ...gax.CallOption) (*storagepb.BucketAccessControl, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -1060,8 +1426,7 @@ func (c *GRPCClient) PatchBucketAccessControl(ctx context.Context, req *storagep return resp, nil } -// DeleteBucket permanently deletes an empty bucket. -func (c *GRPCClient) DeleteBucket(ctx context.Context, req *storagepb.DeleteBucketRequest, opts ...gax.CallOption) error { +func (c *gRPCClient) DeleteBucket(ctx context.Context, req *storagepb.DeleteBucketRequest, opts ...gax.CallOption) error { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -1077,8 +1442,7 @@ func (c *GRPCClient) DeleteBucket(ctx context.Context, req *storagepb.DeleteBuck return err } -// GetBucket returns metadata for the specified bucket. -func (c *GRPCClient) GetBucket(ctx context.Context, req *storagepb.GetBucketRequest, opts ...gax.CallOption) (*storagepb.Bucket, error) { +func (c *gRPCClient) GetBucket(ctx context.Context, req *storagepb.GetBucketRequest, opts ...gax.CallOption) (*storagepb.Bucket, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -1098,8 +1462,7 @@ func (c *GRPCClient) GetBucket(ctx context.Context, req *storagepb.GetBucketRequ return resp, nil } -// InsertBucket creates a new bucket. -func (c *GRPCClient) InsertBucket(ctx context.Context, req *storagepb.InsertBucketRequest, opts ...gax.CallOption) (*storagepb.Bucket, error) { +func (c *gRPCClient) InsertBucket(ctx context.Context, req *storagepb.InsertBucketRequest, opts ...gax.CallOption) (*storagepb.Bucket, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -1119,8 +1482,7 @@ func (c *GRPCClient) InsertBucket(ctx context.Context, req *storagepb.InsertBuck return resp, nil } -// ListChannels list active object change notification channels for this bucket. -func (c *GRPCClient) ListChannels(ctx context.Context, req *storagepb.ListChannelsRequest, opts ...gax.CallOption) (*storagepb.ListChannelsResponse, error) { +func (c *gRPCClient) ListChannels(ctx context.Context, req *storagepb.ListChannelsRequest, opts ...gax.CallOption) (*storagepb.ListChannelsResponse, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -1140,8 +1502,7 @@ func (c *GRPCClient) ListChannels(ctx context.Context, req *storagepb.ListChanne return resp, nil } -// ListBuckets retrieves a list of buckets for a given project. -func (c *GRPCClient) ListBuckets(ctx context.Context, req *storagepb.ListBucketsRequest, opts ...gax.CallOption) (*storagepb.ListBucketsResponse, error) { +func (c *gRPCClient) ListBuckets(ctx context.Context, req *storagepb.ListBucketsRequest, opts ...gax.CallOption) (*storagepb.ListBucketsResponse, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -1161,8 +1522,7 @@ func (c *GRPCClient) ListBuckets(ctx context.Context, req *storagepb.ListBuckets return resp, nil } -// LockBucketRetentionPolicy locks retention policy on a bucket. -func (c *GRPCClient) LockBucketRetentionPolicy(ctx context.Context, req *storagepb.LockRetentionPolicyRequest, opts ...gax.CallOption) (*storagepb.Bucket, error) { +func (c *gRPCClient) LockBucketRetentionPolicy(ctx context.Context, req *storagepb.LockRetentionPolicyRequest, opts ...gax.CallOption) (*storagepb.Bucket, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -1182,8 +1542,7 @@ func (c *GRPCClient) LockBucketRetentionPolicy(ctx context.Context, req *storage return resp, nil } -// GetBucketIamPolicy gets the IAM policy for the specified bucket. -func (c *GRPCClient) GetBucketIamPolicy(ctx context.Context, req *storagepb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { +func (c *gRPCClient) GetBucketIamPolicy(ctx context.Context, req *storagepb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -1203,8 +1562,7 @@ func (c *GRPCClient) GetBucketIamPolicy(ctx context.Context, req *storagepb.GetI return resp, nil } -// SetBucketIamPolicy updates an IAM policy for the specified bucket. -func (c *GRPCClient) SetBucketIamPolicy(ctx context.Context, req *storagepb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { +func (c *gRPCClient) SetBucketIamPolicy(ctx context.Context, req *storagepb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -1224,9 +1582,7 @@ func (c *GRPCClient) SetBucketIamPolicy(ctx context.Context, req *storagepb.SetI return resp, nil } -// TestBucketIamPermissions tests a set of permissions on the given bucket to see which, if -// any, are held by the caller. -func (c *GRPCClient) TestBucketIamPermissions(ctx context.Context, req *storagepb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) { +func (c *gRPCClient) TestBucketIamPermissions(ctx context.Context, req *storagepb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -1246,9 +1602,7 @@ func (c *GRPCClient) TestBucketIamPermissions(ctx context.Context, req *storagep return resp, nil } -// PatchBucket updates a bucket. Changes to the bucket will be readable immediately after -// writing, but configuration changes may take time to propagate. -func (c *GRPCClient) PatchBucket(ctx context.Context, req *storagepb.PatchBucketRequest, opts ...gax.CallOption) (*storagepb.Bucket, error) { +func (c *gRPCClient) PatchBucket(ctx context.Context, req *storagepb.PatchBucketRequest, opts ...gax.CallOption) (*storagepb.Bucket, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -1268,12 +1622,7 @@ func (c *GRPCClient) PatchBucket(ctx context.Context, req *storagepb.PatchBucket return resp, nil } -// UpdateBucket updates a bucket. Equivalent to PatchBucket, but always replaces all -// mutatable fields of the bucket with new values, reverting all -// unspecified fields to their default values. -// Like PatchBucket, Changes to the bucket will be readable immediately after -// writing, but configuration changes may take time to propagate. -func (c *GRPCClient) UpdateBucket(ctx context.Context, req *storagepb.UpdateBucketRequest, opts ...gax.CallOption) (*storagepb.Bucket, error) { +func (c *gRPCClient) UpdateBucket(ctx context.Context, req *storagepb.UpdateBucketRequest, opts ...gax.CallOption) (*storagepb.Bucket, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -1293,11 +1642,7 @@ func (c *GRPCClient) UpdateBucket(ctx context.Context, req *storagepb.UpdateBuck return resp, nil } -// StopChannel halts “Object Change Notification” push messagages. -// See https://cloud.google.com/storage/docs/object-change-notification (at https://cloud.google.com/storage/docs/object-change-notification) -// Note: this is not related to the newer “Notifications” resource, which -// are stopped using DeleteNotification. -func (c *GRPCClient) StopChannel(ctx context.Context, req *storagepb.StopChannelRequest, opts ...gax.CallOption) error { +func (c *gRPCClient) StopChannel(ctx context.Context, req *storagepb.StopChannelRequest, opts ...gax.CallOption) error { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -1313,9 +1658,7 @@ func (c *GRPCClient) StopChannel(ctx context.Context, req *storagepb.StopChannel return err } -// DeleteDefaultObjectAccessControl permanently deletes the default object ACL entry for the specified entity -// on the specified bucket. -func (c *GRPCClient) DeleteDefaultObjectAccessControl(ctx context.Context, req *storagepb.DeleteDefaultObjectAccessControlRequest, opts ...gax.CallOption) error { +func (c *gRPCClient) DeleteDefaultObjectAccessControl(ctx context.Context, req *storagepb.DeleteDefaultObjectAccessControlRequest, opts ...gax.CallOption) error { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -1331,9 +1674,7 @@ func (c *GRPCClient) DeleteDefaultObjectAccessControl(ctx context.Context, req * return err } -// GetDefaultObjectAccessControl returns the default object ACL entry for the specified entity on the -// specified bucket. -func (c *GRPCClient) GetDefaultObjectAccessControl(ctx context.Context, req *storagepb.GetDefaultObjectAccessControlRequest, opts ...gax.CallOption) (*storagepb.ObjectAccessControl, error) { +func (c *gRPCClient) GetDefaultObjectAccessControl(ctx context.Context, req *storagepb.GetDefaultObjectAccessControlRequest, opts ...gax.CallOption) (*storagepb.ObjectAccessControl, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -1353,8 +1694,7 @@ func (c *GRPCClient) GetDefaultObjectAccessControl(ctx context.Context, req *sto return resp, nil } -// InsertDefaultObjectAccessControl creates a new default object ACL entry on the specified bucket. -func (c *GRPCClient) InsertDefaultObjectAccessControl(ctx context.Context, req *storagepb.InsertDefaultObjectAccessControlRequest, opts ...gax.CallOption) (*storagepb.ObjectAccessControl, error) { +func (c *gRPCClient) InsertDefaultObjectAccessControl(ctx context.Context, req *storagepb.InsertDefaultObjectAccessControlRequest, opts ...gax.CallOption) (*storagepb.ObjectAccessControl, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -1374,8 +1714,7 @@ func (c *GRPCClient) InsertDefaultObjectAccessControl(ctx context.Context, req * return resp, nil } -// ListDefaultObjectAccessControls retrieves default object ACL entries on the specified bucket. -func (c *GRPCClient) ListDefaultObjectAccessControls(ctx context.Context, req *storagepb.ListDefaultObjectAccessControlsRequest, opts ...gax.CallOption) (*storagepb.ListObjectAccessControlsResponse, error) { +func (c *gRPCClient) ListDefaultObjectAccessControls(ctx context.Context, req *storagepb.ListDefaultObjectAccessControlsRequest, opts ...gax.CallOption) (*storagepb.ListObjectAccessControlsResponse, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -1395,8 +1734,7 @@ func (c *GRPCClient) ListDefaultObjectAccessControls(ctx context.Context, req *s return resp, nil } -// PatchDefaultObjectAccessControl updates a default object ACL entry on the specified bucket. -func (c *GRPCClient) PatchDefaultObjectAccessControl(ctx context.Context, req *storagepb.PatchDefaultObjectAccessControlRequest, opts ...gax.CallOption) (*storagepb.ObjectAccessControl, error) { +func (c *gRPCClient) PatchDefaultObjectAccessControl(ctx context.Context, req *storagepb.PatchDefaultObjectAccessControlRequest, opts ...gax.CallOption) (*storagepb.ObjectAccessControl, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -1416,10 +1754,7 @@ func (c *GRPCClient) PatchDefaultObjectAccessControl(ctx context.Context, req *s return resp, nil } -// UpdateDefaultObjectAccessControl updates a default object ACL entry on the specified bucket. Equivalent to -// PatchDefaultObjectAccessControl, but modifies all unspecified fields to -// their default values. -func (c *GRPCClient) UpdateDefaultObjectAccessControl(ctx context.Context, req *storagepb.UpdateDefaultObjectAccessControlRequest, opts ...gax.CallOption) (*storagepb.ObjectAccessControl, error) { +func (c *gRPCClient) UpdateDefaultObjectAccessControl(ctx context.Context, req *storagepb.UpdateDefaultObjectAccessControlRequest, opts ...gax.CallOption) (*storagepb.ObjectAccessControl, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -1439,10 +1774,7 @@ func (c *GRPCClient) UpdateDefaultObjectAccessControl(ctx context.Context, req * return resp, nil } -// DeleteNotification permanently deletes a notification subscription. -// Note: Older, “Object Change Notification” push subscriptions should be -// deleted using StopChannel instead. -func (c *GRPCClient) DeleteNotification(ctx context.Context, req *storagepb.DeleteNotificationRequest, opts ...gax.CallOption) error { +func (c *gRPCClient) DeleteNotification(ctx context.Context, req *storagepb.DeleteNotificationRequest, opts ...gax.CallOption) error { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -1458,8 +1790,7 @@ func (c *GRPCClient) DeleteNotification(ctx context.Context, req *storagepb.Dele return err } -// GetNotification view a notification configuration. -func (c *GRPCClient) GetNotification(ctx context.Context, req *storagepb.GetNotificationRequest, opts ...gax.CallOption) (*storagepb.Notification, error) { +func (c *gRPCClient) GetNotification(ctx context.Context, req *storagepb.GetNotificationRequest, opts ...gax.CallOption) (*storagepb.Notification, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -1479,11 +1810,7 @@ func (c *GRPCClient) GetNotification(ctx context.Context, req *storagepb.GetNoti return resp, nil } -// InsertNotification creates a notification subscription for a given bucket. -// These notifications, when triggered, publish messages to the specified -// Cloud Pub/Sub topics. -// See https://cloud.google.com/storage/docs/pubsub-notifications (at https://cloud.google.com/storage/docs/pubsub-notifications). -func (c *GRPCClient) InsertNotification(ctx context.Context, req *storagepb.InsertNotificationRequest, opts ...gax.CallOption) (*storagepb.Notification, error) { +func (c *gRPCClient) InsertNotification(ctx context.Context, req *storagepb.InsertNotificationRequest, opts ...gax.CallOption) (*storagepb.Notification, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -1503,8 +1830,7 @@ func (c *GRPCClient) InsertNotification(ctx context.Context, req *storagepb.Inse return resp, nil } -// ListNotifications retrieves a list of notification subscriptions for a given bucket. -func (c *GRPCClient) ListNotifications(ctx context.Context, req *storagepb.ListNotificationsRequest, opts ...gax.CallOption) (*storagepb.ListNotificationsResponse, error) { +func (c *gRPCClient) ListNotifications(ctx context.Context, req *storagepb.ListNotificationsRequest, opts ...gax.CallOption) (*storagepb.ListNotificationsResponse, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -1524,9 +1850,7 @@ func (c *GRPCClient) ListNotifications(ctx context.Context, req *storagepb.ListN return resp, nil } -// DeleteObjectAccessControl permanently deletes the ACL entry for the specified entity on the specified -// object. -func (c *GRPCClient) DeleteObjectAccessControl(ctx context.Context, req *storagepb.DeleteObjectAccessControlRequest, opts ...gax.CallOption) error { +func (c *gRPCClient) DeleteObjectAccessControl(ctx context.Context, req *storagepb.DeleteObjectAccessControlRequest, opts ...gax.CallOption) error { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -1542,8 +1866,7 @@ func (c *GRPCClient) DeleteObjectAccessControl(ctx context.Context, req *storage return err } -// GetObjectAccessControl returns the ACL entry for the specified entity on the specified object. -func (c *GRPCClient) GetObjectAccessControl(ctx context.Context, req *storagepb.GetObjectAccessControlRequest, opts ...gax.CallOption) (*storagepb.ObjectAccessControl, error) { +func (c *gRPCClient) GetObjectAccessControl(ctx context.Context, req *storagepb.GetObjectAccessControlRequest, opts ...gax.CallOption) (*storagepb.ObjectAccessControl, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -1563,8 +1886,7 @@ func (c *GRPCClient) GetObjectAccessControl(ctx context.Context, req *storagepb. return resp, nil } -// InsertObjectAccessControl creates a new ACL entry on the specified object. -func (c *GRPCClient) InsertObjectAccessControl(ctx context.Context, req *storagepb.InsertObjectAccessControlRequest, opts ...gax.CallOption) (*storagepb.ObjectAccessControl, error) { +func (c *gRPCClient) InsertObjectAccessControl(ctx context.Context, req *storagepb.InsertObjectAccessControlRequest, opts ...gax.CallOption) (*storagepb.ObjectAccessControl, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -1584,8 +1906,7 @@ func (c *GRPCClient) InsertObjectAccessControl(ctx context.Context, req *storage return resp, nil } -// ListObjectAccessControls retrieves ACL entries on the specified object. -func (c *GRPCClient) ListObjectAccessControls(ctx context.Context, req *storagepb.ListObjectAccessControlsRequest, opts ...gax.CallOption) (*storagepb.ListObjectAccessControlsResponse, error) { +func (c *gRPCClient) ListObjectAccessControls(ctx context.Context, req *storagepb.ListObjectAccessControlsRequest, opts ...gax.CallOption) (*storagepb.ListObjectAccessControlsResponse, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -1605,10 +1926,7 @@ func (c *GRPCClient) ListObjectAccessControls(ctx context.Context, req *storagep return resp, nil } -// PatchObjectAccessControl patches an ACL entry on the specified object. Patch is similar to update, -// but only applies or appends the specified fields in the -// object_access_control object. Other fields are unaffected. -func (c *GRPCClient) PatchObjectAccessControl(ctx context.Context, req *storagepb.PatchObjectAccessControlRequest, opts ...gax.CallOption) (*storagepb.ObjectAccessControl, error) { +func (c *gRPCClient) PatchObjectAccessControl(ctx context.Context, req *storagepb.PatchObjectAccessControlRequest, opts ...gax.CallOption) (*storagepb.ObjectAccessControl, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -1628,8 +1946,7 @@ func (c *GRPCClient) PatchObjectAccessControl(ctx context.Context, req *storagep return resp, nil } -// UpdateObjectAccessControl updates an ACL entry on the specified object. -func (c *GRPCClient) UpdateObjectAccessControl(ctx context.Context, req *storagepb.UpdateObjectAccessControlRequest, opts ...gax.CallOption) (*storagepb.ObjectAccessControl, error) { +func (c *gRPCClient) UpdateObjectAccessControl(ctx context.Context, req *storagepb.UpdateObjectAccessControlRequest, opts ...gax.CallOption) (*storagepb.ObjectAccessControl, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -1649,9 +1966,7 @@ func (c *GRPCClient) UpdateObjectAccessControl(ctx context.Context, req *storage return resp, nil } -// ComposeObject concatenates a list of existing objects into a new object in the same -// bucket. -func (c *GRPCClient) ComposeObject(ctx context.Context, req *storagepb.ComposeObjectRequest, opts ...gax.CallOption) (*storagepb.Object, error) { +func (c *gRPCClient) ComposeObject(ctx context.Context, req *storagepb.ComposeObjectRequest, opts ...gax.CallOption) (*storagepb.Object, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -1671,9 +1986,7 @@ func (c *GRPCClient) ComposeObject(ctx context.Context, req *storagepb.ComposeOb return resp, nil } -// CopyObject copies a source object to a destination object. Optionally overrides -// metadata. -func (c *GRPCClient) CopyObject(ctx context.Context, req *storagepb.CopyObjectRequest, opts ...gax.CallOption) (*storagepb.Object, error) { +func (c *gRPCClient) CopyObject(ctx context.Context, req *storagepb.CopyObjectRequest, opts ...gax.CallOption) (*storagepb.Object, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -1693,10 +2006,7 @@ func (c *GRPCClient) CopyObject(ctx context.Context, req *storagepb.CopyObjectRe return resp, nil } -// DeleteObject deletes an object and its metadata. Deletions are permanent if versioning -// is not enabled for the bucket, or if the generation parameter -// is used. -func (c *GRPCClient) DeleteObject(ctx context.Context, req *storagepb.DeleteObjectRequest, opts ...gax.CallOption) error { +func (c *gRPCClient) DeleteObject(ctx context.Context, req *storagepb.DeleteObjectRequest, opts ...gax.CallOption) error { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -1712,8 +2022,7 @@ func (c *GRPCClient) DeleteObject(ctx context.Context, req *storagepb.DeleteObje return err } -// GetObject retrieves an object’s metadata. -func (c *GRPCClient) GetObject(ctx context.Context, req *storagepb.GetObjectRequest, opts ...gax.CallOption) (*storagepb.Object, error) { +func (c *gRPCClient) GetObject(ctx context.Context, req *storagepb.GetObjectRequest, opts ...gax.CallOption) (*storagepb.Object, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -1733,8 +2042,7 @@ func (c *GRPCClient) GetObject(ctx context.Context, req *storagepb.GetObjectRequ return resp, nil } -// GetObjectMedia reads an object’s data. -func (c *GRPCClient) GetObjectMedia(ctx context.Context, req *storagepb.GetObjectMediaRequest, opts ...gax.CallOption) (storagepb.Storage_GetObjectMediaClient, error) { +func (c *gRPCClient) GetObjectMedia(ctx context.Context, req *storagepb.GetObjectMediaRequest, opts ...gax.CallOption) (storagepb.Storage_GetObjectMediaClient, error) { ctx = insertMetadata(ctx, c.xGoogMetadata) var resp storagepb.Storage_GetObjectMediaClient err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { @@ -1748,31 +2056,7 @@ func (c *GRPCClient) GetObjectMedia(ctx context.Context, req *storagepb.GetObjec return resp, nil } -// InsertObject stores a new object and metadata. -// -// An object can be written either in a single message stream or in a -// resumable sequence of message streams. To write using a single stream, -// the client should include in the first message of the stream an -// InsertObjectSpec describing the destination bucket, object, and any -// preconditions. Additionally, the final message must set ‘finish_write’ to -// true, or else it is an error. -// -// For a resumable write, the client should instead call -// StartResumableWrite() and provide that method an InsertObjectSpec. -// They should then attach the returned upload_id to the first message of -// each following call to Insert. If there is an error or the connection is -// broken during the resumable Insert(), the client should check the status -// of the Insert() by calling QueryWriteStatus() and continue writing from -// the returned committed_size. This may be less than the amount of data the -// client previously sent. -// -// The service will not view the object as complete until the client has -// sent an Insert with finish_write set to true. Sending any -// requests on a stream after sending a request with finish_write set to -// true will cause an error. The client should check the -// Object it receives to determine how much data the service was -// able to commit and whether the service views the object as complete. -func (c *GRPCClient) InsertObject(ctx context.Context, opts ...gax.CallOption) (storagepb.Storage_InsertObjectClient, error) { +func (c *gRPCClient) InsertObject(ctx context.Context, opts ...gax.CallOption) (storagepb.Storage_InsertObjectClient, error) { ctx = insertMetadata(ctx, c.xGoogMetadata) var resp storagepb.Storage_InsertObjectClient opts = append((*c.CallOptions).InsertObject[0:len((*c.CallOptions).InsertObject):len((*c.CallOptions).InsertObject)], opts...) @@ -1787,8 +2071,7 @@ func (c *GRPCClient) InsertObject(ctx context.Context, opts ...gax.CallOption) ( return resp, nil } -// ListObjects retrieves a list of objects matching the criteria. -func (c *GRPCClient) ListObjects(ctx context.Context, req *storagepb.ListObjectsRequest, opts ...gax.CallOption) (*storagepb.ListObjectsResponse, error) { +func (c *gRPCClient) ListObjects(ctx context.Context, req *storagepb.ListObjectsRequest, opts ...gax.CallOption) (*storagepb.ListObjectsResponse, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -1808,9 +2091,7 @@ func (c *GRPCClient) ListObjects(ctx context.Context, req *storagepb.ListObjects return resp, nil } -// RewriteObject rewrites a source object to a destination object. Optionally overrides -// metadata. -func (c *GRPCClient) RewriteObject(ctx context.Context, req *storagepb.RewriteObjectRequest, opts ...gax.CallOption) (*storagepb.RewriteResponse, error) { +func (c *gRPCClient) RewriteObject(ctx context.Context, req *storagepb.RewriteObjectRequest, opts ...gax.CallOption) (*storagepb.RewriteResponse, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -1830,10 +2111,7 @@ func (c *GRPCClient) RewriteObject(ctx context.Context, req *storagepb.RewriteOb return resp, nil } -// StartResumableWrite starts a resumable write. How long the write operation remains valid, and -// what happens when the write operation becomes invalid, are -// service-dependent. -func (c *GRPCClient) StartResumableWrite(ctx context.Context, req *storagepb.StartResumableWriteRequest, opts ...gax.CallOption) (*storagepb.StartResumableWriteResponse, error) { +func (c *gRPCClient) StartResumableWrite(ctx context.Context, req *storagepb.StartResumableWriteRequest, opts ...gax.CallOption) (*storagepb.StartResumableWriteResponse, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -1853,20 +2131,7 @@ func (c *GRPCClient) StartResumableWrite(ctx context.Context, req *storagepb.Sta return resp, nil } -// QueryWriteStatus determines the committed_size for an object that is being written, which -// can then be used as the write_offset for the next Write() call. -// -// If the object does not exist (i.e., the object has been deleted, or the -// first Write() has not yet reached the service), this method returns the -// error NOT_FOUND. -// -// The client may call QueryWriteStatus() at any time to determine how -// much data has been processed for this object. This is useful if the -// client is buffering data and needs to know which data can be safely -// evicted. For any sequence of QueryWriteStatus() calls for a given -// object name, the sequence of returned committed_size values will be -// non-decreasing. -func (c *GRPCClient) QueryWriteStatus(ctx context.Context, req *storagepb.QueryWriteStatusRequest, opts ...gax.CallOption) (*storagepb.QueryWriteStatusResponse, error) { +func (c *gRPCClient) QueryWriteStatus(ctx context.Context, req *storagepb.QueryWriteStatusRequest, opts ...gax.CallOption) (*storagepb.QueryWriteStatusResponse, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -1886,8 +2151,7 @@ func (c *GRPCClient) QueryWriteStatus(ctx context.Context, req *storagepb.QueryW return resp, nil } -// PatchObject updates an object’s metadata. -func (c *GRPCClient) PatchObject(ctx context.Context, req *storagepb.PatchObjectRequest, opts ...gax.CallOption) (*storagepb.Object, error) { +func (c *gRPCClient) PatchObject(ctx context.Context, req *storagepb.PatchObjectRequest, opts ...gax.CallOption) (*storagepb.Object, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -1907,10 +2171,7 @@ func (c *GRPCClient) PatchObject(ctx context.Context, req *storagepb.PatchObject return resp, nil } -// UpdateObject updates an object’s metadata. Equivalent to PatchObject, but always -// replaces all mutatable fields of the bucket with new values, reverting all -// unspecified fields to their default values. -func (c *GRPCClient) UpdateObject(ctx context.Context, req *storagepb.UpdateObjectRequest, opts ...gax.CallOption) (*storagepb.Object, error) { +func (c *gRPCClient) UpdateObject(ctx context.Context, req *storagepb.UpdateObjectRequest, opts ...gax.CallOption) (*storagepb.Object, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -1930,8 +2191,7 @@ func (c *GRPCClient) UpdateObject(ctx context.Context, req *storagepb.UpdateObje return resp, nil } -// GetObjectIamPolicy gets the IAM policy for the specified object. -func (c *GRPCClient) GetObjectIamPolicy(ctx context.Context, req *storagepb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { +func (c *gRPCClient) GetObjectIamPolicy(ctx context.Context, req *storagepb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -1951,8 +2211,7 @@ func (c *GRPCClient) GetObjectIamPolicy(ctx context.Context, req *storagepb.GetI return resp, nil } -// SetObjectIamPolicy updates an IAM policy for the specified object. -func (c *GRPCClient) SetObjectIamPolicy(ctx context.Context, req *storagepb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { +func (c *gRPCClient) SetObjectIamPolicy(ctx context.Context, req *storagepb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -1972,9 +2231,7 @@ func (c *GRPCClient) SetObjectIamPolicy(ctx context.Context, req *storagepb.SetI return resp, nil } -// TestObjectIamPermissions tests a set of permissions on the given object to see which, if -// any, are held by the caller. -func (c *GRPCClient) TestObjectIamPermissions(ctx context.Context, req *storagepb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) { +func (c *gRPCClient) TestObjectIamPermissions(ctx context.Context, req *storagepb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -1994,8 +2251,7 @@ func (c *GRPCClient) TestObjectIamPermissions(ctx context.Context, req *storagep return resp, nil } -// WatchAllObjects watch for changes on all objects in a bucket. -func (c *GRPCClient) WatchAllObjects(ctx context.Context, req *storagepb.WatchAllObjectsRequest, opts ...gax.CallOption) (*storagepb.Channel, error) { +func (c *gRPCClient) WatchAllObjects(ctx context.Context, req *storagepb.WatchAllObjectsRequest, opts ...gax.CallOption) (*storagepb.Channel, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -2015,8 +2271,7 @@ func (c *GRPCClient) WatchAllObjects(ctx context.Context, req *storagepb.WatchAl return resp, nil } -// GetServiceAccount retrieves the name of a project’s Google Cloud Storage service account. -func (c *GRPCClient) GetServiceAccount(ctx context.Context, req *storagepb.GetProjectServiceAccountRequest, opts ...gax.CallOption) (*storagepb.ServiceAccount, error) { +func (c *gRPCClient) GetServiceAccount(ctx context.Context, req *storagepb.GetProjectServiceAccountRequest, opts ...gax.CallOption) (*storagepb.ServiceAccount, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -2036,8 +2291,7 @@ func (c *GRPCClient) GetServiceAccount(ctx context.Context, req *storagepb.GetPr return resp, nil } -// CreateHmacKey creates a new HMAC key for the given service account. -func (c *GRPCClient) CreateHmacKey(ctx context.Context, req *storagepb.CreateHmacKeyRequest, opts ...gax.CallOption) (*storagepb.CreateHmacKeyResponse, error) { +func (c *gRPCClient) CreateHmacKey(ctx context.Context, req *storagepb.CreateHmacKeyRequest, opts ...gax.CallOption) (*storagepb.CreateHmacKeyResponse, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -2057,8 +2311,7 @@ func (c *GRPCClient) CreateHmacKey(ctx context.Context, req *storagepb.CreateHma return resp, nil } -// DeleteHmacKey deletes a given HMAC key. Key must be in an INACTIVE state. -func (c *GRPCClient) DeleteHmacKey(ctx context.Context, req *storagepb.DeleteHmacKeyRequest, opts ...gax.CallOption) error { +func (c *gRPCClient) DeleteHmacKey(ctx context.Context, req *storagepb.DeleteHmacKeyRequest, opts ...gax.CallOption) error { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -2074,8 +2327,7 @@ func (c *GRPCClient) DeleteHmacKey(ctx context.Context, req *storagepb.DeleteHma return err } -// GetHmacKey gets an existing HMAC key metadata for the given id. -func (c *GRPCClient) GetHmacKey(ctx context.Context, req *storagepb.GetHmacKeyRequest, opts ...gax.CallOption) (*storagepb.HmacKeyMetadata, error) { +func (c *gRPCClient) GetHmacKey(ctx context.Context, req *storagepb.GetHmacKeyRequest, opts ...gax.CallOption) (*storagepb.HmacKeyMetadata, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -2095,8 +2347,7 @@ func (c *GRPCClient) GetHmacKey(ctx context.Context, req *storagepb.GetHmacKeyRe return resp, nil } -// ListHmacKeys lists HMAC keys under a given project with the additional filters provided. -func (c *GRPCClient) ListHmacKeys(ctx context.Context, req *storagepb.ListHmacKeysRequest, opts ...gax.CallOption) (*storagepb.ListHmacKeysResponse, error) { +func (c *gRPCClient) ListHmacKeys(ctx context.Context, req *storagepb.ListHmacKeysRequest, opts ...gax.CallOption) (*storagepb.ListHmacKeysResponse, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -2116,8 +2367,7 @@ func (c *GRPCClient) ListHmacKeys(ctx context.Context, req *storagepb.ListHmacKe return resp, nil } -// UpdateHmacKey updates a given HMAC key state between ACTIVE and INACTIVE. -func (c *GRPCClient) UpdateHmacKey(ctx context.Context, req *storagepb.UpdateHmacKeyRequest, opts ...gax.CallOption) (*storagepb.HmacKeyMetadata, error) { +func (c *gRPCClient) UpdateHmacKey(ctx context.Context, req *storagepb.UpdateHmacKeyRequest, opts ...gax.CallOption) (*storagepb.HmacKeyMetadata, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() diff --git a/storage/internal/apiv1/storage_client_example_test.go b/storage/internal/apiv1/storage_client_example_test.go index 6591fc9d209..8dbd77f7fbe 100644 --- a/storage/internal/apiv1/storage_client_example_test.go +++ b/storage/internal/apiv1/storage_client_example_test.go @@ -29,6 +29,8 @@ func ExampleNewClient() { if err != nil { // TODO: Handle error. } + defer c.Close() + // TODO: Use client. _ = c } @@ -39,6 +41,7 @@ func ExampleClient_DeleteBucketAccessControl() { if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.DeleteBucketAccessControlRequest{ // TODO: Fill request struct fields. @@ -50,13 +53,12 @@ func ExampleClient_DeleteBucketAccessControl() { } func ExampleClient_GetBucketAccessControl() { - // import storagepb "google.golang.org/genproto/googleapis/storage/v1" - ctx := context.Background() c, err := storage.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.GetBucketAccessControlRequest{ // TODO: Fill request struct fields. @@ -70,13 +72,12 @@ func ExampleClient_GetBucketAccessControl() { } func ExampleClient_InsertBucketAccessControl() { - // import storagepb "google.golang.org/genproto/googleapis/storage/v1" - ctx := context.Background() c, err := storage.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.InsertBucketAccessControlRequest{ // TODO: Fill request struct fields. @@ -90,13 +91,12 @@ func ExampleClient_InsertBucketAccessControl() { } func ExampleClient_ListBucketAccessControls() { - // import storagepb "google.golang.org/genproto/googleapis/storage/v1" - ctx := context.Background() c, err := storage.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.ListBucketAccessControlsRequest{ // TODO: Fill request struct fields. @@ -110,13 +110,12 @@ func ExampleClient_ListBucketAccessControls() { } func ExampleClient_UpdateBucketAccessControl() { - // import storagepb "google.golang.org/genproto/googleapis/storage/v1" - ctx := context.Background() c, err := storage.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.UpdateBucketAccessControlRequest{ // TODO: Fill request struct fields. @@ -130,13 +129,12 @@ func ExampleClient_UpdateBucketAccessControl() { } func ExampleClient_PatchBucketAccessControl() { - // import storagepb "google.golang.org/genproto/googleapis/storage/v1" - ctx := context.Background() c, err := storage.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.PatchBucketAccessControlRequest{ // TODO: Fill request struct fields. @@ -155,6 +153,7 @@ func ExampleClient_DeleteBucket() { if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.DeleteBucketRequest{ // TODO: Fill request struct fields. @@ -166,13 +165,12 @@ func ExampleClient_DeleteBucket() { } func ExampleClient_GetBucket() { - // import storagepb "google.golang.org/genproto/googleapis/storage/v1" - ctx := context.Background() c, err := storage.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.GetBucketRequest{ // TODO: Fill request struct fields. @@ -186,13 +184,12 @@ func ExampleClient_GetBucket() { } func ExampleClient_InsertBucket() { - // import storagepb "google.golang.org/genproto/googleapis/storage/v1" - ctx := context.Background() c, err := storage.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.InsertBucketRequest{ // TODO: Fill request struct fields. @@ -206,13 +203,12 @@ func ExampleClient_InsertBucket() { } func ExampleClient_ListChannels() { - // import storagepb "google.golang.org/genproto/googleapis/storage/v1" - ctx := context.Background() c, err := storage.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.ListChannelsRequest{ // TODO: Fill request struct fields. @@ -226,13 +222,12 @@ func ExampleClient_ListChannels() { } func ExampleClient_ListBuckets() { - // import storagepb "google.golang.org/genproto/googleapis/storage/v1" - ctx := context.Background() c, err := storage.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.ListBucketsRequest{ // TODO: Fill request struct fields. @@ -246,13 +241,12 @@ func ExampleClient_ListBuckets() { } func ExampleClient_LockBucketRetentionPolicy() { - // import storagepb "google.golang.org/genproto/googleapis/storage/v1" - ctx := context.Background() c, err := storage.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.LockRetentionPolicyRequest{ // TODO: Fill request struct fields. @@ -266,13 +260,12 @@ func ExampleClient_LockBucketRetentionPolicy() { } func ExampleClient_GetBucketIamPolicy() { - // import storagepb "google.golang.org/genproto/googleapis/storage/v1" - ctx := context.Background() c, err := storage.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.GetIamPolicyRequest{ // TODO: Fill request struct fields. @@ -286,13 +279,12 @@ func ExampleClient_GetBucketIamPolicy() { } func ExampleClient_SetBucketIamPolicy() { - // import storagepb "google.golang.org/genproto/googleapis/storage/v1" - ctx := context.Background() c, err := storage.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.SetIamPolicyRequest{ // TODO: Fill request struct fields. @@ -306,13 +298,12 @@ func ExampleClient_SetBucketIamPolicy() { } func ExampleClient_TestBucketIamPermissions() { - // import storagepb "google.golang.org/genproto/googleapis/storage/v1" - ctx := context.Background() c, err := storage.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.TestIamPermissionsRequest{ // TODO: Fill request struct fields. @@ -326,13 +317,12 @@ func ExampleClient_TestBucketIamPermissions() { } func ExampleClient_PatchBucket() { - // import storagepb "google.golang.org/genproto/googleapis/storage/v1" - ctx := context.Background() c, err := storage.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.PatchBucketRequest{ // TODO: Fill request struct fields. @@ -346,13 +336,12 @@ func ExampleClient_PatchBucket() { } func ExampleClient_UpdateBucket() { - // import storagepb "google.golang.org/genproto/googleapis/storage/v1" - ctx := context.Background() c, err := storage.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.UpdateBucketRequest{ // TODO: Fill request struct fields. @@ -371,6 +360,7 @@ func ExampleClient_StopChannel() { if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.StopChannelRequest{ // TODO: Fill request struct fields. @@ -387,6 +377,7 @@ func ExampleClient_DeleteDefaultObjectAccessControl() { if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.DeleteDefaultObjectAccessControlRequest{ // TODO: Fill request struct fields. @@ -398,13 +389,12 @@ func ExampleClient_DeleteDefaultObjectAccessControl() { } func ExampleClient_GetDefaultObjectAccessControl() { - // import storagepb "google.golang.org/genproto/googleapis/storage/v1" - ctx := context.Background() c, err := storage.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.GetDefaultObjectAccessControlRequest{ // TODO: Fill request struct fields. @@ -418,13 +408,12 @@ func ExampleClient_GetDefaultObjectAccessControl() { } func ExampleClient_InsertDefaultObjectAccessControl() { - // import storagepb "google.golang.org/genproto/googleapis/storage/v1" - ctx := context.Background() c, err := storage.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.InsertDefaultObjectAccessControlRequest{ // TODO: Fill request struct fields. @@ -438,13 +427,12 @@ func ExampleClient_InsertDefaultObjectAccessControl() { } func ExampleClient_ListDefaultObjectAccessControls() { - // import storagepb "google.golang.org/genproto/googleapis/storage/v1" - ctx := context.Background() c, err := storage.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.ListDefaultObjectAccessControlsRequest{ // TODO: Fill request struct fields. @@ -458,13 +446,12 @@ func ExampleClient_ListDefaultObjectAccessControls() { } func ExampleClient_PatchDefaultObjectAccessControl() { - // import storagepb "google.golang.org/genproto/googleapis/storage/v1" - ctx := context.Background() c, err := storage.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.PatchDefaultObjectAccessControlRequest{ // TODO: Fill request struct fields. @@ -478,13 +465,12 @@ func ExampleClient_PatchDefaultObjectAccessControl() { } func ExampleClient_UpdateDefaultObjectAccessControl() { - // import storagepb "google.golang.org/genproto/googleapis/storage/v1" - ctx := context.Background() c, err := storage.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.UpdateDefaultObjectAccessControlRequest{ // TODO: Fill request struct fields. @@ -503,6 +489,7 @@ func ExampleClient_DeleteNotification() { if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.DeleteNotificationRequest{ // TODO: Fill request struct fields. @@ -514,13 +501,12 @@ func ExampleClient_DeleteNotification() { } func ExampleClient_GetNotification() { - // import storagepb "google.golang.org/genproto/googleapis/storage/v1" - ctx := context.Background() c, err := storage.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.GetNotificationRequest{ // TODO: Fill request struct fields. @@ -534,13 +520,12 @@ func ExampleClient_GetNotification() { } func ExampleClient_InsertNotification() { - // import storagepb "google.golang.org/genproto/googleapis/storage/v1" - ctx := context.Background() c, err := storage.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.InsertNotificationRequest{ // TODO: Fill request struct fields. @@ -554,13 +539,12 @@ func ExampleClient_InsertNotification() { } func ExampleClient_ListNotifications() { - // import storagepb "google.golang.org/genproto/googleapis/storage/v1" - ctx := context.Background() c, err := storage.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.ListNotificationsRequest{ // TODO: Fill request struct fields. @@ -579,6 +563,7 @@ func ExampleClient_DeleteObjectAccessControl() { if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.DeleteObjectAccessControlRequest{ // TODO: Fill request struct fields. @@ -590,13 +575,12 @@ func ExampleClient_DeleteObjectAccessControl() { } func ExampleClient_GetObjectAccessControl() { - // import storagepb "google.golang.org/genproto/googleapis/storage/v1" - ctx := context.Background() c, err := storage.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.GetObjectAccessControlRequest{ // TODO: Fill request struct fields. @@ -610,13 +594,12 @@ func ExampleClient_GetObjectAccessControl() { } func ExampleClient_InsertObjectAccessControl() { - // import storagepb "google.golang.org/genproto/googleapis/storage/v1" - ctx := context.Background() c, err := storage.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.InsertObjectAccessControlRequest{ // TODO: Fill request struct fields. @@ -630,13 +613,12 @@ func ExampleClient_InsertObjectAccessControl() { } func ExampleClient_ListObjectAccessControls() { - // import storagepb "google.golang.org/genproto/googleapis/storage/v1" - ctx := context.Background() c, err := storage.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.ListObjectAccessControlsRequest{ // TODO: Fill request struct fields. @@ -650,13 +632,12 @@ func ExampleClient_ListObjectAccessControls() { } func ExampleClient_PatchObjectAccessControl() { - // import storagepb "google.golang.org/genproto/googleapis/storage/v1" - ctx := context.Background() c, err := storage.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.PatchObjectAccessControlRequest{ // TODO: Fill request struct fields. @@ -670,13 +651,12 @@ func ExampleClient_PatchObjectAccessControl() { } func ExampleClient_UpdateObjectAccessControl() { - // import storagepb "google.golang.org/genproto/googleapis/storage/v1" - ctx := context.Background() c, err := storage.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.UpdateObjectAccessControlRequest{ // TODO: Fill request struct fields. @@ -690,13 +670,12 @@ func ExampleClient_UpdateObjectAccessControl() { } func ExampleClient_ComposeObject() { - // import storagepb "google.golang.org/genproto/googleapis/storage/v1" - ctx := context.Background() c, err := storage.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.ComposeObjectRequest{ // TODO: Fill request struct fields. @@ -710,13 +689,12 @@ func ExampleClient_ComposeObject() { } func ExampleClient_CopyObject() { - // import storagepb "google.golang.org/genproto/googleapis/storage/v1" - ctx := context.Background() c, err := storage.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.CopyObjectRequest{ // TODO: Fill request struct fields. @@ -735,6 +713,7 @@ func ExampleClient_DeleteObject() { if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.DeleteObjectRequest{ // TODO: Fill request struct fields. @@ -746,13 +725,12 @@ func ExampleClient_DeleteObject() { } func ExampleClient_GetObject() { - // import storagepb "google.golang.org/genproto/googleapis/storage/v1" - ctx := context.Background() c, err := storage.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.GetObjectRequest{ // TODO: Fill request struct fields. @@ -766,13 +744,12 @@ func ExampleClient_GetObject() { } func ExampleClient_ListObjects() { - // import storagepb "google.golang.org/genproto/googleapis/storage/v1" - ctx := context.Background() c, err := storage.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.ListObjectsRequest{ // TODO: Fill request struct fields. @@ -786,13 +763,12 @@ func ExampleClient_ListObjects() { } func ExampleClient_RewriteObject() { - // import storagepb "google.golang.org/genproto/googleapis/storage/v1" - ctx := context.Background() c, err := storage.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.RewriteObjectRequest{ // TODO: Fill request struct fields. @@ -806,13 +782,12 @@ func ExampleClient_RewriteObject() { } func ExampleClient_StartResumableWrite() { - // import storagepb "google.golang.org/genproto/googleapis/storage/v1" - ctx := context.Background() c, err := storage.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.StartResumableWriteRequest{ // TODO: Fill request struct fields. @@ -826,13 +801,12 @@ func ExampleClient_StartResumableWrite() { } func ExampleClient_QueryWriteStatus() { - // import storagepb "google.golang.org/genproto/googleapis/storage/v1" - ctx := context.Background() c, err := storage.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.QueryWriteStatusRequest{ // TODO: Fill request struct fields. @@ -846,13 +820,12 @@ func ExampleClient_QueryWriteStatus() { } func ExampleClient_PatchObject() { - // import storagepb "google.golang.org/genproto/googleapis/storage/v1" - ctx := context.Background() c, err := storage.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.PatchObjectRequest{ // TODO: Fill request struct fields. @@ -866,13 +839,12 @@ func ExampleClient_PatchObject() { } func ExampleClient_UpdateObject() { - // import storagepb "google.golang.org/genproto/googleapis/storage/v1" - ctx := context.Background() c, err := storage.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.UpdateObjectRequest{ // TODO: Fill request struct fields. @@ -886,13 +858,12 @@ func ExampleClient_UpdateObject() { } func ExampleClient_GetObjectIamPolicy() { - // import storagepb "google.golang.org/genproto/googleapis/storage/v1" - ctx := context.Background() c, err := storage.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.GetIamPolicyRequest{ // TODO: Fill request struct fields. @@ -906,13 +877,12 @@ func ExampleClient_GetObjectIamPolicy() { } func ExampleClient_SetObjectIamPolicy() { - // import storagepb "google.golang.org/genproto/googleapis/storage/v1" - ctx := context.Background() c, err := storage.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.SetIamPolicyRequest{ // TODO: Fill request struct fields. @@ -926,13 +896,12 @@ func ExampleClient_SetObjectIamPolicy() { } func ExampleClient_TestObjectIamPermissions() { - // import storagepb "google.golang.org/genproto/googleapis/storage/v1" - ctx := context.Background() c, err := storage.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.TestIamPermissionsRequest{ // TODO: Fill request struct fields. @@ -946,13 +915,12 @@ func ExampleClient_TestObjectIamPermissions() { } func ExampleClient_WatchAllObjects() { - // import storagepb "google.golang.org/genproto/googleapis/storage/v1" - ctx := context.Background() c, err := storage.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.WatchAllObjectsRequest{ // TODO: Fill request struct fields. @@ -966,13 +934,12 @@ func ExampleClient_WatchAllObjects() { } func ExampleClient_GetServiceAccount() { - // import storagepb "google.golang.org/genproto/googleapis/storage/v1" - ctx := context.Background() c, err := storage.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.GetProjectServiceAccountRequest{ // TODO: Fill request struct fields. @@ -986,13 +953,12 @@ func ExampleClient_GetServiceAccount() { } func ExampleClient_CreateHmacKey() { - // import storagepb "google.golang.org/genproto/googleapis/storage/v1" - ctx := context.Background() c, err := storage.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.CreateHmacKeyRequest{ // TODO: Fill request struct fields. @@ -1011,6 +977,7 @@ func ExampleClient_DeleteHmacKey() { if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.DeleteHmacKeyRequest{ // TODO: Fill request struct fields. @@ -1022,13 +989,12 @@ func ExampleClient_DeleteHmacKey() { } func ExampleClient_GetHmacKey() { - // import storagepb "google.golang.org/genproto/googleapis/storage/v1" - ctx := context.Background() c, err := storage.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.GetHmacKeyRequest{ // TODO: Fill request struct fields. @@ -1042,13 +1008,12 @@ func ExampleClient_GetHmacKey() { } func ExampleClient_ListHmacKeys() { - // import storagepb "google.golang.org/genproto/googleapis/storage/v1" - ctx := context.Background() c, err := storage.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.ListHmacKeysRequest{ // TODO: Fill request struct fields. @@ -1062,13 +1027,12 @@ func ExampleClient_ListHmacKeys() { } func ExampleClient_UpdateHmacKey() { - // import storagepb "google.golang.org/genproto/googleapis/storage/v1" - ctx := context.Background() c, err := storage.NewClient(ctx) if err != nil { // TODO: Handle error. } + defer c.Close() req := &storagepb.UpdateHmacKeyRequest{ // TODO: Fill request struct fields.