From 86178128cae668f46d014569d5c25844aa379cdb Mon Sep 17 00:00:00 2001 From: Chris Cotter Date: Thu, 28 Jan 2021 21:50:02 -0500 Subject: [PATCH] docs(storage): fix CustomTime docs (#3568) Update docs for ObjectAttrsToUpdate to account for behavior of CustomTime field. Closes #3474 --- storage/storage.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/storage/storage.go b/storage/storage.go index 8852b9c6fc5..c46d7c21c58 100644 --- a/storage/storage.go +++ b/storage/storage.go @@ -829,8 +829,8 @@ func (o *ObjectHandle) Attrs(ctx context.Context) (attrs *ObjectAttrs, err error return newObject(obj), nil } -// Update updates an object with the provided attributes. -// All zero-value attributes are ignored. +// Update updates an object with the provided attributes. See +// ObjectAttrsToUpdate docs for details on treatment of zero values. // ErrObjectNotExist will be returned if the object is not found. func (o *ObjectHandle) Update(ctx context.Context, uattrs ObjectAttrsToUpdate) (oa *ObjectAttrs, err error) { ctx = trace.StartSpan(ctx, "cloud.google.com/go/storage.Object.Update") @@ -941,7 +941,8 @@ func (o *ObjectHandle) ObjectName() string { // ObjectAttrsToUpdate is used to update the attributes of an object. // Only fields set to non-nil values will be updated. -// Set a field to its zero value to delete it. +// For all fields except CustomTime, set the field to its zero value to delete +// it. CustomTime cannot be deleted or changed to an earlier time once set. // // For example, to change ContentType and delete ContentEncoding and // Metadata, use @@ -958,8 +959,8 @@ type ObjectAttrsToUpdate struct { ContentEncoding optional.String ContentDisposition optional.String CacheControl optional.String - CustomTime time.Time - Metadata map[string]string // set to map[string]string{} to delete + CustomTime time.Time // Cannot be deleted or backdated from its current value. + Metadata map[string]string // Set to map[string]string{} to delete. ACL []ACLRule // If not empty, applies a predefined set of access controls. ACL must be nil. @@ -1229,7 +1230,8 @@ type ObjectAttrs struct { // LifecycleConditions to manage object lifecycles. // // CustomTime cannot be removed once set on an object. It can be updated to a - // later value but not to an earlier one. + // later value but not to an earlier one. For more information see + // https://cloud.google.com/storage/docs/metadata#custom-time . CustomTime time.Time }