Skip to content

Instantly share code, notes, and snippets.

@callmehiphop
Created February 11, 2016 19:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save callmehiphop/d6136d6fa9280451195b to your computer and use it in GitHub Desktop.
Save callmehiphop/d6136d6fa9280451195b to your computer and use it in GitHub Desktop.
{
"id": "bucket",
"metadata": {
"name": "Bucket",
"description": null
},
"methods": [{
"metadata": {
"constructor": true,
"name": "Bucket",
"source": "/lib/storage/bucket.js#L95",
"description": "<p>Create a Bucket object to interact with a Google Cloud Storage bucket.</p>",
"examples": [{
"code": "var gcloud = require('gcloud');\n\nvar gcs = gcloud.storage({\n keyFilename: '/path/to/keyfile.json',\n projectId: 'grape-spaceship-123'\n});\n\nvar bucket = gcs.bucket('albums');"
}],
"resources": []
},
"params": [{
"name": "options",
"description": "<ul> <li>Configuration options.</li> </ul> ",
"types": ["object"],
"optional": false,
"nullable": false
}, {
"name": "options.bucketName",
"description": "<ul> <li>Name of the bucket.</li> </ul> ",
"types": ["string"],
"optional": false,
"nullable": false
}, {
"name": "options.keyFilename",
"description": "<ul> <li>Full path to the JSON key downloaded from the Google Developers Console. Alternatively, you may provide a <code>credentials</code> object.</li> </ul> ",
"types": ["string"],
"optional": true,
"nullable": false
}, {
"name": "options.credentials",
"description": "<ul> <li>Credentials object, used in place of a <code>keyFilename</code>.</li> </ul> ",
"types": ["object"],
"optional": true,
"nullable": false
}],
"exceptions": [],
"returns": []
}, {
"metadata": {
"constructor": false,
"name": "create",
"source": "/lib/storage/bucket.js#L109",
"description": "<p>Create a bucket.</p>",
"examples": [{
"code": "bucket.create(function(err, zone, apiResponse) {\n if (!err) {\n // The zone was created successfully.\n }\n});"
}],
"resources": []
},
"params": [{
"name": "config",
"description": "<ul> <li>See <a data-custom-type=\"storage#createBucket\"></a>.</li> </ul> ",
"types": ["object"],
"optional": true,
"nullable": false
}],
"exceptions": [],
"returns": []
}, {
"metadata": {
"constructor": false,
"name": "delete",
"source": "/lib/storage/bucket.js#L124",
"description": "<p>Delete the bucket.</p>",
"examples": [{
"code": "bucket.delete(function(err, apiResponse) {});"
}],
"resources": [{
"title": "Buckets: delete API Documentation",
"link": "https://cloud.google.com/storage/docs/json_api/v1/buckets/delete"
}]
},
"params": [{
"name": "callback",
"description": "<ul> <li>The callback function.</li> </ul> ",
"types": ["function"],
"optional": true,
"nullable": false
}, {
"name": "callback.err",
"description": "<ul> <li>An error returned while making this request.</li> </ul> ",
"types": ["error"],
"optional": false,
"nullable": true
}, {
"name": "callback.apiResponse",
"description": "<ul> <li>The full API response.</li> </ul> ",
"types": ["object"],
"optional": false,
"nullable": false
}],
"exceptions": [],
"returns": []
}, {
"metadata": {
"constructor": false,
"name": "exists",
"source": "/lib/storage/bucket.js#L137",
"description": "<p>Check if the bucket exists.</p>",
"examples": [{
"code": "bucket.exists(function(err, exists) {});"
}],
"resources": []
},
"params": [{
"name": "callback",
"description": "<ul> <li>The callback function.</li> </ul> ",
"types": ["function"],
"optional": false,
"nullable": false
}, {
"name": "callback.err",
"description": "<ul> <li>An error returned while making this request.</li> </ul> ",
"types": ["error"],
"optional": false,
"nullable": true
}, {
"name": "callback.exists",
"description": "<ul> <li>Whether the bucket exists or not.</li> </ul> ",
"types": ["boolean"],
"optional": false,
"nullable": false
}],
"exceptions": [],
"returns": []
}, {
"metadata": {
"constructor": false,
"name": "get",
"source": "/lib/storage/bucket.js#L156",
"description": "<p>Get a bucket if it exists.</p><p>You may optionally use this to &quot;get or create&quot; an object by providing an object with <code>autoCreate</code> set to <code>true</code>. Any extra configuration that is normally required for the <code>create</code> method must be contained within this object as well.</p>",
"examples": [{
"code": "bucket.get(function(err, bucket, apiResponse) {\n // `bucket.metadata` has been populated.\n});"
}],
"resources": []
},
"params": [{
"name": "options",
"description": "<ul> <li>Configuration object.</li> </ul> ",
"types": ["options"],
"optional": true,
"nullable": false
}, {
"name": "options.autoCreate",
"description": "<ul> <li>Automatically create the object if it does not exist. Default: <code>false</code></li> </ul> ",
"types": ["boolean"],
"optional": false,
"nullable": false
}],
"exceptions": [],
"returns": []
}, {
"metadata": {
"constructor": false,
"name": "getMetadata",
"source": "/lib/storage/bucket.js#L174",
"description": "<p>Get the bucket&#39;s metadata.</p><p>To set metadata, see <a data-custom-type=\"storage/bucket#setMetadata\"></a>.</p>",
"examples": [{
"code": "bucket.getMetadata(function(err, metadata, apiResponse) {});"
}],
"resources": [{
"title": "Buckets: get API Documentation",
"link": "https://cloud.google.com/storage/docs/json_api/v1/buckets/get"
}]
},
"params": [{
"name": "callback",
"description": "<ul> <li>The callback function.</li> </ul> ",
"types": ["function"],
"optional": true,
"nullable": false
}, {
"name": "callback.err",
"description": "<ul> <li>An error returned while making this request.</li> </ul> ",
"types": ["error"],
"optional": false,
"nullable": true
}, {
"name": "callback.metadata",
"description": "<ul> <li>Tbe bucket&#39;s metadata.</li> </ul> ",
"types": ["object"],
"optional": false,
"nullable": false
}, {
"name": "callback.apiResponse",
"description": "<ul> <li>The full API response.</li> </ul> ",
"types": ["object"],
"optional": false,
"nullable": false
}],
"exceptions": [],
"returns": []
}, {
"metadata": {
"constructor": false,
"name": "setMetadata",
"source": "/lib/storage/bucket.js#L207",
"description": "<p>Set the bucket&#39;s metadata.</p>",
"examples": [{
"caption": "<p>Set website metadata field on the bucket.</p>",
"code": "bucket.setMetadata({\n website: {\n mainPageSuffix: 'http://example.com',\n notFoundPage: 'http://example.com/404.html'\n }\n}, function(err, apiResponse) {});"
}, {
"caption": "<p>Enable versioning for your bucket.</p>",
"code": "bucket.setMetadata({\n versioning: {\n enabled: true\n }\n}, function(err, apiResponse) {});"
}],
"resources": [{
"title": "Buckets: patch API Documentation",
"link": "https://cloud.google.com/storage/docs/json_api/v1/buckets/patch"
}]
},
"params": [{
"name": "metadata",
"description": "<ul> <li>The metadata you wish to set.</li> </ul> ",
"types": ["object"],
"optional": false,
"nullable": false
}, {
"name": "callback",
"description": "<ul> <li>The callback function.</li> </ul> ",
"types": ["function"],
"optional": true,
"nullable": false
}, {
"name": "callback.err",
"description": "<ul> <li>An error returned while making this request.</li> </ul> ",
"types": ["error"],
"optional": false,
"nullable": true
}, {
"name": "callback.apiResponse",
"description": "<ul> <li>The full API response.</li> </ul> ",
"types": ["object"],
"optional": false,
"nullable": false
}],
"exceptions": [],
"returns": []
}, {
"metadata": {
"constructor": false,
"name": "acl",
"source": "/lib/storage/bucket.js#L257",
"description": "<p>Google Cloud Storage uses access control lists (ACLs) to manage object and bucket access. ACLs are the mechanism you use to share objects with other users and allow other users to access your buckets and objects.</p><p>An ACL consists of one or more entries, where each entry grants permissions to an entity. Permissions define the actions that can be performed against an object or bucket (for example, <code>READ</code> or <code>WRITE</code>); the entity defines who the permission applies to (for example, a specific user or group of users).</p><p>The <code>acl</code> object on a Bucket instance provides methods to get you a list of the ACLs defined on your bucket, as well as set, update, and delete them.</p><p>Buckets also have <a href=\"https://cloud.google.com/storage/docs/accesscontrol#default\">default ACLs</a> for all created files. Default ACLs specify permissions that all new objects added to the bucket will inherit by default. You can add, delete, get, and update entities and permissions for these as well with <a data-custom-type=\"storage/bucket#acl.default\"></a>.</p>",
"examples": [{
"caption": "<p>Make a bucket's contents publicly readable.</p>",
"code": "var myBucket = gcs.bucket('my-bucket');\nmyBucket.acl.add({\n entity: 'allUsers',\n role: gcs.acl.READER_ROLE\n}, function(err, aclObject) {});"
}],
"resources": [{
"title": "About Access Control Lists",
"link": "http://goo.gl/6qBBPO"
}, {
"title": "Default ACLs",
"link": "https://cloud.google.com/storage/docs/accesscontrol#default"
}]
},
"params": [],
"exceptions": [],
"returns": []
}, {
"metadata": {
"constructor": false,
"name": "acl.default",
"source": "/lib/storage/bucket.js#L271",
"description": "<p>Google Cloud Storage Buckets have <a href=\"http://goo.gl/YpGdyv\">default ACLs</a> for all created files. You can add, delete, get, and update entities and permissions for these as well. The method signatures and examples are all the same, after only prefixing the method call with <code>default</code>.</p>",
"examples": [],
"resources": []
},
"params": [],
"exceptions": [],
"returns": []
}, {
"metadata": {
"constructor": false,
"name": "combine",
"source": "/lib/storage/bucket.js#L313",
"description": "<p>Combine mutliple files into one new file.</p>",
"examples": [{
"code": "var logBucket = gcs.bucket('log-bucket');\n\nvar logs2013 = logBucket.file('2013-logs.txt');\nvar logs2014 = logBucket.file('2014-logs.txt');\n\nvar allLogs = logBucket.file('all-logs.txt');\n\nlogBucket.combine([\n logs2013,\n logs2014\n], allLogs, function(err, newFile, apiResponse) {\n // newFile === allLogs\n});"
}],
"resources": [{
"title": "Objects: compose API Documentation",
"link": "https://cloud.google.com/storage/docs/json_api/v1/objects/compose"
}]
},
"params": [{
"name": "sources",
"description": "<ul> <li>The source files that will be combined.</li> </ul> ",
"types": ["string[]", "<a data-custom-type=\"storage/file\"></a>"],
"optional": false,
"nullable": false
}, {
"name": "destination",
"description": "<ul> <li>The file you would like the source files combined into.</li> </ul> ",
"types": ["string", "<a data-custom-type=\"storage/file\"></a>"],
"optional": false,
"nullable": false
}, {
"name": "callback",
"description": "<ul> <li>The callback function.</li> </ul> ",
"types": ["function"],
"optional": true,
"nullable": false
}, {
"name": "callback.err",
"description": "<ul> <li>An error returned while making this request</li> </ul> ",
"types": ["error"],
"optional": false,
"nullable": true
}, {
"name": "callback.newFile",
"description": "<ul> <li>The combined file.</li> </ul> ",
"types": ["<a data-custom-type=\"storage/file\"></a>"],
"optional": false,
"nullable": false
}, {
"name": "callback.apiResponse",
"description": "<ul> <li>The full API response.</li> </ul> ",
"types": ["object"],
"optional": false,
"nullable": false
}],
"exceptions": [{
"type": "Error",
"description": "<p>if a non-array is provided as sources argument.</p>"
}, {
"type": "Error",
"description": "<p>if less than two sources are provided.</p>"
}, {
"type": "Error",
"description": "<p>if no destination is provided.</p>"
}, {
"type": "Error",
"description": "<p>if content type can&#39;t be determined for the destination file.</p>"
}],
"returns": []
}, {
"metadata": {
"constructor": false,
"name": "createChannel",
"source": "/lib/storage/bucket.js#L409",
"description": "<p>Create a channel that will be notified when objects in this bucket changes.</p>",
"examples": [{
"code": "var id = 'new-channel-id';\n\nvar config = {\n address: 'https://...'\n};\n\nbucket.createChannel(id, config, function(err, channel, apiResponse) {\n if (!err) {\n // Channel created successfully.\n }\n});"
}],
"resources": [{
"title": "Objects: watchAll API Documentation",
"link": "https://cloud.google.com/storage/docs/json_api/v1/objects/watchAll"
}]
},
"params": [{
"name": "id",
"description": "<ul> <li>The ID of the channel to create.</li> </ul> ",
"types": ["string"],
"optional": false,
"nullable": false
}, {
"name": "config",
"description": "<ul> <li>See a <a href=\"https://cloud.google.com/storage/docs/json_api/v1/objects/watchAll\">Objects: watchAll request body</a>.</li> </ul> ",
"types": ["object"],
"optional": false,
"nullable": false
}, {
"name": "config.address",
"description": "<ul> <li>The address where notifications are delivered for this channel.</li> </ul> ",
"types": ["string"],
"optional": false,
"nullable": false
}, {
"name": "callback",
"description": "<ul> <li>The callback function.</li> </ul> ",
"types": ["function"],
"optional": false,
"nullable": false
}, {
"name": "callback.err",
"description": "<ul> <li>An error returned while making this request</li> </ul> ",
"types": ["error"],
"optional": false,
"nullable": true
}, {
"name": "callback.channel",
"description": "<ul> <li>The created Channel object.</li> </ul> ",
"types": ["<a data-custom-type=\"storage/channel\"></a>"],
"optional": false,
"nullable": false
}, {
"name": "callback.apiResponse",
"description": "<ul> <li>The full API response.</li> </ul> ",
"types": ["object"],
"optional": false,
"nullable": false
}],
"exceptions": [{
"type": "Error",
"description": "<p>If an ID is not provided.</p>"
}, {
"type": "Error",
"description": "<p>If an address is not provided.</p>"
}],
"returns": []
}, {
"metadata": {
"constructor": false,
"name": "deleteFiles",
"source": "/lib/storage/bucket.js#L497",
"description": "<p>Iterate over the bucket&#39;s files, calling <code>file.delete()</code> on each.</p><p><strong>This is not an atomic request.</strong> A delete attempt will be made for each file individually. Any one can fail, in which case only a portion of the files you intended to be deleted would have.</p><p>Operations are performed in parallel, up to 10 at once. The first error breaks the loop and will execute the provided callback with it. Specify <code>{ force: true }</code> to suppress the errors until all files have had a chance to be processed.</p><p>The <code>query</code> object passed as the first argument will also be passed to <a data-custom-type=\"storage/bucket#getFiles\"></a>.</p>",
"examples": [{
"caption": "<p>Delete all of the files in the bucket.</p>",
"code": "bucket.deleteFiles(function(err) {});"
}, {
"caption": "<p>By default, if a file cannot be deleted, this method will stop deleting \nfiles from your bucket. You can override this setting with <code>force: true</code>.</p>",
"code": "bucket.deleteFiles({\n force: true\n}, function(errors) {\n // `errors`:\n // Array of errors if any occurred, otherwise null.\n});"
}, {
"caption": "<p>The first argument to this method acts as a query to \n<a data-custom-type=\"storage/bucket#getFiles\"></a>. As an example, you can delete files \nwhich match a prefix.</p>",
"code": "bucket.deleteFiles({\n prefix: 'images/'\n}, function(err) {\n if (!err) {\n // All files in the `images` directory have been deleted.\n }\n});"
}],
"resources": [{
"title": "Objects: delete API Documentation",
"link": "https://cloud.google.com/storage/docs/json_api/v1/objects/delete"
}]
},
"params": [{
"name": "query",
"description": "<ul> <li>Query object. See <a data-custom-type=\"storage/bucket#getFiles\"></a> for all of the supported properties.</li> </ul> ",
"types": ["object"],
"optional": true,
"nullable": false
}, {
"name": "query.force",
"description": "<ul> <li>Supress errors until all files have been processed.</li> </ul> ",
"types": ["boolean"],
"optional": false,
"nullable": false
}, {
"name": "callback",
"description": "<ul> <li>The callback function.</li> </ul> ",
"types": ["function"],
"optional": false,
"nullable": false
}, {
"name": "callback.err",
"description": "<ul> <li>An API error or array of errors from files that were not able to be deleted.</li> </ul> ",
"types": ["error", "error[]"],
"optional": false,
"nullable": true
}],
"exceptions": [],
"returns": []
}, {
"metadata": {
"constructor": false,
"name": "file",
"source": "/lib/storage/bucket.js#L557",
"description": "<p>Create a File object. See <a data-custom-type=\"storage/file\"></a> to see how to handle the different use cases you may have.</p>",
"examples": [{
"code": "var file = bucket.file('my-existing-file.png');"
}],
"resources": []
},
"params": [{
"name": "name",
"description": "<ul> <li>The name of the file in this bucket.</li> </ul> ",
"types": ["string"],
"optional": false,
"nullable": false
}, {
"name": "options",
"description": "<ul> <li>Configuration options.</li> </ul> ",
"types": ["object"],
"optional": true,
"nullable": false
}, {
"name": "options.generation",
"description": "<ul> <li>Only use a specific revision of this file.</li> </ul> ",
"types": ["string", "number"],
"optional": false,
"nullable": false
}],
"exceptions": [],
"returns": []
}, {
"metadata": {
"constructor": false,
"name": "getFiles",
"source": "/lib/storage/bucket.js#L654",
"description": "<p>Get File objects for the files currently in the bucket.</p>",
"examples": [{
"code": "bucket.getFiles(function(err, files) {\n if (!err) {\n // files is an array of File objects.\n }\n});"
}, {
"caption": "<p>If your bucket has versioning enabled, you can get all of your files \nscoped to their generation.</p>",
"code": "bucket.getFiles({\n versions: true\n}, function(err, files) {\n // Each file is scoped to its generation.\n});"
}, {
"caption": "<p>To control how many API requests are made and page through the results \nmanually, set <code>autoPaginate</code> to <code>false</code>.</p>",
"code": "var callback = function(err, files, nextQuery, apiResponse) {\n if (nextQuery) {\n // More results exist.\n bucket.getFiles(nextQuery, callback);\n }\n\n // The `metadata` property is populated for you with the metadata at the\n // time of fetching.\n files[0].metadata;\n\n // However, in cases where you are concerned the metadata could have\n // changed, use the `getMetadata` method.\n files[0].getMetadata(function(err, metadata) {});\n};\n\nbucket.getFiles({\n autoPaginate: false\n}, callback);"
}, {
"caption": "<p>Get the files from your bucket as a readable object stream.</p>",
"code": "bucket.getFiles()\n .on('error', console.error)\n .on('data', function(file) {\n // file is a File object.\n })\n .on('end', function() {\n // All files retrieved.\n });"
}, {
"caption": "<p>If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.</p>",
"code": "bucket.getFiles()\n .on('data', function(file) {\n this.end();\n });"
}],
"resources": [{
"title": "Objects: list API Documentation",
"link": "https://cloud.google.com/storage/docs/json_api/v1/objects/list"
}]
},
"params": [{
"name": "query",
"description": "<ul> <li>Query object.</li> </ul> ",
"types": ["object"],
"optional": true,
"nullable": false
}, {
"name": "query.autoPaginate",
"description": "<ul> <li>Have pagination handled automatically. Default: true.</li> </ul> ",
"types": ["boolean"],
"optional": false,
"nullable": false
}, {
"name": "query.delimiter",
"description": "<ul> <li>Results will contain only objects whose names, aside from the prefix, do not contain delimiter. Objects whose names, aside from the prefix, contain delimiter will have their name truncated after the delimiter, returned in <code>apiResponse.prefixes</code>. Duplicate prefixes are omitted.</li> </ul> ",
"types": ["string"],
"optional": false,
"nullable": false
}, {
"name": "query.prefix",
"description": "<ul> <li>Filter results to objects whose names begin with this prefix.</li> </ul> ",
"types": ["string"],
"optional": false,
"nullable": false
}, {
"name": "query.maxResults",
"description": "<ul> <li>Maximum number of items plus prefixes to return.</li> </ul> ",
"types": ["number"],
"optional": false,
"nullable": false
}, {
"name": "query.pageToken",
"description": "<ul> <li>A previously-returned page token representing part of the larger set of results to view.</li> </ul> ",
"types": ["string"],
"optional": false,
"nullable": false
}, {
"name": "query.versions",
"description": "<ul> <li>If true, returns File objects scoped to their versions.</li> </ul> ",
"types": ["bool"],
"optional": false,
"nullable": false
}, {
"name": "callback",
"description": "<ul> <li>The callback function.</li> </ul> ",
"types": ["function"],
"optional": true,
"nullable": false
}, {
"name": "callback.err",
"description": "<ul> <li>An error returned while making this request</li> </ul> ",
"types": ["error"],
"optional": false,
"nullable": true
}, {
"name": "callback.files",
"description": "<ul> <li>List of files.</li> </ul> ",
"types": ["<a data-custom-type=\"storage/file[]\"></a>"],
"optional": false,
"nullable": false
}, {
"name": "callback.nextQuery",
"description": "<ul> <li>If present, query with this object to check for more results.</li> </ul> ",
"types": ["object"],
"optional": false,
"nullable": true
}, {
"name": "callback.apiResponse",
"description": "<ul> <li>The full API response.</li> </ul> ",
"types": ["object"],
"optional": false,
"nullable": false
}],
"exceptions": [],
"returns": []
}, {
"metadata": {
"constructor": false,
"name": "makePrivate",
"source": "/lib/storage/bucket.js#L760",
"description": "<p>Make the bucket listing private.</p><p>You may also choose to make the contents of the bucket private by specifying <code>includeFiles: true</code>. This will automatically run <a data-custom-type=\"storage/file#makePrivate\"></a> for every file in the bucket.</p><p>When specifying <code>includeFiles: true</code>, use <code>force: true</code> to delay execution of your callback until all files have been processed. By default, the callback is executed after the first error. Use <code>force</code> to queue such errors until all files have been procssed, after which they will be returned as an array as the first argument to your callback.</p><p>NOTE: This may cause the process to be long-running and use a high number of requests. Use with caution.</p>",
"examples": [{
"caption": "<p>Make the bucket private.</p>",
"code": "bucket.makePrivate(function(err) {});"
}, {
"caption": "<p>Make the bucket and its contents private.</p>",
"code": "var opts = {\n includeFiles: true\n};\n\nbucket.makePrivate(opts, function(err, files) {\n // `err`:\n // The first error to occur, otherwise null.\n //\n // `files`:\n // Array of files successfully made private in the bucket.\n});"
}, {
"caption": "<p>Make the bucket and its contents private, using force to suppress errors \nuntil all files have been processed.</p>",
"code": "var opts = {\n includeFiles: true,\n force: true\n};\n\nbucket.makePrivate(opts, function(errors, files) {\n // `errors`:\n // Array of errors if any occurred, otherwise null.\n //\n // `files`:\n // Array of files successfully made private in the bucket.\n});"
}],
"resources": [{
"title": "Buckets: patch API Documentation",
"link": "https://cloud.google.com/storage/docs/json_api/v1/buckets/patch"
}]
},
"params": [{
"name": "options",
"description": "<ul> <li>The configuration object.</li> </ul> ",
"types": ["object"],
"optional": true,
"nullable": false
}, {
"name": "options.includeFiles",
"description": "<ul> <li>Make each file in the bucket private. Default: <code>false</code>.</li> </ul> ",
"types": ["boolean"],
"optional": false,
"nullable": false
}, {
"name": "options.force",
"description": "<ul> <li>Queue errors occurred while making files private until all files have been processed.</li> </ul> ",
"types": ["boolean"],
"optional": false,
"nullable": false
}, {
"name": "callback",
"description": "<ul> <li>The callback function.</li> </ul> ",
"types": ["function"],
"optional": false,
"nullable": false
}, {
"name": "callback.err",
"description": "<ul> <li>An error returned while making this request</li> </ul> ",
"types": ["error"],
"optional": false,
"nullable": true
}, {
"name": "callback.files",
"description": "<ul> <li>List of files made private.</li> </ul> ",
"types": ["<a data-custom-type=\"storage/file[]\"></a>"],
"optional": false,
"nullable": false
}],
"exceptions": [],
"returns": []
}, {
"metadata": {
"constructor": false,
"name": "makePublic",
"source": "/lib/storage/bucket.js#L876",
"description": "<p>Make the bucket publicly readable.</p><p>You may also choose to make the contents of the bucket publicly readable by specifying <code>includeFiles: true</code>. This will automatically run <a data-custom-type=\"storage/file#makePublic\"></a> for every file in the bucket.</p><p>When specifying <code>includeFiles: true</code>, use <code>force: true</code> to delay execution of your callback until all files have been processed. By default, the callback is executed after the first error. Use <code>force</code> to queue such errors until all files have been procssed, after which they will be returned as an array as the first argument to your callback.</p><p>NOTE: This may cause the process to be long-running and use a high number of requests. Use with caution.</p>",
"examples": [{
"caption": "<p>Make the bucket publicly readable.</p>",
"code": "bucket.makePublic(function(err) {});"
}, {
"caption": "<p>Make the bucket and its contents publicly readable.</p>",
"code": "var opts = {\n includeFiles: true\n};\n\nbucket.makePublic(opts, function(err, files) {\n // `err`:\n // The first error to occur, otherwise null.\n //\n // `files`:\n // Array of files successfully made public in the bucket.\n});"
}, {
"caption": "<p>Make the bucket and its contents publicly readable, using force to \nsuppress errors until all files have been processed.</p>",
"code": "var opts = {\n includeFiles: true,\n force: true\n};\n\nbucket.makePublic(opts, function(errors, files) {\n // `errors`:\n // Array of errors if any occurred, otherwise null.\n //\n // `files`:\n // Array of files successfully made public in the bucket.\n});"
}],
"resources": [{
"title": "Buckets: patch API Documentation",
"link": "https://cloud.google.com/storage/docs/json_api/v1/buckets/patch"
}]
},
"params": [{
"name": "options",
"description": "<ul> <li>The configuration object.</li> </ul> ",
"types": ["object"],
"optional": true,
"nullable": false
}, {
"name": "options.includeFiles",
"description": "<ul> <li>Make each file in the bucket publicly readable. Default: <code>false</code>.</li> </ul> ",
"types": ["boolean"],
"optional": false,
"nullable": false
}, {
"name": "options.force",
"description": "<ul> <li>Queue errors occurred while making files public until all files have been processed.</li> </ul> ",
"types": ["boolean"],
"optional": false,
"nullable": false
}, {
"name": "callback",
"description": "<ul> <li>The callback function.</li> </ul> ",
"types": ["function"],
"optional": false,
"nullable": false
}, {
"name": "callback.err",
"description": "<ul> <li>An error returned while making this request</li> </ul> ",
"types": ["error"],
"optional": false,
"nullable": true
}, {
"name": "callback.files",
"description": "<ul> <li>List of files made public.</li> </ul> ",
"types": ["<a data-custom-type=\"storage/file[]\"></a>"],
"optional": false,
"nullable": false
}],
"exceptions": [],
"returns": []
}, {
"metadata": {
"constructor": false,
"name": "upload",
"source": "/lib/storage/bucket.js#L1015",
"description": "<p>Upload a file to the bucket. This is a convenience method that wraps <a data-custom-type=\"storage/file#createWriteStream\"></a>.</p><p>You can specify whether or not an upload is resumable by setting <code>options.resumable</code>. <em>Resumable uploads are enabled by default if your input file is larger than 5 MB.</em></p>",
"examples": [{
"caption": "<p>The easiest way to upload a file.</p>",
"code": "bucket.upload('/local/path/image.png', function(err, file, apiResponse) {\n // Your bucket now contains:\n // - \"image.png\" (with the contents of `/local/path/image.png')\n\n // `file` is an instance of a File object that refers to your new file.\n});"
}, {
"caption": "<p>It's not always that easy. You will likely want to specify the filename \nused when your new file lands in your bucket. \nYou may also want to set metadata or customize other options.</p>",
"code": "var options = {\n destination: 'new-image.png',\n resumable: true,\n validation: 'crc32c',\n metadata: {\n event: 'Fall trip to the zoo'\n }\n};\n\nbucket.upload('local-image.png', options, function(err, file) {\n // Your bucket now contains:\n // - \"new-image.png\" (with the contents of `local-image.png')\n\n // `file` is an instance of a File object that refers to your new file.\n});"
}, {
"caption": "<p>You can also have a file gzip'd on the fly.</p>",
"code": "bucket.upload('index.html', { gzip: true }, function(err, file) {\n // Your bucket now contains:\n // - \"index.html\" (automatically compressed with gzip)\n\n // Downloading the file with `file.download` will automatically decode the\n // file.\n});"
}, {
"caption": "<p>You may also re-use a File object, <a data-custom-type=\"storage/file\"></a>, that references \nthe file you wish to create or overwrite.</p>",
"code": "var options = {\n destination: bucket.file('existing-file.png'),\n resumable: false\n};\n\nbucket.upload('local-img.png', options, function(err, newFile) {\n // Your bucket now contains:\n // - \"existing-file.png\" (with the contents of `local-img.png')\n\n // Note:\n // The `newFile` parameter is equal to `file`.\n});"
}],
"resources": [{
"title": "Upload Options (Simple or Resumable)",
"link": "https://cloud.google.com/storage/docs/json_api/v1/how-tos/upload#uploads"
}, {
"title": "Objects: insert API Documentation",
"link": "https://cloud.google.com/storage/docs/json_api/v1/objects/insert"
}]
},
"params": [{
"name": "localPath",
"description": "<ul> <li>The fully qualified path to the file you wish to upload to your bucket.</li> </ul> ",
"types": ["string"],
"optional": false,
"nullable": false
}, {
"name": "options",
"description": "<ul> <li>Configuration options.</li> </ul> ",
"types": ["object"],
"optional": true,
"nullable": false
}, {
"name": "options.destination",
"description": "<ul> <li>The place to save your file. If given a string, the file will be uploaded to the bucket using the string as a filename. When given a File object, your local file will be uploaded to the File object&#39;s bucket and under the File object&#39;s name. Lastly, when this argument is omitted, the file is uploaded to your bucket using the name of the local file.</li> </ul> ",
"types": ["string", "<a data-custom-type=\"storage/file\"></a>"],
"optional": false,
"nullable": false
}, {
"name": "options.gzip",
"description": "<ul> <li>Automatically gzip the file. This will set <code>options.metadata.contentEncoding</code> to <code>gzip</code>.</li> </ul> ",
"types": ["boolean"],
"optional": false,
"nullable": false
}, {
"name": "options.metadata",
"description": "<ul> <li>See an <a href=\"https://cloud.google.com/storage/docs/json_api/v1/objects/insert#request_properties_JSON\">Objects: insert request body</a>.</li> </ul> ",
"types": ["object"],
"optional": true,
"nullable": false
}, {
"name": "options.resumable",
"description": "<ul> <li>Force a resumable upload. (default: true for files larger than 5 MB).</li> </ul> ",
"types": ["boolean"],
"optional": true,
"nullable": false
}, {
"name": "callback",
"description": "<ul> <li>The callback function.</li> </ul> ",
"types": ["function"],
"optional": false,
"nullable": false
}, {
"name": "callback.err",
"description": "<ul> <li>An error returned while making this request</li> </ul> ",
"types": ["error"],
"optional": false,
"nullable": true
}, {
"name": "callback.file",
"description": "<ul> <li>The uploaded File.</li> </ul> ",
"types": ["<a data-custom-type=\"storage/file\"></a>"],
"optional": false,
"nullable": false
}, {
"name": "callback.apiResponse",
"description": "<ul> <li>The full API response.</li> </ul> ",
"types": ["object"],
"optional": false,
"nullable": false
}, {
"name": "options.validation",
"description": "<ul> <li>Possible values: <code>&quot;md5&quot;</code>, <code>&quot;crc32c&quot;</code>, or <code>false</code>. By default, data integrity is validated with an MD5 checksum for maximum reliability. CRC32c will provide better performance with less reliability. You may also choose to skip validation completely, however this is <strong>not recommended</strong>.</li> </ul> ",
"types": ["string", "boolean"],
"optional": false,
"nullable": false
}],
"exceptions": [],
"returns": []
}, {
"metadata": {
"constructor": false,
"name": "acl.owners",
"source": "lib/storage/acl.js#L115",
"description": "<p>An object of convenience methods to add or delete owner ACL permissions for a given entity.</p><p>The supported methods include:</p><ul> <li><code>myFile.acl.owners.addAllAuthenticatedUsers</code></li> <li><code>myFile.acl.owners.deleteAllAuthenticatedUsers</code></li> <li><code>myFile.acl.owners.addAllUsers</code></li> <li><code>myFile.acl.owners.deleteAllUsers</code></li> <li><code>myFile.acl.owners.addDomain</code></li> <li><code>myFile.acl.owners.deleteDomain</code></li> <li><code>myFile.acl.owners.addGroup</code></li> <li><code>myFile.acl.owners.deleteGroup</code></li> <li><code>myFile.acl.owners.addProject</code></li> <li><code>myFile.acl.owners.deleteProject</code></li> <li><code>myFile.acl.owners.addUser</code></li> <li><code>myFile.acl.owners.deleteUser</code></li> </ul> ",
"examples": [{
"code": "var gcs = gcloud.storage({\n projectId: 'grape-spaceship-123'\n});"
}, {
"caption": "<p>Add a user as an owner of a file.</p>",
"code": "var myBucket = gcs.bucket('my-bucket');\nvar myFile = myBucket.file('my-file');\nmyFile.acl.owners.addUser('email@example.com', function(err, aclObject) {});"
}, {
"caption": "<p>For reference, the above command is the same as running the following.</p>",
"code": "myFile.acl.add({\n entity: 'user-email@example.com',\n role: gcs.acl.OWNER_ROLE\n}, function(err, aclObject) {});"
}],
"resources": []
},
"params": [],
"exceptions": [],
"returns": []
}, {
"metadata": {
"constructor": false,
"name": "acl.readers",
"source": "lib/storage/acl.js#L152",
"description": "<p>An object of convenience methods to add or delete reader ACL permissions for a given entity.</p><p>The supported methods include:</p><ul> <li><code>myFile.acl.readers.addAllAuthenticatedUsers</code></li> <li><code>myFile.acl.readers.deleteAllAuthenticatedUsers</code></li> <li><code>myFile.acl.readers.addAllUsers</code></li> <li><code>myFile.acl.readers.deleteAllUsers</code></li> <li><code>myFile.acl.readers.addDomain</code></li> <li><code>myFile.acl.readers.deleteDomain</code></li> <li><code>myFile.acl.readers.addGroup</code></li> <li><code>myFile.acl.readers.deleteGroup</code></li> <li><code>myFile.acl.readers.addProject</code></li> <li><code>myFile.acl.readers.deleteProject</code></li> <li><code>myFile.acl.readers.addUser</code></li> <li><code>myFile.acl.readers.deleteUser</code></li> </ul> ",
"examples": [{
"caption": "<p>Add a user as a reader of a file.</p>",
"code": "myFile.acl.readers.addUser('email@example.com', function(err, aclObject) {});"
}, {
"caption": "<p>For reference, the above command is the same as running the following.</p>",
"code": "myFile.acl.add({\n entity: 'user-email@example.com',\n role: gcs.acl.READER_ROLE\n}, function(err, aclObject) {});"
}],
"resources": []
},
"params": [],
"exceptions": [],
"returns": []
}, {
"metadata": {
"constructor": false,
"name": "acl.writers",
"source": "lib/storage/acl.js#L189",
"description": "<p>An object of convenience methods to add or delete writer ACL permissions for a given entity.</p><p>The supported methods include:</p><ul> <li><code>myFile.acl.writers.addAllAuthenticatedUsers</code></li> <li><code>myFile.acl.writers.deleteAllAuthenticatedUsers</code></li> <li><code>myFile.acl.writers.addAllUsers</code></li> <li><code>myFile.acl.writers.deleteAllUsers</code></li> <li><code>myFile.acl.writers.addDomain</code></li> <li><code>myFile.acl.writers.deleteDomain</code></li> <li><code>myFile.acl.writers.addGroup</code></li> <li><code>myFile.acl.writers.deleteGroup</code></li> <li><code>myFile.acl.writers.addProject</code></li> <li><code>myFile.acl.writers.deleteProject</code></li> <li><code>myFile.acl.writers.addUser</code></li> <li><code>myFile.acl.writers.deleteUser</code></li> </ul> ",
"examples": [{
"caption": "<p>Add a user as a writer of a file.</p>",
"code": "myFile.acl.writers.addUser('email@example.com', function(err, aclObject) {});"
}, {
"caption": "<p>For reference, the above command is the same as running the following.</p>",
"code": "myFile.acl.add({\n entity: 'user-email@example.com',\n role: gcs.acl.WRITER_ROLE\n}, function(err, aclObject) {});"
}],
"resources": []
},
"params": [],
"exceptions": [],
"returns": []
}, {
"metadata": {
"constructor": false,
"name": "acl.add",
"source": "lib/storage/acl.js#L227",
"description": "<p>Add access controls on a <a data-custom-type=\"storage/bucket\"></a> or <a data-custom-type=\"storage/file\"></a>.</p>",
"examples": [{
"code": "myBucket.acl.add({\n entity: 'user-useremail@example.com',\n role: gcs.acl.OWNER_ROLE\n}, function(err, aclObject, apiResponse) {});"
}, {
"caption": "<p>For file ACL operations, you can also specify a <code>generation</code> property. \nHere is how you would grant ownership permissions to a user on a specific \nrevision of a file.</p>",
"code": "myFile.acl.add({\n entity: 'user-useremail@example.com',\n role: gcs.acl.OWNER_ROLE,\n generation: 1\n}, function(err, aclObject, apiResponse) {});"
}],
"resources": [{
"title": "BucketAccessControls: insert API Documentation",
"link": "https://cloud.google.com/storage/docs/json_api/v1/bucketAccessControls/insert"
}, {
"title": "ObjectAccessControls: insert API Documentation",
"link": "https://cloud.google.com/storage/docs/json_api/v1/objectAccessControls/insert"
}]
},
"params": [{
"name": "options",
"description": "<ul> <li>Configuration object.</li> </ul> ",
"types": ["object"],
"optional": false,
"nullable": false
}, {
"name": "options.entity",
"description": "<ul> <li>Whose permissions will be added.</li> </ul> ",
"types": ["string"],
"optional": false,
"nullable": false
}, {
"name": "options.role",
"description": "<ul> <li>Permissions allowed for the defined entity. See <a data-custom-type=\"storage#acl\"></a>.</li> </ul> ",
"types": ["string"],
"optional": false,
"nullable": false
}, {
"name": "options.generation",
"description": "<ul> <li><strong>File Objects Only</strong> Select a specific revision of this file (as opposed to the latest version, the default).</li> </ul> ",
"types": ["int"],
"optional": true,
"nullable": false
}, {
"name": "callback",
"description": "<ul> <li>The callback function.</li> </ul> ",
"types": ["function"],
"optional": false,
"nullable": false
}, {
"name": "callback.err",
"description": "<ul> <li>An error returned while making this request</li> </ul> ",
"types": ["error"],
"optional": false,
"nullable": true
}, {
"name": "callback.aclObject",
"description": "<ul> <li>The Acl Object.</li> </ul> ",
"types": ["object"],
"optional": false,
"nullable": false
}, {
"name": "callback.apiResponse",
"description": "<ul> <li>The full API response.</li> </ul> ",
"types": ["object"],
"optional": false,
"nullable": false
}],
"exceptions": [],
"returns": []
}, {
"metadata": {
"constructor": false,
"name": "acl.delete",
"source": "lib/storage/acl.js#L281",
"description": "<p>Delete access controls on a <a data-custom-type=\"storage/bucket\"></a> or <a data-custom-type=\"storage/file\"></a>.</p>",
"examples": [{
"code": "myBucket.acl.delete({\n entity: 'user-useremail@example.com'\n}, function(err, apiResponse) {});"
}, {
"caption": "<p>For file ACL operations, you can also specify a <code>generation</code> property.</p>",
"code": "myFile.acl.delete({\n entity: 'user-useremail@example.com',\n generation: 1\n}, function(err, apiResponse) {});"
}],
"resources": [{
"title": "BucketAccessControls: delete API Documentation",
"link": "https://cloud.google.com/storage/docs/json_api/v1/bucketAccessControls/delete"
}, {
"title": "ObjectAccessControls: delete API Documentation",
"link": "https://cloud.google.com/storage/docs/json_api/v1/objectAccessControls/delete"
}]
},
"params": [{
"name": "options",
"description": "<ul> <li>Configuration object.</li> </ul> ",
"types": ["object"],
"optional": true,
"nullable": false
}, {
"name": "options.entity",
"description": "<ul> <li>Whose permissions will be revoked.</li> </ul> ",
"types": ["string"],
"optional": false,
"nullable": false
}, {
"name": "options.generation",
"description": "<ul> <li><strong>File Objects Only</strong> Select a specific revision of this file (as opposed to the latest version, the default).</li> </ul> ",
"types": ["int"],
"optional": true,
"nullable": false
}, {
"name": "callback",
"description": "<ul> <li>The callback function.</li> </ul> ",
"types": ["function"],
"optional": false,
"nullable": false
}, {
"name": "callback.err",
"description": "<ul> <li>An error returned while making this request</li> </ul> ",
"types": ["error"],
"optional": false,
"nullable": true
}, {
"name": "callback.apiResponse",
"description": "<ul> <li>The full API response.</li> </ul> ",
"types": ["object"],
"optional": false,
"nullable": false
}],
"exceptions": [],
"returns": []
}, {
"metadata": {
"constructor": false,
"name": "acl.get",
"source": "lib/storage/acl.js#L341",
"description": "<p>Get access controls on a <a data-custom-type=\"storage/bucket\"></a> or <a data-custom-type=\"storage/file\"></a>. If an entity is omitted, you will receive an array of all applicable access controls.</p>",
"examples": [{
"code": "myBucket.acl.get({\n entity: 'user-useremail@example.com'\n}, function(err, aclObject, apiResponse) {});"
}, {
"caption": "<p>Get all access controls.</p>",
"code": "myBucket.acl.get(function(err, aclObjects, apiResponse) {\n // aclObjects = [\n // {\n // entity: 'user-useremail@example.com',\n // role: 'owner'\n // }\n // ]\n});"
}, {
"caption": "<p>For file ACL operations, you can also specify a <code>generation</code> property.</p>",
"code": "myFile.acl.get({\n entity: 'user-useremail@example.com',\n generation: 1\n}, function(err, aclObject, apiResponse) {});"
}],
"resources": [{
"title": "BucketAccessControls: get API Documentation",
"link": "https://cloud.google.com/storage/docs/json_api/v1/bucketAccessControls/get"
}, {
"title": "ObjectAccessControls: get API Documentation",
"link": "https://cloud.google.com/storage/docs/json_api/v1/objectAccessControls/get"
}]
},
"params": [{
"name": "options",
"description": "<ul> <li>Configuration object. If you want to receive a list of all access controls, pass the callback function as the only argument.</li> </ul> ",
"types": ["object", "function"],
"optional": false,
"nullable": false
}, {
"name": "options.entity",
"description": "<ul> <li>Whose permissions will be fetched.</li> </ul> ",
"types": ["string"],
"optional": true,
"nullable": false
}, {
"name": "options.generation",
"description": "<ul> <li><strong>File Objects Only</strong> Select a specific revision of this file (as opposed to the latest version, the default).</li> </ul> ",
"types": ["int"],
"optional": true,
"nullable": false
}, {
"name": "callback",
"description": "<ul> <li>The callback function.</li> </ul> ",
"types": ["function"],
"optional": false,
"nullable": false
}, {
"name": "callback.err",
"description": "<ul> <li>An error returned while making this request</li> </ul> ",
"types": ["error"],
"optional": false,
"nullable": true
}, {
"name": "callback.aclObject",
"description": "<ul> <li>Single or Array of Acl Objects.</li> </ul> ",
"types": ["object", "array"],
"optional": false,
"nullable": false
}, {
"name": "callback.apiResponse",
"description": "<ul> <li>The full API response.</li> </ul> ",
"types": ["object"],
"optional": false,
"nullable": false
}],
"exceptions": [],
"returns": []
}, {
"metadata": {
"constructor": false,
"name": "acl.update",
"source": "lib/storage/acl.js#L414",
"description": "<p>Update access controls on a <a data-custom-type=\"storage/bucket\"></a> or <a data-custom-type=\"storage/file\"></a>.</p>",
"examples": [{
"code": "var gcs = gcloud.storage({\n projectId: 'grape-spaceship-123'\n});\n\nmyBucket.acl.update({\n entity: 'user-useremail@example.com',\n role: gcs.acl.WRITER_ROLE\n}, function(err, aclObject, apiResponse) {});"
}, {
"caption": "<p>For file ACL operations, you can also specify a <code>generation</code> property.</p>",
"code": "myFile.acl.update({\n entity: 'user-useremail@example.com',\n role: gcs.acl.WRITER_ROLE,\n generation: 1\n}, function(err, aclObject, apiResponse) {});"
}],
"resources": [{
"title": "BucketAccessControls: update API Documentation",
"link": "https://cloud.google.com/storage/docs/json_api/v1/bucketAccessControls/update"
}, {
"title": "ObjectAccessControls: update API Documentation",
"link": "https://cloud.google.com/storage/docs/json_api/v1/objectAccessControls/update"
}]
},
"params": [{
"name": "options",
"description": "<ul> <li>Configuration object.</li> </ul> ",
"types": ["object"],
"optional": true,
"nullable": false
}, {
"name": "options.entity",
"description": "<ul> <li>Whose permissions will be updated.</li> </ul> ",
"types": ["string"],
"optional": false,
"nullable": false
}, {
"name": "options.role",
"description": "<ul> <li>Permissions allowed for the defined entity. See <a data-custom-type=\"storage#acl\"></a>.</li> </ul> ",
"types": ["string"],
"optional": false,
"nullable": false
}, {
"name": "options.generation",
"description": "<ul> <li><strong>File Objects Only</strong> Select a specific revision of this file (as opposed to the latest version, the default).</li> </ul> ",
"types": ["int"],
"optional": true,
"nullable": false
}, {
"name": "callback",
"description": "<ul> <li>The callback function.</li> </ul> ",
"types": ["function"],
"optional": false,
"nullable": false
}, {
"name": "callback.err",
"description": "<ul> <li>An error returned while making this request</li> </ul> ",
"types": ["error"],
"optional": false,
"nullable": true
}, {
"name": "callback.aclObject",
"description": "<ul> <li>The updated Acl Object.</li> </ul> ",
"types": ["object"],
"optional": false,
"nullable": false
}, {
"name": "callback.apiResponse",
"description": "<ul> <li>The full API response.</li> </ul> ",
"types": ["object"],
"optional": false,
"nullable": false
}],
"exceptions": [],
"returns": []
}, {
"metadata": {
"constructor": false,
"name": "acl.default.owners",
"source": "lib/storage/acl.js#L115",
"description": "<p>An object of convenience methods to add or delete owner ACL permissions for a given entity.</p><p>The supported methods include:</p><ul> <li><code>myFile.acl.owners.addAllAuthenticatedUsers</code></li> <li><code>myFile.acl.owners.deleteAllAuthenticatedUsers</code></li> <li><code>myFile.acl.owners.addAllUsers</code></li> <li><code>myFile.acl.owners.deleteAllUsers</code></li> <li><code>myFile.acl.owners.addDomain</code></li> <li><code>myFile.acl.owners.deleteDomain</code></li> <li><code>myFile.acl.owners.addGroup</code></li> <li><code>myFile.acl.owners.deleteGroup</code></li> <li><code>myFile.acl.owners.addProject</code></li> <li><code>myFile.acl.owners.deleteProject</code></li> <li><code>myFile.acl.owners.addUser</code></li> <li><code>myFile.acl.owners.deleteUser</code></li> </ul> ",
"examples": [{
"code": "var gcs = gcloud.storage({\n projectId: 'grape-spaceship-123'\n});"
}, {
"caption": "<p>Add a user as an owner of a file.</p>",
"code": "var myBucket = gcs.bucket('my-bucket');\nvar myFile = myBucket.file('my-file');\nmyFile.acl.owners.addUser('email@example.com', function(err, aclObject) {});"
}, {
"caption": "<p>For reference, the above command is the same as running the following.</p>",
"code": "myFile.acl.add({\n entity: 'user-email@example.com',\n role: gcs.acl.OWNER_ROLE\n}, function(err, aclObject) {});"
}],
"resources": []
},
"params": [],
"exceptions": [],
"returns": []
}, {
"metadata": {
"constructor": false,
"name": "acl.default.readers",
"source": "lib/storage/acl.js#L152",
"description": "<p>An object of convenience methods to add or delete reader ACL permissions for a given entity.</p><p>The supported methods include:</p><ul> <li><code>myFile.acl.readers.addAllAuthenticatedUsers</code></li> <li><code>myFile.acl.readers.deleteAllAuthenticatedUsers</code></li> <li><code>myFile.acl.readers.addAllUsers</code></li> <li><code>myFile.acl.readers.deleteAllUsers</code></li> <li><code>myFile.acl.readers.addDomain</code></li> <li><code>myFile.acl.readers.deleteDomain</code></li> <li><code>myFile.acl.readers.addGroup</code></li> <li><code>myFile.acl.readers.deleteGroup</code></li> <li><code>myFile.acl.readers.addProject</code></li> <li><code>myFile.acl.readers.deleteProject</code></li> <li><code>myFile.acl.readers.addUser</code></li> <li><code>myFile.acl.readers.deleteUser</code></li> </ul> ",
"examples": [{
"caption": "<p>Add a user as a reader of a file.</p>",
"code": "myFile.acl.readers.addUser('email@example.com', function(err, aclObject) {});"
}, {
"caption": "<p>For reference, the above command is the same as running the following.</p>",
"code": "myFile.acl.add({\n entity: 'user-email@example.com',\n role: gcs.acl.READER_ROLE\n}, function(err, aclObject) {});"
}],
"resources": []
},
"params": [],
"exceptions": [],
"returns": []
}, {
"metadata": {
"constructor": false,
"name": "acl.default.writers",
"source": "lib/storage/acl.js#L189",
"description": "<p>An object of convenience methods to add or delete writer ACL permissions for a given entity.</p><p>The supported methods include:</p><ul> <li><code>myFile.acl.writers.addAllAuthenticatedUsers</code></li> <li><code>myFile.acl.writers.deleteAllAuthenticatedUsers</code></li> <li><code>myFile.acl.writers.addAllUsers</code></li> <li><code>myFile.acl.writers.deleteAllUsers</code></li> <li><code>myFile.acl.writers.addDomain</code></li> <li><code>myFile.acl.writers.deleteDomain</code></li> <li><code>myFile.acl.writers.addGroup</code></li> <li><code>myFile.acl.writers.deleteGroup</code></li> <li><code>myFile.acl.writers.addProject</code></li> <li><code>myFile.acl.writers.deleteProject</code></li> <li><code>myFile.acl.writers.addUser</code></li> <li><code>myFile.acl.writers.deleteUser</code></li> </ul> ",
"examples": [{
"caption": "<p>Add a user as a writer of a file.</p>",
"code": "myFile.acl.writers.addUser('email@example.com', function(err, aclObject) {});"
}, {
"caption": "<p>For reference, the above command is the same as running the following.</p>",
"code": "myFile.acl.add({\n entity: 'user-email@example.com',\n role: gcs.acl.WRITER_ROLE\n}, function(err, aclObject) {});"
}],
"resources": []
},
"params": [],
"exceptions": [],
"returns": []
}, {
"metadata": {
"constructor": false,
"name": "acl.default.add",
"source": "lib/storage/acl.js#L227",
"description": "<p>Add access controls on a <a data-custom-type=\"storage/bucket\"></a> or <a data-custom-type=\"storage/file\"></a>.</p>",
"examples": [{
"code": "myBucket.acl.add({\n entity: 'user-useremail@example.com',\n role: gcs.acl.OWNER_ROLE\n}, function(err, aclObject, apiResponse) {});"
}, {
"caption": "<p>For file ACL operations, you can also specify a <code>generation</code> property. \nHere is how you would grant ownership permissions to a user on a specific \nrevision of a file.</p>",
"code": "myFile.acl.add({\n entity: 'user-useremail@example.com',\n role: gcs.acl.OWNER_ROLE,\n generation: 1\n}, function(err, aclObject, apiResponse) {});"
}],
"resources": [{
"title": "BucketAccessControls: insert API Documentation",
"link": "https://cloud.google.com/storage/docs/json_api/v1/bucketAccessControls/insert"
}, {
"title": "ObjectAccessControls: insert API Documentation",
"link": "https://cloud.google.com/storage/docs/json_api/v1/objectAccessControls/insert"
}]
},
"params": [{
"name": "options",
"description": "<ul> <li>Configuration object.</li> </ul> ",
"types": ["object"],
"optional": false,
"nullable": false
}, {
"name": "options.entity",
"description": "<ul> <li>Whose permissions will be added.</li> </ul> ",
"types": ["string"],
"optional": false,
"nullable": false
}, {
"name": "options.role",
"description": "<ul> <li>Permissions allowed for the defined entity. See <a data-custom-type=\"storage#acl\"></a>.</li> </ul> ",
"types": ["string"],
"optional": false,
"nullable": false
}, {
"name": "options.generation",
"description": "<ul> <li><strong>File Objects Only</strong> Select a specific revision of this file (as opposed to the latest version, the default).</li> </ul> ",
"types": ["int"],
"optional": true,
"nullable": false
}, {
"name": "callback",
"description": "<ul> <li>The callback function.</li> </ul> ",
"types": ["function"],
"optional": false,
"nullable": false
}, {
"name": "callback.err",
"description": "<ul> <li>An error returned while making this request</li> </ul> ",
"types": ["error"],
"optional": false,
"nullable": true
}, {
"name": "callback.aclObject",
"description": "<ul> <li>The Acl Object.</li> </ul> ",
"types": ["object"],
"optional": false,
"nullable": false
}, {
"name": "callback.apiResponse",
"description": "<ul> <li>The full API response.</li> </ul> ",
"types": ["object"],
"optional": false,
"nullable": false
}],
"exceptions": [],
"returns": []
}, {
"metadata": {
"constructor": false,
"name": "acl.default.delete",
"source": "lib/storage/acl.js#L281",
"description": "<p>Delete access controls on a <a data-custom-type=\"storage/bucket\"></a> or <a data-custom-type=\"storage/file\"></a>.</p>",
"examples": [{
"code": "myBucket.acl.delete({\n entity: 'user-useremail@example.com'\n}, function(err, apiResponse) {});"
}, {
"caption": "<p>For file ACL operations, you can also specify a <code>generation</code> property.</p>",
"code": "myFile.acl.delete({\n entity: 'user-useremail@example.com',\n generation: 1\n}, function(err, apiResponse) {});"
}],
"resources": [{
"title": "BucketAccessControls: delete API Documentation",
"link": "https://cloud.google.com/storage/docs/json_api/v1/bucketAccessControls/delete"
}, {
"title": "ObjectAccessControls: delete API Documentation",
"link": "https://cloud.google.com/storage/docs/json_api/v1/objectAccessControls/delete"
}]
},
"params": [{
"name": "options",
"description": "<ul> <li>Configuration object.</li> </ul> ",
"types": ["object"],
"optional": true,
"nullable": false
}, {
"name": "options.entity",
"description": "<ul> <li>Whose permissions will be revoked.</li> </ul> ",
"types": ["string"],
"optional": false,
"nullable": false
}, {
"name": "options.generation",
"description": "<ul> <li><strong>File Objects Only</strong> Select a specific revision of this file (as opposed to the latest version, the default).</li> </ul> ",
"types": ["int"],
"optional": true,
"nullable": false
}, {
"name": "callback",
"description": "<ul> <li>The callback function.</li> </ul> ",
"types": ["function"],
"optional": false,
"nullable": false
}, {
"name": "callback.err",
"description": "<ul> <li>An error returned while making this request</li> </ul> ",
"types": ["error"],
"optional": false,
"nullable": true
}, {
"name": "callback.apiResponse",
"description": "<ul> <li>The full API response.</li> </ul> ",
"types": ["object"],
"optional": false,
"nullable": false
}],
"exceptions": [],
"returns": []
}, {
"metadata": {
"constructor": false,
"name": "acl.default.get",
"source": "lib/storage/acl.js#L341",
"description": "<p>Get access controls on a <a data-custom-type=\"storage/bucket\"></a> or <a data-custom-type=\"storage/file\"></a>. If an entity is omitted, you will receive an array of all applicable access controls.</p>",
"examples": [{
"code": "myBucket.acl.get({\n entity: 'user-useremail@example.com'\n}, function(err, aclObject, apiResponse) {});"
}, {
"caption": "<p>Get all access controls.</p>",
"code": "myBucket.acl.get(function(err, aclObjects, apiResponse) {\n // aclObjects = [\n // {\n // entity: 'user-useremail@example.com',\n // role: 'owner'\n // }\n // ]\n});"
}, {
"caption": "<p>For file ACL operations, you can also specify a <code>generation</code> property.</p>",
"code": "myFile.acl.get({\n entity: 'user-useremail@example.com',\n generation: 1\n}, function(err, aclObject, apiResponse) {});"
}],
"resources": [{
"title": "BucketAccessControls: get API Documentation",
"link": "https://cloud.google.com/storage/docs/json_api/v1/bucketAccessControls/get"
}, {
"title": "ObjectAccessControls: get API Documentation",
"link": "https://cloud.google.com/storage/docs/json_api/v1/objectAccessControls/get"
}]
},
"params": [{
"name": "options",
"description": "<ul> <li>Configuration object. If you want to receive a list of all access controls, pass the callback function as the only argument.</li> </ul> ",
"types": ["object", "function"],
"optional": false,
"nullable": false
}, {
"name": "options.entity",
"description": "<ul> <li>Whose permissions will be fetched.</li> </ul> ",
"types": ["string"],
"optional": true,
"nullable": false
}, {
"name": "options.generation",
"description": "<ul> <li><strong>File Objects Only</strong> Select a specific revision of this file (as opposed to the latest version, the default).</li> </ul> ",
"types": ["int"],
"optional": true,
"nullable": false
}, {
"name": "callback",
"description": "<ul> <li>The callback function.</li> </ul> ",
"types": ["function"],
"optional": false,
"nullable": false
}, {
"name": "callback.err",
"description": "<ul> <li>An error returned while making this request</li> </ul> ",
"types": ["error"],
"optional": false,
"nullable": true
}, {
"name": "callback.aclObject",
"description": "<ul> <li>Single or Array of Acl Objects.</li> </ul> ",
"types": ["object", "array"],
"optional": false,
"nullable": false
}, {
"name": "callback.apiResponse",
"description": "<ul> <li>The full API response.</li> </ul> ",
"types": ["object"],
"optional": false,
"nullable": false
}],
"exceptions": [],
"returns": []
}, {
"metadata": {
"constructor": false,
"name": "acl.default.update",
"source": "lib/storage/acl.js#L414",
"description": "<p>Update access controls on a <a data-custom-type=\"storage/bucket\"></a> or <a data-custom-type=\"storage/file\"></a>.</p>",
"examples": [{
"code": "var gcs = gcloud.storage({\n projectId: 'grape-spaceship-123'\n});\n\nmyBucket.acl.update({\n entity: 'user-useremail@example.com',\n role: gcs.acl.WRITER_ROLE\n}, function(err, aclObject, apiResponse) {});"
}, {
"caption": "<p>For file ACL operations, you can also specify a <code>generation</code> property.</p>",
"code": "myFile.acl.update({\n entity: 'user-useremail@example.com',\n role: gcs.acl.WRITER_ROLE,\n generation: 1\n}, function(err, aclObject, apiResponse) {});"
}],
"resources": [{
"title": "BucketAccessControls: update API Documentation",
"link": "https://cloud.google.com/storage/docs/json_api/v1/bucketAccessControls/update"
}, {
"title": "ObjectAccessControls: update API Documentation",
"link": "https://cloud.google.com/storage/docs/json_api/v1/objectAccessControls/update"
}]
},
"params": [{
"name": "options",
"description": "<ul> <li>Configuration object.</li> </ul> ",
"types": ["object"],
"optional": true,
"nullable": false
}, {
"name": "options.entity",
"description": "<ul> <li>Whose permissions will be updated.</li> </ul> ",
"types": ["string"],
"optional": false,
"nullable": false
}, {
"name": "options.role",
"description": "<ul> <li>Permissions allowed for the defined entity. See <a data-custom-type=\"storage#acl\"></a>.</li> </ul> ",
"types": ["string"],
"optional": false,
"nullable": false
}, {
"name": "options.generation",
"description": "<ul> <li><strong>File Objects Only</strong> Select a specific revision of this file (as opposed to the latest version, the default).</li> </ul> ",
"types": ["int"],
"optional": true,
"nullable": false
}, {
"name": "callback",
"description": "<ul> <li>The callback function.</li> </ul> ",
"types": ["function"],
"optional": false,
"nullable": false
}, {
"name": "callback.err",
"description": "<ul> <li>An error returned while making this request</li> </ul> ",
"types": ["error"],
"optional": false,
"nullable": true
}, {
"name": "callback.aclObject",
"description": "<ul> <li>The updated Acl Object.</li> </ul> ",
"types": ["object"],
"optional": false,
"nullable": false
}, {
"name": "callback.apiResponse",
"description": "<ul> <li>The full API response.</li> </ul> ",
"types": ["object"],
"optional": false,
"nullable": false
}],
"exceptions": [],
"returns": []
}]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment