Skip to content

Commit

Permalink
docs(storage): fix CustomTime docs (#3568)
Browse files Browse the repository at this point in the history
Update docs for ObjectAttrsToUpdate to account for behavior
of CustomTime field.

Closes #3474
  • Loading branch information
tritone committed Jan 29, 2021
1 parent 13d50b9 commit 8617812
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions storage/storage.go
Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 8617812

Please sign in to comment.