@@ -514,6 +514,9 @@ type BucketAttrs struct {
514514 // It cannot be modified after bucket creation time.
515515 // UniformBucketLevelAccess must also also be enabled on the bucket.
516516 HierarchicalNamespace * HierarchicalNamespace
517+
518+ // OwnerEntity contains entity information in the form "project-owner-projectId".
519+ OwnerEntity string
517520}
518521
519522// BucketPolicyOnly is an alias for UniformBucketLevelAccess.
@@ -864,6 +867,7 @@ func newBucket(b *raw.Bucket) (*BucketAttrs, error) {
864867 Autoclass : toAutoclassFromRaw (b .Autoclass ),
865868 SoftDeletePolicy : toSoftDeletePolicyFromRaw (b .SoftDeletePolicy ),
866869 HierarchicalNamespace : toHierarchicalNamespaceFromRaw (b .HierarchicalNamespace ),
870+ OwnerEntity : ownerEntityFromRaw (b .Owner ),
867871 }, nil
868872}
869873
@@ -900,6 +904,7 @@ func newBucketFromProto(b *storagepb.Bucket) *BucketAttrs {
900904 Autoclass : toAutoclassFromProto (b .GetAutoclass ()),
901905 SoftDeletePolicy : toSoftDeletePolicyFromProto (b .SoftDeletePolicy ),
902906 HierarchicalNamespace : toHierarchicalNamespaceFromProto (b .HierarchicalNamespace ),
907+ OwnerEntity : ownerEntityFromProto (b .GetOwner ()),
903908 }
904909}
905910
@@ -2224,6 +2229,20 @@ func toHierarchicalNamespaceFromRaw(r *raw.BucketHierarchicalNamespace) *Hierarc
22242229 }
22252230}
22262231
2232+ func ownerEntityFromRaw (r * raw.BucketOwner ) string {
2233+ if r == nil {
2234+ return ""
2235+ }
2236+ return r .Entity
2237+ }
2238+
2239+ func ownerEntityFromProto (p * storagepb.Owner ) string {
2240+ if p == nil {
2241+ return ""
2242+ }
2243+ return p .GetEntity ()
2244+ }
2245+
22272246// Objects returns an iterator over the objects in the bucket that match the
22282247// Query q. If q is nil, no filtering is done. Objects will be iterated over
22292248// lexicographically by name.
0 commit comments