1### YamlMime:UniversalReference
2items:
3- uid: cloud.google.com/go/storage
4  name: cloud.google.com/go/storage
5  id: storage
6  summary: "<p>Package storage provides an easy way to work with Google Cloud Storage.\nGoogle
7    Cloud Storage stores data in named objects, which are grouped into buckets.</p>\n<p>More
8    information about Google Cloud Storage is available at\nhttps://cloud.google.com/storage/docs.</p>\n<p>See
9    https://godoc.org/cloud.google.com/go for authentication, timeouts,\nconnection
10    pooling and similar aspects of this package.</p>\n<p>All of the methods of this
11    package use exponential backoff to retry calls that fail\nwith certain errors,
12    as described in\nhttps://cloud.google.com/storage/docs/exponential-backoff. Retrying
13    continues\nindefinitely unless the controlling context is canceled or the client
14    is closed. See\ncontext.WithTimeout and context.WithCancel.</p>\n<h3>Creating
15    a Client</h3>\n<p>To start working with this package, create a client:</p>\n<pre><code
16    class=\"prettyprint\">ctx := context.Background()\nclient, err := storage.NewClient(ctx)\nif
17    err != nil {\n    // TODO: Handle error.\n}\n</code></pre><p>The client will use
18    your default application credentials. Clients should be\nreused instead of created
19    as needed. The methods of Client are safe for\nconcurrent use by multiple goroutines.</p>\n<p>If
20    you only wish to access public data, you can create\nan unauthenticated client
21    with</p>\n<pre><code class=\"prettyprint\">client, err := storage.NewClient(ctx,
22    option.WithoutAuthentication())\n</code></pre><h3>Buckets</h3>\n<p>A Google Cloud
23    Storage bucket is a collection of objects. To work with a\nbucket, make a bucket
24    handle:</p>\n<pre><code class=\"prettyprint\">bkt := client.Bucket(bucketName)\n</code></pre><p>A
25    handle is a reference to a bucket. You can have a handle even if the\nbucket doesn't
26    exist yet. To create a bucket in Google Cloud Storage,\ncall Create on the handle:</p>\n<pre><code
27    class=\"prettyprint\">if err := bkt.Create(ctx, projectID, nil); err != nil {\n
28    \   // TODO: Handle error.\n}\n</code></pre><p>Note that although buckets are
29    associated with projects, bucket names are\nglobal across all projects.</p>\n<p>Each
30    bucket has associated metadata, represented in this package by\nBucketAttrs. The
31    third argument to BucketHandle.Create allows you to set\nthe initial BucketAttrs
32    of a bucket. To retrieve a bucket's attributes, use\nAttrs:</p>\n<pre><code class=\"prettyprint\">attrs,
33    err := bkt.Attrs(ctx)\nif err != nil {\n    // TODO: Handle error.\n}\nfmt.Printf(&quot;bucket
34    %s, created at %s, is located in %s with storage class %s\\n&quot;,\n    attrs.Name,
35    attrs.Created, attrs.Location, attrs.StorageClass)\n</code></pre><h3>Objects</h3>\n<p>An
36    object holds arbitrary data as a sequence of bytes, like a file. You\nrefer to
37    objects using a handle, just as with buckets, but unlike buckets\nyou don't explicitly
38    create an object. Instead, the first time you write\nto an object it will be created.
39    You can use the standard Go io.Reader\nand io.Writer interfaces to read and write
40    object data:</p>\n<pre><code class=\"prettyprint\">obj := bkt.Object(&quot;data&quot;)\n//
41    Write something to obj.\n// w implements io.Writer.\nw := obj.NewWriter(ctx)\n//
42    Write some text to obj. This will either create the object or overwrite whatever
43    is there already.\nif _, err := fmt.Fprintf(w, &quot;This object contains text.\\n&quot;);
44    err != nil {\n    // TODO: Handle error.\n}\n// Close, just like writing a file.\nif
45    err := w.Close(); err != nil {\n    // TODO: Handle error.\n}\n\n// Read it back.\nr,
46    err := obj.NewReader(ctx)\nif err != nil {\n    // TODO: Handle error.\n}\ndefer
47    r.Close()\nif _, err := io.Copy(os.Stdout, r); err != nil {\n    // TODO: Handle
48    error.\n}\n// Prints &quot;This object contains text.&quot;\n</code></pre><p>Objects
49    also have attributes, which you can fetch with Attrs:</p>\n<pre><code class=\"prettyprint\">objAttrs,
50    err := obj.Attrs(ctx)\nif err != nil {\n    // TODO: Handle error.\n}\nfmt.Printf(&quot;object
51    %s has size %d and can be read using %s\\n&quot;,\n    objAttrs.Name, objAttrs.Size,
52    objAttrs.MediaLink)\n</code></pre><h3>Listing objects</h3>\n<p>Listing objects
53    in a bucket is done with the Bucket.Objects method:</p>\n<pre><code class=\"prettyprint\">query
54    := &amp;storage.Query{Prefix: &quot;&quot;}\n\nvar names []string\nit := bkt.Objects(ctx,
55    query)\nfor {\n    attrs, err := it.Next()\n    if err == iterator.Done {\n        break\n
56    \   }\n    if err != nil {\n        log.Fatal(err)\n    }\n    names = append(names,
57    attrs.Name)\n}\n</code></pre><p>If only a subset of object attributes is needed
58    when listing, specifying this\nsubset using Query.SetAttrSelection may speed up
59    the listing process:</p>\n<pre><code class=\"prettyprint\">query := &amp;storage.Query{Prefix:
60    &quot;&quot;}\nquery.SetAttrSelection([]string{&quot;Name&quot;})\n\n// ... as
61    before\n</code></pre><h3>ACLs</h3>\n<p>Both objects and buckets have ACLs (Access
62    Control Lists). An ACL is a list of\nACLRules, each of which specifies the role
63    of a user, group or project. ACLs\nare suitable for fine-grained control, but
64    you may prefer using IAM to control\naccess at the project level (see\nhttps://cloud.google.com/storage/docs/access-control/iam).</p>\n<p>To
65    list the ACLs of a bucket or object, obtain an ACLHandle and call its List method:</p>\n<pre><code
66    class=\"prettyprint\">acls, err := obj.ACL().List(ctx)\nif err != nil {\n    //
67    TODO: Handle error.\n}\nfor _, rule := range acls {\n    fmt.Printf(&quot;%s has
68    role %s\\n&quot;, rule.Entity, rule.Role)\n}\n</code></pre><p>You can also set
69    and delete ACLs.</p>\n<h3>Conditions</h3>\n<p>Every object has a generation and
70    a metageneration. The generation changes\nwhenever the content changes, and the
71    metageneration changes whenever the\nmetadata changes. Conditions let you check
72    these values before an operation;\nthe operation only executes if the conditions
73    match. You can use conditions to\nprevent race conditions in read-modify-write
74    operations.</p>\n<p>For example, say you've read an object's metadata into objAttrs.
75    Now\nyou want to write to that object, but only if its contents haven't changed\nsince
76    you read it. Here is how to express that:</p>\n<pre><code class=\"prettyprint\">w
77    = obj.If(storage.Conditions{GenerationMatch: objAttrs.Generation}).NewWriter(ctx)\n//
78    Proceed with writing as above.\n</code></pre><h3>Signed URLs</h3>\n<p>You can
79    obtain a URL that lets anyone read or write an object for a limited time.\nYou
80    don't need to create a client to do this. See the documentation of\nSignedURL
81    for details.</p>\n<pre><code class=\"prettyprint\">url, err := storage.SignedURL(bucketName,
82    &quot;shared-object&quot;, opts)\nif err != nil {\n    // TODO: Handle error.\n}\nfmt.Println(url)\n</code></pre><h3>Post
83    Policy V4 Signed Request</h3>\n<p>A type of signed request that allows uploads
84    through HTML forms directly to Cloud Storage with\ntemporary permission. Conditions
85    can be applied to restrict how the HTML form is used and exercised\nby a user.</p>\n<p>For
86    more information, please see https://cloud.google.com/storage/docs/xml-api/post-object
87    as well\nas the documentation of GenerateSignedPostPolicyV4.</p>\n<pre><code class=\"prettyprint\">pv4,
88    err := storage.GenerateSignedPostPolicyV4(bucketName, objectName, opts)\nif err
89    != nil {\n    // TODO: Handle error.\n}\nfmt.Printf(&quot;URL: %s\\nFields; %v\\n&quot;,
90    pv4.URL, pv4.Fields)\n</code></pre><h3>Errors</h3>\n<p>Errors returned by this
91    client are often of the type <a href=\"https://godoc.org/google.golang.org/api/googleapi#Error\"><code>googleapi.Error</code></a>.\nThese
92    errors can be introspected for more information by type asserting to the richer
93    <code>googleapi.Error</code> type. For example:</p>\n<pre><code class=\"prettyprint\">if
94    e, ok := err.(*googleapi.Error); ok {\n\t  if e.Code == 409 { ... }\n}\n</code></pre>"
95  type: package
96  langs:
97  - go
98  children:
99  - cloud.google.com/go/storage.DeleteAction,SetStorageClassAction
100  - cloud.google.com/go/storage.NoPayload,JSONPayload
101  - cloud.google.com/go/storage.ObjectFinalizeEvent,ObjectMetadataUpdateEvent,ObjectDeleteEvent,ObjectArchiveEvent
102  - cloud.google.com/go/storage.ScopeFullControl,ScopeReadOnly,ScopeReadWrite
103  - cloud.google.com/go/storage.ErrBucketNotExist,ErrObjectNotExist
104  - cloud.google.com/go/storage.ACLEntity
105  - cloud.google.com/go/storage.AllUsers,AllAuthenticatedUsers
106  - cloud.google.com/go/storage.ACLHandle
107  - cloud.google.com/go/storage.ACLHandle.Delete
108  - cloud.google.com/go/storage.ACLHandle.List
109  - cloud.google.com/go/storage.ACLHandle.Set
110  - cloud.google.com/go/storage.ACLRole
111  - cloud.google.com/go/storage.RoleOwner,RoleReader,RoleWriter
112  - cloud.google.com/go/storage.ACLRule
113  - cloud.google.com/go/storage.BucketAttrs
114  - cloud.google.com/go/storage.BucketAttrsToUpdate
115  - cloud.google.com/go/storage.BucketAttrsToUpdate.DeleteLabel
116  - cloud.google.com/go/storage.BucketAttrsToUpdate.SetLabel
117  - cloud.google.com/go/storage.BucketConditions
118  - cloud.google.com/go/storage.BucketEncryption
119  - cloud.google.com/go/storage.BucketHandle
120  - cloud.google.com/go/storage.BucketHandle.ACL
121  - cloud.google.com/go/storage.BucketHandle.AddNotification
122  - cloud.google.com/go/storage.BucketHandle.Attrs
123  - cloud.google.com/go/storage.BucketHandle.Create
124  - cloud.google.com/go/storage.BucketHandle.DefaultObjectACL
125  - cloud.google.com/go/storage.BucketHandle.Delete
126  - cloud.google.com/go/storage.BucketHandle.DeleteNotification
127  - cloud.google.com/go/storage.BucketHandle.IAM
128  - cloud.google.com/go/storage.BucketHandle.If
129  - cloud.google.com/go/storage.BucketHandle.LockRetentionPolicy
130  - cloud.google.com/go/storage.BucketHandle.Notifications
131  - cloud.google.com/go/storage.BucketHandle.Object
132  - cloud.google.com/go/storage.BucketHandle.Objects
133  - cloud.google.com/go/storage.BucketHandle.Update
134  - cloud.google.com/go/storage.BucketHandle.UserProject
135  - cloud.google.com/go/storage.BucketIterator
136  - cloud.google.com/go/storage.BucketIterator.Next
137  - cloud.google.com/go/storage.BucketIterator.PageInfo
138  - cloud.google.com/go/storage.BucketLogging
139  - cloud.google.com/go/storage.BucketPolicyOnly
140  - cloud.google.com/go/storage.BucketWebsite
141  - cloud.google.com/go/storage.CORS
142  - cloud.google.com/go/storage.Client
143  - cloud.google.com/go/storage.Client.NewClient
144  - cloud.google.com/go/storage.Client.Bucket
145  - cloud.google.com/go/storage.Client.Buckets
146  - cloud.google.com/go/storage.Client.Close
147  - cloud.google.com/go/storage.Client.CreateHMACKey
148  - cloud.google.com/go/storage.Client.HMACKeyHandle
149  - cloud.google.com/go/storage.Client.ListHMACKeys
150  - cloud.google.com/go/storage.Client.ServiceAccount
151  - cloud.google.com/go/storage.Composer
152  - cloud.google.com/go/storage.Composer.Run
153  - cloud.google.com/go/storage.Conditions
154  - cloud.google.com/go/storage.Copier
155  - cloud.google.com/go/storage.Copier.Run
156  - cloud.google.com/go/storage.HMACKey
157  - cloud.google.com/go/storage.HMACKeyAttrsToUpdate
158  - cloud.google.com/go/storage.HMACKeyHandle
159  - cloud.google.com/go/storage.HMACKeyHandle.Delete
160  - cloud.google.com/go/storage.HMACKeyHandle.Get
161  - cloud.google.com/go/storage.HMACKeyHandle.Update
162  - cloud.google.com/go/storage.HMACKeyOption
163  - cloud.google.com/go/storage.HMACKeyOption.ForHMACKeyServiceAccountEmail
164  - cloud.google.com/go/storage.HMACKeyOption.ShowDeletedHMACKeys
165  - cloud.google.com/go/storage.HMACKeyOption.UserProjectForHMACKeys
166  - cloud.google.com/go/storage.HMACKeysIterator
167  - cloud.google.com/go/storage.HMACKeysIterator.Next
168  - cloud.google.com/go/storage.HMACKeysIterator.PageInfo
169  - cloud.google.com/go/storage.HMACState
170  - cloud.google.com/go/storage.Active,Inactive,Deleted
171  - cloud.google.com/go/storage.Lifecycle
172  - cloud.google.com/go/storage.LifecycleAction
173  - cloud.google.com/go/storage.LifecycleCondition
174  - cloud.google.com/go/storage.LifecycleRule
175  - cloud.google.com/go/storage.Liveness
176  - cloud.google.com/go/storage.LiveAndArchived,Live,Archived
177  - cloud.google.com/go/storage.Notification
178  - cloud.google.com/go/storage.ObjectAttrs
179  - cloud.google.com/go/storage.ObjectAttrsToUpdate
180  - cloud.google.com/go/storage.ObjectHandle
181  - cloud.google.com/go/storage.ObjectHandle.ACL
182  - cloud.google.com/go/storage.ObjectHandle.Attrs
183  - cloud.google.com/go/storage.ObjectHandle.BucketName
184  - cloud.google.com/go/storage.ObjectHandle.ComposerFrom
185  - cloud.google.com/go/storage.ObjectHandle.CopierFrom
186  - cloud.google.com/go/storage.ObjectHandle.Delete
187  - cloud.google.com/go/storage.ObjectHandle.Generation
188  - cloud.google.com/go/storage.ObjectHandle.If
189  - cloud.google.com/go/storage.ObjectHandle.Key
190  - cloud.google.com/go/storage.ObjectHandle.NewRangeReader
191  - cloud.google.com/go/storage.ObjectHandle.NewReader
192  - cloud.google.com/go/storage.ObjectHandle.NewWriter
193  - cloud.google.com/go/storage.ObjectHandle.ObjectName
194  - cloud.google.com/go/storage.ObjectHandle.ReadCompressed
195  - cloud.google.com/go/storage.ObjectHandle.Update
196  - cloud.google.com/go/storage.ObjectIterator
197  - cloud.google.com/go/storage.ObjectIterator.Next
198  - cloud.google.com/go/storage.ObjectIterator.PageInfo
199  - cloud.google.com/go/storage.PolicyV4Fields
200  - cloud.google.com/go/storage.PostPolicyV4
201  - cloud.google.com/go/storage.PostPolicyV4.GenerateSignedPostPolicyV4
202  - cloud.google.com/go/storage.PostPolicyV4Condition
203  - cloud.google.com/go/storage.PostPolicyV4Condition.ConditionContentLengthRange
204  - cloud.google.com/go/storage.PostPolicyV4Condition.ConditionStartsWith
205  - cloud.google.com/go/storage.PostPolicyV4Options
206  - cloud.google.com/go/storage.ProjectTeam
207  - cloud.google.com/go/storage.Query
208  - cloud.google.com/go/storage.Query.SetAttrSelection
209  - cloud.google.com/go/storage.Reader
210  - cloud.google.com/go/storage.Reader.CacheControl
211  - cloud.google.com/go/storage.Reader.Close
212  - cloud.google.com/go/storage.Reader.ContentEncoding
213  - cloud.google.com/go/storage.Reader.ContentType
214  - cloud.google.com/go/storage.Reader.LastModified
215  - cloud.google.com/go/storage.Reader.Read
216  - cloud.google.com/go/storage.Reader.Remain
217  - cloud.google.com/go/storage.Reader.Size
218  - cloud.google.com/go/storage.ReaderObjectAttrs
219  - cloud.google.com/go/storage.RetentionPolicy
220  - cloud.google.com/go/storage.SignedURLOptions
221  - cloud.google.com/go/storage.SigningScheme
222  - cloud.google.com/go/storage.SigningSchemeDefault,SigningSchemeV2,SigningSchemeV4
223  - cloud.google.com/go/storage.URLStyle
224  - cloud.google.com/go/storage.URLStyle.BucketBoundHostname
225  - cloud.google.com/go/storage.URLStyle.PathStyle
226  - cloud.google.com/go/storage.URLStyle.VirtualHostedStyle
227  - cloud.google.com/go/storage.UniformBucketLevelAccess
228  - cloud.google.com/go/storage.Writer
229  - cloud.google.com/go/storage.Writer.Attrs
230  - cloud.google.com/go/storage.Writer.Close
231  - cloud.google.com/go/storage.Writer.CloseWithError
232  - cloud.google.com/go/storage.Writer.Write
233  - cloud.google.com/go/storage.SignedURL
234  alt_link: https://pkg.go.dev/cloud.google.com/go/storage
235- uid: cloud.google.com/go/storage.DeleteAction,SetStorageClassAction
236  name: DeleteAction, SetStorageClassAction
237  id: DeleteAction,SetStorageClassAction
238  parent: cloud.google.com/go/storage
239  type: const
240  langs:
241  - go
242  syntax:
243    content: "const (\n\n\t// DeleteAction is a lifecycle action that deletes a live
244      and/or archived\n\t// objects. Takes precedence over SetStorageClass actions.\n\tDeleteAction
245      = \"Delete\"\n\n\t// SetStorageClassAction changes the storage class of live
246      and/or archived\n\t// objects.\n\tSetStorageClassAction = \"SetStorageClass\"\n)"
247- uid: cloud.google.com/go/storage.NoPayload,JSONPayload
248  name: NoPayload, JSONPayload
249  id: NoPayload,JSONPayload
250  summary: |
251    Values for Notification.PayloadFormat.
252  parent: cloud.google.com/go/storage
253  type: const
254  langs:
255  - go
256  syntax:
257    content: "const (\n\t// Send no payload with notification messages.\n\tNoPayload
258      = \"NONE\"\n\n\t// Send object metadata as JSON with notification messages.\n\tJSONPayload
259      = \"JSON_API_V1\"\n)"
260- uid: cloud.google.com/go/storage.ObjectFinalizeEvent,ObjectMetadataUpdateEvent,ObjectDeleteEvent,ObjectArchiveEvent
261  name: ObjectFinalizeEvent, ObjectMetadataUpdateEvent, ObjectDeleteEvent, ObjectArchiveEvent
262  id: ObjectFinalizeEvent,ObjectMetadataUpdateEvent,ObjectDeleteEvent,ObjectArchiveEvent
263  summary: |
264    Values for Notification.EventTypes.
265  parent: cloud.google.com/go/storage
266  type: const
267  langs:
268  - go
269  syntax:
270    content: "const (\n\t// Event that occurs when an object is successfully created.\n\tObjectFinalizeEvent
271      = \"OBJECT_FINALIZE\"\n\n\t// Event that occurs when the metadata of an existing
272      object changes.\n\tObjectMetadataUpdateEvent = \"OBJECT_METADATA_UPDATE\"\n\n\t//
273      Event that occurs when an object is permanently deleted.\n\tObjectDeleteEvent
274      = \"OBJECT_DELETE\"\n\n\t// Event that occurs when the live version of an object
275      becomes an\n\t// archived version.\n\tObjectArchiveEvent = \"OBJECT_ARCHIVE\"\n)"
276- uid: cloud.google.com/go/storage.ScopeFullControl,ScopeReadOnly,ScopeReadWrite
277  name: ScopeFullControl, ScopeReadOnly, ScopeReadWrite
278  id: ScopeFullControl,ScopeReadOnly,ScopeReadWrite
279  parent: cloud.google.com/go/storage
280  type: const
281  langs:
282  - go
283  syntax:
284    content: "const (\n\t// ScopeFullControl grants permissions to manage your\n\t//
285      data and permissions in Google Cloud Storage.\n\tScopeFullControl = <a href=\"https://pkg.go.dev/google.golang.org/api/storage/v1\">raw</a>.<a
286      href=\"https://pkg.go.dev/google.golang.org/api/storage/v1#DevstorageFullControlScope\">DevstorageFullControlScope</a>\n\n\t//
287      ScopeReadOnly grants permissions to\n\t// view your data in Google Cloud Storage.\n\tScopeReadOnly
288      = <a href=\"https://pkg.go.dev/google.golang.org/api/storage/v1\">raw</a>.<a
289      href=\"https://pkg.go.dev/google.golang.org/api/storage/v1#DevstorageReadOnlyScope\">DevstorageReadOnlyScope</a>\n\n\t//
290      ScopeReadWrite grants permissions to manage your\n\t// data in Google Cloud
291      Storage.\n\tScopeReadWrite = <a href=\"https://pkg.go.dev/google.golang.org/api/storage/v1\">raw</a>.<a
292      href=\"https://pkg.go.dev/google.golang.org/api/storage/v1#DevstorageReadWriteScope\">DevstorageReadWriteScope</a>\n)"
293- uid: cloud.google.com/go/storage.ErrBucketNotExist,ErrObjectNotExist
294  name: ErrBucketNotExist, ErrObjectNotExist
295  id: ErrBucketNotExist,ErrObjectNotExist
296  parent: cloud.google.com/go/storage
297  type: variable
298  langs:
299  - go
300  syntax:
301    content: "var (\n\t// ErrBucketNotExist indicates that the bucket does not exist.\n\tErrBucketNotExist
302      = <a href=\"https://pkg.go.dev/errors\">errors</a>.<a href=\"https://pkg.go.dev/errors#New\">New</a>(\"storage:
303      bucket doesn't exist\")\n\t// ErrObjectNotExist indicates that the object does
304      not exist.\n\tErrObjectNotExist = <a href=\"https://pkg.go.dev/errors\">errors</a>.<a
305      href=\"https://pkg.go.dev/errors#New\">New</a>(\"storage: object doesn't exist\")\n)"
306- uid: cloud.google.com/go/storage.ACLEntity
307  name: ACLEntity
308  id: ACLEntity
309  summary: |
310    ACLEntity refers to a user or group.
311    They are sometimes referred to as grantees.
312
313    It could be in the form of:
314    "user-<userId>", "user-<email>", "group-<groupId>", "group-<email>",
315    "domain-<domain>" and "project-team-<projectId>".
316
317    Or one of the predefined constants: AllUsers, AllAuthenticatedUsers.
318  parent: cloud.google.com/go/storage
319  type: type
320  langs:
321  - go
322  syntax:
323    content: type ACLEntity <a href="https://pkg.go.dev/builtin#string">string</a>
324- uid: cloud.google.com/go/storage.AllUsers,AllAuthenticatedUsers
325  name: AllUsers, AllAuthenticatedUsers
326  id: AllUsers,AllAuthenticatedUsers
327  parent: cloud.google.com/go/storage.ACLEntity
328  type: const
329  langs:
330  - go
331  syntax:
332    content: "const (\n\tAllUsers              <a href=\"#cloud_google_com_go_storage_ACLEntity\">ACLEntity</a>
333      = \"allUsers\"\n\tAllAuthenticatedUsers <a href=\"#cloud_google_com_go_storage_ACLEntity\">ACLEntity</a>
334      = \"allAuthenticatedUsers\"\n)"
335- uid: cloud.google.com/go/storage.ACLHandle
336  name: ACLHandle
337  id: ACLHandle
338  summary: |
339    ACLHandle provides operations on an access control list for a Google Cloud Storage bucket or object.
340  parent: cloud.google.com/go/storage
341  type: type
342  langs:
343  - go
344  syntax:
345    content: "type ACLHandle struct {\n\t// contains filtered or unexported fields\n}"
346- uid: cloud.google.com/go/storage.ACLHandle.Delete
347  name: |
348    func (*ACLHandle) Delete
349  id: Delete
350  summary: |
351    Delete permanently deletes the ACL entry for the given entity.
352  parent: cloud.google.com/go/storage.ACLHandle
353  type: method
354  langs:
355  - go
356  syntax:
357    content: func (a *<a href="#cloud_google_com_go_storage_ACLHandle">ACLHandle</a>)
358      Delete(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>,
359      entity <a href="#cloud_google_com_go_storage_ACLEntity">ACLEntity</a>) (err
360      <a href="https://pkg.go.dev/builtin#error">error</a>)
361  codeexamples:
362  - content: "package main\n\nimport (\n\t\"cloud.google.com/go/storage\"\n\t\"context\"\n)\n\nfunc
363      main() {\n\tctx := context.Background()\n\tclient, err := storage.NewClient(ctx)\n\tif
364      err != nil {\n\t\t// TODO: handle error.\n\t}\n\t// No longer grant access to
365      the bucket to everyone on the Internet.\n\tif err := client.Bucket(\"my-bucket\").ACL().Delete(ctx,
366      storage.AllUsers); err != nil {\n\t\t// TODO: handle error.\n\t}\n}\n"
367- uid: cloud.google.com/go/storage.ACLHandle.List
368  name: |
369    func (*ACLHandle) List
370  id: List
371  summary: |
372    List retrieves ACL entries.
373  parent: cloud.google.com/go/storage.ACLHandle
374  type: method
375  langs:
376  - go
377  syntax:
378    content: func (a *<a href="#cloud_google_com_go_storage_ACLHandle">ACLHandle</a>)
379      List(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>)
380      (rules []<a href="#cloud_google_com_go_storage_ACLRule">ACLRule</a>, err <a
381      href="https://pkg.go.dev/builtin#error">error</a>)
382  codeexamples:
383  - content: "package main\n\nimport (\n\t\"cloud.google.com/go/storage\"\n\t\"context\"\n\t\"fmt\"\n)\n\nfunc
384      main() {\n\tctx := context.Background()\n\tclient, err := storage.NewClient(ctx)\n\tif
385      err != nil {\n\t\t// TODO: handle error.\n\t}\n\t// List the default object
386      ACLs for my-bucket.\n\taclRules, err := client.Bucket(\"my-bucket\").DefaultObjectACL().List(ctx)\n\tif
387      err != nil {\n\t\t// TODO: handle error.\n\t}\n\tfmt.Println(aclRules)\n}\n"
388- uid: cloud.google.com/go/storage.ACLHandle.Set
389  name: |
390    func (*ACLHandle) Set
391  id: Set
392  summary: |
393    Set sets the role for the given entity.
394  parent: cloud.google.com/go/storage.ACLHandle
395  type: method
396  langs:
397  - go
398  syntax:
399    content: func (a *<a href="#cloud_google_com_go_storage_ACLHandle">ACLHandle</a>)
400      Set(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>,
401      entity <a href="#cloud_google_com_go_storage_ACLEntity">ACLEntity</a>, role
402      <a href="#cloud_google_com_go_storage_ACLRole">ACLRole</a>) (err <a href="https://pkg.go.dev/builtin#error">error</a>)
403  codeexamples:
404  - content: "package main\n\nimport (\n\t\"cloud.google.com/go/storage\"\n\t\"context\"\n)\n\nfunc
405      main() {\n\tctx := context.Background()\n\tclient, err := storage.NewClient(ctx)\n\tif
406      err != nil {\n\t\t// TODO: handle error.\n\t}\n\t// Let any authenticated user
407      read my-bucket/my-object.\n\tobj := client.Bucket(\"my-bucket\").Object(\"my-object\")\n\tif
408      err := obj.ACL().Set(ctx, storage.AllAuthenticatedUsers, storage.RoleReader);
409      err != nil {\n\t\t// TODO: handle error.\n\t}\n}\n"
410- uid: cloud.google.com/go/storage.ACLRole
411  name: ACLRole
412  id: ACLRole
413  summary: |
414    ACLRole is the level of access to grant.
415  parent: cloud.google.com/go/storage
416  type: type
417  langs:
418  - go
419  syntax:
420    content: type ACLRole <a href="https://pkg.go.dev/builtin#string">string</a>
421- uid: cloud.google.com/go/storage.RoleOwner,RoleReader,RoleWriter
422  name: RoleOwner, RoleReader, RoleWriter
423  id: RoleOwner,RoleReader,RoleWriter
424  parent: cloud.google.com/go/storage.ACLRole
425  type: const
426  langs:
427  - go
428  syntax:
429    content: "const (\n\tRoleOwner  <a href=\"#cloud_google_com_go_storage_ACLRole\">ACLRole</a>
430      = \"OWNER\"\n\tRoleReader <a href=\"#cloud_google_com_go_storage_ACLRole\">ACLRole</a>
431      = \"READER\"\n\tRoleWriter <a href=\"#cloud_google_com_go_storage_ACLRole\">ACLRole</a>
432      = \"WRITER\"\n)"
433- uid: cloud.google.com/go/storage.ACLRule
434  name: ACLRule
435  id: ACLRule
436  summary: |
437    ACLRule represents a grant for a role to an entity (user, group or team) for a
438    Google Cloud Storage object or bucket.
439  parent: cloud.google.com/go/storage
440  type: type
441  langs:
442  - go
443  syntax:
444    content: "type ACLRule struct {\n\tEntity      <a href=\"#cloud_google_com_go_storage_ACLEntity\">ACLEntity</a>\n\tEntityID
445      \   <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\tRole        <a
446      href=\"#cloud_google_com_go_storage_ACLRole\">ACLRole</a>\n\tDomain      <a
447      href=\"https://pkg.go.dev/builtin#string\">string</a>\n\tEmail       <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\tProjectTeam
448      *<a href=\"#cloud_google_com_go_storage_ProjectTeam\">ProjectTeam</a>\n}"
449- uid: cloud.google.com/go/storage.BucketAttrs
450  name: BucketAttrs
451  id: BucketAttrs
452  summary: |
453    BucketAttrs represents the metadata for a Google Cloud Storage bucket.
454    Read-only fields are ignored by BucketHandle.Create.
455  parent: cloud.google.com/go/storage
456  type: type
457  langs:
458  - go
459  syntax:
460    content: "type BucketAttrs struct {\n\t// Name is the name of the bucket.\n\t//
461      This field is read-only.\n\tName <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t//
462      ACL is the list of access control rules on the bucket.\n\tACL []<a href=\"#cloud_google_com_go_storage_ACLRule\">ACLRule</a>\n\n\t//
463      BucketPolicyOnly is an alias for UniformBucketLevelAccess. Use of\n\t// UniformBucketLevelAccess
464      is recommended above the use of this field.\n\t// Setting BucketPolicyOnly.Enabled
465      OR UniformBucketLevelAccess.Enabled to\n\t// true, will enable UniformBucketLevelAccess.\n\tBucketPolicyOnly
466      <a href=\"#cloud_google_com_go_storage_BucketPolicyOnly\">BucketPolicyOnly</a>\n\n\t//
467      UniformBucketLevelAccess configures access checks to use only bucket-level IAM\n\t//
468      policies and ignore any ACL rules for the bucket.\n\t// See https://cloud.google.com/storage/docs/uniform-bucket-level-access\n\t//
469      for more information.\n\tUniformBucketLevelAccess <a href=\"#cloud_google_com_go_storage_UniformBucketLevelAccess\">UniformBucketLevelAccess</a>\n\n\t//
470      DefaultObjectACL is the list of access controls to\n\t// apply to new objects
471      when no object ACL is provided.\n\tDefaultObjectACL []<a href=\"#cloud_google_com_go_storage_ACLRule\">ACLRule</a>\n\n\t//
472      DefaultEventBasedHold is the default value for event-based hold on\n\t// newly
473      created objects in this bucket. It defaults to false.\n\tDefaultEventBasedHold
474      <a href=\"https://pkg.go.dev/builtin#bool\">bool</a>\n\n\t// If not empty, applies
475      a predefined set of access controls. It should be set\n\t// only when creating
476      a bucket.\n\t// It is always empty for BucketAttrs returned from the service.\n\t//
477      See https://cloud.google.com/storage/docs/json_api/v1/buckets/insert\n\t// for
478      valid values.\n\tPredefinedACL <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t//
479      If not empty, applies a predefined set of default object access controls.\n\t//
480      It should be set only when creating a bucket.\n\t// It is always empty for BucketAttrs
481      returned from the service.\n\t// See https://cloud.google.com/storage/docs/json_api/v1/buckets/insert\n\t//
482      for valid values.\n\tPredefinedDefaultObjectACL <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t//
483      Location is the location of the bucket. It defaults to \"US\".\n\tLocation <a
484      href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t// MetaGeneration
485      is the metadata generation of the bucket.\n\t// This field is read-only.\n\tMetaGeneration
486      <a href=\"https://pkg.go.dev/builtin#int64\">int64</a>\n\n\t// StorageClass
487      is the default storage class of the bucket. This defines\n\t// how objects in
488      the bucket are stored and determines the SLA\n\t// and the cost of storage.
489      Typical values are \"STANDARD\", \"NEARLINE\",\n\t// \"COLDLINE\" and \"ARCHIVE\".
490      Defaults to \"STANDARD\".\n\t// See https://cloud.google.com/storage/docs/storage-classes
491      for all\n\t// valid values.\n\tStorageClass <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t//
492      Created is the creation time of the bucket.\n\t// This field is read-only.\n\tCreated
493      <a href=\"https://pkg.go.dev/time\">time</a>.<a href=\"https://pkg.go.dev/time#Time\">Time</a>\n\n\t//
494      VersioningEnabled reports whether this bucket has versioning enabled.\n\tVersioningEnabled
495      <a href=\"https://pkg.go.dev/builtin#bool\">bool</a>\n\n\t// Labels are the
496      bucket's labels.\n\tLabels map[<a href=\"https://pkg.go.dev/builtin#string\">string</a>]<a
497      href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t// RequesterPays
498      reports whether the bucket is a Requester Pays bucket.\n\t// Clients performing
499      operations on Requester Pays buckets must provide\n\t// a user project (see
500      BucketHandle.UserProject), which will be billed\n\t// for the operations.\n\tRequesterPays
501      <a href=\"https://pkg.go.dev/builtin#bool\">bool</a>\n\n\t// Lifecycle is the
502      lifecycle configuration for objects in the bucket.\n\tLifecycle <a href=\"#cloud_google_com_go_storage_Lifecycle\">Lifecycle</a>\n\n\t//
503      Retention policy enforces a minimum retention time for all objects\n\t// contained
504      in the bucket. A RetentionPolicy of nil implies the bucket\n\t// has no minimum
505      data retention.\n\t//\n\t// This feature is in private alpha release. It is
506      not currently available to\n\t// most customers. It might be changed in backwards-incompatible
507      ways and is not\n\t// subject to any SLA or deprecation policy.\n\tRetentionPolicy
508      *<a href=\"#cloud_google_com_go_storage_RetentionPolicy\">RetentionPolicy</a>\n\n\t//
509      The bucket's Cross-Origin Resource Sharing (CORS) configuration.\n\tCORS []<a
510      href=\"#cloud_google_com_go_storage_CORS\">CORS</a>\n\n\t// The encryption configuration
511      used by default for newly inserted objects.\n\tEncryption *<a href=\"#cloud_google_com_go_storage_BucketEncryption\">BucketEncryption</a>\n\n\t//
512      The logging configuration.\n\tLogging *<a href=\"#cloud_google_com_go_storage_BucketLogging\">BucketLogging</a>\n\n\t//
513      The website configuration.\n\tWebsite *<a href=\"#cloud_google_com_go_storage_BucketWebsite\">BucketWebsite</a>\n\n\t//
514      Etag is the HTTP/1.1 Entity tag for the bucket.\n\t// This field is read-only.\n\tEtag
515      <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t// LocationType
516      describes how data is stored and replicated.\n\t// Typical values are \"multi-region\",
517      \"region\" and \"dual-region\".\n\t// This field is read-only.\n\tLocationType
518      <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n}"
519- uid: cloud.google.com/go/storage.BucketAttrsToUpdate
520  name: BucketAttrsToUpdate
521  id: BucketAttrsToUpdate
522  summary: |
523    BucketAttrsToUpdate define the attributes to update during an Update call.
524  parent: cloud.google.com/go/storage
525  type: type
526  langs:
527  - go
528  syntax:
529    content: "type BucketAttrsToUpdate struct {\n\t// If set, updates whether the
530      bucket uses versioning.\n\tVersioningEnabled <a href=\"https://pkg.go.dev/cloud.google.com/go/internal/optional\">optional</a>.<a
531      href=\"https://pkg.go.dev/cloud.google.com/go/internal/optional#Bool\">Bool</a>\n\n\t//
532      If set, updates whether the bucket is a Requester Pays bucket.\n\tRequesterPays
533      <a href=\"https://pkg.go.dev/cloud.google.com/go/internal/optional\">optional</a>.<a
534      href=\"https://pkg.go.dev/cloud.google.com/go/internal/optional#Bool\">Bool</a>\n\n\t//
535      DefaultEventBasedHold is the default value for event-based hold on\n\t// newly
536      created objects in this bucket.\n\tDefaultEventBasedHold <a href=\"https://pkg.go.dev/cloud.google.com/go/internal/optional\">optional</a>.<a
537      href=\"https://pkg.go.dev/cloud.google.com/go/internal/optional#Bool\">Bool</a>\n\n\t//
538      BucketPolicyOnly is an alias for UniformBucketLevelAccess. Use of\n\t// UniformBucketLevelAccess
539      is recommended above the use of this field.\n\t// Setting BucketPolicyOnly.Enabled
540      OR UniformBucketLevelAccess.Enabled to\n\t// true, will enable UniformBucketLevelAccess.
541      If both BucketPolicyOnly and\n\t// UniformBucketLevelAccess are set, the value
542      of UniformBucketLevelAccess\n\t// will take precedence.\n\tBucketPolicyOnly
543      *<a href=\"#cloud_google_com_go_storage_BucketPolicyOnly\">BucketPolicyOnly</a>\n\n\t//
544      UniformBucketLevelAccess configures access checks to use only bucket-level IAM\n\t//
545      policies and ignore any ACL rules for the bucket.\n\t// See https://cloud.google.com/storage/docs/uniform-bucket-level-access\n\t//
546      for more information.\n\tUniformBucketLevelAccess *<a href=\"#cloud_google_com_go_storage_UniformBucketLevelAccess\">UniformBucketLevelAccess</a>\n\n\t//
547      If set, updates the retention policy of the bucket. Using\n\t// RetentionPolicy.RetentionPeriod
548      = 0 will delete the existing policy.\n\t//\n\t// This feature is in private
549      alpha release. It is not currently available to\n\t// most customers. It might
550      be changed in backwards-incompatible ways and is not\n\t// subject to any SLA
551      or deprecation policy.\n\tRetentionPolicy *<a href=\"#cloud_google_com_go_storage_RetentionPolicy\">RetentionPolicy</a>\n\n\t//
552      If set, replaces the CORS configuration with a new configuration.\n\t// An empty
553      (rather than nil) slice causes all CORS policies to be removed.\n\tCORS []<a
554      href=\"#cloud_google_com_go_storage_CORS\">CORS</a>\n\n\t// If set, replaces
555      the encryption configuration of the bucket. Using\n\t// BucketEncryption.DefaultKMSKeyName
556      = \"\" will delete the existing\n\t// configuration.\n\tEncryption *<a href=\"#cloud_google_com_go_storage_BucketEncryption\">BucketEncryption</a>\n\n\t//
557      If set, replaces the lifecycle configuration of the bucket.\n\tLifecycle *<a
558      href=\"#cloud_google_com_go_storage_Lifecycle\">Lifecycle</a>\n\n\t// If set,
559      replaces the logging configuration of the bucket.\n\tLogging *<a href=\"#cloud_google_com_go_storage_BucketLogging\">BucketLogging</a>\n\n\t//
560      If set, replaces the website configuration of the bucket.\n\tWebsite *<a href=\"#cloud_google_com_go_storage_BucketWebsite\">BucketWebsite</a>\n\n\t//
561      If not empty, applies a predefined set of access controls.\n\t// See https://cloud.google.com/storage/docs/json_api/v1/buckets/patch.\n\tPredefinedACL
562      <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t// If not empty,
563      applies a predefined set of default object access controls.\n\t// See https://cloud.google.com/storage/docs/json_api/v1/buckets/patch.\n\tPredefinedDefaultObjectACL
564      <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\t// contains filtered
565      or unexported fields\n}"
566- uid: cloud.google.com/go/storage.BucketAttrsToUpdate.DeleteLabel
567  name: |
568    func (*BucketAttrsToUpdate) DeleteLabel
569  id: DeleteLabel
570  summary: |
571    DeleteLabel causes a label to be deleted when ua is used in a
572    call to Bucket.Update.
573  parent: cloud.google.com/go/storage.BucketAttrsToUpdate
574  type: method
575  langs:
576  - go
577  syntax:
578    content: func (ua *<a href="#cloud_google_com_go_storage_BucketAttrsToUpdate">BucketAttrsToUpdate</a>)
579      DeleteLabel(name <a href="https://pkg.go.dev/builtin#string">string</a>)
580- uid: cloud.google.com/go/storage.BucketAttrsToUpdate.SetLabel
581  name: |
582    func (*BucketAttrsToUpdate) SetLabel
583  id: SetLabel
584  summary: |
585    SetLabel causes a label to be added or modified when ua is used
586    in a call to Bucket.Update.
587  parent: cloud.google.com/go/storage.BucketAttrsToUpdate
588  type: method
589  langs:
590  - go
591  syntax:
592    content: func (ua *<a href="#cloud_google_com_go_storage_BucketAttrsToUpdate">BucketAttrsToUpdate</a>)
593      SetLabel(name, value <a href="https://pkg.go.dev/builtin#string">string</a>)
594- uid: cloud.google.com/go/storage.BucketConditions
595  name: BucketConditions
596  id: BucketConditions
597  summary: |
598    BucketConditions constrain bucket methods to act on specific metagenerations.
599
600    The zero value is an empty set of constraints.
601  parent: cloud.google.com/go/storage
602  type: type
603  langs:
604  - go
605  syntax:
606    content: "type BucketConditions struct {\n\t// MetagenerationMatch specifies that
607      the bucket must have the given\n\t// metageneration for the operation to occur.\n\t//
608      If MetagenerationMatch is zero, it has no effect.\n\tMetagenerationMatch <a
609      href=\"https://pkg.go.dev/builtin#int64\">int64</a>\n\n\t// MetagenerationNotMatch
610      specifies that the bucket must not have the given\n\t// metageneration for the
611      operation to occur.\n\t// If MetagenerationNotMatch is zero, it has no effect.\n\tMetagenerationNotMatch
612      <a href=\"https://pkg.go.dev/builtin#int64\">int64</a>\n}"
613- uid: cloud.google.com/go/storage.BucketEncryption
614  name: BucketEncryption
615  id: BucketEncryption
616  summary: |
617    BucketEncryption is a bucket's encryption configuration.
618  parent: cloud.google.com/go/storage
619  type: type
620  langs:
621  - go
622  syntax:
623    content: "type BucketEncryption struct {\n\t// A Cloud KMS key name, in the form\n\t//
624      projects/P/locations/L/keyRings/R/cryptoKeys/K, that will be used to encrypt\n\t//
625      objects inserted into this bucket, if no encryption method is specified.\n\t//
626      The key's location must be the same as the bucket's.\n\tDefaultKMSKeyName <a
627      href=\"https://pkg.go.dev/builtin#string\">string</a>\n}"
628- uid: cloud.google.com/go/storage.BucketHandle
629  name: BucketHandle
630  id: BucketHandle
631  summary: |
632    BucketHandle provides operations on a Google Cloud Storage bucket.
633    Use Client.Bucket to get a handle.
634  parent: cloud.google.com/go/storage
635  type: type
636  langs:
637  - go
638  syntax:
639    content: "type BucketHandle struct {\n\t// contains filtered or unexported fields\n}"
640  codeexamples:
641  - content: "package main\n\nimport (\n\t\"cloud.google.com/go/storage\"\n\t\"context\"\n\t\"fmt\"\n)\n\nfunc
642      main() {\n\tctx := context.Background()\n\tclient, err := storage.NewClient(ctx)\n\tif
643      err != nil {\n\t\t// TODO: handle error.\n\t}\n\n\tattrs, err := client.Bucket(\"my-bucket\").Attrs(ctx)\n\tif
644      err == storage.ErrBucketNotExist {\n\t\tfmt.Println(\"The bucket does not exist\")\n\t\treturn\n\t}\n\tif
645      err != nil {\n\t\t// TODO: handle error.\n\t}\n\tfmt.Printf(\"The bucket exists
646      and has attributes: %#v\\n\", attrs)\n}\n"
647    name: exists
648- uid: cloud.google.com/go/storage.BucketHandle.ACL
649  name: |
650    func (*BucketHandle) ACL
651  id: ACL
652  summary: |
653    ACL returns an ACLHandle, which provides access to the bucket's access control list.
654    This controls who can list, create or overwrite the objects in a bucket.
655    This call does not perform any network operations.
656  parent: cloud.google.com/go/storage.BucketHandle
657  type: method
658  langs:
659  - go
660  syntax:
661    content: func (b *<a href="#cloud_google_com_go_storage_BucketHandle">BucketHandle</a>)
662      ACL() *<a href="#cloud_google_com_go_storage_ACLHandle">ACLHandle</a>
663- uid: cloud.google.com/go/storage.BucketHandle.AddNotification
664  name: |
665    func (*BucketHandle) AddNotification
666  id: AddNotification
667  summary: |
668    AddNotification adds a notification to b. You must set n's TopicProjectID, TopicID
669    and PayloadFormat, and must not set its ID. The other fields are all optional. The
670    returned Notification's ID can be used to refer to it.
671  parent: cloud.google.com/go/storage.BucketHandle
672  type: method
673  langs:
674  - go
675  syntax:
676    content: func (b *<a href="#cloud_google_com_go_storage_BucketHandle">BucketHandle</a>)
677      AddNotification(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>,
678      n *<a href="#cloud_google_com_go_storage_Notification">Notification</a>) (ret
679      *<a href="#cloud_google_com_go_storage_Notification">Notification</a>, err <a
680      href="https://pkg.go.dev/builtin#error">error</a>)
681  codeexamples:
682  - content: "package main\n\nimport (\n\t\"cloud.google.com/go/storage\"\n\t\"context\"\n\t\"fmt\"\n)\n\nfunc
683      main() {\n\tctx := context.Background()\n\tclient, err := storage.NewClient(ctx)\n\tif
684      err != nil {\n\t\t// TODO: handle error.\n\t}\n\tb := client.Bucket(\"my-bucket\")\n\tn,
685      err := b.AddNotification(ctx, &storage.Notification{\n\t\tTopicProjectID: \"my-project\",\n\t\tTopicID:
686      \       \"my-topic\",\n\t\tPayloadFormat:  storage.JSONPayload,\n\t})\n\tif
687      err != nil {\n\t\t// TODO: handle error.\n\t}\n\tfmt.Println(n.ID)\n}\n"
688- uid: cloud.google.com/go/storage.BucketHandle.Attrs
689  name: |
690    func (*BucketHandle) Attrs
691  id: Attrs
692  summary: |
693    Attrs returns the metadata for the bucket.
694  parent: cloud.google.com/go/storage.BucketHandle
695  type: method
696  langs:
697  - go
698  syntax:
699    content: func (b *<a href="#cloud_google_com_go_storage_BucketHandle">BucketHandle</a>)
700      Attrs(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>)
701      (attrs *<a href="#cloud_google_com_go_storage_BucketAttrs">BucketAttrs</a>,
702      err <a href="https://pkg.go.dev/builtin#error">error</a>)
703  codeexamples:
704  - content: "package main\n\nimport (\n\t\"cloud.google.com/go/storage\"\n\t\"context\"\n\t\"fmt\"\n)\n\nfunc
705      main() {\n\tctx := context.Background()\n\tclient, err := storage.NewClient(ctx)\n\tif
706      err != nil {\n\t\t// TODO: handle error.\n\t}\n\tattrs, err := client.Bucket(\"my-bucket\").Attrs(ctx)\n\tif
707      err != nil {\n\t\t// TODO: handle error.\n\t}\n\tfmt.Println(attrs)\n}\n"
708- uid: cloud.google.com/go/storage.BucketHandle.Create
709  name: |
710    func (*BucketHandle) Create
711  id: Create
712  summary: |
713    Create creates the Bucket in the project.
714    If attrs is nil the API defaults will be used.
715  parent: cloud.google.com/go/storage.BucketHandle
716  type: method
717  langs:
718  - go
719  syntax:
720    content: func (b *<a href="#cloud_google_com_go_storage_BucketHandle">BucketHandle</a>)
721      Create(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>,
722      projectID <a href="https://pkg.go.dev/builtin#string">string</a>, attrs *<a
723      href="#cloud_google_com_go_storage_BucketAttrs">BucketAttrs</a>) (err <a href="https://pkg.go.dev/builtin#error">error</a>)
724  codeexamples:
725  - content: "package main\n\nimport (\n\t\"cloud.google.com/go/storage\"\n\t\"context\"\n)\n\nfunc
726      main() {\n\tctx := context.Background()\n\tclient, err := storage.NewClient(ctx)\n\tif
727      err != nil {\n\t\t// TODO: handle error.\n\t}\n\tif err := client.Bucket(\"my-bucket\").Create(ctx,
728      \"my-project\", nil); err != nil {\n\t\t// TODO: handle error.\n\t}\n}\n"
729- uid: cloud.google.com/go/storage.BucketHandle.DefaultObjectACL
730  name: |
731    func (*BucketHandle) DefaultObjectACL
732  id: DefaultObjectACL
733  summary: |
734    DefaultObjectACL returns an ACLHandle, which provides access to the bucket's default object ACLs.
735    These ACLs are applied to newly created objects in this bucket that do not have a defined ACL.
736    This call does not perform any network operations.
737  parent: cloud.google.com/go/storage.BucketHandle
738  type: method
739  langs:
740  - go
741  syntax:
742    content: func (b *<a href="#cloud_google_com_go_storage_BucketHandle">BucketHandle</a>)
743      DefaultObjectACL() *<a href="#cloud_google_com_go_storage_ACLHandle">ACLHandle</a>
744- uid: cloud.google.com/go/storage.BucketHandle.Delete
745  name: |
746    func (*BucketHandle) Delete
747  id: Delete
748  summary: |
749    Delete deletes the Bucket.
750  parent: cloud.google.com/go/storage.BucketHandle
751  type: method
752  langs:
753  - go
754  syntax:
755    content: func (b *<a href="#cloud_google_com_go_storage_BucketHandle">BucketHandle</a>)
756      Delete(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>)
757      (err <a href="https://pkg.go.dev/builtin#error">error</a>)
758  codeexamples:
759  - content: "package main\n\nimport (\n\t\"cloud.google.com/go/storage\"\n\t\"context\"\n)\n\nfunc
760      main() {\n\tctx := context.Background()\n\tclient, err := storage.NewClient(ctx)\n\tif
761      err != nil {\n\t\t// TODO: handle error.\n\t}\n\tif err := client.Bucket(\"my-bucket\").Delete(ctx);
762      err != nil {\n\t\t// TODO: handle error.\n\t}\n}\n"
763- uid: cloud.google.com/go/storage.BucketHandle.DeleteNotification
764  name: |
765    func (*BucketHandle) DeleteNotification
766  id: DeleteNotification
767  summary: |
768    DeleteNotification deletes the notification with the given ID.
769  parent: cloud.google.com/go/storage.BucketHandle
770  type: method
771  langs:
772  - go
773  syntax:
774    content: func (b *<a href="#cloud_google_com_go_storage_BucketHandle">BucketHandle</a>)
775      DeleteNotification(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>,
776      id <a href="https://pkg.go.dev/builtin#string">string</a>) (err <a href="https://pkg.go.dev/builtin#error">error</a>)
777  codeexamples:
778  - content: "package main\n\nimport (\n\t\"cloud.google.com/go/storage\"\n\t\"context\"\n)\n\nvar
779      notificationID string\n\nfunc main() {\n\tctx := context.Background()\n\tclient,
780      err := storage.NewClient(ctx)\n\tif err != nil {\n\t\t// TODO: handle error.\n\t}\n\tb
781      := client.Bucket(\"my-bucket\")\n\t// TODO: Obtain notificationID from BucketHandle.AddNotification\n\t//
782      or BucketHandle.Notifications.\n\terr = b.DeleteNotification(ctx, notificationID)\n\tif
783      err != nil {\n\t\t// TODO: handle error.\n\t}\n}\n"
784- uid: cloud.google.com/go/storage.BucketHandle.IAM
785  name: |
786    func (*BucketHandle) IAM
787  id: IAM
788  summary: |
789    IAM provides access to IAM access control for the bucket.
790  parent: cloud.google.com/go/storage.BucketHandle
791  type: method
792  langs:
793  - go
794  syntax:
795    content: func (b *<a href="#cloud_google_com_go_storage_BucketHandle">BucketHandle</a>)
796      IAM() *<a href="/go/docs/reference/cloud.google.com/go/latest/iam">iam</a>.<a
797      href="/go/docs/reference/cloud.google.com/go/latest/iam#cloud_google_com_go_iam_Handle">Handle</a>
798- uid: cloud.google.com/go/storage.BucketHandle.If
799  name: |
800    func (*BucketHandle) If
801  id: If
802  summary: |
803    If returns a new BucketHandle that applies a set of preconditions.
804    Preconditions already set on the BucketHandle are ignored.
805    Operations on the new handle will return an error if the preconditions are not
806    satisfied. The only valid preconditions for buckets are MetagenerationMatch
807    and MetagenerationNotMatch.
808  parent: cloud.google.com/go/storage.BucketHandle
809  type: method
810  langs:
811  - go
812  syntax:
813    content: func (b *<a href="#cloud_google_com_go_storage_BucketHandle">BucketHandle</a>)
814      If(conds <a href="#cloud_google_com_go_storage_BucketConditions">BucketConditions</a>)
815      *<a href="#cloud_google_com_go_storage_BucketHandle">BucketHandle</a>
816- uid: cloud.google.com/go/storage.BucketHandle.LockRetentionPolicy
817  name: |
818    func (*BucketHandle) LockRetentionPolicy
819  id: LockRetentionPolicy
820  summary: |
821    LockRetentionPolicy locks a bucket's retention policy until a previously-configured
822    RetentionPeriod past the EffectiveTime. Note that if RetentionPeriod is set to less
823    than a day, the retention policy is treated as a development configuration and locking
824    will have no effect. The BucketHandle must have a metageneration condition that
825    matches the bucket's metageneration. See BucketHandle.If.
826
827    This feature is in private alpha release. It is not currently available to
828    most customers. It might be changed in backwards-incompatible ways and is not
829    subject to any SLA or deprecation policy.
830  parent: cloud.google.com/go/storage.BucketHandle
831  type: method
832  langs:
833  - go
834  syntax:
835    content: func (b *<a href="#cloud_google_com_go_storage_BucketHandle">BucketHandle</a>)
836      LockRetentionPolicy(ctx <a href="https://pkg.go.dev/context">context</a>.<a
837      href="https://pkg.go.dev/context#Context">Context</a>) <a href="https://pkg.go.dev/builtin#error">error</a>
838  codeexamples:
839  - content: "package main\n\nimport (\n\t\"cloud.google.com/go/storage\"\n\t\"context\"\n)\n\nfunc
840      main() {\n\tctx := context.Background()\n\tclient, err := storage.NewClient(ctx)\n\tif
841      err != nil {\n\t\t// TODO: handle error.\n\t}\n\tb := client.Bucket(\"my-bucket\")\n\tattrs,
842      err := b.Attrs(ctx)\n\tif err != nil {\n\t\t// TODO: handle error.\n\t}\n\t//
843      Note that locking the bucket without first attaching a RetentionPolicy\n\t//
844      that's at least 1 day is a no-op\n\terr = b.If(storage.BucketConditions{MetagenerationMatch:
845      attrs.MetaGeneration}).LockRetentionPolicy(ctx)\n\tif err != nil {\n\t\t// TODO:
846      handle err\n\t}\n}\n"
847- uid: cloud.google.com/go/storage.BucketHandle.Notifications
848  name: |
849    func (*BucketHandle) Notifications
850  id: Notifications
851  summary: |
852    Notifications returns all the Notifications configured for this bucket, as a map
853    indexed by notification ID.
854  parent: cloud.google.com/go/storage.BucketHandle
855  type: method
856  langs:
857  - go
858  syntax:
859    content: func (b *<a href="#cloud_google_com_go_storage_BucketHandle">BucketHandle</a>)
860      Notifications(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>)
861      (n map[<a href="https://pkg.go.dev/builtin#string">string</a>]*<a href="#cloud_google_com_go_storage_Notification">Notification</a>,
862      err <a href="https://pkg.go.dev/builtin#error">error</a>)
863  codeexamples:
864  - content: "package main\n\nimport (\n\t\"cloud.google.com/go/storage\"\n\t\"context\"\n\t\"fmt\"\n)\n\nfunc
865      main() {\n\tctx := context.Background()\n\tclient, err := storage.NewClient(ctx)\n\tif
866      err != nil {\n\t\t// TODO: handle error.\n\t}\n\tb := client.Bucket(\"my-bucket\")\n\tns,
867      err := b.Notifications(ctx)\n\tif err != nil {\n\t\t// TODO: handle error.\n\t}\n\tfor
868      id, n := range ns {\n\t\tfmt.Printf(\"%s: %+v\\n\", id, n)\n\t}\n}\n"
869- uid: cloud.google.com/go/storage.BucketHandle.Object
870  name: |
871    func (*BucketHandle) Object
872  id: Object
873  summary: |
874    Object returns an ObjectHandle, which provides operations on the named object.
875    This call does not perform any network operations.
876
877    name must consist entirely of valid UTF-8-encoded runes. The full specification
878    for valid object names can be found at:
879      https://cloud.google.com/storage/docs/bucket-naming
880  parent: cloud.google.com/go/storage.BucketHandle
881  type: method
882  langs:
883  - go
884  syntax:
885    content: func (b *<a href="#cloud_google_com_go_storage_BucketHandle">BucketHandle</a>)
886      Object(name <a href="https://pkg.go.dev/builtin#string">string</a>) *<a href="#cloud_google_com_go_storage_ObjectHandle">ObjectHandle</a>
887- uid: cloud.google.com/go/storage.BucketHandle.Objects
888  name: |
889    func (*BucketHandle) Objects
890  id: Objects
891  summary: |
892    Objects returns an iterator over the objects in the bucket that match the Query q.
893    If q is nil, no filtering is done.
894
895    Note: The returned iterator is not safe for concurrent operations without explicit synchronization.
896  parent: cloud.google.com/go/storage.BucketHandle
897  type: method
898  langs:
899  - go
900  syntax:
901    content: func (b *<a href="#cloud_google_com_go_storage_BucketHandle">BucketHandle</a>)
902      Objects(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>,
903      q *<a href="#cloud_google_com_go_storage_Query">Query</a>) *<a href="#cloud_google_com_go_storage_ObjectIterator">ObjectIterator</a>
904  codeexamples:
905  - content: "package main\n\nimport (\n\t\"cloud.google.com/go/storage\"\n\t\"context\"\n)\n\nfunc
906      main() {\n\tctx := context.Background()\n\tclient, err := storage.NewClient(ctx)\n\tif
907      err != nil {\n\t\t// TODO: handle error.\n\t}\n\tit := client.Bucket(\"my-bucket\").Objects(ctx,
908      nil)\n\t_ = it // TODO: iterate using Next or iterator.Pager.\n}\n"
909- uid: cloud.google.com/go/storage.BucketHandle.Update
910  name: |
911    func (*BucketHandle) Update
912  id: Update
913  summary: |
914    Update updates a bucket's attributes.
915  parent: cloud.google.com/go/storage.BucketHandle
916  type: method
917  langs:
918  - go
919  syntax:
920    content: func (b *<a href="#cloud_google_com_go_storage_BucketHandle">BucketHandle</a>)
921      Update(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>,
922      uattrs <a href="#cloud_google_com_go_storage_BucketAttrsToUpdate">BucketAttrsToUpdate</a>)
923      (attrs *<a href="#cloud_google_com_go_storage_BucketAttrs">BucketAttrs</a>,
924      err <a href="https://pkg.go.dev/builtin#error">error</a>)
925  codeexamples:
926  - content: "package main\n\nimport (\n\t\"cloud.google.com/go/storage\"\n\t\"context\"\n\t\"fmt\"\n)\n\nfunc
927      main() {\n\tctx := context.Background()\n\tclient, err := storage.NewClient(ctx)\n\tif
928      err != nil {\n\t\t// TODO: handle error.\n\t}\n\t// Enable versioning in the
929      bucket, regardless of its previous value.\n\tattrs, err := client.Bucket(\"my-bucket\").Update(ctx,\n\t\tstorage.BucketAttrsToUpdate{VersioningEnabled:
930      true})\n\tif err != nil {\n\t\t// TODO: handle error.\n\t}\n\tfmt.Println(attrs)\n}\n"
931  - content: "package main\n\nimport (\n\t\"cloud.google.com/go/storage\"\n\t\"context\"\n\t\"fmt\"\n)\n\nfunc
932      main() {\n\tctx := context.Background()\n\tclient, err := storage.NewClient(ctx)\n\tif
933      err != nil {\n\t\t// TODO: handle error.\n\t}\n\tb := client.Bucket(\"my-bucket\")\n\tattrs,
934      err := b.Attrs(ctx)\n\tif err != nil {\n\t\t// TODO: handle error.\n\t}\n\tvar
935      au storage.BucketAttrsToUpdate\n\tau.SetLabel(\"lab\", attrs.Labels[\"lab\"]+\"-more\")\n\tif
936      attrs.Labels[\"delete-me\"] == \"yes\" {\n\t\tau.DeleteLabel(\"delete-me\")\n\t}\n\tattrs,
937      err = b.\n\t\tIf(storage.BucketConditions{MetagenerationMatch: attrs.MetaGeneration}).\n\t\tUpdate(ctx,
938      au)\n\tif err != nil {\n\t\t// TODO: handle error.\n\t}\n\tfmt.Println(attrs)\n}\n"
939    name: readModifyWrite
940- uid: cloud.google.com/go/storage.BucketHandle.UserProject
941  name: |
942    func (*BucketHandle) UserProject
943  id: UserProject
944  summary: |
945    UserProject returns a new BucketHandle that passes the project ID as the user
946    project for all subsequent calls. Calls with a user project will be billed to that
947    project rather than to the bucket's owning project.
948
949    A user project is required for all operations on Requester Pays buckets.
950  parent: cloud.google.com/go/storage.BucketHandle
951  type: method
952  langs:
953  - go
954  syntax:
955    content: func (b *<a href="#cloud_google_com_go_storage_BucketHandle">BucketHandle</a>)
956      UserProject(projectID <a href="https://pkg.go.dev/builtin#string">string</a>)
957      *<a href="#cloud_google_com_go_storage_BucketHandle">BucketHandle</a>
958- uid: cloud.google.com/go/storage.BucketIterator
959  name: BucketIterator
960  id: BucketIterator
961  summary: |
962    A BucketIterator is an iterator over BucketAttrs.
963
964    Note: This iterator is not safe for concurrent operations without explicit synchronization.
965  parent: cloud.google.com/go/storage
966  type: type
967  langs:
968  - go
969  syntax:
970    content: "type BucketIterator struct {\n\t// Prefix restricts the iterator to
971      buckets whose names begin with it.\n\tPrefix <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\t//
972      contains filtered or unexported fields\n}"
973- uid: cloud.google.com/go/storage.BucketIterator.Next
974  name: |
975    func (*BucketIterator) Next
976  id: Next
977  summary: |
978    Next returns the next result. Its second return value is iterator.Done if
979    there are no more results. Once Next returns iterator.Done, all subsequent
980    calls will return iterator.Done.
981
982    Note: This method is not safe for concurrent operations without explicit synchronization.
983  parent: cloud.google.com/go/storage.BucketIterator
984  type: method
985  langs:
986  - go
987  syntax:
988    content: func (it *<a href="#cloud_google_com_go_storage_BucketIterator">BucketIterator</a>)
989      Next() (*<a href="#cloud_google_com_go_storage_BucketAttrs">BucketAttrs</a>,
990      <a href="https://pkg.go.dev/builtin#error">error</a>)
991  codeexamples:
992  - content: "package main\n\nimport (\n\t\"cloud.google.com/go/storage\"\n\t\"context\"\n\t\"fmt\"\n\t\"google.golang.org/api/iterator\"\n)\n\nfunc
993      main() {\n\tctx := context.Background()\n\tclient, err := storage.NewClient(ctx)\n\tif
994      err != nil {\n\t\t// TODO: handle error.\n\t}\n\tit := client.Buckets(ctx, \"my-project\")\n\tfor
995      {\n\t\tbucketAttrs, err := it.Next()\n\t\tif err == iterator.Done {\n\t\t\tbreak\n\t\t}\n\t\tif
996      err != nil {\n\t\t\t// TODO: Handle error.\n\t\t}\n\t\tfmt.Println(bucketAttrs)\n\t}\n}\n"
997- uid: cloud.google.com/go/storage.BucketIterator.PageInfo
998  name: |
999    func (*BucketIterator) PageInfo
1000  id: PageInfo
1001  summary: |
1002    PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
1003
1004    Note: This method is not safe for concurrent operations without explicit synchronization.
1005  parent: cloud.google.com/go/storage.BucketIterator
1006  type: method
1007  langs:
1008  - go
1009  syntax:
1010    content: func (it *<a href="#cloud_google_com_go_storage_BucketIterator">BucketIterator</a>)
1011      PageInfo() *<a href="https://pkg.go.dev/google.golang.org/api/iterator">iterator</a>.<a
1012      href="https://pkg.go.dev/google.golang.org/api/iterator#PageInfo">PageInfo</a>
1013- uid: cloud.google.com/go/storage.BucketLogging
1014  name: BucketLogging
1015  id: BucketLogging
1016  summary: |
1017    BucketLogging holds the bucket's logging configuration, which defines the
1018    destination bucket and optional name prefix for the current bucket's
1019    logs.
1020  parent: cloud.google.com/go/storage
1021  type: type
1022  langs:
1023  - go
1024  syntax:
1025    content: "type BucketLogging struct {\n\t// The destination bucket where the current
1026      bucket's logs\n\t// should be placed.\n\tLogBucket <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t//
1027      A prefix for log object names.\n\tLogObjectPrefix <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n}"
1028- uid: cloud.google.com/go/storage.BucketPolicyOnly
1029  name: BucketPolicyOnly
1030  id: BucketPolicyOnly
1031  summary: |
1032    BucketPolicyOnly is an alias for UniformBucketLevelAccess.
1033    Use of UniformBucketLevelAccess is preferred above BucketPolicyOnly.
1034  parent: cloud.google.com/go/storage
1035  type: type
1036  langs:
1037  - go
1038  syntax:
1039    content: "type BucketPolicyOnly struct {\n\t// Enabled specifies whether access
1040      checks use only bucket-level IAM\n\t// policies. Enabled may be disabled until
1041      the locked time.\n\tEnabled <a href=\"https://pkg.go.dev/builtin#bool\">bool</a>\n\t//
1042      LockedTime specifies the deadline for changing Enabled from true to\n\t// false.\n\tLockedTime
1043      <a href=\"https://pkg.go.dev/time\">time</a>.<a href=\"https://pkg.go.dev/time#Time\">Time</a>\n}"
1044- uid: cloud.google.com/go/storage.BucketWebsite
1045  name: BucketWebsite
1046  id: BucketWebsite
1047  summary: |
1048    BucketWebsite holds the bucket's website configuration, controlling how the
1049    service behaves when accessing bucket contents as a web site. See
1050    https://cloud.google.com/storage/docs/static-website for more information.
1051  parent: cloud.google.com/go/storage
1052  type: type
1053  langs:
1054  - go
1055  syntax:
1056    content: "type BucketWebsite struct {\n\t// If the requested object path is missing,
1057      the service will ensure the path has\n\t// a trailing '/', append this suffix,
1058      and attempt to retrieve the resulting\n\t// object. This allows the creation
1059      of index.html objects to represent directory\n\t// pages.\n\tMainPageSuffix
1060      <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t// If the requested
1061      object path is missing, and any mainPageSuffix object is\n\t// missing, if applicable,
1062      the service will return the named object from this\n\t// bucket as the content
1063      for a 404 Not Found result.\n\tNotFoundPage <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n}"
1064- uid: cloud.google.com/go/storage.CORS
1065  name: CORS
1066  id: CORS
1067  summary: |
1068    CORS is the bucket's Cross-Origin Resource Sharing (CORS) configuration.
1069  parent: cloud.google.com/go/storage
1070  type: type
1071  langs:
1072  - go
1073  syntax:
1074    content: "type CORS struct {\n\t// MaxAge is the value to return in the Access-Control-Max-Age\n\t//
1075      header used in preflight responses.\n\tMaxAge <a href=\"https://pkg.go.dev/time\">time</a>.<a
1076      href=\"https://pkg.go.dev/time#Duration\">Duration</a>\n\n\t// Methods is the
1077      list of HTTP methods on which to include CORS response\n\t// headers, (GET,
1078      OPTIONS, POST, etc) Note: \"*\" is permitted in the list\n\t// of methods, and
1079      means \"any method\".\n\tMethods []<a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t//
1080      Origins is the list of Origins eligible to receive CORS response\n\t// headers.
1081      Note: \"*\" is permitted in the list of origins, and means\n\t// \"any Origin\".\n\tOrigins
1082      []<a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t// ResponseHeaders
1083      is the list of HTTP headers other than the simple\n\t// response headers to
1084      give permission for the user-agent to share\n\t// across domains.\n\tResponseHeaders
1085      []<a href=\"https://pkg.go.dev/builtin#string\">string</a>\n}"
1086- uid: cloud.google.com/go/storage.Client
1087  name: Client
1088  id: Client
1089  summary: |
1090    Client is a client for interacting with Google Cloud Storage.
1091
1092    Clients should be reused instead of created as needed.
1093    The methods of Client are safe for concurrent use by multiple goroutines.
1094  parent: cloud.google.com/go/storage
1095  type: type
1096  langs:
1097  - go
1098  syntax:
1099    content: "type Client struct {\n\t// contains filtered or unexported fields\n}"
1100- uid: cloud.google.com/go/storage.Client.NewClient
1101  name: |
1102    func NewClient
1103  id: NewClient
1104  summary: |
1105    NewClient creates a new Google Cloud Storage client.
1106    The default scope is ScopeFullControl. To use a different scope, like
1107    ScopeReadOnly, use option.WithScopes.
1108
1109    Clients should be reused instead of created as needed. The methods of Client
1110    are safe for concurrent use by multiple goroutines.
1111  parent: cloud.google.com/go/storage.Client
1112  type: function
1113  langs:
1114  - go
1115  syntax:
1116    content: func NewClient(ctx <a href="https://pkg.go.dev/context">context</a>.<a
1117      href="https://pkg.go.dev/context#Context">Context</a>, opts ...<a href="https://pkg.go.dev/google.golang.org/api/option">option</a>.<a
1118      href="https://pkg.go.dev/google.golang.org/api/option#ClientOption">ClientOption</a>)
1119      (*<a href="#cloud_google_com_go_storage_Client">Client</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)
1120  codeexamples:
1121  - content: "package main\n\nimport (\n\t\"cloud.google.com/go/storage\"\n\t\"context\"\n)\n\nfunc
1122      main() {\n\tctx := context.Background()\n\t// Use Google Application Default
1123      Credentials to authorize and authenticate the client.\n\t// More information
1124      about Application Default Credentials and how to enable is at\n\t// https://developers.google.com/identity/protocols/application-default-credentials.\n\tclient,
1125      err := storage.NewClient(ctx)\n\tif err != nil {\n\t\t// TODO: handle error.\n\t}\n\t//
1126      Use the client.\n\n\t// Close the client when finished.\n\tif err := client.Close();
1127      err != nil {\n\t\t// TODO: handle error.\n\t}\n}\n"
1128  - content: "package main\n\nimport (\n\t\"cloud.google.com/go/storage\"\n\t\"context\"\n\t\"google.golang.org/api/option\"\n)\n\nfunc
1129      main() {\n\tctx := context.Background()\n\tclient, err := storage.NewClient(ctx,
1130      option.WithoutAuthentication())\n\tif err != nil {\n\t\t// TODO: handle error.\n\t}\n\t//
1131      Use the client.\n\n\t// Close the client when finished.\n\tif err := client.Close();
1132      err != nil {\n\t\t// TODO: handle error.\n\t}\n}\n"
1133    name: unauthenticated
1134- uid: cloud.google.com/go/storage.Client.Bucket
1135  name: |
1136    func (*Client) Bucket
1137  id: Bucket
1138  summary: |
1139    Bucket returns a BucketHandle, which provides operations on the named bucket.
1140    This call does not perform any network operations.
1141
1142    The supplied name must contain only lowercase letters, numbers, dashes,
1143    underscores, and dots. The full specification for valid bucket names can be
1144    found at:
1145      https://cloud.google.com/storage/docs/bucket-naming
1146  parent: cloud.google.com/go/storage.Client
1147  type: method
1148  langs:
1149  - go
1150  syntax:
1151    content: func (c *<a href="#cloud_google_com_go_storage_Client">Client</a>) Bucket(name
1152      <a href="https://pkg.go.dev/builtin#string">string</a>) *<a href="#cloud_google_com_go_storage_BucketHandle">BucketHandle</a>
1153- uid: cloud.google.com/go/storage.Client.Buckets
1154  name: |
1155    func (*Client) Buckets
1156  id: Buckets
1157  summary: |
1158    Buckets returns an iterator over the buckets in the project. You may
1159    optionally set the iterator's Prefix field to restrict the list to buckets
1160    whose names begin with the prefix. By default, all buckets in the project
1161    are returned.
1162
1163    Note: The returned iterator is not safe for concurrent operations without explicit synchronization.
1164  parent: cloud.google.com/go/storage.Client
1165  type: method
1166  langs:
1167  - go
1168  syntax:
1169    content: func (c *<a href="#cloud_google_com_go_storage_Client">Client</a>) Buckets(ctx
1170      <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>,
1171      projectID <a href="https://pkg.go.dev/builtin#string">string</a>) *<a href="#cloud_google_com_go_storage_BucketIterator">BucketIterator</a>
1172  codeexamples:
1173  - content: "package main\n\nimport (\n\t\"cloud.google.com/go/storage\"\n\t\"context\"\n)\n\nfunc
1174      main() {\n\tctx := context.Background()\n\tclient, err := storage.NewClient(ctx)\n\tif
1175      err != nil {\n\t\t// TODO: handle error.\n\t}\n\tit := client.Buckets(ctx, \"my-bucket\")\n\t_
1176      = it // TODO: iterate using Next or iterator.Pager.\n}\n"
1177- uid: cloud.google.com/go/storage.Client.Close
1178  name: |
1179    func (*Client) Close
1180  id: Close
1181  summary: |
1182    Close closes the Client.
1183
1184    Close need not be called at program exit.
1185  parent: cloud.google.com/go/storage.Client
1186  type: method
1187  langs:
1188  - go
1189  syntax:
1190    content: func (c *<a href="#cloud_google_com_go_storage_Client">Client</a>) Close()
1191      <a href="https://pkg.go.dev/builtin#error">error</a>
1192- uid: cloud.google.com/go/storage.Client.CreateHMACKey
1193  name: |
1194    func (*Client) CreateHMACKey
1195  id: CreateHMACKey
1196  summary: |
1197    CreateHMACKey invokes an RPC for Google Cloud Storage to create a new HMACKey.
1198
1199    This method is EXPERIMENTAL and subject to change or removal without notice.
1200  parent: cloud.google.com/go/storage.Client
1201  type: method
1202  langs:
1203  - go
1204  syntax:
1205    content: func (c *<a href="#cloud_google_com_go_storage_Client">Client</a>) CreateHMACKey(ctx
1206      <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>,
1207      projectID, serviceAccountEmail <a href="https://pkg.go.dev/builtin#string">string</a>,
1208      opts ...<a href="#cloud_google_com_go_storage_HMACKeyOption">HMACKeyOption</a>)
1209      (*<a href="#cloud_google_com_go_storage_HMACKey">HMACKey</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)
1210  codeexamples:
1211  - content: "package main\n\nimport (\n\t\"cloud.google.com/go/storage\"\n\t\"context\"\n)\n\nfunc
1212      main() {\n\tctx := context.Background()\n\tclient, err := storage.NewClient(ctx)\n\tif
1213      err != nil {\n\t\t// TODO: handle error.\n\t}\n\n\thkey, err := client.CreateHMACKey(ctx,
1214      \"project-id\", \"service-account-email\")\n\tif err != nil {\n\t\t// TODO:
1215      handle error.\n\t}\n\t_ = hkey // TODO: Use the HMAC Key.\n}\n"
1216- uid: cloud.google.com/go/storage.Client.HMACKeyHandle
1217  name: |
1218    func (*Client) HMACKeyHandle
1219  id: HMACKeyHandle
1220  summary: |
1221    HMACKeyHandle creates a handle that will be used for HMACKey operations.
1222
1223    This method is EXPERIMENTAL and subject to change or removal without notice.
1224  parent: cloud.google.com/go/storage.Client
1225  type: method
1226  langs:
1227  - go
1228  syntax:
1229    content: func (c *<a href="#cloud_google_com_go_storage_Client">Client</a>) HMACKeyHandle(projectID,
1230      accessID <a href="https://pkg.go.dev/builtin#string">string</a>) *<a href="#cloud_google_com_go_storage_HMACKeyHandle">HMACKeyHandle</a>
1231- uid: cloud.google.com/go/storage.Client.ListHMACKeys
1232  name: |
1233    func (*Client) ListHMACKeys
1234  id: ListHMACKeys
1235  summary: |
1236    ListHMACKeys returns an iterator for listing HMACKeys.
1237
1238    Note: This iterator is not safe for concurrent operations without explicit synchronization.
1239
1240    This method is EXPERIMENTAL and subject to change or removal without notice.
1241  parent: cloud.google.com/go/storage.Client
1242  type: method
1243  langs:
1244  - go
1245  syntax:
1246    content: func (c *<a href="#cloud_google_com_go_storage_Client">Client</a>) ListHMACKeys(ctx
1247      <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>,
1248      projectID <a href="https://pkg.go.dev/builtin#string">string</a>, opts ...<a
1249      href="#cloud_google_com_go_storage_HMACKeyOption">HMACKeyOption</a>) *<a href="#cloud_google_com_go_storage_HMACKeysIterator">HMACKeysIterator</a>
1250  codeexamples:
1251  - content: "package main\n\nimport (\n\t\"cloud.google.com/go/storage\"\n\t\"context\"\n\t\"google.golang.org/api/iterator\"\n)\n\nfunc
1252      main() {\n\tctx := context.Background()\n\tclient, err := storage.NewClient(ctx)\n\tif
1253      err != nil {\n\t\t// TODO: handle error.\n\t}\n\n\titer := client.ListHMACKeys(ctx,
1254      \"project-id\")\n\tfor {\n\t\tkey, err := iter.Next()\n\t\tif err == iterator.Done
1255      {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\t// TODO: handle error.\n\t\t}\n\t\t_
1256      = key // TODO: Use the key.\n\t}\n}\n"
1257  - content: "package main\n\nimport (\n\t\"cloud.google.com/go/storage\"\n\t\"context\"\n\t\"google.golang.org/api/iterator\"\n)\n\nfunc
1258      main() {\n\tctx := context.Background()\n\tclient, err := storage.NewClient(ctx)\n\tif
1259      err != nil {\n\t\t// TODO: handle error.\n\t}\n\n\titer := client.ListHMACKeys(ctx,
1260      \"project-id\", storage.ForHMACKeyServiceAccountEmail(\"service@account.email\"))\n\tfor
1261      {\n\t\tkey, err := iter.Next()\n\t\tif err == iterator.Done {\n\t\t\tbreak\n\t\t}\n\t\tif
1262      err != nil {\n\t\t\t// TODO: handle error.\n\t\t}\n\t\t_ = key // TODO: Use
1263      the key.\n\t}\n}\n"
1264    name: forServiceAccountEmail
1265  - content: "package main\n\nimport (\n\t\"cloud.google.com/go/storage\"\n\t\"context\"\n\t\"google.golang.org/api/iterator\"\n)\n\nfunc
1266      main() {\n\tctx := context.Background()\n\tclient, err := storage.NewClient(ctx)\n\tif
1267      err != nil {\n\t\t// TODO: handle error.\n\t}\n\n\titer := client.ListHMACKeys(ctx,
1268      \"project-id\", storage.ShowDeletedHMACKeys())\n\tfor {\n\t\tkey, err := iter.Next()\n\t\tif
1269      err == iterator.Done {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\t// TODO:
1270      handle error.\n\t\t}\n\t\t_ = key // TODO: Use the key.\n\t}\n}\n"
1271    name: showDeletedKeys
1272- uid: cloud.google.com/go/storage.Client.ServiceAccount
1273  name: |
1274    func (*Client) ServiceAccount
1275  id: ServiceAccount
1276  summary: |
1277    ServiceAccount fetches the email address of the given project's Google Cloud Storage service account.
1278  parent: cloud.google.com/go/storage.Client
1279  type: method
1280  langs:
1281  - go
1282  syntax:
1283    content: func (c *<a href="#cloud_google_com_go_storage_Client">Client</a>) ServiceAccount(ctx
1284      <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>,
1285      projectID <a href="https://pkg.go.dev/builtin#string">string</a>) (<a href="https://pkg.go.dev/builtin#string">string</a>,
1286      <a href="https://pkg.go.dev/builtin#error">error</a>)
1287- uid: cloud.google.com/go/storage.Composer
1288  name: Composer
1289  id: Composer
1290  summary: |
1291    A Composer composes source objects into a destination object.
1292
1293    For Requester Pays buckets, the user project of dst is billed.
1294  parent: cloud.google.com/go/storage
1295  type: type
1296  langs:
1297  - go
1298  syntax:
1299    content: "type Composer struct {\n\t// ObjectAttrs are optional attributes to
1300      set on the destination object.\n\t// Any attributes must be initialized before
1301      any calls on the Composer. Nil\n\t// or zero-valued attributes are ignored.\n\t<a
1302      href=\"#cloud_google_com_go_storage_ObjectAttrs\">ObjectAttrs</a>\n\n\t// SendCRC
1303      specifies whether to transmit a CRC32C field. It should be set\n\t// to true
1304      in addition to setting the Composer's CRC32C field, because zero\n\t// is a
1305      valid CRC and normally a zero would not be transmitted.\n\t// If a CRC32C is
1306      sent, and the data in the destination object does not match\n\t// the checksum,
1307      the compose will be rejected.\n\tSendCRC32C <a href=\"https://pkg.go.dev/builtin#bool\">bool</a>\n\t//
1308      contains filtered or unexported fields\n}"
1309- uid: cloud.google.com/go/storage.Composer.Run
1310  name: |
1311    func (*Composer) Run
1312  id: Run
1313  summary: |
1314    Run performs the compose operation.
1315  parent: cloud.google.com/go/storage.Composer
1316  type: method
1317  langs:
1318  - go
1319  syntax:
1320    content: func (c *<a href="#cloud_google_com_go_storage_Composer">Composer</a>)
1321      Run(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>)
1322      (attrs *<a href="#cloud_google_com_go_storage_ObjectAttrs">ObjectAttrs</a>,
1323      err <a href="https://pkg.go.dev/builtin#error">error</a>)
1324  codeexamples:
1325  - content: "package main\n\nimport (\n\t\"cloud.google.com/go/storage\"\n\t\"context\"\n\t\"fmt\"\n)\n\nfunc
1326      main() {\n\tctx := context.Background()\n\tclient, err := storage.NewClient(ctx)\n\tif
1327      err != nil {\n\t\t// TODO: handle error.\n\t}\n\tbkt := client.Bucket(\"bucketname\")\n\tsrc1
1328      := bkt.Object(\"o1\")\n\tsrc2 := bkt.Object(\"o2\")\n\tdst := bkt.Object(\"o3\")\n\n\t//
1329      Compose and modify metadata.\n\tc := dst.ComposerFrom(src1, src2)\n\tc.ContentType
1330      = \"text/plain\"\n\n\t// Set the expected checksum for the destination object
1331      to be validated by\n\t// the backend (if desired).\n\tc.CRC32C = 42\n\tc.SendCRC32C
1332      = true\n\n\tattrs, err := c.Run(ctx)\n\tif err != nil {\n\t\t// TODO: Handle
1333      error.\n\t}\n\tfmt.Println(attrs)\n\t// Just compose.\n\tattrs, err = dst.ComposerFrom(src1,
1334      src2).Run(ctx)\n\tif err != nil {\n\t\t// TODO: Handle error.\n\t}\n\tfmt.Println(attrs)\n}\n"
1335- uid: cloud.google.com/go/storage.Conditions
1336  name: Conditions
1337  id: Conditions
1338  summary: |
1339    Conditions constrain methods to act on specific generations of
1340    objects.
1341
1342    The zero value is an empty set of constraints. Not all conditions or
1343    combinations of conditions are applicable to all methods.
1344    See https://cloud.google.com/storage/docs/generations-preconditions
1345    for details on how these operate.
1346  parent: cloud.google.com/go/storage
1347  type: type
1348  langs:
1349  - go
1350  syntax:
1351    content: "type Conditions struct {\n\n\t// GenerationMatch specifies that the
1352      object must have the given generation\n\t// for the operation to occur.\n\t//
1353      If GenerationMatch is zero, it has no effect.\n\t// Use DoesNotExist to specify
1354      that the object does not exist in the bucket.\n\tGenerationMatch <a href=\"https://pkg.go.dev/builtin#int64\">int64</a>\n\n\t//
1355      GenerationNotMatch specifies that the object must not have the given\n\t// generation
1356      for the operation to occur.\n\t// If GenerationNotMatch is zero, it has no effect.\n\tGenerationNotMatch
1357      <a href=\"https://pkg.go.dev/builtin#int64\">int64</a>\n\n\t// DoesNotExist
1358      specifies that the object must not exist in the bucket for\n\t// the operation
1359      to occur.\n\t// If DoesNotExist is false, it has no effect.\n\tDoesNotExist
1360      <a href=\"https://pkg.go.dev/builtin#bool\">bool</a>\n\n\t// MetagenerationMatch
1361      specifies that the object must have the given\n\t// metageneration for the operation
1362      to occur.\n\t// If MetagenerationMatch is zero, it has no effect.\n\tMetagenerationMatch
1363      <a href=\"https://pkg.go.dev/builtin#int64\">int64</a>\n\n\t// MetagenerationNotMatch
1364      specifies that the object must not have the given\n\t// metageneration for the
1365      operation to occur.\n\t// If MetagenerationNotMatch is zero, it has no effect.\n\tMetagenerationNotMatch
1366      <a href=\"https://pkg.go.dev/builtin#int64\">int64</a>\n}"
1367- uid: cloud.google.com/go/storage.Copier
1368  name: Copier
1369  id: Copier
1370  summary: |
1371    A Copier copies a source object to a destination.
1372  parent: cloud.google.com/go/storage
1373  type: type
1374  langs:
1375  - go
1376  syntax:
1377    content: "type Copier struct {\n\t// ObjectAttrs are optional attributes to set
1378      on the destination object.\n\t// Any attributes must be initialized before any
1379      calls on the Copier. Nil\n\t// or zero-valued attributes are ignored.\n\t<a
1380      href=\"#cloud_google_com_go_storage_ObjectAttrs\">ObjectAttrs</a>\n\n\t// RewriteToken
1381      can be set before calling Run to resume a copy\n\t// operation. After Run returns
1382      a non-nil error, RewriteToken will\n\t// have been updated to contain the value
1383      needed to resume the copy.\n\tRewriteToken <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t//
1384      ProgressFunc can be used to monitor the progress of a multi-RPC copy\n\t// operation.
1385      If ProgressFunc is not nil and copying requires multiple\n\t// calls to the
1386      underlying service (see\n\t// https://cloud.google.com/storage/docs/json_api/v1/objects/rewrite),
1387      then\n\t// ProgressFunc will be invoked after each call with the number of bytes
1388      of\n\t// content copied so far and the total size in bytes of the source object.\n\t//\n\t//
1389      ProgressFunc is intended to make upload progress available to the\n\t// application.
1390      For example, the implementation of ProgressFunc may update\n\t// a progress
1391      bar in the application's UI, or log the result of\n\t// float64(copiedBytes)/float64(totalBytes).\n\t//\n\t//
1392      ProgressFunc should return quickly without blocking.\n\tProgressFunc func(copiedBytes,
1393      totalBytes <a href=\"https://pkg.go.dev/builtin#uint64\">uint64</a>)\n\n\t//
1394      The Cloud KMS key, in the form projects/P/locations/L/keyRings/R/cryptoKeys/K,\n\t//
1395      that will be used to encrypt the object. Overrides the object's KMSKeyName,
1396      if\n\t// any.\n\t//\n\t// Providing both a DestinationKMSKeyName and a customer-supplied
1397      encryption key\n\t// (via ObjectHandle.Key) on the destination object will result
1398      in an error when\n\t// Run is called.\n\tDestinationKMSKeyName <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\t//
1399      contains filtered or unexported fields\n}"
1400- uid: cloud.google.com/go/storage.Copier.Run
1401  name: |
1402    func (*Copier) Run
1403  id: Run
1404  summary: |
1405    Run performs the copy.
1406  parent: cloud.google.com/go/storage.Copier
1407  type: method
1408  langs:
1409  - go
1410  syntax:
1411    content: func (c *<a href="#cloud_google_com_go_storage_Copier">Copier</a>) Run(ctx
1412      <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>)
1413      (attrs *<a href="#cloud_google_com_go_storage_ObjectAttrs">ObjectAttrs</a>,
1414      err <a href="https://pkg.go.dev/builtin#error">error</a>)
1415  codeexamples:
1416  - content: "package main\n\nimport (\n\t\"cloud.google.com/go/storage\"\n\t\"context\"\n\t\"fmt\"\n)\n\nfunc
1417      main() {\n\tctx := context.Background()\n\tclient, err := storage.NewClient(ctx)\n\tif
1418      err != nil {\n\t\t// TODO: handle error.\n\t}\n\tsrc := client.Bucket(\"bucketname\").Object(\"file1\")\n\tdst
1419      := client.Bucket(\"another-bucketname\").Object(\"file2\")\n\n\t// Copy content
1420      and modify metadata.\n\tcopier := dst.CopierFrom(src)\n\tcopier.ContentType
1421      = \"text/plain\"\n\tattrs, err := copier.Run(ctx)\n\tif err != nil {\n\t\t//
1422      TODO: Handle error, possibly resuming with copier.RewriteToken.\n\t}\n\tfmt.Println(attrs)\n\n\t//
1423      Just copy content.\n\tattrs, err = dst.CopierFrom(src).Run(ctx)\n\tif err !=
1424      nil {\n\t\t// TODO: Handle error. No way to resume.\n\t}\n\tfmt.Println(attrs)\n}\n"
1425  - content: "package main\n\nimport (\n\t\"cloud.google.com/go/storage\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc
1426      main() {\n\t// Display progress across multiple rewrite RPCs.\n\tctx := context.Background()\n\tclient,
1427      err := storage.NewClient(ctx)\n\tif err != nil {\n\t\t// TODO: handle error.\n\t}\n\tsrc
1428      := client.Bucket(\"bucketname\").Object(\"file1\")\n\tdst := client.Bucket(\"another-bucketname\").Object(\"file2\")\n\n\tcopier
1429      := dst.CopierFrom(src)\n\tcopier.ProgressFunc = func(copiedBytes, totalBytes
1430      uint64) {\n\t\tlog.Printf(\"copy %.1f%% done\", float64(copiedBytes)/float64(totalBytes)*100)\n\t}\n\tif
1431      _, err := copier.Run(ctx); err != nil {\n\t\t// TODO: handle error.\n\t}\n}\n"
1432    name: progress
1433- uid: cloud.google.com/go/storage.HMACKey
1434  name: HMACKey
1435  id: HMACKey
1436  summary: |
1437    HMACKey is the representation of a Google Cloud Storage HMAC key.
1438
1439    HMAC keys are used to authenticate signed access to objects. To enable HMAC key
1440    authentication, please visit https://cloud.google.com/storage/docs/migrating.
1441
1442    This type is EXPERIMENTAL and subject to change or removal without notice.
1443  parent: cloud.google.com/go/storage
1444  type: type
1445  langs:
1446  - go
1447  syntax:
1448    content: "type HMACKey struct {\n\t// The HMAC's secret key.\n\tSecret <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t//
1449      AccessID is the ID of the HMAC key.\n\tAccessID <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t//
1450      Etag is the HTTP/1.1 Entity tag.\n\tEtag <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t//
1451      ID is the ID of the HMAC key, including the ProjectID and AccessID.\n\tID <a
1452      href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t// ProjectID is the
1453      ID of the project that owns the\n\t// service account to which the key authenticates.\n\tProjectID
1454      <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t// ServiceAccountEmail
1455      is the email address\n\t// of the key's associated service account.\n\tServiceAccountEmail
1456      <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t// CreatedTime
1457      is the creation time of the HMAC key.\n\tCreatedTime <a href=\"https://pkg.go.dev/time\">time</a>.<a
1458      href=\"https://pkg.go.dev/time#Time\">Time</a>\n\n\t// UpdatedTime is the last
1459      modification time of the HMAC key metadata.\n\tUpdatedTime <a href=\"https://pkg.go.dev/time\">time</a>.<a
1460      href=\"https://pkg.go.dev/time#Time\">Time</a>\n\n\t// State is the state of
1461      the HMAC key.\n\t// It can be one of StateActive, StateInactive or StateDeleted.\n\tState
1462      <a href=\"#cloud_google_com_go_storage_HMACState\">HMACState</a>\n}"
1463- uid: cloud.google.com/go/storage.HMACKeyAttrsToUpdate
1464  name: HMACKeyAttrsToUpdate
1465  id: HMACKeyAttrsToUpdate
1466  summary: |
1467    HMACKeyAttrsToUpdate defines the attributes of an HMACKey that will be updated.
1468
1469    This type is EXPERIMENTAL and subject to change or removal without notice.
1470  parent: cloud.google.com/go/storage
1471  type: type
1472  langs:
1473  - go
1474  syntax:
1475    content: "type HMACKeyAttrsToUpdate struct {\n\t// State is required and must
1476      be either StateActive or StateInactive.\n\tState <a href=\"#cloud_google_com_go_storage_HMACState\">HMACState</a>\n\n\t//
1477      Etag is an optional field and it is the HTTP/1.1 Entity tag.\n\tEtag <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n}"
1478- uid: cloud.google.com/go/storage.HMACKeyHandle
1479  name: HMACKeyHandle
1480  id: HMACKeyHandle
1481  summary: |
1482    HMACKeyHandle helps provide access and management for HMAC keys.
1483
1484    This type is EXPERIMENTAL and subject to change or removal without notice.
1485  parent: cloud.google.com/go/storage
1486  type: type
1487  langs:
1488  - go
1489  syntax:
1490    content: "type HMACKeyHandle struct {\n\t// contains filtered or unexported fields\n}"
1491- uid: cloud.google.com/go/storage.HMACKeyHandle.Delete
1492  name: |
1493    func (*HMACKeyHandle) Delete
1494  id: Delete
1495  summary: |
1496    Delete invokes an RPC to delete the key referenced by accessID, on Google Cloud Storage.
1497    Only inactive HMAC keys can be deleted.
1498    After deletion, a key cannot be used to authenticate requests.
1499
1500    This method is EXPERIMENTAL and subject to change or removal without notice.
1501  parent: cloud.google.com/go/storage.HMACKeyHandle
1502  type: method
1503  langs:
1504  - go
1505  syntax:
1506    content: func (hkh *<a href="#cloud_google_com_go_storage_HMACKeyHandle">HMACKeyHandle</a>)
1507      Delete(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>,
1508      opts ...<a href="#cloud_google_com_go_storage_HMACKeyOption">HMACKeyOption</a>)
1509      <a href="https://pkg.go.dev/builtin#error">error</a>
1510  codeexamples:
1511  - content: "package main\n\nimport (\n\t\"cloud.google.com/go/storage\"\n\t\"context\"\n)\n\nfunc
1512      main() {\n\tctx := context.Background()\n\tclient, err := storage.NewClient(ctx)\n\tif
1513      err != nil {\n\t\t// TODO: handle error.\n\t}\n\n\thkh := client.HMACKeyHandle(\"project-id\",
1514      \"access-key-id\")\n\t// Make sure that the HMACKey being deleted has a status
1515      of inactive.\n\tif err := hkh.Delete(ctx); err != nil {\n\t\t// TODO: handle
1516      error.\n\t}\n}\n"
1517- uid: cloud.google.com/go/storage.HMACKeyHandle.Get
1518  name: |
1519    func (*HMACKeyHandle) Get
1520  id: Get
1521  summary: |
1522    Get invokes an RPC to retrieve the HMAC key referenced by the
1523    HMACKeyHandle's accessID.
1524
1525    Options such as UserProjectForHMACKeys can be used to set the
1526    userProject to be billed against for operations.
1527
1528    This method is EXPERIMENTAL and subject to change or removal without notice.
1529  parent: cloud.google.com/go/storage.HMACKeyHandle
1530  type: method
1531  langs:
1532  - go
1533  syntax:
1534    content: func (hkh *<a href="#cloud_google_com_go_storage_HMACKeyHandle">HMACKeyHandle</a>)
1535      Get(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>,
1536      opts ...<a href="#cloud_google_com_go_storage_HMACKeyOption">HMACKeyOption</a>)
1537      (*<a href="#cloud_google_com_go_storage_HMACKey">HMACKey</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)
1538  codeexamples:
1539  - content: "package main\n\nimport (\n\t\"cloud.google.com/go/storage\"\n\t\"context\"\n)\n\nfunc
1540      main() {\n\tctx := context.Background()\n\tclient, err := storage.NewClient(ctx)\n\tif
1541      err != nil {\n\t\t// TODO: handle error.\n\t}\n\n\thkh := client.HMACKeyHandle(\"project-id\",
1542      \"access-key-id\")\n\thkey, err := hkh.Get(ctx)\n\tif err != nil {\n\t\t// TODO:
1543      handle error.\n\t}\n\t_ = hkey // TODO: Use the HMAC Key.\n}\n"
1544- uid: cloud.google.com/go/storage.HMACKeyHandle.Update
1545  name: |
1546    func (*HMACKeyHandle) Update
1547  id: Update
1548  summary: |
1549    Update mutates the HMACKey referred to by accessID.
1550
1551    This method is EXPERIMENTAL and subject to change or removal without notice.
1552  parent: cloud.google.com/go/storage.HMACKeyHandle
1553  type: method
1554  langs:
1555  - go
1556  syntax:
1557    content: func (h *<a href="#cloud_google_com_go_storage_HMACKeyHandle">HMACKeyHandle</a>)
1558      Update(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>,
1559      au <a href="#cloud_google_com_go_storage_HMACKeyAttrsToUpdate">HMACKeyAttrsToUpdate</a>,
1560      opts ...<a href="#cloud_google_com_go_storage_HMACKeyOption">HMACKeyOption</a>)
1561      (*<a href="#cloud_google_com_go_storage_HMACKey">HMACKey</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)
1562  codeexamples:
1563  - content: "package main\n\nimport (\n\t\"cloud.google.com/go/storage\"\n\t\"context\"\n)\n\nfunc
1564      main() {\n\tctx := context.Background()\n\tclient, err := storage.NewClient(ctx)\n\tif
1565      err != nil {\n\t\t// TODO: handle error.\n\t}\n\n\thkh := client.HMACKeyHandle(\"project-id\",
1566      \"access-key-id\")\n\tukey, err := hkh.Update(ctx, storage.HMACKeyAttrsToUpdate{\n\t\tState:
1567      storage.Inactive,\n\t})\n\tif err != nil {\n\t\t// TODO: handle error.\n\t}\n\t_
1568      = ukey // TODO: Use the HMAC Key.\n}\n"
1569- uid: cloud.google.com/go/storage.HMACKeyOption
1570  name: HMACKeyOption
1571  id: HMACKeyOption
1572  summary: |
1573    HMACKeyOption configures the behavior of HMACKey related methods and actions.
1574
1575    This interface is EXPERIMENTAL and subject to change or removal without notice.
1576  parent: cloud.google.com/go/storage
1577  type: type
1578  langs:
1579  - go
1580  syntax:
1581    content: "type HMACKeyOption interface {\n\t// contains filtered or unexported
1582      methods\n}"
1583- uid: cloud.google.com/go/storage.HMACKeyOption.ForHMACKeyServiceAccountEmail
1584  name: |
1585    func ForHMACKeyServiceAccountEmail
1586  id: ForHMACKeyServiceAccountEmail
1587  summary: |
1588    ForHMACKeyServiceAccountEmail returns HMAC Keys that are
1589    associated with the email address of a service account in the project.
1590
1591    Only one service account email can be used as a filter, so if multiple
1592    of these options are applied, the last email to be set will be used.
1593
1594    This option is EXPERIMENTAL and subject to change or removal without notice.
1595  parent: cloud.google.com/go/storage.HMACKeyOption
1596  type: function
1597  langs:
1598  - go
1599  syntax:
1600    content: func ForHMACKeyServiceAccountEmail(serviceAccountEmail <a href="https://pkg.go.dev/builtin#string">string</a>)
1601      <a href="#cloud_google_com_go_storage_HMACKeyOption">HMACKeyOption</a>
1602- uid: cloud.google.com/go/storage.HMACKeyOption.ShowDeletedHMACKeys
1603  name: |
1604    func ShowDeletedHMACKeys
1605  id: ShowDeletedHMACKeys
1606  summary: |
1607    ShowDeletedHMACKeys will also list keys whose state is "DELETED".
1608
1609    This option is EXPERIMENTAL and subject to change or removal without notice.
1610  parent: cloud.google.com/go/storage.HMACKeyOption
1611  type: function
1612  langs:
1613  - go
1614  syntax:
1615    content: func ShowDeletedHMACKeys() <a href="#cloud_google_com_go_storage_HMACKeyOption">HMACKeyOption</a>
1616- uid: cloud.google.com/go/storage.HMACKeyOption.UserProjectForHMACKeys
1617  name: |
1618    func UserProjectForHMACKeys
1619  id: UserProjectForHMACKeys
1620  summary: |
1621    UserProjectForHMACKeys will bill the request against userProjectID
1622    if userProjectID is non-empty.
1623
1624    Note: This is a noop right now and only provided for API compatibility.
1625
1626    This option is EXPERIMENTAL and subject to change or removal without notice.
1627  parent: cloud.google.com/go/storage.HMACKeyOption
1628  type: function
1629  langs:
1630  - go
1631  syntax:
1632    content: func UserProjectForHMACKeys(userProjectID <a href="https://pkg.go.dev/builtin#string">string</a>)
1633      <a href="#cloud_google_com_go_storage_HMACKeyOption">HMACKeyOption</a>
1634- uid: cloud.google.com/go/storage.HMACKeysIterator
1635  name: HMACKeysIterator
1636  id: HMACKeysIterator
1637  summary: |
1638    An HMACKeysIterator is an iterator over HMACKeys.
1639
1640    Note: This iterator is not safe for concurrent operations without explicit synchronization.
1641
1642    This type is EXPERIMENTAL and subject to change or removal without notice.
1643  parent: cloud.google.com/go/storage
1644  type: type
1645  langs:
1646  - go
1647  syntax:
1648    content: "type HMACKeysIterator struct {\n\t// contains filtered or unexported
1649      fields\n}"
1650- uid: cloud.google.com/go/storage.HMACKeysIterator.Next
1651  name: |
1652    func (*HMACKeysIterator) Next
1653  id: Next
1654  summary: |
1655    Next returns the next result. Its second return value is iterator.Done if
1656    there are no more results. Once Next returns iterator.Done, all subsequent
1657    calls will return iterator.Done.
1658
1659    Note: This iterator is not safe for concurrent operations without explicit synchronization.
1660
1661    This method is EXPERIMENTAL and subject to change or removal without notice.
1662  parent: cloud.google.com/go/storage.HMACKeysIterator
1663  type: method
1664  langs:
1665  - go
1666  syntax:
1667    content: func (it *<a href="#cloud_google_com_go_storage_HMACKeysIterator">HMACKeysIterator</a>)
1668      Next() (*<a href="#cloud_google_com_go_storage_HMACKey">HMACKey</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)
1669- uid: cloud.google.com/go/storage.HMACKeysIterator.PageInfo
1670  name: |
1671    func (*HMACKeysIterator) PageInfo
1672  id: PageInfo
1673  summary: |
1674    PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
1675
1676    Note: This iterator is not safe for concurrent operations without explicit synchronization.
1677
1678    This method is EXPERIMENTAL and subject to change or removal without notice.
1679  parent: cloud.google.com/go/storage.HMACKeysIterator
1680  type: method
1681  langs:
1682  - go
1683  syntax:
1684    content: func (it *<a href="#cloud_google_com_go_storage_HMACKeysIterator">HMACKeysIterator</a>)
1685      PageInfo() *<a href="https://pkg.go.dev/google.golang.org/api/iterator">iterator</a>.<a
1686      href="https://pkg.go.dev/google.golang.org/api/iterator#PageInfo">PageInfo</a>
1687- uid: cloud.google.com/go/storage.HMACState
1688  name: HMACState
1689  id: HMACState
1690  summary: |
1691    HMACState is the state of the HMAC key.
1692
1693    This type is EXPERIMENTAL and subject to change or removal without notice.
1694  parent: cloud.google.com/go/storage
1695  type: type
1696  langs:
1697  - go
1698  syntax:
1699    content: type HMACState <a href="https://pkg.go.dev/builtin#string">string</a>
1700- uid: cloud.google.com/go/storage.Active,Inactive,Deleted
1701  name: Active, Inactive, Deleted
1702  id: Active,Inactive,Deleted
1703  parent: cloud.google.com/go/storage.HMACState
1704  type: const
1705  langs:
1706  - go
1707  syntax:
1708    content: "const (\n\t// Active is the status for an active key that can be used
1709      to sign\n\t// requests.\n\tActive <a href=\"#cloud_google_com_go_storage_HMACState\">HMACState</a>
1710      = \"ACTIVE\"\n\n\t// Inactive is the status for an inactive key thus requests
1711      signed by\n\t// this key will be denied.\n\tInactive <a href=\"#cloud_google_com_go_storage_HMACState\">HMACState</a>
1712      = \"INACTIVE\"\n\n\t// Deleted is the status for a key that is deleted.\n\t//
1713      Once in this state the key cannot key cannot be recovered\n\t// and does not
1714      count towards key limits. Deleted keys will be cleaned\n\t// up later.\n\tDeleted
1715      <a href=\"#cloud_google_com_go_storage_HMACState\">HMACState</a> = \"DELETED\"\n)"
1716- uid: cloud.google.com/go/storage.Lifecycle
1717  name: Lifecycle
1718  id: Lifecycle
1719  summary: |
1720    Lifecycle is the lifecycle configuration for objects in the bucket.
1721  parent: cloud.google.com/go/storage
1722  type: type
1723  langs:
1724  - go
1725  syntax:
1726    content: "type Lifecycle struct {\n\tRules []<a href=\"#cloud_google_com_go_storage_LifecycleRule\">LifecycleRule</a>\n}"
1727- uid: cloud.google.com/go/storage.LifecycleAction
1728  name: LifecycleAction
1729  id: LifecycleAction
1730  summary: |
1731    LifecycleAction is a lifecycle configuration action.
1732  parent: cloud.google.com/go/storage
1733  type: type
1734  langs:
1735  - go
1736  syntax:
1737    content: "type LifecycleAction struct {\n\t// Type is the type of action to take
1738      on matching objects.\n\t//\n\t// Acceptable values are \"Delete\" to delete
1739      matching objects and\n\t// \"SetStorageClass\" to set the storage class defined
1740      in StorageClass on\n\t// matching objects.\n\tType <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t//
1741      StorageClass is the storage class to set on matching objects if the Action\n\t//
1742      is \"SetStorageClass\".\n\tStorageClass <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n}"
1743- uid: cloud.google.com/go/storage.LifecycleCondition
1744  name: LifecycleCondition
1745  id: LifecycleCondition
1746  summary: |
1747    LifecycleCondition is a set of conditions used to match objects and take an
1748    action automatically.
1749
1750    All configured conditions must be met for the associated action to be taken.
1751  parent: cloud.google.com/go/storage
1752  type: type
1753  langs:
1754  - go
1755  syntax:
1756    content: "type LifecycleCondition struct {\n\t// AgeInDays is the age of the object
1757      in days.\n\tAgeInDays <a href=\"https://pkg.go.dev/builtin#int64\">int64</a>\n\n\t//
1758      CreatedBefore is the time the object was created.\n\t//\n\t// This condition
1759      is satisfied when an object is created before midnight of\n\t// the specified
1760      date in UTC.\n\tCreatedBefore <a href=\"https://pkg.go.dev/time\">time</a>.<a
1761      href=\"https://pkg.go.dev/time#Time\">Time</a>\n\n\t// CustomTimeBefore is the
1762      CustomTime metadata field of the object. This\n\t// condition is satisfied when
1763      an object's CustomTime timestamp is before\n\t// midnight of the specified date
1764      in UTC.\n\t//\n\t// This condition can only be satisfied if CustomTime has been
1765      set.\n\tCustomTimeBefore <a href=\"https://pkg.go.dev/time\">time</a>.<a href=\"https://pkg.go.dev/time#Time\">Time</a>\n\n\t//
1766      DaysSinceCustomTime is the days elapsed since the CustomTime date of the\n\t//
1767      object. This condition can only be satisfied if CustomTime has been set.\n\tDaysSinceCustomTime
1768      <a href=\"https://pkg.go.dev/builtin#int64\">int64</a>\n\n\t// DaysSinceNoncurrentTime
1769      is the days elapsed since the noncurrent timestamp\n\t// of the object. This
1770      condition is relevant only for versioned objects.\n\tDaysSinceNoncurrentTime
1771      <a href=\"https://pkg.go.dev/builtin#int64\">int64</a>\n\n\t// Liveness specifies
1772      the object's liveness. Relevant only for versioned objects\n\tLiveness <a href=\"#cloud_google_com_go_storage_Liveness\">Liveness</a>\n\n\t//
1773      MatchesStorageClasses is the condition matching the object's storage\n\t// class.\n\t//\n\t//
1774      Values include \"STANDARD\", \"NEARLINE\", \"COLDLINE\" and \"ARCHIVE\".\n\tMatchesStorageClasses
1775      []<a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t// NoncurrentTimeBefore
1776      is the noncurrent timestamp of the object. This\n\t// condition is satisfied
1777      when an object's noncurrent timestamp is before\n\t// midnight of the specified
1778      date in UTC.\n\t//\n\t// This condition is relevant only for versioned objects.\n\tNoncurrentTimeBefore
1779      <a href=\"https://pkg.go.dev/time\">time</a>.<a href=\"https://pkg.go.dev/time#Time\">Time</a>\n\n\t//
1780      NumNewerVersions is the condition matching objects with a number of newer versions.\n\t//\n\t//
1781      If the value is N, this condition is satisfied when there are at least N\n\t//
1782      versions (including the live version) newer than this version of the\n\t// object.\n\tNumNewerVersions
1783      <a href=\"https://pkg.go.dev/builtin#int64\">int64</a>\n}"
1784- uid: cloud.google.com/go/storage.LifecycleRule
1785  name: LifecycleRule
1786  id: LifecycleRule
1787  summary: |
1788    LifecycleRule is a lifecycle configuration rule.
1789
1790    When all the configured conditions are met by an object in the bucket, the
1791    configured action will automatically be taken on that object.
1792  parent: cloud.google.com/go/storage
1793  type: type
1794  langs:
1795  - go
1796  syntax:
1797    content: "type LifecycleRule struct {\n\t// Action is the action to take when
1798      all of the associated conditions are\n\t// met.\n\tAction <a href=\"#cloud_google_com_go_storage_LifecycleAction\">LifecycleAction</a>\n\n\t//
1799      Condition is the set of conditions that must be met for the associated\n\t//
1800      action to be taken.\n\tCondition <a href=\"#cloud_google_com_go_storage_LifecycleCondition\">LifecycleCondition</a>\n}"
1801- uid: cloud.google.com/go/storage.Liveness
1802  name: Liveness
1803  id: Liveness
1804  summary: |
1805    Liveness specifies whether the object is live or not.
1806  parent: cloud.google.com/go/storage
1807  type: type
1808  langs:
1809  - go
1810  syntax:
1811    content: type Liveness <a href="https://pkg.go.dev/builtin#int">int</a>
1812- uid: cloud.google.com/go/storage.LiveAndArchived,Live,Archived
1813  name: LiveAndArchived, Live, Archived
1814  id: LiveAndArchived,Live,Archived
1815  parent: cloud.google.com/go/storage.Liveness
1816  type: const
1817  langs:
1818  - go
1819  syntax:
1820    content: "const (\n\t// LiveAndArchived includes both live and archived objects.\n\tLiveAndArchived
1821      <a href=\"#cloud_google_com_go_storage_Liveness\">Liveness</a> = <a href=\"https://pkg.go.dev/builtin#iota\">iota</a>\n\t//
1822      Live specifies that the object is still live.\n\tLive\n\t// Archived specifies
1823      that the object is archived.\n\tArchived\n)"
1824- uid: cloud.google.com/go/storage.Notification
1825  name: Notification
1826  id: Notification
1827  summary: |
1828    A Notification describes how to send Cloud PubSub messages when certain
1829    events occur in a bucket.
1830  parent: cloud.google.com/go/storage
1831  type: type
1832  langs:
1833  - go
1834  syntax:
1835    content: "type Notification struct {\n\t//The ID of the notification.\n\tID <a
1836      href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t// The ID of the
1837      topic to which this subscription publishes.\n\tTopicID <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t//
1838      The ID of the project to which the topic belongs.\n\tTopicProjectID <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t//
1839      Only send notifications about listed event types. If empty, send notifications\n\t//
1840      for all event types.\n\t// See https://cloud.google.com/storage/docs/pubsub-notifications#events.\n\tEventTypes
1841      []<a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t// If present,
1842      only apply this notification configuration to object names that\n\t// begin
1843      with this prefix.\n\tObjectNamePrefix <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t//
1844      An optional list of additional attributes to attach to each Cloud PubSub\n\t//
1845      message published for this notification subscription.\n\tCustomAttributes map[<a
1846      href=\"https://pkg.go.dev/builtin#string\">string</a>]<a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t//
1847      The contents of the message payload.\n\t// See https://cloud.google.com/storage/docs/pubsub-notifications#payload.\n\tPayloadFormat
1848      <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n}"
1849- uid: cloud.google.com/go/storage.ObjectAttrs
1850  name: ObjectAttrs
1851  id: ObjectAttrs
1852  summary: |
1853    ObjectAttrs represents the metadata for a Google Cloud Storage (GCS) object.
1854  parent: cloud.google.com/go/storage
1855  type: type
1856  langs:
1857  - go
1858  syntax:
1859    content: "type ObjectAttrs struct {\n\t// Bucket is the name of the bucket containing
1860      this GCS object.\n\t// This field is read-only.\n\tBucket <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t//
1861      Name is the name of the object within the bucket.\n\t// This field is read-only.\n\tName
1862      <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t// ContentType
1863      is the MIME type of the object's content.\n\tContentType <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t//
1864      ContentLanguage is the content language of the object's content.\n\tContentLanguage
1865      <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t// CacheControl
1866      is the Cache-Control header to be sent in the response\n\t// headers when serving
1867      the object data.\n\tCacheControl <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t//
1868      EventBasedHold specifies whether an object is under event-based hold. New\n\t//
1869      objects created in a bucket whose DefaultEventBasedHold is set will\n\t// default
1870      to that value.\n\tEventBasedHold <a href=\"https://pkg.go.dev/builtin#bool\">bool</a>\n\n\t//
1871      TemporaryHold specifies whether an object is under temporary hold. While\n\t//
1872      this flag is set to true, the object is protected against deletion and\n\t//
1873      overwrites.\n\tTemporaryHold <a href=\"https://pkg.go.dev/builtin#bool\">bool</a>\n\n\t//
1874      RetentionExpirationTime is a server-determined value that specifies the\n\t//
1875      earliest time that the object's retention period expires.\n\t// This is a read-only
1876      field.\n\tRetentionExpirationTime <a href=\"https://pkg.go.dev/time\">time</a>.<a
1877      href=\"https://pkg.go.dev/time#Time\">Time</a>\n\n\t// ACL is the list of access
1878      control rules for the object.\n\tACL []<a href=\"#cloud_google_com_go_storage_ACLRule\">ACLRule</a>\n\n\t//
1879      If not empty, applies a predefined set of access controls. It should be set\n\t//
1880      only when writing, copying or composing an object. When copying or composing,\n\t//
1881      it acts as the destinationPredefinedAcl parameter.\n\t// PredefinedACL is always
1882      empty for ObjectAttrs returned from the service.\n\t// See https://cloud.google.com/storage/docs/json_api/v1/objects/insert\n\t//
1883      for valid values.\n\tPredefinedACL <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t//
1884      Owner is the owner of the object. This field is read-only.\n\t//\n\t// If non-zero,
1885      it is in the form of \"user-<userId>\".\n\tOwner <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t//
1886      Size is the length of the object's content. This field is read-only.\n\tSize
1887      <a href=\"https://pkg.go.dev/builtin#int64\">int64</a>\n\n\t// ContentEncoding
1888      is the encoding of the object's content.\n\tContentEncoding <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t//
1889      ContentDisposition is the optional Content-Disposition header of the object\n\t//
1890      sent in the response headers.\n\tContentDisposition <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t//
1891      MD5 is the MD5 hash of the object's content. This field is read-only,\n\t//
1892      except when used from a Writer. If set on a Writer, the uploaded\n\t// data
1893      is rejected if its MD5 hash does not match this field.\n\tMD5 []<a href=\"https://pkg.go.dev/builtin#byte\">byte</a>\n\n\t//
1894      CRC32C is the CRC32 checksum of the object's content using the Castagnoli93\n\t//
1895      polynomial. This field is read-only, except when used from a Writer or\n\t//
1896      Composer. In those cases, if the SendCRC32C field in the Writer or Composer\n\t//
1897      is set to is true, the uploaded data is rejected if its CRC32C hash does\n\t//
1898      not match this field.\n\tCRC32C <a href=\"https://pkg.go.dev/builtin#uint32\">uint32</a>\n\n\t//
1899      MediaLink is an URL to the object's content. This field is read-only.\n\tMediaLink
1900      <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t// Metadata represents
1901      user-provided metadata, in key/value pairs.\n\t// It can be nil if no metadata
1902      is provided.\n\tMetadata map[<a href=\"https://pkg.go.dev/builtin#string\">string</a>]<a
1903      href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t// Generation is
1904      the generation number of the object's content.\n\t// This field is read-only.\n\tGeneration
1905      <a href=\"https://pkg.go.dev/builtin#int64\">int64</a>\n\n\t// Metageneration
1906      is the version of the metadata for this\n\t// object at this generation. This
1907      field is used for preconditions\n\t// and for detecting changes in metadata.
1908      A metageneration number\n\t// is only meaningful in the context of a particular
1909      generation\n\t// of a particular object. This field is read-only.\n\tMetageneration
1910      <a href=\"https://pkg.go.dev/builtin#int64\">int64</a>\n\n\t// StorageClass
1911      is the storage class of the object. This defines\n\t// how objects are stored
1912      and determines the SLA and the cost of storage.\n\t// Typical values are \"STANDARD\",
1913      \"NEARLINE\", \"COLDLINE\" and \"ARCHIVE\".\n\t// Defaults to \"STANDARD\".\n\t//
1914      See https://cloud.google.com/storage/docs/storage-classes for all\n\t// valid
1915      values.\n\tStorageClass <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t//
1916      Created is the time the object was created. This field is read-only.\n\tCreated
1917      <a href=\"https://pkg.go.dev/time\">time</a>.<a href=\"https://pkg.go.dev/time#Time\">Time</a>\n\n\t//
1918      Deleted is the time the object was deleted.\n\t// If not deleted, it is the
1919      zero value. This field is read-only.\n\tDeleted <a href=\"https://pkg.go.dev/time\">time</a>.<a
1920      href=\"https://pkg.go.dev/time#Time\">Time</a>\n\n\t// Updated is the creation
1921      or modification time of the object.\n\t// For buckets with versioning enabled,
1922      changing an object's\n\t// metadata does not change this property. This field
1923      is read-only.\n\tUpdated <a href=\"https://pkg.go.dev/time\">time</a>.<a href=\"https://pkg.go.dev/time#Time\">Time</a>\n\n\t//
1924      CustomerKeySHA256 is the base64-encoded SHA-256 hash of the\n\t// customer-supplied
1925      encryption key for the object. It is empty if there is\n\t// no customer-supplied
1926      encryption key.\n\t// See // https://cloud.google.com/storage/docs/encryption
1927      for more about\n\t// encryption in Google Cloud Storage.\n\tCustomerKeySHA256
1928      <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t// Cloud KMS key
1929      name, in the form\n\t// projects/P/locations/L/keyRings/R/cryptoKeys/K, used
1930      to encrypt this object,\n\t// if the object is encrypted by such a key.\n\t//\n\t//
1931      Providing both a KMSKeyName and a customer-supplied encryption key (via\n\t//
1932      ObjectHandle.Key) will result in an error when writing an object.\n\tKMSKeyName
1933      <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t// Prefix is set
1934      only for ObjectAttrs which represent synthetic \"directory\n\t// entries\" when
1935      iterating over buckets using Query.Delimiter. See\n\t// ObjectIterator.Next.
1936      When set, no other fields in ObjectAttrs will be\n\t// populated.\n\tPrefix
1937      <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t// Etag is the
1938      HTTP/1.1 Entity tag for the object.\n\t// This field is read-only.\n\tEtag <a
1939      href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t// A user-specified
1940      timestamp which can be applied to an object. This is\n\t// typically set in
1941      order to use the CustomTimeBefore and DaysSinceCustomTime\n\t// LifecycleConditions
1942      to manage object lifecycles.\n\t//\n\t// CustomTime cannot be removed once set
1943      on an object. It can be updated to a\n\t// later value but not to an earlier
1944      one.\n\tCustomTime <a href=\"https://pkg.go.dev/time\">time</a>.<a href=\"https://pkg.go.dev/time#Time\">Time</a>\n}"
1945- uid: cloud.google.com/go/storage.ObjectAttrsToUpdate
1946  name: ObjectAttrsToUpdate
1947  id: ObjectAttrsToUpdate
1948  summary: |
1949    ObjectAttrsToUpdate is used to update the attributes of an object.
1950    Only fields set to non-nil values will be updated.
1951    Set a field to its zero value to delete it.
1952
1953    For example, to change ContentType and delete ContentEncoding and
1954    Metadata, use
1955       ObjectAttrsToUpdate{
1956           ContentType: "text/html",
1957           ContentEncoding: "",
1958           Metadata: map[string]string{},
1959       }
1960  parent: cloud.google.com/go/storage
1961  type: type
1962  langs:
1963  - go
1964  syntax:
1965    content: "type ObjectAttrsToUpdate struct {\n\tEventBasedHold     <a href=\"https://pkg.go.dev/cloud.google.com/go/internal/optional\">optional</a>.<a
1966      href=\"https://pkg.go.dev/cloud.google.com/go/internal/optional#Bool\">Bool</a>\n\tTemporaryHold
1967      \     <a href=\"https://pkg.go.dev/cloud.google.com/go/internal/optional\">optional</a>.<a
1968      href=\"https://pkg.go.dev/cloud.google.com/go/internal/optional#Bool\">Bool</a>\n\tContentType
1969      \       <a href=\"https://pkg.go.dev/cloud.google.com/go/internal/optional\">optional</a>.<a
1970      href=\"https://pkg.go.dev/cloud.google.com/go/internal/optional#String\">String</a>\n\tContentLanguage
1971      \   <a href=\"https://pkg.go.dev/cloud.google.com/go/internal/optional\">optional</a>.<a
1972      href=\"https://pkg.go.dev/cloud.google.com/go/internal/optional#String\">String</a>\n\tContentEncoding
1973      \   <a href=\"https://pkg.go.dev/cloud.google.com/go/internal/optional\">optional</a>.<a
1974      href=\"https://pkg.go.dev/cloud.google.com/go/internal/optional#String\">String</a>\n\tContentDisposition
1975      <a href=\"https://pkg.go.dev/cloud.google.com/go/internal/optional\">optional</a>.<a
1976      href=\"https://pkg.go.dev/cloud.google.com/go/internal/optional#String\">String</a>\n\tCacheControl
1977      \      <a href=\"https://pkg.go.dev/cloud.google.com/go/internal/optional\">optional</a>.<a
1978      href=\"https://pkg.go.dev/cloud.google.com/go/internal/optional#String\">String</a>\n\tCustomTime
1979      \        <a href=\"https://pkg.go.dev/time\">time</a>.<a href=\"https://pkg.go.dev/time#Time\">Time</a>\n\tMetadata
1980      \          map[<a href=\"https://pkg.go.dev/builtin#string\">string</a>]<a href=\"https://pkg.go.dev/builtin#string\">string</a>
1981      // set to map[string]string{} to delete\n\tACL                []<a href=\"#cloud_google_com_go_storage_ACLRule\">ACLRule</a>\n\n\t//
1982      If not empty, applies a predefined set of access controls. ACL must be nil.\n\t//
1983      See https://cloud.google.com/storage/docs/json_api/v1/objects/patch.\n\tPredefinedACL
1984      <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n}"
1985- uid: cloud.google.com/go/storage.ObjectHandle
1986  name: ObjectHandle
1987  id: ObjectHandle
1988  summary: |
1989    ObjectHandle provides operations on an object in a Google Cloud Storage bucket.
1990    Use BucketHandle.Object to get a handle.
1991  parent: cloud.google.com/go/storage
1992  type: type
1993  langs:
1994  - go
1995  syntax:
1996    content: "type ObjectHandle struct {\n\t// contains filtered or unexported fields\n}"
1997  codeexamples:
1998  - content: "package main\n\nimport (\n\t\"cloud.google.com/go/storage\"\n\t\"context\"\n\t\"fmt\"\n)\n\nfunc
1999      main() {\n\tctx := context.Background()\n\tclient, err := storage.NewClient(ctx)\n\tif
2000      err != nil {\n\t\t// TODO: handle error.\n\t}\n\n\tattrs, err := client.Bucket(\"my-bucket\").Object(\"my-object\").Attrs(ctx)\n\tif
2001      err == storage.ErrObjectNotExist {\n\t\tfmt.Println(\"The object does not exist\")\n\t\treturn\n\t}\n\tif
2002      err != nil {\n\t\t// TODO: handle error.\n\t}\n\tfmt.Printf(\"The object exists
2003      and has attributes: %#v\\n\", attrs)\n}\n"
2004    name: exists
2005- uid: cloud.google.com/go/storage.ObjectHandle.ACL
2006  name: |
2007    func (*ObjectHandle) ACL
2008  id: ACL
2009  summary: |
2010    ACL provides access to the object's access control list.
2011    This controls who can read and write this object.
2012    This call does not perform any network operations.
2013  parent: cloud.google.com/go/storage.ObjectHandle
2014  type: method
2015  langs:
2016  - go
2017  syntax:
2018    content: func (o *<a href="#cloud_google_com_go_storage_ObjectHandle">ObjectHandle</a>)
2019      ACL() *<a href="#cloud_google_com_go_storage_ACLHandle">ACLHandle</a>
2020- uid: cloud.google.com/go/storage.ObjectHandle.Attrs
2021  name: |
2022    func (*ObjectHandle) Attrs
2023  id: Attrs
2024  summary: |
2025    Attrs returns meta information about the object.
2026    ErrObjectNotExist will be returned if the object is not found.
2027  parent: cloud.google.com/go/storage.ObjectHandle
2028  type: method
2029  langs:
2030  - go
2031  syntax:
2032    content: func (o *<a href="#cloud_google_com_go_storage_ObjectHandle">ObjectHandle</a>)
2033      Attrs(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>)
2034      (attrs *<a href="#cloud_google_com_go_storage_ObjectAttrs">ObjectAttrs</a>,
2035      err <a href="https://pkg.go.dev/builtin#error">error</a>)
2036  codeexamples:
2037  - content: "package main\n\nimport (\n\t\"cloud.google.com/go/storage\"\n\t\"context\"\n\t\"fmt\"\n)\n\nfunc
2038      main() {\n\tctx := context.Background()\n\tclient, err := storage.NewClient(ctx)\n\tif
2039      err != nil {\n\t\t// TODO: handle error.\n\t}\n\tobjAttrs, err := client.Bucket(\"my-bucket\").Object(\"my-object\").Attrs(ctx)\n\tif
2040      err != nil {\n\t\t// TODO: handle error.\n\t}\n\tfmt.Println(objAttrs)\n}\n"
2041  - content: "package main\n\nimport (\n\t\"cloud.google.com/go/storage\"\n\t\"context\"\n\t\"fmt\"\n\t\"time\"\n)\n\nfunc
2042      main() {\n\tctx := context.Background()\n\tclient, err := storage.NewClient(ctx)\n\tif
2043      err != nil {\n\t\t// TODO: handle error.\n\t}\n\tobj := client.Bucket(\"my-bucket\").Object(\"my-object\")\n\t//
2044      Read the object.\n\tobjAttrs1, err := obj.Attrs(ctx)\n\tif err != nil {\n\t\t//
2045      TODO: handle error.\n\t}\n\t// Do something else for a while.\n\ttime.Sleep(5
2046      * time.Minute)\n\t// Now read the same contents, even if the object has been
2047      written since the last read.\n\tobjAttrs2, err := obj.Generation(objAttrs1.Generation).Attrs(ctx)\n\tif
2048      err != nil {\n\t\t// TODO: handle error.\n\t}\n\tfmt.Println(objAttrs1, objAttrs2)\n}\n"
2049    name: withConditions
2050- uid: cloud.google.com/go/storage.ObjectHandle.BucketName
2051  name: |
2052    func (*ObjectHandle) BucketName
2053  id: BucketName
2054  summary: |
2055    BucketName returns the name of the bucket.
2056  parent: cloud.google.com/go/storage.ObjectHandle
2057  type: method
2058  langs:
2059  - go
2060  syntax:
2061    content: func (o *<a href="#cloud_google_com_go_storage_ObjectHandle">ObjectHandle</a>)
2062      BucketName() <a href="https://pkg.go.dev/builtin#string">string</a>
2063- uid: cloud.google.com/go/storage.ObjectHandle.ComposerFrom
2064  name: |
2065    func (*ObjectHandle) ComposerFrom
2066  id: ComposerFrom
2067  summary: |
2068    ComposerFrom creates a Composer that can compose srcs into dst.
2069    You can immediately call Run on the returned Composer, or you can
2070    configure it first.
2071
2072    The encryption key for the destination object will be used to decrypt all
2073    source objects and encrypt the destination object. It is an error
2074    to specify an encryption key for any of the source objects.
2075  parent: cloud.google.com/go/storage.ObjectHandle
2076  type: method
2077  langs:
2078  - go
2079  syntax:
2080    content: func (dst *<a href="#cloud_google_com_go_storage_ObjectHandle">ObjectHandle</a>)
2081      ComposerFrom(srcs ...*<a href="#cloud_google_com_go_storage_ObjectHandle">ObjectHandle</a>)
2082      *<a href="#cloud_google_com_go_storage_Composer">Composer</a>
2083- uid: cloud.google.com/go/storage.ObjectHandle.CopierFrom
2084  name: |
2085    func (*ObjectHandle) CopierFrom
2086  id: CopierFrom
2087  summary: |
2088    CopierFrom creates a Copier that can copy src to dst.
2089    You can immediately call Run on the returned Copier, or
2090    you can configure it first.
2091
2092    For Requester Pays buckets, the user project of dst is billed, unless it is empty,
2093    in which case the user project of src is billed.
2094  parent: cloud.google.com/go/storage.ObjectHandle
2095  type: method
2096  langs:
2097  - go
2098  syntax:
2099    content: func (dst *<a href="#cloud_google_com_go_storage_ObjectHandle">ObjectHandle</a>)
2100      CopierFrom(src *<a href="#cloud_google_com_go_storage_ObjectHandle">ObjectHandle</a>)
2101      *<a href="#cloud_google_com_go_storage_Copier">Copier</a>
2102  codeexamples:
2103  - content: "package main\n\nimport (\n\t\"cloud.google.com/go/storage\"\n\t\"context\"\n)\n\nvar
2104      key1, key2 []byte\n\nfunc main() {\n\t// To rotate the encryption key on an
2105      object, copy it onto itself.\n\tctx := context.Background()\n\tclient, err :=
2106      storage.NewClient(ctx)\n\tif err != nil {\n\t\t// TODO: handle error.\n\t}\n\tobj
2107      := client.Bucket(\"bucketname\").Object(\"obj\")\n\t// Assume obj is encrypted
2108      with key1, and we want to change to key2.\n\t_, err = obj.Key(key2).CopierFrom(obj.Key(key1)).Run(ctx)\n\tif
2109      err != nil {\n\t\t// TODO: handle error.\n\t}\n}\n"
2110    name: rotateEncryptionKeys
2111- uid: cloud.google.com/go/storage.ObjectHandle.Delete
2112  name: |
2113    func (*ObjectHandle) Delete
2114  id: Delete
2115  summary: |
2116    Delete deletes the single specified object.
2117  parent: cloud.google.com/go/storage.ObjectHandle
2118  type: method
2119  langs:
2120  - go
2121  syntax:
2122    content: func (o *<a href="#cloud_google_com_go_storage_ObjectHandle">ObjectHandle</a>)
2123      Delete(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>)
2124      <a href="https://pkg.go.dev/builtin#error">error</a>
2125  codeexamples:
2126  - content: "package main\n\nimport (\n\t\"cloud.google.com/go/storage\"\n\t\"context\"\n\t\"fmt\"\n\t\"google.golang.org/api/iterator\"\n)\n\nfunc
2127      main() {\n\tctx := context.Background()\n\tclient, err := storage.NewClient(ctx)\n\tif
2128      err != nil {\n\t\t// TODO: handle error.\n\t}\n\t// To delete multiple objects
2129      in a bucket, list them with an\n\t// ObjectIterator, then Delete them.\n\n\t//
2130      If you are using this package on the App Engine Flex runtime,\n\t// you can
2131      init a bucket client with your app's default bucket name.\n\t// See http://godoc.org/google.golang.org/appengine/file#DefaultBucketName.\n\tbucket
2132      := client.Bucket(\"my-bucket\")\n\tit := bucket.Objects(ctx, nil)\n\tfor {\n\t\tobjAttrs,
2133      err := it.Next()\n\t\tif err != nil && err != iterator.Done {\n\t\t\t// TODO:
2134      Handle error.\n\t\t}\n\t\tif err == iterator.Done {\n\t\t\tbreak\n\t\t}\n\t\tif
2135      err := bucket.Object(objAttrs.Name).Delete(ctx); err != nil {\n\t\t\t// TODO:
2136      Handle error.\n\t\t}\n\t}\n\tfmt.Println(\"deleted all object items in the bucket
2137      specified.\")\n}\n"
2138- uid: cloud.google.com/go/storage.ObjectHandle.Generation
2139  name: |
2140    func (*ObjectHandle) Generation
2141  id: Generation
2142  summary: |
2143    Generation returns a new ObjectHandle that operates on a specific generation
2144    of the object.
2145    By default, the handle operates on the latest generation. Not
2146    all operations work when given a specific generation; check the API
2147    endpoints at https://cloud.google.com/storage/docs/json_api/ for details.
2148  parent: cloud.google.com/go/storage.ObjectHandle
2149  type: method
2150  langs:
2151  - go
2152  syntax:
2153    content: func (o *<a href="#cloud_google_com_go_storage_ObjectHandle">ObjectHandle</a>)
2154      Generation(gen <a href="https://pkg.go.dev/builtin#int64">int64</a>) *<a href="#cloud_google_com_go_storage_ObjectHandle">ObjectHandle</a>
2155  codeexamples:
2156  - content: "package main\n\nimport (\n\t\"cloud.google.com/go/storage\"\n\t\"context\"\n\t\"io\"\n\t\"os\"\n)\n\nvar
2157      gen int64\n\nfunc main() {\n\t// Read an object's contents from generation gen,
2158      regardless of the\n\t// current generation of the object.\n\tctx := context.Background()\n\tclient,
2159      err := storage.NewClient(ctx)\n\tif err != nil {\n\t\t// TODO: handle error.\n\t}\n\tobj
2160      := client.Bucket(\"my-bucket\").Object(\"my-object\")\n\trc, err := obj.Generation(gen).NewReader(ctx)\n\tif
2161      err != nil {\n\t\t// TODO: handle error.\n\t}\n\tdefer rc.Close()\n\tif _, err
2162      := io.Copy(os.Stdout, rc); err != nil {\n\t\t// TODO: handle error.\n\t}\n}\n"
2163- uid: cloud.google.com/go/storage.ObjectHandle.If
2164  name: |
2165    func (*ObjectHandle) If
2166  id: If
2167  summary: |
2168    If returns a new ObjectHandle that applies a set of preconditions.
2169    Preconditions already set on the ObjectHandle are ignored.
2170    Operations on the new handle will return an error if the preconditions are not
2171    satisfied. See https://cloud.google.com/storage/docs/generations-preconditions
2172    for more details.
2173  parent: cloud.google.com/go/storage.ObjectHandle
2174  type: method
2175  langs:
2176  - go
2177  syntax:
2178    content: func (o *<a href="#cloud_google_com_go_storage_ObjectHandle">ObjectHandle</a>)
2179      If(conds <a href="#cloud_google_com_go_storage_Conditions">Conditions</a>) *<a
2180      href="#cloud_google_com_go_storage_ObjectHandle">ObjectHandle</a>
2181  codeexamples:
2182  - content: "package main\n\nimport (\n\t\"cloud.google.com/go/storage\"\n\t\"context\"\n\t\"google.golang.org/api/googleapi\"\n\t\"io\"\n\t\"net/http\"\n\t\"os\"\n)\n\nvar
2183      gen int64\n\nfunc main() {\n\t// Read from an object only if the current generation
2184      is gen.\n\tctx := context.Background()\n\tclient, err := storage.NewClient(ctx)\n\tif
2185      err != nil {\n\t\t// TODO: handle error.\n\t}\n\tobj := client.Bucket(\"my-bucket\").Object(\"my-object\")\n\trc,
2186      err := obj.If(storage.Conditions{GenerationMatch: gen}).NewReader(ctx)\n\tif
2187      err != nil {\n\t\t// TODO: handle error.\n\t}\n\n\tif _, err := io.Copy(os.Stdout,
2188      rc); err != nil {\n\t\t// TODO: handle error.\n\t}\n\tif err := rc.Close();
2189      err != nil {\n\t\tswitch ee := err.(type) {\n\t\tcase *googleapi.Error:\n\t\t\tif
2190      ee.Code == http.StatusPreconditionFailed {\n\t\t\t\t// The condition presented
2191      in the If failed.\n\t\t\t\t// TODO: handle error.\n\t\t\t}\n\n\t\t\t// TODO:
2192      handle other status codes here.\n\n\t\tdefault:\n\t\t\t// TODO: handle error.\n\t\t}\n\t}\n}\n"
2193- uid: cloud.google.com/go/storage.ObjectHandle.Key
2194  name: |
2195    func (*ObjectHandle) Key
2196  id: Key
2197  summary: |
2198    Key returns a new ObjectHandle that uses the supplied encryption
2199    key to encrypt and decrypt the object's contents.
2200
2201    Encryption key must be a 32-byte AES-256 key.
2202    See https://cloud.google.com/storage/docs/encryption for details.
2203  parent: cloud.google.com/go/storage.ObjectHandle
2204  type: method
2205  langs:
2206  - go
2207  syntax:
2208    content: func (o *<a href="#cloud_google_com_go_storage_ObjectHandle">ObjectHandle</a>)
2209      Key(encryptionKey []<a href="https://pkg.go.dev/builtin#byte">byte</a>) *<a
2210      href="#cloud_google_com_go_storage_ObjectHandle">ObjectHandle</a>
2211  codeexamples:
2212  - content: "package main\n\nimport (\n\t\"cloud.google.com/go/storage\"\n\t\"context\"\n)\n\nvar
2213      secretKey []byte\n\nfunc main() {\n\tctx := context.Background()\n\tclient,
2214      err := storage.NewClient(ctx)\n\tif err != nil {\n\t\t// TODO: handle error.\n\t}\n\tobj
2215      := client.Bucket(\"my-bucket\").Object(\"my-object\")\n\t// Encrypt the object's
2216      contents.\n\tw := obj.Key(secretKey).NewWriter(ctx)\n\tif _, err := w.Write([]byte(\"top
2217      secret\")); err != nil {\n\t\t// TODO: handle error.\n\t}\n\tif err := w.Close();
2218      err != nil {\n\t\t// TODO: handle error.\n\t}\n}\n"
2219- uid: cloud.google.com/go/storage.ObjectHandle.NewRangeReader
2220  name: |
2221    func (*ObjectHandle) NewRangeReader
2222  id: NewRangeReader
2223  summary: |
2224    NewRangeReader reads part of an object, reading at most length bytes
2225    starting at the given offset. If length is negative, the object is read
2226    until the end. If offset is negative, the object is read abs(offset) bytes
2227    from the end, and length must also be negative to indicate all remaining
2228    bytes will be read.
2229
2230    If the object's metadata property "Content-Encoding" is set to "gzip" or satisfies
2231    decompressive transcoding per https://cloud.google.com/storage/docs/transcoding
2232    that file will be served back whole, regardless of the requested range as
2233    Google Cloud Storage dictates.
2234  parent: cloud.google.com/go/storage.ObjectHandle
2235  type: method
2236  langs:
2237  - go
2238  syntax:
2239    content: func (o *<a href="#cloud_google_com_go_storage_ObjectHandle">ObjectHandle</a>)
2240      NewRangeReader(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>,
2241      offset, length <a href="https://pkg.go.dev/builtin#int64">int64</a>) (r *<a
2242      href="#cloud_google_com_go_storage_Reader">Reader</a>, err <a href="https://pkg.go.dev/builtin#error">error</a>)
2243  codeexamples:
2244  - content: "package main\n\nimport (\n\t\"cloud.google.com/go/storage\"\n\t\"context\"\n\t\"fmt\"\n\t\"io/ioutil\"\n)\n\nfunc
2245      main() {\n\tctx := context.Background()\n\tclient, err := storage.NewClient(ctx)\n\tif
2246      err != nil {\n\t\t// TODO: handle error.\n\t}\n\t// Read only the first 64K.\n\trc,
2247      err := client.Bucket(\"bucketname\").Object(\"filename1\").NewRangeReader(ctx,
2248      0, 64*1024)\n\tif err != nil {\n\t\t// TODO: handle error.\n\t}\n\tdefer rc.Close()\n\n\tslurp,
2249      err := ioutil.ReadAll(rc)\n\tif err != nil {\n\t\t// TODO: handle error.\n\t}\n\tfmt.Printf(\"first
2250      64K of file contents:\\n%s\\n\", slurp)\n}\n"
2251  - content: "package main\n\nimport (\n\t\"cloud.google.com/go/storage\"\n\t\"context\"\n\t\"fmt\"\n\t\"io/ioutil\"\n)\n\nfunc
2252      main() {\n\tctx := context.Background()\n\tclient, err := storage.NewClient(ctx)\n\tif
2253      err != nil {\n\t\t// TODO: handle error.\n\t}\n\t// Read only the last 10 bytes
2254      until the end of the file.\n\trc, err := client.Bucket(\"bucketname\").Object(\"filename1\").NewRangeReader(ctx,
2255      -10, -1)\n\tif err != nil {\n\t\t// TODO: handle error.\n\t}\n\tdefer rc.Close()\n\n\tslurp,
2256      err := ioutil.ReadAll(rc)\n\tif err != nil {\n\t\t// TODO: handle error.\n\t}\n\tfmt.Printf(\"Last
2257      10 bytes from the end of the file:\\n%s\\n\", slurp)\n}\n"
2258    name: lastNBytes
2259  - content: "package main\n\nimport (\n\t\"cloud.google.com/go/storage\"\n\t\"context\"\n\t\"fmt\"\n\t\"io/ioutil\"\n)\n\nfunc
2260      main() {\n\tctx := context.Background()\n\tclient, err := storage.NewClient(ctx)\n\tif
2261      err != nil {\n\t\t// TODO: handle error.\n\t}\n\t// Read from the 101st byte
2262      until the end of the file.\n\trc, err := client.Bucket(\"bucketname\").Object(\"filename1\").NewRangeReader(ctx,
2263      100, -1)\n\tif err != nil {\n\t\t// TODO: handle error.\n\t}\n\tdefer rc.Close()\n\n\tslurp,
2264      err := ioutil.ReadAll(rc)\n\tif err != nil {\n\t\t// TODO: handle error.\n\t}\n\tfmt.Printf(\"From
2265      101st byte until the end:\\n%s\\n\", slurp)\n}\n"
2266    name: untilEnd
2267- uid: cloud.google.com/go/storage.ObjectHandle.NewReader
2268  name: |
2269    func (*ObjectHandle) NewReader
2270  id: NewReader
2271  summary: |
2272    NewReader creates a new Reader to read the contents of the
2273    object.
2274    ErrObjectNotExist will be returned if the object is not found.
2275
2276    The caller must call Close on the returned Reader when done reading.
2277  parent: cloud.google.com/go/storage.ObjectHandle
2278  type: method
2279  langs:
2280  - go
2281  syntax:
2282    content: func (o *<a href="#cloud_google_com_go_storage_ObjectHandle">ObjectHandle</a>)
2283      NewReader(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>)
2284      (*<a href="#cloud_google_com_go_storage_Reader">Reader</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)
2285  codeexamples:
2286  - content: "package main\n\nimport (\n\t\"cloud.google.com/go/storage\"\n\t\"context\"\n\t\"fmt\"\n\t\"io/ioutil\"\n)\n\nfunc
2287      main() {\n\tctx := context.Background()\n\tclient, err := storage.NewClient(ctx)\n\tif
2288      err != nil {\n\t\t// TODO: handle error.\n\t}\n\trc, err := client.Bucket(\"my-bucket\").Object(\"my-object\").NewReader(ctx)\n\tif
2289      err != nil {\n\t\t// TODO: handle error.\n\t}\n\tslurp, err := ioutil.ReadAll(rc)\n\trc.Close()\n\tif
2290      err != nil {\n\t\t// TODO: handle error.\n\t}\n\tfmt.Println(\"file contents:\",
2291      slurp)\n}\n"
2292- uid: cloud.google.com/go/storage.ObjectHandle.NewWriter
2293  name: |
2294    func (*ObjectHandle) NewWriter
2295  id: NewWriter
2296  summary: |
2297    NewWriter returns a storage Writer that writes to the GCS object
2298    associated with this ObjectHandle.
2299
2300    A new object will be created unless an object with this name already exists.
2301    Otherwise any previous object with the same name will be replaced.
2302    The object will not be available (and any previous object will remain)
2303    until Close has been called.
2304
2305    Attributes can be set on the object by modifying the returned Writer's
2306    ObjectAttrs field before the first call to Write. If no ContentType
2307    attribute is specified, the content type will be automatically sniffed
2308    using net/http.DetectContentType.
2309
2310    It is the caller's responsibility to call Close when writing is done. To
2311    stop writing without saving the data, cancel the context.
2312  parent: cloud.google.com/go/storage.ObjectHandle
2313  type: method
2314  langs:
2315  - go
2316  syntax:
2317    content: func (o *<a href="#cloud_google_com_go_storage_ObjectHandle">ObjectHandle</a>)
2318      NewWriter(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>)
2319      *<a href="#cloud_google_com_go_storage_Writer">Writer</a>
2320  codeexamples:
2321  - content: "package main\n\nimport (\n\t\"cloud.google.com/go/storage\"\n\t\"context\"\n)\n\nfunc
2322      main() {\n\tctx := context.Background()\n\tclient, err := storage.NewClient(ctx)\n\tif
2323      err != nil {\n\t\t// TODO: handle error.\n\t}\n\twc := client.Bucket(\"bucketname\").Object(\"filename1\").NewWriter(ctx)\n\t_
2324      = wc // TODO: Use the Writer.\n}\n"
2325- uid: cloud.google.com/go/storage.ObjectHandle.ObjectName
2326  name: |
2327    func (*ObjectHandle) ObjectName
2328  id: ObjectName
2329  summary: |
2330    ObjectName returns the name of the object.
2331  parent: cloud.google.com/go/storage.ObjectHandle
2332  type: method
2333  langs:
2334  - go
2335  syntax:
2336    content: func (o *<a href="#cloud_google_com_go_storage_ObjectHandle">ObjectHandle</a>)
2337      ObjectName() <a href="https://pkg.go.dev/builtin#string">string</a>
2338- uid: cloud.google.com/go/storage.ObjectHandle.ReadCompressed
2339  name: |
2340    func (*ObjectHandle) ReadCompressed
2341  id: ReadCompressed
2342  summary: |
2343    ReadCompressed when true causes the read to happen without decompressing.
2344  parent: cloud.google.com/go/storage.ObjectHandle
2345  type: method
2346  langs:
2347  - go
2348  syntax:
2349    content: func (o *<a href="#cloud_google_com_go_storage_ObjectHandle">ObjectHandle</a>)
2350      ReadCompressed(compressed <a href="https://pkg.go.dev/builtin#bool">bool</a>)
2351      *<a href="#cloud_google_com_go_storage_ObjectHandle">ObjectHandle</a>
2352- uid: cloud.google.com/go/storage.ObjectHandle.Update
2353  name: |
2354    func (*ObjectHandle) Update
2355  id: Update
2356  summary: |
2357    Update updates an object with the provided attributes.
2358    All zero-value attributes are ignored.
2359    ErrObjectNotExist will be returned if the object is not found.
2360  parent: cloud.google.com/go/storage.ObjectHandle
2361  type: method
2362  langs:
2363  - go
2364  syntax:
2365    content: func (o *<a href="#cloud_google_com_go_storage_ObjectHandle">ObjectHandle</a>)
2366      Update(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>,
2367      uattrs <a href="#cloud_google_com_go_storage_ObjectAttrsToUpdate">ObjectAttrsToUpdate</a>)
2368      (oa *<a href="#cloud_google_com_go_storage_ObjectAttrs">ObjectAttrs</a>, err
2369      <a href="https://pkg.go.dev/builtin#error">error</a>)
2370  codeexamples:
2371  - content: "package main\n\nimport (\n\t\"cloud.google.com/go/storage\"\n\t\"context\"\n\t\"fmt\"\n)\n\nfunc
2372      main() {\n\tctx := context.Background()\n\tclient, err := storage.NewClient(ctx)\n\tif
2373      err != nil {\n\t\t// TODO: handle error.\n\t}\n\t// Change only the content
2374      type of the object.\n\tobjAttrs, err := client.Bucket(\"my-bucket\").Object(\"my-object\").Update(ctx,
2375      storage.ObjectAttrsToUpdate{\n\t\tContentType:        \"text/html\",\n\t\tContentDisposition:
2376      \"\", // delete ContentDisposition\n\t})\n\tif err != nil {\n\t\t// TODO: handle
2377      error.\n\t}\n\tfmt.Println(objAttrs)\n}\n"
2378- uid: cloud.google.com/go/storage.ObjectIterator
2379  name: ObjectIterator
2380  id: ObjectIterator
2381  summary: |
2382    An ObjectIterator is an iterator over ObjectAttrs.
2383
2384    Note: This iterator is not safe for concurrent operations without explicit synchronization.
2385  parent: cloud.google.com/go/storage
2386  type: type
2387  langs:
2388  - go
2389  syntax:
2390    content: "type ObjectIterator struct {\n\t// contains filtered or unexported fields\n}"
2391- uid: cloud.google.com/go/storage.ObjectIterator.Next
2392  name: |
2393    func (*ObjectIterator) Next
2394  id: Next
2395  summary: |
2396    Next returns the next result. Its second return value is iterator.Done if
2397    there are no more results. Once Next returns iterator.Done, all subsequent
2398    calls will return iterator.Done.
2399
2400    If Query.Delimiter is non-empty, some of the ObjectAttrs returned by Next will
2401    have a non-empty Prefix field, and a zero value for all other fields. These
2402    represent prefixes.
2403
2404    Note: This method is not safe for concurrent operations without explicit synchronization.
2405  parent: cloud.google.com/go/storage.ObjectIterator
2406  type: method
2407  langs:
2408  - go
2409  syntax:
2410    content: func (it *<a href="#cloud_google_com_go_storage_ObjectIterator">ObjectIterator</a>)
2411      Next() (*<a href="#cloud_google_com_go_storage_ObjectAttrs">ObjectAttrs</a>,
2412      <a href="https://pkg.go.dev/builtin#error">error</a>)
2413  codeexamples:
2414  - content: "package main\n\nimport (\n\t\"cloud.google.com/go/storage\"\n\t\"context\"\n\t\"fmt\"\n\t\"google.golang.org/api/iterator\"\n)\n\nfunc
2415      main() {\n\tctx := context.Background()\n\tclient, err := storage.NewClient(ctx)\n\tif
2416      err != nil {\n\t\t// TODO: handle error.\n\t}\n\tit := client.Bucket(\"my-bucket\").Objects(ctx,
2417      nil)\n\tfor {\n\t\tobjAttrs, err := it.Next()\n\t\tif err == iterator.Done {\n\t\t\tbreak\n\t\t}\n\t\tif
2418      err != nil {\n\t\t\t// TODO: Handle error.\n\t\t}\n\t\tfmt.Println(objAttrs)\n\t}\n}\n"
2419- uid: cloud.google.com/go/storage.ObjectIterator.PageInfo
2420  name: |
2421    func (*ObjectIterator) PageInfo
2422  id: PageInfo
2423  summary: |
2424    PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
2425
2426    Note: This method is not safe for concurrent operations without explicit synchronization.
2427  parent: cloud.google.com/go/storage.ObjectIterator
2428  type: method
2429  langs:
2430  - go
2431  syntax:
2432    content: func (it *<a href="#cloud_google_com_go_storage_ObjectIterator">ObjectIterator</a>)
2433      PageInfo() *<a href="https://pkg.go.dev/google.golang.org/api/iterator">iterator</a>.<a
2434      href="https://pkg.go.dev/google.golang.org/api/iterator#PageInfo">PageInfo</a>
2435- uid: cloud.google.com/go/storage.PolicyV4Fields
2436  name: PolicyV4Fields
2437  id: PolicyV4Fields
2438  summary: |
2439    PolicyV4Fields describes the attributes for a PostPolicyV4 request.
2440  parent: cloud.google.com/go/storage
2441  type: type
2442  langs:
2443  - go
2444  syntax:
2445    content: "type PolicyV4Fields struct {\n\t// ACL specifies the access control
2446      permissions for the object.\n\t// Optional.\n\tACL <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\t//
2447      CacheControl specifies the caching directives for the object.\n\t// Optional.\n\tCacheControl
2448      <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\t// ContentType specifies
2449      the media type of the object.\n\t// Optional.\n\tContentType <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\t//
2450      ContentDisposition specifies how the file will be served back to requesters.\n\t//
2451      Optional.\n\tContentDisposition <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\t//
2452      ContentEncoding specifies the decompressive transcoding that the object.\n\t//
2453      This field is complementary to ContentType in that the file could be\n\t// compressed
2454      but ContentType specifies the file's original media type.\n\t// Optional.\n\tContentEncoding
2455      <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\t// Metadata specifies
2456      custom metadata for the object.\n\t// If any key doesn't begin with \"x-goog-meta-\",
2457      an error will be returned.\n\t// Optional.\n\tMetadata map[<a href=\"https://pkg.go.dev/builtin#string\">string</a>]<a
2458      href=\"https://pkg.go.dev/builtin#string\">string</a>\n\t// StatusCodeOnSuccess
2459      when set, specifies the status code that Cloud Storage\n\t// will serve back
2460      on successful upload of the object.\n\t// Optional.\n\tStatusCodeOnSuccess <a
2461      href=\"https://pkg.go.dev/builtin#int\">int</a>\n\t// RedirectToURLOnSuccess
2462      when set, specifies the URL that Cloud Storage\n\t// will serve back on successful
2463      upload of the object.\n\t// Optional.\n\tRedirectToURLOnSuccess <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n}"
2464- uid: cloud.google.com/go/storage.PostPolicyV4
2465  name: PostPolicyV4
2466  id: PostPolicyV4
2467  summary: |
2468    PostPolicyV4 describes the URL and respective form fields for a generated PostPolicyV4 request.
2469  parent: cloud.google.com/go/storage
2470  type: type
2471  langs:
2472  - go
2473  syntax:
2474    content: "type PostPolicyV4 struct {\n\t// URL is the generated URL that the file
2475      upload will be made to.\n\tURL <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\t//
2476      Fields specifies the generated key-values that the file uploader\n\t// must
2477      include in their multipart upload form.\n\tFields map[<a href=\"https://pkg.go.dev/builtin#string\">string</a>]<a
2478      href=\"https://pkg.go.dev/builtin#string\">string</a>\n}"
2479- uid: cloud.google.com/go/storage.PostPolicyV4.GenerateSignedPostPolicyV4
2480  name: |
2481    func GenerateSignedPostPolicyV4
2482  id: GenerateSignedPostPolicyV4
2483  summary: |
2484    GenerateSignedPostPolicyV4 generates a PostPolicyV4 value from bucket, object and opts.
2485    The generated URL and fields will then allow an unauthenticated client to perform multipart uploads.
2486  parent: cloud.google.com/go/storage.PostPolicyV4
2487  type: function
2488  langs:
2489  - go
2490  syntax:
2491    content: func GenerateSignedPostPolicyV4(bucket, object <a href="https://pkg.go.dev/builtin#string">string</a>,
2492      opts *<a href="#cloud_google_com_go_storage_PostPolicyV4Options">PostPolicyV4Options</a>)
2493      (*<a href="#cloud_google_com_go_storage_PostPolicyV4">PostPolicyV4</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)
2494  codeexamples:
2495  - content: "package main\n\nimport (\n\t\"bytes\"\n\t\"cloud.google.com/go/storage\"\n\t\"io\"\n\t\"mime/multipart\"\n\t\"net/http\"\n\t\"time\"\n)\n\nfunc
2496      main() {\n\tpv4, err := storage.GenerateSignedPostPolicyV4(\"my-bucket\", \"my-object.txt\",
2497      &storage.PostPolicyV4Options{\n\t\tGoogleAccessID: \"my-access-id\",\n\t\tPrivateKey:
2498      \    []byte(\"my-private-key\"),\n\n\t\t// The upload expires in 2hours.\n\t\tExpires:
2499      time.Now().Add(2 * time.Hour),\n\n\t\tFields: &storage.PolicyV4Fields{\n\t\t\tStatusCodeOnSuccess:
2500      \   200,\n\t\t\tRedirectToURLOnSuccess: \"https://example.org/\",\n\t\t\t//
2501      It MUST only be a text file.\n\t\t\tContentType: \"text/plain\",\n\t\t},\n\n\t\t//
2502      The conditions that the uploaded file will be expected to conform to.\n\t\tConditions:
2503      []storage.PostPolicyV4Condition{\n\t\t\t// Make the file a maximum of 10mB.\n\t\t\tstorage.ConditionContentLengthRange(0,
2504      10<<20),\n\t\t},\n\t})\n\tif err != nil {\n\t\t// TODO: handle error.\n\t}\n\n\t//
2505      Now you can upload your file using the generated post policy\n\t// with a plain
2506      HTTP client or even the browser.\n\tformBuf := new(bytes.Buffer)\n\tmw := multipart.NewWriter(formBuf)\n\tfor
2507      fieldName, value := range pv4.Fields {\n\t\tif err := mw.WriteField(fieldName,
2508      value); err != nil {\n\t\t\t// TODO: handle error.\n\t\t}\n\t}\n\tfile := bytes.NewReader(bytes.Repeat([]byte(\"a\"),
2509      100))\n\n\tmf, err := mw.CreateFormFile(\"file\", \"myfile.txt\")\n\tif err
2510      != nil {\n\t\t// TODO: handle error.\n\t}\n\tif _, err := io.Copy(mf, file);
2511      err != nil {\n\t\t// TODO: handle error.\n\t}\n\tif err := mw.Close(); err !=
2512      nil {\n\t\t// TODO: handle error.\n\t}\n\n\t// Compose the request.\n\treq,
2513      err := http.NewRequest(\"POST\", pv4.URL, formBuf)\n\tif err != nil {\n\t\t//
2514      TODO: handle error.\n\t}\n\t// Ensure the Content-Type is derived from the multipart
2515      writer.\n\treq.Header.Set(\"Content-Type\", mw.FormDataContentType())\n\tres,
2516      err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\t// TODO: handle error.\n\t}\n\t_
2517      = res\n}\n"
2518- uid: cloud.google.com/go/storage.PostPolicyV4Condition
2519  name: PostPolicyV4Condition
2520  id: PostPolicyV4Condition
2521  summary: |
2522    PostPolicyV4Condition describes the constraints that the subsequent
2523    object upload's multipart form fields will be expected to conform to.
2524  parent: cloud.google.com/go/storage
2525  type: type
2526  langs:
2527  - go
2528  syntax:
2529    content: "type PostPolicyV4Condition interface {\n\t<a href=\"https://pkg.go.dev/encoding/json\">json</a>.<a
2530      href=\"https://pkg.go.dev/encoding/json#Marshaler\">Marshaler</a>\n\t// contains
2531      filtered or unexported methods\n}"
2532- uid: cloud.google.com/go/storage.PostPolicyV4Condition.ConditionContentLengthRange
2533  name: |
2534    func ConditionContentLengthRange
2535  id: ConditionContentLengthRange
2536  summary: |
2537    ConditionContentLengthRange constraints the limits that the
2538    multipart upload's range header will be expected to be within.
2539  parent: cloud.google.com/go/storage.PostPolicyV4Condition
2540  type: function
2541  langs:
2542  - go
2543  syntax:
2544    content: func ConditionContentLengthRange(start, end <a href="https://pkg.go.dev/builtin#uint64">uint64</a>)
2545      <a href="#cloud_google_com_go_storage_PostPolicyV4Condition">PostPolicyV4Condition</a>
2546- uid: cloud.google.com/go/storage.PostPolicyV4Condition.ConditionStartsWith
2547  name: |
2548    func ConditionStartsWith
2549  id: ConditionStartsWith
2550  summary: |
2551    ConditionStartsWith checks that an attributes starts with value.
2552    An empty value will cause this condition to be ignored.
2553  parent: cloud.google.com/go/storage.PostPolicyV4Condition
2554  type: function
2555  langs:
2556  - go
2557  syntax:
2558    content: func ConditionStartsWith(key, value <a href="https://pkg.go.dev/builtin#string">string</a>)
2559      <a href="#cloud_google_com_go_storage_PostPolicyV4Condition">PostPolicyV4Condition</a>
2560- uid: cloud.google.com/go/storage.PostPolicyV4Options
2561  name: PostPolicyV4Options
2562  id: PostPolicyV4Options
2563  summary: |
2564    PostPolicyV4Options are used to construct a signed post policy.
2565    Please see https://cloud.google.com/storage/docs/xml-api/post-object
2566    for reference about the fields.
2567  parent: cloud.google.com/go/storage
2568  type: type
2569  langs:
2570  - go
2571  syntax:
2572    content: "type PostPolicyV4Options struct {\n\t// GoogleAccessID represents the
2573      authorizer of the signed URL generation.\n\t// It is typically the Google service
2574      account client email address from\n\t// the Google Developers Console in the
2575      form of \"xxx@developer.gserviceaccount.com\".\n\t// Required.\n\tGoogleAccessID
2576      <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t// PrivateKey
2577      is the Google service account private key. It is obtainable\n\t// from the Google
2578      Developers Console.\n\t// At https://console.developers.google.com/project/<your-project-id>/apiui/credential,\n\t//
2579      create a service account client ID or reuse one of your existing service account\n\t//
2580      credentials. Click on the \"Generate new P12 key\" to generate and download\n\t//
2581      a new private key. Once you download the P12 file, use the following command\n\t//
2582      to convert it into a PEM file.\n\t//\n\t//    $ openssl pkcs12 -in key.p12 -passin
2583      pass:notasecret -out key.pem -nodes\n\t//\n\t// Provide the contents of the
2584      PEM file as a byte slice.\n\t// Exactly one of PrivateKey or SignBytes must
2585      be non-nil.\n\tPrivateKey []<a href=\"https://pkg.go.dev/builtin#byte\">byte</a>\n\n\t//
2586      SignBytes is a function for implementing custom signing. For example, if\n\t//
2587      your application is running on Google App Engine, you can use\n\t// appengine's
2588      internal signing function:\n\t//     ctx := appengine.NewContext(request)\n\t//
2589      \    acc, _ := appengine.ServiceAccount(ctx)\n\t//     url, err := SignedURL(\"bucket\",
2590      \"object\", &SignedURLOptions{\n\t//     \tGoogleAccessID: acc,\n\t//     \tSignBytes:
2591      func(b []byte) ([]byte, error) {\n\t//     \t\t_, signedBytes, err := appengine.SignBytes(ctx,
2592      b)\n\t//     \t\treturn signedBytes, err\n\t//     \t},\n\t//     \t// etc.\n\t//
2593      \    })\n\t//\n\t// Exactly one of PrivateKey or SignBytes must be non-nil.\n\tSignBytes
2594      func(hashBytes []<a href=\"https://pkg.go.dev/builtin#byte\">byte</a>) (signature
2595      []<a href=\"https://pkg.go.dev/builtin#byte\">byte</a>, err <a href=\"https://pkg.go.dev/builtin#error\">error</a>)\n\n\t//
2596      Expires is the expiration time on the signed URL.\n\t// It must be a time in
2597      the future.\n\t// Required.\n\tExpires <a href=\"https://pkg.go.dev/time\">time</a>.<a
2598      href=\"https://pkg.go.dev/time#Time\">Time</a>\n\n\t// Style provides options
2599      for the type of URL to use. Options are\n\t// PathStyle (default), BucketBoundHostname,
2600      and VirtualHostedStyle. See\n\t// https://cloud.google.com/storage/docs/request-endpoints
2601      for details.\n\t// Optional.\n\tStyle <a href=\"#cloud_google_com_go_storage_URLStyle\">URLStyle</a>\n\n\t//
2602      Insecure when set indicates that the generated URL's scheme\n\t// will use \"http\"
2603      instead of \"https\" (default).\n\t// Optional.\n\tInsecure <a href=\"https://pkg.go.dev/builtin#bool\">bool</a>\n\n\t//
2604      Fields specifies the attributes of a PostPolicyV4 request.\n\t// When Fields
2605      is non-nil, its attributes must match those that will\n\t// passed into field
2606      Conditions.\n\t// Optional.\n\tFields *<a href=\"#cloud_google_com_go_storage_PolicyV4Fields\">PolicyV4Fields</a>\n\n\t//
2607      The conditions that the uploaded file will be expected to conform to.\n\t//
2608      When used, the failure of an upload to satisfy a condition will result in\n\t//
2609      a 4XX status code, back with the message describing the problem.\n\t// Optional.\n\tConditions
2610      []<a href=\"#cloud_google_com_go_storage_PostPolicyV4Condition\">PostPolicyV4Condition</a>\n}"
2611- uid: cloud.google.com/go/storage.ProjectTeam
2612  name: ProjectTeam
2613  id: ProjectTeam
2614  summary: |
2615    ProjectTeam is the project team associated with the entity, if any.
2616  parent: cloud.google.com/go/storage
2617  type: type
2618  langs:
2619  - go
2620  syntax:
2621    content: "type ProjectTeam struct {\n\tProjectNumber <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\tTeam
2622      \         <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n}"
2623- uid: cloud.google.com/go/storage.Query
2624  name: Query
2625  id: Query
2626  summary: |
2627    Query represents a query to filter objects from a bucket.
2628  parent: cloud.google.com/go/storage
2629  type: type
2630  langs:
2631  - go
2632  syntax:
2633    content: "type Query struct {\n\t// Delimiter returns results in a directory-like
2634      fashion.\n\t// Results will contain only objects whose names, aside from the\n\t//
2635      prefix, do not contain delimiter. Objects whose names,\n\t// aside from the
2636      prefix, contain delimiter will have their name,\n\t// truncated after the delimiter,
2637      returned in prefixes.\n\t// Duplicate prefixes are omitted.\n\t// Optional.\n\tDelimiter
2638      <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t// Prefix is the
2639      prefix filter to query objects\n\t// whose names begin with this prefix.\n\t//
2640      Optional.\n\tPrefix <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t//
2641      Versions indicates whether multiple versions of the same\n\t// object will be
2642      included in the results.\n\tVersions <a href=\"https://pkg.go.dev/builtin#bool\">bool</a>\n\n\t//
2643      StartOffset is used to filter results to objects whose names are\n\t// lexicographically
2644      equal to or after startOffset. If endOffset is also set,\n\t// the objects listed
2645      will have names between startOffset (inclusive) and\n\t// endOffset (exclusive).\n\tStartOffset
2646      <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t// EndOffset is
2647      used to filter results to objects whose names are\n\t// lexicographically before
2648      endOffset. If startOffset is also set, the objects\n\t// listed will have names
2649      between startOffset (inclusive) and endOffset (exclusive).\n\tEndOffset <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\t//
2650      contains filtered or unexported fields\n}"
2651- uid: cloud.google.com/go/storage.Query.SetAttrSelection
2652  name: |
2653    func (*Query) SetAttrSelection
2654  id: SetAttrSelection
2655  summary: |
2656    SetAttrSelection makes the query populate only specific attributes of
2657    objects. When iterating over objects, if you only need each object's name
2658    and size, pass []string{"Name", "Size"} to this method. Only these fields
2659    will be fetched for each object across the network; the other fields of
2660    ObjectAttr will remain at their default values. This is a performance
2661    optimization; for more information, see
2662    https://cloud.google.com/storage/docs/json_api/v1/how-tos/performance
2663  parent: cloud.google.com/go/storage.Query
2664  type: method
2665  langs:
2666  - go
2667  syntax:
2668    content: func (q *<a href="#cloud_google_com_go_storage_Query">Query</a>) SetAttrSelection(attrs
2669      []<a href="https://pkg.go.dev/builtin#string">string</a>) <a href="https://pkg.go.dev/builtin#error">error</a>
2670- uid: cloud.google.com/go/storage.Reader
2671  name: Reader
2672  id: Reader
2673  summary: |
2674    Reader reads a Cloud Storage object.
2675    It implements io.Reader.
2676
2677    Typically, a Reader computes the CRC of the downloaded content and compares it to
2678    the stored CRC, returning an error from Read if there is a mismatch. This integrity check
2679    is skipped if transcoding occurs. See https://cloud.google.com/storage/docs/transcoding.
2680  parent: cloud.google.com/go/storage
2681  type: type
2682  langs:
2683  - go
2684  syntax:
2685    content: "type Reader struct {\n\tAttrs <a href=\"#cloud_google_com_go_storage_ReaderObjectAttrs\">ReaderObjectAttrs</a>\n\t//
2686      contains filtered or unexported fields\n}"
2687- uid: cloud.google.com/go/storage.Reader.CacheControl
2688  name: |
2689    func (*Reader) CacheControl
2690  id: CacheControl
2691  summary: |
2692    CacheControl returns the cache control of the object.
2693
2694    Deprecated: use Reader.Attrs.CacheControl.
2695  parent: cloud.google.com/go/storage.Reader
2696  type: method
2697  langs:
2698  - go
2699  syntax:
2700    content: func (r *<a href="#cloud_google_com_go_storage_Reader">Reader</a>) CacheControl()
2701      <a href="https://pkg.go.dev/builtin#string">string</a>
2702- uid: cloud.google.com/go/storage.Reader.Close
2703  name: |
2704    func (*Reader) Close
2705  id: Close
2706  summary: |
2707    Close closes the Reader. It must be called when done reading.
2708  parent: cloud.google.com/go/storage.Reader
2709  type: method
2710  langs:
2711  - go
2712  syntax:
2713    content: func (r *<a href="#cloud_google_com_go_storage_Reader">Reader</a>) Close()
2714      <a href="https://pkg.go.dev/builtin#error">error</a>
2715- uid: cloud.google.com/go/storage.Reader.ContentEncoding
2716  name: |
2717    func (*Reader) ContentEncoding
2718  id: ContentEncoding
2719  summary: |
2720    ContentEncoding returns the content encoding of the object.
2721
2722    Deprecated: use Reader.Attrs.ContentEncoding.
2723  parent: cloud.google.com/go/storage.Reader
2724  type: method
2725  langs:
2726  - go
2727  syntax:
2728    content: func (r *<a href="#cloud_google_com_go_storage_Reader">Reader</a>) ContentEncoding()
2729      <a href="https://pkg.go.dev/builtin#string">string</a>
2730- uid: cloud.google.com/go/storage.Reader.ContentType
2731  name: |
2732    func (*Reader) ContentType
2733  id: ContentType
2734  summary: |
2735    ContentType returns the content type of the object.
2736
2737    Deprecated: use Reader.Attrs.ContentType.
2738  parent: cloud.google.com/go/storage.Reader
2739  type: method
2740  langs:
2741  - go
2742  syntax:
2743    content: func (r *<a href="#cloud_google_com_go_storage_Reader">Reader</a>) ContentType()
2744      <a href="https://pkg.go.dev/builtin#string">string</a>
2745- uid: cloud.google.com/go/storage.Reader.LastModified
2746  name: |
2747    func (*Reader) LastModified
2748  id: LastModified
2749  summary: |
2750    LastModified returns the value of the Last-Modified header.
2751
2752    Deprecated: use Reader.Attrs.LastModified.
2753  parent: cloud.google.com/go/storage.Reader
2754  type: method
2755  langs:
2756  - go
2757  syntax:
2758    content: func (r *<a href="#cloud_google_com_go_storage_Reader">Reader</a>) LastModified()
2759      (<a href="https://pkg.go.dev/time">time</a>.<a href="https://pkg.go.dev/time#Time">Time</a>,
2760      <a href="https://pkg.go.dev/builtin#error">error</a>)
2761- uid: cloud.google.com/go/storage.Reader.Read
2762  name: |
2763    func (*Reader) Read
2764  id: Read
2765  parent: cloud.google.com/go/storage.Reader
2766  type: method
2767  langs:
2768  - go
2769  syntax:
2770    content: func (r *<a href="#cloud_google_com_go_storage_Reader">Reader</a>) Read(p
2771      []<a href="https://pkg.go.dev/builtin#byte">byte</a>) (<a href="https://pkg.go.dev/builtin#int">int</a>,
2772      <a href="https://pkg.go.dev/builtin#error">error</a>)
2773- uid: cloud.google.com/go/storage.Reader.Remain
2774  name: |
2775    func (*Reader) Remain
2776  id: Remain
2777  summary: |
2778    Remain returns the number of bytes left to read, or -1 if unknown.
2779  parent: cloud.google.com/go/storage.Reader
2780  type: method
2781  langs:
2782  - go
2783  syntax:
2784    content: func (r *<a href="#cloud_google_com_go_storage_Reader">Reader</a>) Remain()
2785      <a href="https://pkg.go.dev/builtin#int64">int64</a>
2786- uid: cloud.google.com/go/storage.Reader.Size
2787  name: |
2788    func (*Reader) Size
2789  id: Size
2790  summary: |
2791    Size returns the size of the object in bytes.
2792    The returned value is always the same and is not affected by
2793    calls to Read or Close.
2794
2795    Deprecated: use Reader.Attrs.Size.
2796  parent: cloud.google.com/go/storage.Reader
2797  type: method
2798  langs:
2799  - go
2800  syntax:
2801    content: func (r *<a href="#cloud_google_com_go_storage_Reader">Reader</a>) Size()
2802      <a href="https://pkg.go.dev/builtin#int64">int64</a>
2803- uid: cloud.google.com/go/storage.ReaderObjectAttrs
2804  name: ReaderObjectAttrs
2805  id: ReaderObjectAttrs
2806  summary: |
2807    ReaderObjectAttrs are attributes about the object being read. These are populated
2808    during the New call. This struct only holds a subset of object attributes: to
2809    get the full set of attributes, use ObjectHandle.Attrs.
2810
2811    Each field is read-only.
2812  parent: cloud.google.com/go/storage
2813  type: type
2814  langs:
2815  - go
2816  syntax:
2817    content: "type ReaderObjectAttrs struct {\n\t// Size is the length of the object's
2818      content.\n\tSize <a href=\"https://pkg.go.dev/builtin#int64\">int64</a>\n\n\t//
2819      StartOffset is the byte offset within the object\n\t// from which reading begins.\n\t//
2820      This value is only non-zero for range requests.\n\tStartOffset <a href=\"https://pkg.go.dev/builtin#int64\">int64</a>\n\n\t//
2821      ContentType is the MIME type of the object's content.\n\tContentType <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t//
2822      ContentEncoding is the encoding of the object's content.\n\tContentEncoding
2823      <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t// CacheControl
2824      specifies whether and for how long browser and Internet\n\t// caches are allowed
2825      to cache your objects.\n\tCacheControl <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t//
2826      LastModified is the time that the object was last modified.\n\tLastModified
2827      <a href=\"https://pkg.go.dev/time\">time</a>.<a href=\"https://pkg.go.dev/time#Time\">Time</a>\n\n\t//
2828      Generation is the generation number of the object's content.\n\tGeneration <a
2829      href=\"https://pkg.go.dev/builtin#int64\">int64</a>\n\n\t// Metageneration is
2830      the version of the metadata for this object at\n\t// this generation. This field
2831      is used for preconditions and for\n\t// detecting changes in metadata. A metageneration
2832      number is only\n\t// meaningful in the context of a particular generation of
2833      a\n\t// particular object.\n\tMetageneration <a href=\"https://pkg.go.dev/builtin#int64\">int64</a>\n}"
2834- uid: cloud.google.com/go/storage.RetentionPolicy
2835  name: RetentionPolicy
2836  id: RetentionPolicy
2837  summary: |
2838    RetentionPolicy enforces a minimum retention time for all objects
2839    contained in the bucket.
2840
2841    Any attempt to overwrite or delete objects younger than the retention
2842    period will result in an error. An unlocked retention policy can be
2843    modified or removed from the bucket via the Update method. A
2844    locked retention policy cannot be removed or shortened in duration
2845    for the lifetime of the bucket.
2846
2847    This feature is in private alpha release. It is not currently available to
2848    most customers. It might be changed in backwards-incompatible ways and is not
2849    subject to any SLA or deprecation policy.
2850  parent: cloud.google.com/go/storage
2851  type: type
2852  langs:
2853  - go
2854  syntax:
2855    content: "type RetentionPolicy struct {\n\t// RetentionPeriod specifies the duration
2856      that objects need to be\n\t// retained. Retention duration must be greater than
2857      zero and less than\n\t// 100 years. Note that enforcement of retention periods
2858      less than a day\n\t// is not guaranteed. Such periods should only be used for
2859      testing\n\t// purposes.\n\tRetentionPeriod <a href=\"https://pkg.go.dev/time\">time</a>.<a
2860      href=\"https://pkg.go.dev/time#Duration\">Duration</a>\n\n\t// EffectiveTime
2861      is the time from which the policy was enforced and\n\t// effective. This field
2862      is read-only.\n\tEffectiveTime <a href=\"https://pkg.go.dev/time\">time</a>.<a
2863      href=\"https://pkg.go.dev/time#Time\">Time</a>\n\n\t// IsLocked describes whether
2864      the bucket is locked. Once locked, an\n\t// object retention policy cannot be
2865      modified.\n\t// This field is read-only.\n\tIsLocked <a href=\"https://pkg.go.dev/builtin#bool\">bool</a>\n}"
2866- uid: cloud.google.com/go/storage.SignedURLOptions
2867  name: SignedURLOptions
2868  id: SignedURLOptions
2869  summary: |
2870    SignedURLOptions allows you to restrict the access to the signed URL.
2871  parent: cloud.google.com/go/storage
2872  type: type
2873  langs:
2874  - go
2875  syntax:
2876    content: "type SignedURLOptions struct {\n\t// GoogleAccessID represents the authorizer
2877      of the signed URL generation.\n\t// It is typically the Google service account
2878      client email address from\n\t// the Google Developers Console in the form of
2879      \"xxx@developer.gserviceaccount.com\".\n\t// Required.\n\tGoogleAccessID <a
2880      href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t// PrivateKey is
2881      the Google service account private key. It is obtainable\n\t// from the Google
2882      Developers Console.\n\t// At https://console.developers.google.com/project/<your-project-id>/apiui/credential,\n\t//
2883      create a service account client ID or reuse one of your existing service account\n\t//
2884      credentials. Click on the \"Generate new P12 key\" to generate and download\n\t//
2885      a new private key. Once you download the P12 file, use the following command\n\t//
2886      to convert it into a PEM file.\n\t//\n\t//    $ openssl pkcs12 -in key.p12 -passin
2887      pass:notasecret -out key.pem -nodes\n\t//\n\t// Provide the contents of the
2888      PEM file as a byte slice.\n\t// Exactly one of PrivateKey or SignBytes must
2889      be non-nil.\n\tPrivateKey []<a href=\"https://pkg.go.dev/builtin#byte\">byte</a>\n\n\t//
2890      SignBytes is a function for implementing custom signing. For example, if\n\t//
2891      your application is running on Google App Engine, you can use\n\t// appengine's
2892      internal signing function:\n\t//     ctx := appengine.NewContext(request)\n\t//
2893      \    acc, _ := appengine.ServiceAccount(ctx)\n\t//     url, err := SignedURL(\"bucket\",
2894      \"object\", &SignedURLOptions{\n\t//     \tGoogleAccessID: acc,\n\t//     \tSignBytes:
2895      func(b []byte) ([]byte, error) {\n\t//     \t\t_, signedBytes, err := appengine.SignBytes(ctx,
2896      b)\n\t//     \t\treturn signedBytes, err\n\t//     \t},\n\t//     \t// etc.\n\t//
2897      \    })\n\t//\n\t// Exactly one of PrivateKey or SignBytes must be non-nil.\n\tSignBytes
2898      func([]<a href=\"https://pkg.go.dev/builtin#byte\">byte</a>) ([]<a href=\"https://pkg.go.dev/builtin#byte\">byte</a>,
2899      <a href=\"https://pkg.go.dev/builtin#error\">error</a>)\n\n\t// Method is the
2900      HTTP method to be used with the signed URL.\n\t// Signed URLs can be used with
2901      GET, HEAD, PUT, and DELETE requests.\n\t// Required.\n\tMethod <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t//
2902      Expires is the expiration time on the signed URL. It must be\n\t// a datetime
2903      in the future. For SigningSchemeV4, the expiration may be no\n\t// more than
2904      seven days in the future.\n\t// Required.\n\tExpires <a href=\"https://pkg.go.dev/time\">time</a>.<a
2905      href=\"https://pkg.go.dev/time#Time\">Time</a>\n\n\t// ContentType is the content
2906      type header the client must provide\n\t// to use the generated signed URL.\n\t//
2907      Optional.\n\tContentType <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t//
2908      Headers is a list of extension headers the client must provide\n\t// in order
2909      to use the generated signed URL. Each must be a string of the\n\t// form \"key:values\",
2910      with multiple values separated by a semicolon.\n\t// Optional.\n\tHeaders []<a
2911      href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t// QueryParameters
2912      is a map of additional query parameters. When\n\t// SigningScheme is V4, this
2913      is used in computing the signature, and the\n\t// client must use the same query
2914      parameters when using the generated signed\n\t// URL.\n\t// Optional.\n\tQueryParameters
2915      <a href=\"https://pkg.go.dev/net/url\">url</a>.<a href=\"https://pkg.go.dev/net/url#Values\">Values</a>\n\n\t//
2916      MD5 is the base64 encoded MD5 checksum of the file.\n\t// If provided, the client
2917      should provide the exact value on the request\n\t// header in order to use the
2918      signed URL.\n\t// Optional.\n\tMD5 <a href=\"https://pkg.go.dev/builtin#string\">string</a>\n\n\t//
2919      Style provides options for the type of URL to use. Options are\n\t// PathStyle
2920      (default), BucketBoundHostname, and VirtualHostedStyle. See\n\t// https://cloud.google.com/storage/docs/request-endpoints
2921      for details.\n\t// Only supported for V4 signing.\n\t// Optional.\n\tStyle <a
2922      href=\"#cloud_google_com_go_storage_URLStyle\">URLStyle</a>\n\n\t// Insecure
2923      determines whether the signed URL should use HTTPS (default) or\n\t// HTTP.\n\t//
2924      Only supported for V4 signing.\n\t// Optional.\n\tInsecure <a href=\"https://pkg.go.dev/builtin#bool\">bool</a>\n\n\t//
2925      Scheme determines the version of URL signing to use. Default is\n\t// SigningSchemeV2.\n\tScheme
2926      <a href=\"#cloud_google_com_go_storage_SigningScheme\">SigningScheme</a>\n}"
2927- uid: cloud.google.com/go/storage.SigningScheme
2928  name: SigningScheme
2929  id: SigningScheme
2930  summary: |
2931    SigningScheme determines the API version to use when signing URLs.
2932  parent: cloud.google.com/go/storage
2933  type: type
2934  langs:
2935  - go
2936  syntax:
2937    content: type SigningScheme <a href="https://pkg.go.dev/builtin#int">int</a>
2938- uid: cloud.google.com/go/storage.SigningSchemeDefault,SigningSchemeV2,SigningSchemeV4
2939  name: SigningSchemeDefault, SigningSchemeV2, SigningSchemeV4
2940  id: SigningSchemeDefault,SigningSchemeV2,SigningSchemeV4
2941  parent: cloud.google.com/go/storage.SigningScheme
2942  type: const
2943  langs:
2944  - go
2945  syntax:
2946    content: "const (\n\t// SigningSchemeDefault is presently V2 and will change to
2947      V4 in the future.\n\tSigningSchemeDefault <a href=\"#cloud_google_com_go_storage_SigningScheme\">SigningScheme</a>
2948      = <a href=\"https://pkg.go.dev/builtin#iota\">iota</a>\n\n\t// SigningSchemeV2
2949      uses the V2 scheme to sign URLs.\n\tSigningSchemeV2\n\n\t// SigningSchemeV4
2950      uses the V4 scheme to sign URLs.\n\tSigningSchemeV4\n)"
2951- uid: cloud.google.com/go/storage.URLStyle
2952  name: URLStyle
2953  id: URLStyle
2954  summary: |
2955    URLStyle determines the style to use for the signed URL. pathStyle is the
2956    default. All non-default options work with V4 scheme only. See
2957    https://cloud.google.com/storage/docs/request-endpoints for details.
2958  parent: cloud.google.com/go/storage
2959  type: type
2960  langs:
2961  - go
2962  syntax:
2963    content: "type URLStyle interface {\n\t// contains filtered or unexported methods\n}"
2964- uid: cloud.google.com/go/storage.URLStyle.BucketBoundHostname
2965  name: |
2966    func BucketBoundHostname
2967  id: BucketBoundHostname
2968  summary: |
2969    BucketBoundHostname generates a URL with a custom hostname tied to a
2970    specific GCS bucket. The desired hostname should be passed in using the
2971    hostname argument. Generated urls will be of the form
2972    "<bucket-bound-hostname>/<object-name>". See
2973    https://cloud.google.com/storage/docs/request-endpoints#cname and
2974    https://cloud.google.com/load-balancing/docs/https/adding-backend-buckets-to-load-balancers
2975    for details. Note that for CNAMEs, only HTTP is supported, so Insecure must
2976    be set to true.
2977  parent: cloud.google.com/go/storage.URLStyle
2978  type: function
2979  langs:
2980  - go
2981  syntax:
2982    content: func BucketBoundHostname(hostname <a href="https://pkg.go.dev/builtin#string">string</a>)
2983      <a href="#cloud_google_com_go_storage_URLStyle">URLStyle</a>
2984- uid: cloud.google.com/go/storage.URLStyle.PathStyle
2985  name: |
2986    func PathStyle
2987  id: PathStyle
2988  summary: |
2989    PathStyle is the default style, and will generate a URL of the form
2990    "storage.googleapis.com/<bucket-name>/<object-name>".
2991  parent: cloud.google.com/go/storage.URLStyle
2992  type: function
2993  langs:
2994  - go
2995  syntax:
2996    content: func PathStyle() <a href="#cloud_google_com_go_storage_URLStyle">URLStyle</a>
2997- uid: cloud.google.com/go/storage.URLStyle.VirtualHostedStyle
2998  name: |
2999    func VirtualHostedStyle
3000  id: VirtualHostedStyle
3001  summary: |
3002    VirtualHostedStyle generates a URL relative to the bucket's virtual
3003    hostname, e.g. "<bucket-name>.storage.googleapis.com/<object-name>".
3004  parent: cloud.google.com/go/storage.URLStyle
3005  type: function
3006  langs:
3007  - go
3008  syntax:
3009    content: func VirtualHostedStyle() <a href="#cloud_google_com_go_storage_URLStyle">URLStyle</a>
3010- uid: cloud.google.com/go/storage.UniformBucketLevelAccess
3011  name: UniformBucketLevelAccess
3012  id: UniformBucketLevelAccess
3013  summary: |
3014    UniformBucketLevelAccess configures access checks to use only bucket-level IAM
3015    policies.
3016  parent: cloud.google.com/go/storage
3017  type: type
3018  langs:
3019  - go
3020  syntax:
3021    content: "type UniformBucketLevelAccess struct {\n\t// Enabled specifies whether
3022      access checks use only bucket-level IAM\n\t// policies. Enabled may be disabled
3023      until the locked time.\n\tEnabled <a href=\"https://pkg.go.dev/builtin#bool\">bool</a>\n\t//
3024      LockedTime specifies the deadline for changing Enabled from true to\n\t// false.\n\tLockedTime
3025      <a href=\"https://pkg.go.dev/time\">time</a>.<a href=\"https://pkg.go.dev/time#Time\">Time</a>\n}"
3026- uid: cloud.google.com/go/storage.Writer
3027  name: Writer
3028  id: Writer
3029  summary: |
3030    A Writer writes a Cloud Storage object.
3031  parent: cloud.google.com/go/storage
3032  type: type
3033  langs:
3034  - go
3035  syntax:
3036    content: "type Writer struct {\n\t// ObjectAttrs are optional attributes to set
3037      on the object. Any attributes\n\t// must be initialized before the first Write
3038      call. Nil or zero-valued\n\t// attributes are ignored.\n\t<a href=\"#cloud_google_com_go_storage_ObjectAttrs\">ObjectAttrs</a>\n\n\t//
3039      SendCRC specifies whether to transmit a CRC32C field. It should be set\n\t//
3040      to true in addition to setting the Writer's CRC32C field, because zero\n\t//
3041      is a valid CRC and normally a zero would not be transmitted.\n\t// If a CRC32C
3042      is sent, and the data written does not match the checksum,\n\t// the write will
3043      be rejected.\n\tSendCRC32C <a href=\"https://pkg.go.dev/builtin#bool\">bool</a>\n\n\t//
3044      ChunkSize controls the maximum number of bytes of the object that the\n\t//
3045      Writer will attempt to send to the server in a single request. Objects\n\t//
3046      smaller than the size will be sent in a single request, while larger\n\t// objects
3047      will be split over multiple requests. The size will be rounded up\n\t// to the
3048      nearest multiple of 256K.\n\t//\n\t// ChunkSize will default to a reasonable
3049      value. If you perform many\n\t// concurrent writes of small objects (under ~8MB),
3050      you may wish set ChunkSize\n\t// to a value that matches your objects' sizes
3051      to avoid consuming large\n\t// amounts of memory. See\n\t// https://cloud.google.com/storage/docs/json_api/v1/how-tos/upload#size\n\t//
3052      for more information about performance trade-offs related to ChunkSize.\n\t//\n\t//
3053      If ChunkSize is set to zero, chunking will be disabled and the object will\n\t//
3054      be uploaded in a single request without the use of a buffer. This will\n\t//
3055      further reduce memory used during uploads, but will also prevent the writer\n\t//
3056      from retrying in case of a transient error from the server, since a buffer\n\t//
3057      is required in order to retry the failed request.\n\t//\n\t// ChunkSize must
3058      be set before the first Write call.\n\tChunkSize <a href=\"https://pkg.go.dev/builtin#int\">int</a>\n\n\t//
3059      ProgressFunc can be used to monitor the progress of a large write.\n\t// operation.
3060      If ProgressFunc is not nil and writing requires multiple\n\t// calls to the
3061      underlying service (see\n\t// https://cloud.google.com/storage/docs/json_api/v1/how-tos/resumable-upload),\n\t//
3062      then ProgressFunc will be invoked after each call with the number of bytes of\n\t//
3063      content copied so far.\n\t//\n\t// ProgressFunc should return quickly without
3064      blocking.\n\tProgressFunc func(<a href=\"https://pkg.go.dev/builtin#int64\">int64</a>)\n\t//
3065      contains filtered or unexported fields\n}"
3066- uid: cloud.google.com/go/storage.Writer.Attrs
3067  name: |
3068    func (*Writer) Attrs
3069  id: Attrs
3070  summary: |
3071    Attrs returns metadata about a successfully-written object.
3072    It's only valid to call it after Close returns nil.
3073  parent: cloud.google.com/go/storage.Writer
3074  type: method
3075  langs:
3076  - go
3077  syntax:
3078    content: func (w *<a href="#cloud_google_com_go_storage_Writer">Writer</a>) Attrs()
3079      *<a href="#cloud_google_com_go_storage_ObjectAttrs">ObjectAttrs</a>
3080- uid: cloud.google.com/go/storage.Writer.Close
3081  name: |
3082    func (*Writer) Close
3083  id: Close
3084  summary: |
3085    Close completes the write operation and flushes any buffered data.
3086    If Close doesn't return an error, metadata about the written object
3087    can be retrieved by calling Attrs.
3088  parent: cloud.google.com/go/storage.Writer
3089  type: method
3090  langs:
3091  - go
3092  syntax:
3093    content: func (w *<a href="#cloud_google_com_go_storage_Writer">Writer</a>) Close()
3094      <a href="https://pkg.go.dev/builtin#error">error</a>
3095- uid: cloud.google.com/go/storage.Writer.CloseWithError
3096  name: |
3097    func (*Writer) CloseWithError
3098  id: CloseWithError
3099  summary: |
3100    CloseWithError aborts the write operation with the provided error.
3101    CloseWithError always returns nil.
3102
3103    Deprecated: cancel the context passed to NewWriter instead.
3104  parent: cloud.google.com/go/storage.Writer
3105  type: method
3106  langs:
3107  - go
3108  syntax:
3109    content: func (w *<a href="#cloud_google_com_go_storage_Writer">Writer</a>) CloseWithError(err
3110      <a href="https://pkg.go.dev/builtin#error">error</a>) <a href="https://pkg.go.dev/builtin#error">error</a>
3111- uid: cloud.google.com/go/storage.Writer.Write
3112  name: |
3113    func (*Writer) Write
3114  id: Write
3115  summary: |
3116    Write appends to w. It implements the io.Writer interface.
3117
3118    Since writes happen asynchronously, Write may return a nil
3119    error even though the write failed (or will fail). Always
3120    use the error returned from Writer.Close to determine if
3121    the upload was successful.
3122
3123    Writes will be retried on transient errors from the server, unless
3124    Writer.ChunkSize has been set to zero.
3125  parent: cloud.google.com/go/storage.Writer
3126  type: method
3127  langs:
3128  - go
3129  syntax:
3130    content: func (w *<a href="#cloud_google_com_go_storage_Writer">Writer</a>) Write(p
3131      []<a href="https://pkg.go.dev/builtin#byte">byte</a>) (n <a href="https://pkg.go.dev/builtin#int">int</a>,
3132      err <a href="https://pkg.go.dev/builtin#error">error</a>)
3133  codeexamples:
3134  - content: "package main\n\nimport (\n\t\"cloud.google.com/go/storage\"\n\t\"context\"\n\t\"fmt\"\n)\n\nfunc
3135      main() {\n\tctx := context.Background()\n\tclient, err := storage.NewClient(ctx)\n\tif
3136      err != nil {\n\t\t// TODO: handle error.\n\t}\n\twc := client.Bucket(\"bucketname\").Object(\"filename1\").NewWriter(ctx)\n\twc.ContentType
3137      = \"text/plain\"\n\twc.ACL = []storage.ACLRule{{Entity: storage.AllUsers, Role:
3138      storage.RoleReader}}\n\tif _, err := wc.Write([]byte(\"hello world\")); err
3139      != nil {\n\t\t// TODO: handle error.\n\t\t// Note that Write may return nil
3140      in some error situations,\n\t\t// so always check the error from Close.\n\t}\n\tif
3141      err := wc.Close(); err != nil {\n\t\t// TODO: handle error.\n\t}\n\tfmt.Println(\"updated
3142      object:\", wc.Attrs())\n}\n"
3143  - content: "package main\n\nimport (\n\t\"cloud.google.com/go/storage\"\n\t\"context\"\n\t\"fmt\"\n\t\"hash/crc32\"\n)\n\nfunc
3144      main() {\n\tctx := context.Background()\n\tclient, err := storage.NewClient(ctx)\n\tif
3145      err != nil {\n\t\t// TODO: handle error.\n\t}\n\tdata := []byte(\"verify me\")\n\twc
3146      := client.Bucket(\"bucketname\").Object(\"filename1\").NewWriter(ctx)\n\twc.CRC32C
3147      = crc32.Checksum(data, crc32.MakeTable(crc32.Castagnoli))\n\twc.SendCRC32C =
3148      true\n\tif _, err := wc.Write([]byte(\"hello world\")); err != nil {\n\t\t//
3149      TODO: handle error.\n\t\t// Note that Write may return nil in some error situations,\n\t\t//
3150      so always check the error from Close.\n\t}\n\tif err := wc.Close(); err != nil
3151      {\n\t\t// TODO: handle error.\n\t}\n\tfmt.Println(\"updated object:\", wc.Attrs())\n}\n"
3152    name: checksum
3153  - content: "package main\n\nimport (\n\t\"cloud.google.com/go/storage\"\n\t\"context\"\n\t\"fmt\"\n\t\"time\"\n)\n\nfunc
3154      main() {\n\tctx := context.Background()\n\tclient, err := storage.NewClient(ctx)\n\tif
3155      err != nil {\n\t\t// TODO: handle error.\n\t}\n\ttctx, cancel := context.WithTimeout(ctx,
3156      30*time.Second)\n\tdefer cancel() // Cancel when done, whether we time out or
3157      not.\n\twc := client.Bucket(\"bucketname\").Object(\"filename1\").NewWriter(tctx)\n\twc.ContentType
3158      = \"text/plain\"\n\twc.ACL = []storage.ACLRule{{Entity: storage.AllUsers, Role:
3159      storage.RoleReader}}\n\tif _, err := wc.Write([]byte(\"hello world\")); err
3160      != nil {\n\t\t// TODO: handle error.\n\t\t// Note that Write may return nil
3161      in some error situations,\n\t\t// so always check the error from Close.\n\t}\n\tif
3162      err := wc.Close(); err != nil {\n\t\t// TODO: handle error.\n\t}\n\tfmt.Println(\"updated
3163      object:\", wc.Attrs())\n}\n"
3164    name: timeout
3165- uid: cloud.google.com/go/storage.SignedURL
3166  name: |
3167    func SignedURL
3168  id: SignedURL
3169  summary: |
3170    SignedURL returns a URL for the specified object. Signed URLs allow
3171    the users access to a restricted resource for a limited time without having a
3172    Google account or signing in. For more information about the signed
3173    URLs, see https://cloud.google.com/storage/docs/accesscontrol#Signed-URLs.
3174  parent: cloud.google.com/go/storage
3175  type: function
3176  langs:
3177  - go
3178  syntax:
3179    content: func SignedURL(bucket, name <a href="https://pkg.go.dev/builtin#string">string</a>,
3180      opts *<a href="#cloud_google_com_go_storage_SignedURLOptions">SignedURLOptions</a>)
3181      (<a href="https://pkg.go.dev/builtin#string">string</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)
3182  codeexamples:
3183  - content: "package main\n\nimport (\n\t\"cloud.google.com/go/storage\"\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"time\"\n)\n\nfunc
3184      main() {\n\tpkey, err := ioutil.ReadFile(\"my-private-key.pem\")\n\tif err !=
3185      nil {\n\t\t// TODO: handle error.\n\t}\n\turl, err := storage.SignedURL(\"my-bucket\",
3186      \"my-object\", &storage.SignedURLOptions{\n\t\tGoogleAccessID: \"xxx@developer.gserviceaccount.com\",\n\t\tPrivateKey:
3187      \    pkey,\n\t\tMethod:         \"GET\",\n\t\tExpires:        time.Now().Add(48
3188      * time.Hour),\n\t})\n\tif err != nil {\n\t\t// TODO: handle error.\n\t}\n\tfmt.Println(url)\n}\n"
3189