-
Notifications
You must be signed in to change notification settings - Fork 591
/
index.json
862 lines (862 loc) · 37 KB
/
index.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
[
{
"tags": [],
"description": {
"full": "<p>Copyright 2014 Google Inc. All Rights Reserved.</p><p>Licensed under the Apache License, Version 2.0 (the "License");<br />you may not use this file except in compliance with the License.<br />You may obtain a copy of the License at</p><pre><code> http://www.apache.org/licenses/LICENSE-2.0\n</code></pre><p>Unless required by applicable law or agreed to in writing, software<br />distributed under the License is distributed on an "AS IS" BASIS,<br />WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<br />See the License for the specific language governing permissions and<br />limitations under the License.</p>",
"summary": "<p>Copyright 2014 Google Inc. All Rights Reserved.</p>",
"body": "<p>Licensed under the Apache License, Version 2.0 (the "License");<br />you may not use this file except in compliance with the License.<br />You may obtain a copy of the License at</p><pre><code> http://www.apache.org/licenses/LICENSE-2.0\n</code></pre><p>Unless required by applicable law or agreed to in writing, software<br />distributed under the License is distributed on an "AS IS" BASIS,<br />WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<br />See the License for the specific language governing permissions and<br />limitations under the License.</p>"
},
"isPrivate": false,
"isConstructor": false,
"isClass": false,
"isEvent": false,
"ignore": true,
"line": 1,
"codeStart": 16
},
{
"tags": [
{
"type": "module",
"string": "storage",
"html": "<p>storage</p>"
}
],
"description": {
"full": "",
"summary": "",
"body": ""
},
"isPrivate": false,
"isConstructor": false,
"isClass": false,
"isEvent": false,
"ignore": true,
"line": 17,
"codeStart": 21,
"code": "'use strict';\n\nvar extend = require('extend');",
"ctx": false
},
{
"tags": [
{
"type": "type",
"string": "{module:storage/bucket}",
"types": [
"module:storage/bucket"
],
"typesDescription": "module:<a href=\"module%3Astorage%2Fbucket.html\">storage/bucket</a>",
"optional": false,
"nullable": false,
"nonNullable": false,
"variable": false,
"html": "<p>{module:storage/bucket}</p>"
},
{
"type": "private",
"string": "",
"visibility": "private",
"html": ""
}
],
"description": {
"full": "",
"summary": "",
"body": ""
},
"isPrivate": true,
"isConstructor": false,
"isClass": false,
"isEvent": false,
"ignore": false,
"line": 25,
"codeStart": 29,
"code": "var Bucket = require('./bucket.js');",
"ctx": {
"type": "declaration",
"name": "Bucket",
"value": "require('./bucket.js')",
"string": "Bucket"
}
},
{
"tags": [
{
"type": "type",
"string": "{module:common/streamrouter}",
"types": [
"module:common/streamrouter"
],
"typesDescription": "module:<a href=\"module%3Acommon%2Fstreamrouter.html\">common/streamrouter</a>",
"optional": false,
"nullable": false,
"nonNullable": false,
"variable": false,
"html": "<p>{module:common/streamrouter}</p>"
},
{
"type": "private",
"string": "",
"visibility": "private",
"html": ""
}
],
"description": {
"full": "",
"summary": "",
"body": ""
},
"isPrivate": true,
"isConstructor": false,
"isClass": false,
"isEvent": false,
"ignore": false,
"line": 31,
"codeStart": 35,
"code": "var streamRouter = require('../common/stream-router.js');",
"ctx": {
"type": "declaration",
"name": "streamRouter",
"value": "require('../common/stream-router.js')",
"string": "streamRouter"
}
},
{
"tags": [
{
"type": "type",
"string": "{module:common/util}",
"types": [
"module:common/util"
],
"typesDescription": "module:<a href=\"module%3Acommon%2Futil.html\">common/util</a>",
"optional": false,
"nullable": false,
"nonNullable": false,
"variable": false,
"html": "<p>{module:common/util}</p>"
},
{
"type": "private",
"string": "",
"visibility": "private",
"html": ""
}
],
"description": {
"full": "",
"summary": "",
"body": ""
},
"isPrivate": true,
"isConstructor": false,
"isClass": false,
"isEvent": false,
"ignore": false,
"line": 37,
"codeStart": 41,
"code": "var util = require('../common/util.js');",
"ctx": {
"type": "declaration",
"name": "util",
"value": "require('../common/util.js')",
"string": "util"
}
},
{
"tags": [
{
"type": "const",
"string": "{array}",
"html": "<p>{array}</p>"
},
{
"type": "private",
"string": "",
"visibility": "private",
"html": ""
}
],
"description": {
"full": "<p>Required scopes for Google Cloud Storage API.</p>",
"summary": "<p>Required scopes for Google Cloud Storage API.</p>",
"body": ""
},
"isPrivate": true,
"isConstructor": false,
"isClass": false,
"isEvent": false,
"ignore": false,
"line": 43,
"codeStart": 48,
"code": "var SCOPES = ['https://www.googleapis.com/auth/devstorage.full_control'];",
"ctx": {
"type": "declaration",
"name": "SCOPES",
"value": "['https://www.googleapis.com/auth/devstorage.full_control']",
"string": "SCOPES"
}
},
{
"tags": [
{
"type": "const",
"string": "{string}",
"html": "<p>{string}</p>"
},
{
"type": "private",
"string": "",
"visibility": "private",
"html": ""
}
],
"description": {
"full": "",
"summary": "",
"body": ""
},
"isPrivate": true,
"isConstructor": false,
"isClass": false,
"isEvent": false,
"ignore": false,
"line": 50,
"codeStart": 54,
"code": "var STORAGE_BASE_URL = 'https://www.googleapis.com/storage/v1/b';",
"ctx": {
"type": "declaration",
"name": "STORAGE_BASE_URL",
"value": "'https://www.googleapis.com/storage/v1/b'",
"string": "STORAGE_BASE_URL"
}
},
{
"tags": [
{
"type": "param",
"string": "{object} options - Configuration object.",
"name": "options",
"description": "<ul>\n<li>Configuration object.</li>\n</ul>\n",
"types": [
"object"
],
"typesDescription": "<code>object</code>",
"optional": false,
"nullable": false,
"nonNullable": false,
"variable": false
}
],
"description": {
"full": "<p>Developer Documentation</p><p>Invoke this method to create a new Storage object bound with pre-determined<br />configuration options. For each object that can be created (e.g., a bucket),<br />there is an equivalent static and instance method. While they are classes,<br />they can be instantiated without use of the <code>new</code> keyword.</p>",
"summary": "<p>Developer Documentation</p>",
"body": "<p>Invoke this method to create a new Storage object bound with pre-determined<br />configuration options. For each object that can be created (e.g., a bucket),<br />there is an equivalent static and instance method. While they are classes,<br />they can be instantiated without use of the <code>new</code> keyword.</p>"
},
"isPrivate": false,
"isConstructor": false,
"isClass": false,
"isEvent": false,
"ignore": true,
"line": 56,
"codeStart": 65
},
{
"tags": [
{
"type": "alias",
"string": "module:storage",
"html": "<p>module:storage</p>"
},
{
"type": "constructor",
"string": "",
"html": ""
},
{
"type": "param",
"string": "{object} options - [Configuration object](#/docs/?method=gcloud).\n",
"name": "options",
"description": "<ul>\n<li><a href=\"#/docs/?method=gcloud\">Configuration object</a>. </li>\n</ul>\n",
"types": [
"object"
],
"typesDescription": "<code>object</code>",
"optional": false,
"nullable": false,
"nonNullable": false,
"variable": false
},
{
"type": "example",
"string": "var gcloud = require('gcloud')({\n keyFilename: '/path/to/keyfile.json',\n projectId: 'my-project'\n});\n\nvar gcs = gcloud.storage();",
"html": "<p>var gcloud = require('gcloud')({<br /> keyFilename: '/path/to/keyfile.json',<br /> projectId: 'my-project'<br />});</p><p>var gcs = gcloud.storage();</p>"
}
],
"description": {
"full": "<p>To access your Cloud Storage buckets, you will use the <code>bucket</code> function<br />returned from this <code>storage</code> object.</p><p>The examples below will demonstrate the different usage patterns your app may<br />need to connect to <code>gcloud</code> and access your bucket.</p>",
"summary": "<p>To access your Cloud Storage buckets, you will use the <code>bucket</code> function<br />returned from this <code>storage</code> object.</p>",
"body": "<p>The examples below will demonstrate the different usage patterns your app may<br />need to connect to <code>gcloud</code> and access your bucket.</p>"
},
"isPrivate": false,
"isConstructor": true,
"isClass": false,
"isEvent": false,
"ignore": false,
"line": 65,
"codeStart": 85,
"code": "function Storage(options) {\n if (!(this instanceof Storage)) {\n return new Storage(options);\n }\n\n options = options || {};\n\n if (!options.projectId) {\n throw util.missingProjectIdError;\n }\n\n this.makeAuthorizedRequest_ = util.makeAuthorizedRequestFactory({\n credentials: options.credentials,\n keyFile: options.keyFilename,\n scopes: SCOPES,\n email: options.email\n });\n\n this.projectId = options.projectId;\n}",
"ctx": {
"type": "constructor",
"name": "Storage",
"string": "Storage()"
}
},
{
"tags": [
{
"type": "resource",
"string": "[About Access Control Lists]{@link https://cloud.google.com/storage/docs/access-control#About-Access-Control-Lists} ",
"html": "<p>[About Access Control Lists]{@link <a href=\"https://cloud.google.com/storage/docs/access-control#About-Access-Control-Lists}\">https://cloud.google.com/storage/docs/access-control#About-Access-Control-Lists}</a> </p>"
},
{
"type": "type",
"string": "{object}\n",
"types": [
"object"
],
"typesDescription": "<code>object</code>",
"optional": false,
"nullable": false,
"nonNullable": false,
"variable": false,
"html": "<p>{object}</p>"
},
{
"type": "example",
"string": "var gcs = gcloud.storage({\n projectId: 'grape-spaceship-123'\n});\n\nvar albums = gcs.bucket('albums');\n\n//-\n// Make all of the files currently in a bucket publicly readable.\n//-\nalbums.acl.add({\n entity: 'allUsers',\n role: gcs.acl.READER_ROLE\n}, function(err, aclObject) {});\n\n//-\n// Make any new objects added to a bucket publicly readable.\n//-\nalbums.acl.default.add({\n entity: 'allUsers',\n role: gcs.acl.READER_ROLE\n}, function(err, aclObject) {});\n\n//-\n// Grant a user ownership permissions to a bucket.\n//-\n\nalbums.acl.add({\n entity: 'user-useremail@example.com',\n role: gcs.acl.OWNER_ROLE\n}, function(err, aclObject) {});",
"html": "<p>var gcs = gcloud.storage({<br /> projectId: 'grape-spaceship-123'<br />});</p><p>var albums = gcs.bucket('albums');</p><p>//-<br />// Make all of the files currently in a bucket publicly readable.<br />//-<br />albums.acl.add({<br /> entity: 'allUsers',<br /> role: gcs.acl.READER_ROLE<br />}, function(err, aclObject) {});</p><p>//-<br />// Make any new objects added to a bucket publicly readable.<br />//-<br />albums.acl.default.add({<br /> entity: 'allUsers',<br /> role: gcs.acl.READER_ROLE<br />}, function(err, aclObject) {});</p><p>//-<br />// Grant a user ownership permissions to a bucket.<br />//-</p><p>albums.acl.add({<br /> entity: 'user-useremail@example.com',<br /> role: gcs.acl.OWNER_ROLE<br />}, function(err, aclObject) {});</p>"
}
],
"description": {
"full": "<p>Google Cloud Storage uses access control lists (ACLs) to manage object and<br />bucket access. ACLs are the mechanism you use to share objects with other<br />users and allow other users to access your buckets and objects.</p><p>This object provides constants to refer to the three permission levels that<br />can be granted to an entity:</p><ul>\n<li><code>gcs.acl.OWNER_ROLE</code> - ("OWNER")</li>\n<li><code>gcs.acl.READER_ROLE</code> - ("READER")</li>\n<li><code>gcs.acl.WRITER_ROLE</code> - ("WRITER")</li>\n</ul>\n",
"summary": "<p>Google Cloud Storage uses access control lists (ACLs) to manage object and<br />bucket access. ACLs are the mechanism you use to share objects with other<br />users and allow other users to access your buckets and objects.</p>",
"body": "<p>This object provides constants to refer to the three permission levels that<br />can be granted to an entity:</p><ul>\n<li><code>gcs.acl.OWNER_ROLE</code> - ("OWNER")</li>\n<li><code>gcs.acl.READER_ROLE</code> - ("READER")</li>\n<li><code>gcs.acl.WRITER_ROLE</code> - ("WRITER")</li>\n</ul>\n"
},
"isPrivate": false,
"isConstructor": false,
"isClass": false,
"isEvent": false,
"ignore": false,
"line": 106,
"codeStart": 154,
"code": "Storage.acl = {\n OWNER_ROLE: 'OWNER',\n READER_ROLE: 'READER',\n WRITER_ROLE: 'WRITER'\n};\n\nStorage.prototype.acl = Storage.acl;",
"ctx": {
"type": "property",
"receiver": "Storage",
"name": "acl",
"value": "{",
"string": "Storage.acl"
}
},
{
"tags": [
{
"type": "param",
"string": "{object|string} name - Name of the existing bucket.",
"name": "name",
"description": "<ul>\n<li>Name of the existing bucket.</li>\n</ul>\n",
"types": [
"object",
"string"
],
"typesDescription": "<code>object</code>|<code>string</code>",
"optional": false,
"nullable": false,
"nonNullable": false,
"variable": false
},
{
"type": "return",
"string": "{module:storage/bucket}\n",
"types": [
"module:storage/bucket"
],
"typesDescription": "module:<a href=\"module%3Astorage%2Fbucket.html\">storage/bucket</a>",
"optional": false,
"nullable": false,
"nonNullable": false,
"variable": false,
"description": "",
"html": "<p>{module:storage/bucket}</p>"
},
{
"type": "example",
"string": "var gcloud = require('gcloud')({\n projectId: 'grape-spaceship-123',\n keyFilename: '/path/to/keyfile.json'\n});\n\nvar gcs = gcloud.storage();\n\nvar albums = gcs.bucket('albums');\nvar photos = gcs.bucket('photos');",
"html": "<p>var gcloud = require('gcloud')({<br /> projectId: 'grape-spaceship-123',<br /> keyFilename: '/path/to/keyfile.json'<br />});</p><p>var gcs = gcloud.storage();</p><p>var albums = gcs.bucket('albums');<br />var photos = gcs.bucket('photos');</p>"
}
],
"description": {
"full": "<p>Get a reference to a Google Cloud Storage bucket.</p>",
"summary": "<p>Get a reference to a Google Cloud Storage bucket.</p>",
"body": ""
},
"isPrivate": false,
"isConstructor": false,
"isClass": false,
"isEvent": false,
"ignore": false,
"line": 162,
"codeStart": 179,
"code": "Storage.prototype.bucket = function(name) {\n return new Bucket(this, name);\n};",
"ctx": {
"type": "method",
"constructor": "Storage",
"cons": "Storage",
"name": "bucket",
"string": "Storage.prototype.bucket()"
}
},
{
"tags": [
{
"type": "resource",
"string": "[Buckets: insert API Documentation]{@link https://cloud.google.com/storage/docs/json_api/v1/buckets/insert}",
"html": "<p>[Buckets: insert API Documentation]{@link <a href=\"https://cloud.google.com/storage/docs/json_api/v1/buckets/insert}\">https://cloud.google.com/storage/docs/json_api/v1/buckets/insert}</a></p>"
},
{
"type": "resource",
"string": "[Durable Reduced Availability]{@link https://cloud.google.com/storage/docs/durable-reduced-availability}",
"html": "<p>[Durable Reduced Availability]{@link <a href=\"https://cloud.google.com/storage/docs/durable-reduced-availability}\">https://cloud.google.com/storage/docs/durable-reduced-availability}</a></p>"
},
{
"type": "resource",
"string": "[Nearline]{@link https://cloud.google.com/storage/docs/nearline}",
"html": "<p>[Nearline]{@link <a href=\"https://cloud.google.com/storage/docs/nearline}\">https://cloud.google.com/storage/docs/nearline}</a></p>"
},
{
"type": "resource",
"string": "[Storage Classes]{@link https://cloud.google.com/storage/docs/storage-classes} ",
"html": "<p>[Storage Classes]{@link <a href=\"https://cloud.google.com/storage/docs/storage-classes}\">https://cloud.google.com/storage/docs/storage-classes}</a> </p>"
},
{
"type": "throws",
"string": "{Error} If a name is not provided.\n",
"types": [
"Error"
],
"description": "<p>If a name is not provided. </p>"
},
{
"type": "param",
"string": "{string} name - Name of the bucket to create.",
"name": "name",
"description": "<ul>\n<li>Name of the bucket to create.</li>\n</ul>\n",
"types": [
"string"
],
"typesDescription": "<code>string</code>",
"optional": false,
"nullable": false,
"nonNullable": false,
"variable": false
},
{
"type": "param",
"string": "{object=} metadata - Metadata to set for the bucket.",
"name": "metadata",
"description": "<ul>\n<li>Metadata to set for the bucket.</li>\n</ul>\n",
"types": [
"object"
],
"typesDescription": "<code>object</code>|<code>undefined</code>",
"optional": true,
"nullable": false,
"nonNullable": false,
"variable": false
},
{
"type": "param",
"string": "{boolean=} metadata.dra - Specify the storage class as\n [Durable Reduced Availability](https://goo.gl/26lthK).",
"name": "metadata.dra",
"description": "<ul>\n<li>Specify the storage class as <a href=\"https://goo.gl/26lthK\">Durable Reduced Availability</a>.</li>\n</ul>\n",
"types": [
"boolean"
],
"typesDescription": "<code>boolean</code>|<code>undefined</code>",
"optional": true,
"nullable": false,
"nonNullable": false,
"variable": false
},
{
"type": "param",
"string": "{boolean=} metadata.nearline - Specify the storage class as\n [Nearline](https://goo.gl/sN5wNh).",
"name": "metadata.nearline",
"description": "<ul>\n<li>Specify the storage class as <a href=\"https://goo.gl/sN5wNh\">Nearline</a>.</li>\n</ul>\n",
"types": [
"boolean"
],
"typesDescription": "<code>boolean</code>|<code>undefined</code>",
"optional": true,
"nullable": false,
"nonNullable": false,
"variable": false
},
{
"type": "param",
"string": "{function} callback - The callback function.",
"name": "callback",
"description": "<ul>\n<li>The callback function.</li>\n</ul>\n",
"types": [
"function"
],
"typesDescription": "<code>function</code>",
"optional": false,
"nullable": false,
"nonNullable": false,
"variable": false
},
{
"type": "param",
"string": "{?error} callback.err - An error returned while making this request",
"name": "callback.err",
"description": "<ul>\n<li>An error returned while making this request</li>\n</ul>\n",
"types": [
"error"
],
"typesDescription": "<code>error</code>|<code>null</code>",
"optional": false,
"nullable": true,
"nonNullable": false,
"variable": false
},
{
"type": "param",
"string": "{module:storage/bucket} callback.bucket - The newly created Bucket.",
"name": "callback.bucket",
"description": "<ul>\n<li>The newly created Bucket.</li>\n</ul>\n",
"types": [
"module:storage/bucket"
],
"typesDescription": "module:<a href=\"module%3Astorage%2Fbucket.html\">storage/bucket</a>",
"optional": false,
"nullable": false,
"nonNullable": false,
"variable": false
},
{
"type": "param",
"string": "{object} callback.apiResponse - The full API response.\n",
"name": "callback.apiResponse",
"description": "<ul>\n<li>The full API response. </li>\n</ul>\n",
"types": [
"object"
],
"typesDescription": "<code>object</code>",
"optional": false,
"nullable": false,
"nonNullable": false,
"variable": false
},
{
"type": "example",
"string": "var callback = function(err, bucket, apiResponse) {\n // `bucket` is a Bucket object.\n};\n\ngcs.createBucket('new-bucket', callback);\n\n//-\n// Create a bucket in a specific location and region. <em>See the <a\n// href=\"https://cloud.google.com/storage/docs/json_api/v1/buckets/insert\">\n// Official JSON API docs</a> for complete details on the `location` option.\n// </em>\n//-\nvar metadata = {\n location: 'US-CENTRAL1',\n dra: true\n};\n\ngcs.createBucket('new-bucket', metadata, callback);\n\n//-\n// Enable versioning on a new bucket.\n//-\nvar metadata = {\n versioning: {\n enabled: true\n }\n};\n\ngcs.createBucket('new-bucket', metadata, callback);",
"html": "<p>var callback = function(err, bucket, apiResponse) {<br /> // <code>bucket</code> is a Bucket object.<br />};</p><p>gcs.createBucket('new-bucket', callback);</p><p>//-<br />// Create a bucket in a specific location and region. <em>See the <a\n// href=\"https://cloud.google.com/storage/docs/json_api/v1/buckets/insert\"><br />// Official JSON API docs</a> for complete details on the <code>location</code> option.<br />// </em><br />//-<br />var metadata = {<br /> location: 'US-CENTRAL1',<br /> dra: true<br />};</p><p>gcs.createBucket('new-bucket', metadata, callback);</p><p>//-<br />// Enable versioning on a new bucket.<br />//-<br />var metadata = {<br /> versioning: {<br /> enabled: true<br /> }<br />};</p><p>gcs.createBucket('new-bucket', metadata, callback);</p>"
}
],
"description": {
"full": "<p>Create a bucket.</p>",
"summary": "<p>Create a bucket.</p>",
"body": ""
},
"isPrivate": false,
"isConstructor": false,
"isClass": false,
"isEvent": false,
"ignore": false,
"line": 183,
"codeStart": 235,
"code": "Storage.prototype.createBucket = function(name, metadata, callback) {\n var self = this;\n if (!name) {\n throw new Error('A name is required to create a bucket.');\n }\n if (!callback) {\n callback = metadata;\n metadata = {};\n }\n var query = {\n project: this.projectId\n };\n var body = extend(metadata, {\n name: name\n });\n var storageClasses = {\n dra: 'DURABLE_REDUCED_AVAILABILITY',\n nearline: 'NEARLINE'\n };\n\n Object.keys(storageClasses).forEach(function(storageClass) {\n if (body[storageClass]) {\n body.storageClass = storageClasses[storageClass];\n delete body[storageClass];\n }\n });\n\n this.makeReq_('POST', '', query, body, function(err, resp) {\n if (err) {\n callback(err, null, resp);\n return;\n }\n var bucket = self.bucket(name);\n bucket.metadata = resp;\n callback(null, bucket, resp);\n });\n};",
"ctx": {
"type": "method",
"constructor": "Storage",
"cons": "Storage",
"name": "createBucket",
"string": "Storage.prototype.createBucket()"
}
},
{
"tags": [
{
"type": "resource",
"string": "[Buckets: list API Documentation]{@link https://cloud.google.com/storage/docs/json_api/v1/buckets/list} ",
"html": "<p>[Buckets: list API Documentation]{@link <a href=\"https://cloud.google.com/storage/docs/json_api/v1/buckets/list}\">https://cloud.google.com/storage/docs/json_api/v1/buckets/list}</a> </p>"
},
{
"type": "param",
"string": "{object=} query - Query object.",
"name": "query",
"description": "<ul>\n<li>Query object.</li>\n</ul>\n",
"types": [
"object"
],
"typesDescription": "<code>object</code>|<code>undefined</code>",
"optional": true,
"nullable": false,
"nonNullable": false,
"variable": false
},
{
"type": "param",
"string": "{boolean} options.autoPaginate - Have pagination handled\n automatically. Default: true.",
"name": "options.autoPaginate",
"description": "<ul>\n<li>Have pagination handled automatically. Default: true.</li>\n</ul>\n",
"types": [
"boolean"
],
"typesDescription": "<code>boolean</code>",
"optional": false,
"nullable": false,
"nonNullable": false,
"variable": false
},
{
"type": "param",
"string": "{number} query.maxResults - Maximum number of items plus prefixes to\n return.",
"name": "query.maxResults",
"description": "<ul>\n<li>Maximum number of items plus prefixes to return.</li>\n</ul>\n",
"types": [
"number"
],
"typesDescription": "<code>number</code>",
"optional": false,
"nullable": false,
"nonNullable": false,
"variable": false
},
{
"type": "param",
"string": "{string} query.pageToken - A previously-returned page token\n representing part of the larger set of results to view.",
"name": "query.pageToken",
"description": "<ul>\n<li>A previously-returned page token representing part of the larger set of results to view.</li>\n</ul>\n",
"types": [
"string"
],
"typesDescription": "<code>string</code>",
"optional": false,
"nullable": false,
"nonNullable": false,
"variable": false
},
{
"type": "param",
"string": "{function=} callback - The callback function.",
"name": "callback",
"description": "<ul>\n<li>The callback function.</li>\n</ul>\n",
"types": [
"function"
],
"typesDescription": "<code>function</code>|<code>undefined</code>",
"optional": true,
"nullable": false,
"nonNullable": false,
"variable": false
},
{
"type": "param",
"string": "{?error} callback.err - An error returned while making this request",
"name": "callback.err",
"description": "<ul>\n<li>An error returned while making this request</li>\n</ul>\n",
"types": [
"error"
],
"typesDescription": "<code>error</code>|<code>null</code>",
"optional": false,
"nullable": true,
"nonNullable": false,
"variable": false
},
{
"type": "param",
"string": "{module:storage/bucket[]} callback.buckets - List of all Buckets.",
"name": "callback.buckets",
"description": "<ul>\n<li>List of all Buckets.</li>\n</ul>\n",
"types": [
"Array.<module:storage/bucket>"
],
"typesDescription": "<code>Array</code>.<module:<a href=\"module%3Astorage%2Fbucket.html\">storage/bucket</a>>",
"optional": false,
"nullable": false,
"nonNullable": false,
"variable": false
},
{
"type": "param",
"string": "{?object} callback.nextQuery - If present, query with this object to\n check for more results.",
"name": "callback.nextQuery",
"description": "<ul>\n<li>If present, query with this object to check for more results.</li>\n</ul>\n",
"types": [
"object"
],
"typesDescription": "<code>object</code>|<code>null</code>",
"optional": false,
"nullable": true,
"nonNullable": false,
"variable": false
},
{
"type": "param",
"string": "{object} callback.apiResponse - The full API response.\n",
"name": "callback.apiResponse",
"description": "<ul>\n<li>The full API response. </li>\n</ul>\n",
"types": [
"object"
],
"typesDescription": "<code>object</code>",
"optional": false,
"nullable": false,
"nonNullable": false,
"variable": false
},
{
"type": "example",
"string": "gcs.getBuckets(function(err, buckets) {\n if (!err) {\n // buckets is an array of Bucket objects.\n }\n});\n\n//-\n// To control how many API requests are made and page through the results\n// manually, set `autoPaginate` to `false`.\n//-\nvar callback = function(err, buckets, nextQuery, apiResponse) {\n if (nextQuery) {\n // More results exist.\n gcs.getBuckets(nextQuery, callback);\n }\n\n // The `metadata` property is populated for you with the metadata at the\n // time of fetching.\n buckets[0].metadata;\n\n // However, in cases where you are concerned the metadata could have\n // changed, use the `getMetadata` method.\n buckets[0].getMetadata(function(err, metadata, apiResponse) {});\n};\n\ngcs.getBuckets({\n autoPaginate: false\n}, callback);\n\n//-\n// Get the buckets from your project as a readable object stream.\n//-\ngcs.getBuckets()\n .on('error', console.error)\n .on('data', function(bucket) {\n // bucket is a Bucket object.\n })\n .on('end', function() {\n // All buckets retrieved.\n });\n\n//-\n// If you anticipate many results, you can end a stream early to prevent\n// unnecessary processing and API requests.\n//-\ngcs.getBuckets()\n .on('data', function(bucket) {\n this.end();\n });",
"html": "<p>gcs.getBuckets(function(err, buckets) {<br /> if (!err) {<br /> // buckets is an array of Bucket objects.<br /> }<br />});</p><p>//-<br />// To control how many API requests are made and page through the results<br />// manually, set <code>autoPaginate</code> to <code>false</code>.<br />//-<br />var callback = function(err, buckets, nextQuery, apiResponse) {<br /> if (nextQuery) {<br /> // More results exist.<br /> gcs.getBuckets(nextQuery, callback);<br /> }</p><p> // The <code>metadata</code> property is populated for you with the metadata at the<br /> // time of fetching.<br /> buckets[0].metadata;</p><p> // However, in cases where you are concerned the metadata could have<br /> // changed, use the <code>getMetadata</code> method.<br /> buckets[0].getMetadata(function(err, metadata, apiResponse) {});<br />};</p><p>gcs.getBuckets({<br /> autoPaginate: false<br />}, callback);</p><p>//-<br />// Get the buckets from your project as a readable object stream.<br />//-<br />gcs.getBuckets()<br /> .on('error', console.error)<br /> .on('data', function(bucket) {<br /> // bucket is a Bucket object.<br /> })<br /> .on('end', function() {<br /> // All buckets retrieved.<br /> });</p><p>//-<br />// If you anticipate many results, you can end a stream early to prevent<br />// unnecessary processing and API requests.<br />//-<br />gcs.getBuckets()<br /> .on('data', function(bucket) {<br /> this.end();<br /> });</p>"
}
],
"description": {
"full": "<p>Get Bucket objects for all of the buckets in your project.</p>",
"summary": "<p>Get Bucket objects for all of the buckets in your project.</p>",
"body": ""
},
"isPrivate": false,
"isConstructor": false,
"isClass": false,
"isEvent": false,
"ignore": false,
"line": 273,
"codeStart": 343,
"code": "Storage.prototype.getBuckets = function(query, callback) {\n var that = this;\n if (!callback) {\n callback = query;\n query = {};\n }\n query.project = query.project || this.projectId;\n this.makeReq_('GET', '', query, null, function(err, resp) {\n if (err) {\n callback(err, null, null, resp);\n return;\n }\n var buckets = (resp.items || []).map(function(item) {\n var bucket = that.bucket(item.id);\n bucket.metadata = item;\n return bucket;\n });\n var nextQuery = null;\n if (resp.nextPageToken) {\n nextQuery = extend({}, query, { pageToken: resp.nextPageToken });\n }\n callback(null, buckets, nextQuery, resp);\n });\n};",
"ctx": {
"type": "method",
"constructor": "Storage",
"cons": "Storage",
"name": "getBuckets",
"string": "Storage.prototype.getBuckets()"
}
},
{
"tags": [
{
"type": "private",
"string": "\n",
"visibility": "private",
"html": ""
},
{
"type": "param",
"string": "{string} method - Action.",
"name": "method",
"description": "<ul>\n<li>Action.</li>\n</ul>\n",
"types": [
"string"
],
"typesDescription": "<code>string</code>",
"optional": false,
"nullable": false,
"nonNullable": false,
"variable": false
},
{
"type": "param",
"string": "{string} path - Request path.",
"name": "path",
"description": "<ul>\n<li>Request path.</li>\n</ul>\n",
"types": [
"string"
],
"typesDescription": "<code>string</code>",
"optional": false,
"nullable": false,
"nonNullable": false,
"variable": false
},
{
"type": "param",
"string": "{*} query - Request query object.",
"name": "query",
"description": "<ul>\n<li>Request query object.</li>\n</ul>\n",
"types": [],
"typesDescription": "<code>*</code>",
"optional": false,
"nullable": false,
"nonNullable": false,
"variable": false
},
{
"type": "param",
"string": "{*} body - Request body contents.",
"name": "body",
"description": "<ul>\n<li>Request body contents.</li>\n</ul>\n",
"types": [],
"typesDescription": "<code>*</code>",
"optional": false,
"nullable": false,
"nonNullable": false,
"variable": false
},
{
"type": "param",
"string": "{function} callback - The callback function.",
"name": "callback",
"description": "<ul>\n<li>The callback function.</li>\n</ul>\n",
"types": [
"function"
],
"typesDescription": "<code>function</code>",
"optional": false,
"nullable": false,
"nonNullable": false,
"variable": false
}
],
"description": {
"full": "<p>Make a new request object from the provided arguments and wrap the callback<br />to intercept non-successful responses.</p>",
"summary": "<p>Make a new request object from the provided arguments and wrap the callback<br />to intercept non-successful responses.</p>",
"body": ""
},
"isPrivate": true,
"isConstructor": false,
"isClass": false,
"isEvent": false,
"ignore": false,
"line": 368,
"codeStart": 380,
"code": "Storage.prototype.makeReq_ = function(method, path, query, body, callback) {\n var reqOpts = {\n method: method,\n qs: query,\n uri: STORAGE_BASE_URL + path\n };\n\n if (body) {\n reqOpts.json = body;\n }\n\n this.makeAuthorizedRequest_(reqOpts, callback);\n};",
"ctx": {
"type": "method",
"constructor": "Storage",
"cons": "Storage",
"name": "makeReq_",
"string": "Storage.prototype.makeReq_()"
}
},
{
"tags": [],
"description": {
"full": "<p>Developer Documentation</p><p>This method can be used with either a callback or as a readable object<br />stream. <code>streamRouter</code> is used to add this dual behavior.</p>",
"summary": "<p>Developer Documentation</p>",
"body": "<p>This method can be used with either a callback or as a readable object<br />stream. <code>streamRouter</code> is used to add this dual behavior.</p>"
},
"isPrivate": false,
"isConstructor": false,
"isClass": false,
"isEvent": false,
"ignore": true,
"line": 394,
"codeStart": 399,
"code": "streamRouter.extend(Storage, 'getBuckets');\n\nmodule.exports = Storage;",
"ctx": false
}
]