From f24e607f7e98b8d9c57a2659d9e09b7459fd0832 Mon Sep 17 00:00:00 2001
From: circle-ci \n This class allows you interact with BigQuery.\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, \n Going forward, please install only the individual service modules that you need, such as \n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n \n First, install \n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to \n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n \n The full set of options which can be passed to Interact with your BigQuery dataset. Create a Dataset instance with bigquery#createDataset or bigquery#dataset. Create a dataset. If the callback is omitted, we'll return a Promise. Check if the dataset exists. If the callback is omitted, we'll return a Promise. Get a dataset if it exists. You may optionally use this to "get or create" an object by providing an object with If the callback is omitted, we'll return a Promise. Get the metadata for the Dataset. If the callback is omitted, we'll return a Promise. Sets the metadata of the Dataset object. If the callback is omitted, we'll return a Promise. Create a table given a tableId or configuration object. If the callback is omitted, we'll return a Promise. Delete the dataset. Delete the dataset, only if it does not have any tables. Delete the dataset and any tables it contains. If the callback is omitted, we'll return a Promise. Get a list of tables. To control how many API requests are made and page through the results \nmanually, set If the callback is omitted, we'll return a Promise. List all or some of the bigquery/table objects in your project as a readable object stream. If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests. Create a Table object. \n This class allows you interact with BigQuery.\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, \n Going forward, please install only the individual service modules that you need, such as \n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n \n First, install \n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to \n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n \n The full set of options which can be passed to In the following examples from this page and the other modules ( We will create a table with the correct schema, import the public CSV file into that table, and query it for data. The Alternatively, provide an object. A Alternatively, provide an object. A Alternatively, provide an object. A timestamp represents an absolute point in time, independent of any time zone or convention such as Daylight Savings Time. Create a dataset. If the callback is omitted, we'll return a Promise. Run a query scoped to your project as a readable object stream. If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests. Create a reference to a dataset. List all or some of the datasets in your project. To control how many API requests are made and page through the results \nmanually, set If the callback is omitted, we'll return a Promise. List all or some of the bigquery/dataset objects in your project as a readable object stream. If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests. Get all of the jobs from your project. To control how many API requests are made and page through the results \nmanually, set If the callback is omitted, we'll return a Promise. List all or some of the bigquery/job objects in your project as a readable object stream. If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests. Create a reference to an existing job. Run a query scoped to your project. Positional SQL parameters are supported. Or if you prefer to name them, that's also supported. If you need to use a To control how many API requests are made and page through the results \nmanually, set If the callback is omitted, we'll return a Promise. Run a query as a job. No results are immediately returned. Instead, your callback will be executed with a bigquery/job object that you must ping for the results. See the Job documentation for explanations of how to check on the status of the job. You may pass only a query string, having a new table created to store the \nresults of the query. You can also control the destination table by providing a \nbigquery/table object. After you have run If the callback is omitted, we'll return a Promise. If a query is not specified. If a Table is not provided as a destination. \n This class allows you interact with BigQuery.\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, \n Going forward, please install only the individual service modules that you need, such as \n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n \n First, install \n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to \n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n \n The full set of options which can be passed to Job objects are returned from various places in the BigQuery API: They can be used to check the status of a running job or fetching the results of a previously-executed one. All jobs are event emitters. The status of each job is polled \ncontinuously, starting only after you register a \"complete\" listener. Be sure to register an error handler as well to catch any issues which \nimpeded the job. To force the Job object to stop polling for updates, simply remove any \n\"complete\" listeners you've registered. \nThe easiest way to do this is with Check if the job exists. If the callback is omitted, we'll return a Promise. Get a job if it exists. If the callback is omitted, we'll return a Promise. Get the metadata of the job. This will mostly be useful for checking the status of a previously-run job. If the callback is omitted, we'll return a Promise. Cancel a job. Use bigquery/job#getMetadata to see if the cancel completes successfully. See an example implementation below. If the callback is omitted, we'll return a Promise. Get the results of a job. Get all of the results of a query. Customize the results you want to fetch. To control how many API requests are made and page through the results \nmanually, set If the callback is omitted, we'll return a Promise. Get the results of a job as a readable object stream. \n This class allows you interact with BigQuery.\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, \n Going forward, please install only the individual service modules that you need, such as \n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n \n First, install \n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to \n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n \n The full set of options which can be passed to Table objects are returned by methods such as bigquery/dataset#table, bigquery/dataset#createTable, and bigquery/dataset#getTables. Create a table. If the callback is omitted, we'll return a Promise. Delete a table and all its data. If the callback is omitted, we'll return a Promise. Check if the table exists. If the callback is omitted, we'll return a Promise. Get a table if it exists. You may optionally use this to "get or create" an object by providing an object with If the callback is omitted, we'll return a Promise. Return the metadata associated with the Table. If the callback is omitted, we'll return a Promise. Copy data from one table to another, optionally creating that table. See the If the callback is omitted, we'll return a Promise. If a destination other than a Table object is provided. Create a readable stream of the rows of data in your table. This method is simply a wrapper around bigquery/table#getRows. If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests. Load data into your table from a readable stream of JSON, CSV, or AVRO data. Load data from a CSV file. Load data from a JSON file. If source format isn't recognized. Export table to Cloud Storage. To use the default options, just pass a storage/file object. \nNote: The exported format type will be inferred by the file's extension. \nIf you wish to override this, or provide an array of destination files, \nyou must provide an If you need more customization, pass an You can also specify multiple destination files. If the callback is omitted, we'll return a Promise. If destination isn't a File object. If destination format isn't recongized. Retrieves table data from a specified set of rows. The rows are returned to your callback as an array of objects matching your table's schema. To control how many API requests are made and page through the results \nmanually, set If the callback is omitted, we'll return a Promise. Load data from a local file or Storage file (storage/file). By loading data this way, you create a load job that will run your data load asynchronously. If you would like instantaneous access to your data, insert it using bigquery/table#insert. Note: The file type will be inferred by the given file's extension. If you wish to override this, you must provide Load data from a local file. You may also pass in metadata in the format of a Jobs resource. See \n(http://goo.gl/BVcXk4) for a full list of supported values. Load data from a file in your Cloud Storage bucket. Load data from multiple files in your Cloud Storage bucket(s). If the callback is omitted, we'll return a Promise. If the source isn't a string file name or a File instance. Stream data into BigQuery one record at a time without running a load job. There are more strict quota limits using this method so it is highly recommended that you load data into BigQuery using bigquery/table#import instead. Insert a single row. Insert multiple rows at a time. Insert a row as according to the \nspecification. Handling the response. See \nTroubleshooting Errors for best practices on how to handle errors. If the callback is omitted, we'll return a Promise. Set the metadata on the table. If the callback is omitted, we'll return a Promise. \n This class allows you interact with Cloud Bigtable.\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, \n Going forward, please install only the individual service modules that you need, such as \n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n \n First, install \n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to \n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n \n The full set of options which can be passed to Create a cluster object to interact with your cluster. Create a cluster. If the callback is omitted, we'll return a Promise. Delete the cluster. If the callback is omitted, we'll return a Promise. Check if a cluster exists. If the callback is omitted, we'll return a Promise. Get a cluster if it exists. If the callback is omitted, we'll return a Promise. Get the cluster metadata. If the callback is omitted, we'll return a Promise. Set the cluster metadata. See bigtable/instance#createCluster for a detailed explanation of the arguments. If the callback is omitted, we'll return a Promise. \n This class allows you interact with Cloud Bigtable.\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, \n Going forward, please install only the individual service modules that you need, such as \n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n \n First, install \n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to \n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n \n The full set of options which can be passed to Create a Family object to interact with your table column families. Create a column family. If the callback is omitted, we'll return a Promise. Delete the column family. If the callback is omitted, we'll return a Promise. Check if the column family exists. If the callback is omitted, we'll return a Promise. Get a column family if it exists. You may optionally use this to "get or create" an object by providing an object with If the callback is omitted, we'll return a Promise. Get the column family's metadata. If the callback is omitted, we'll return a Promise. Set the column family's metadata. See bigtable/table#createFamily for a detailed explanation of the arguments. If the callback is omitted, we'll return a Promise. \n This class allows you interact with Cloud Bigtable.\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, \n Going forward, please install only the individual service modules that you need, such as \n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n \n First, install \n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to \n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n \n The full set of options which can be passed to A filter takes a row as input and produces an alternate view of the row based on specified rules. For example, a row filter might trim down a row to include just the cells from columns matching a given regular expression, or might return all the cells of a row but not their values. More complicated filters can be composed out of these components to express requests such as, "within every column of a particular family, give just the two most recent cells which are older than timestamp X." There are two broad categories of filters (true filters and transformers), as well as two ways to compose simple filters into more complex ones (bigtable/filter#interleave). They work as follows: True filters alter the input row by excluding some of its cells wholesale from the output row. An example of a true filter is the bigtable/filter#value filter, which excludes cells whose values don't match the specified pattern. All regex true filters use RE2 syntax (https://github.com/google/re2/wiki/Syntax) and are evaluated as full matches. An important point to keep in mind is that RE2(.) is equivalent by default to RE2([^\\n]), meaning that it does not match newlines. When attempting to match an arbitrary byte, you should therefore use the escape sequence '\\C', which may need to be further escaped as '\\C' in your client language. Transformers alter the input row by changing the values of some of its cells in the output, without excluding them completely. Currently, the only supported transformer is the bigtable/filter#value The total serialized size of a filter message must not exceed 4096 bytes, and filters may not be nested within each other to a depth of more than 20. Use the following table for the various examples found throughout the filter documentation. Matches all cells, regardless of input. Functionally equivalent to \nleaving Does not match any cells, regardless of input. Useful for temporarily \ndisabling just part of a filter. Matches only cells from columns whose qualifiers satisfy the given RE2 regex. Note that, since column qualifiers can contain arbitrary bytes, the '\\C' escape sequence must be used if a true wildcard is desired. The '.' character will not match the new line character '\\n', which may be present in a binary qualifier. Using the following filter, we would retrieve the You can also provide a string (optionally containing regexp characters) \nfor simple column filters. Or you can provide an array of strings if you wish to match against \nmultiple columns. If you wish to use additional column filters, consider using the following \nsyntax.google-cloud
is deprecated\n google-cloud
.\n @google-cloud/bigquery
.\n google-cloud
with npm:\ngoogle-cloud
— we figure that out for you.\nGoogle Cloud Platform
\nElsewhere
\ngoogle-cloud
are outlined in our Authentication guide.\n
","types":["function"],"optional":false,"nullable":false},{"name":"callback.err","description":"
","types":["error"],"optional":false,"nullable":true},{"name":"callback.exists","description":"
","types":["boolean"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]},{"id":"get","name":"get","type":"instance","description":"autoCreate
set to true
. Any extra configuration that is normally required for the create
method must be contained within this object as well.
","types":["options"],"optional":true,"nullable":false},{"name":"options.autoCreate","description":"
","types":["boolean"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]},{"id":"getMetadata","name":"getMetadata","type":"instance","description":"false
","types":["function"],"optional":false,"nullable":false},{"name":"callback.err","description":"
","types":["error"],"optional":false,"nullable":true},{"name":"callback.metadata","description":"
","types":["object"],"optional":false,"nullable":false},{"name":"callback.apiResponse","description":"
","types":["object"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]},{"id":"setMetadata","name":"setMetadata","type":"instance","description":"
","types":["object"],"optional":false,"nullable":false},{"name":"callback","description":"
","types":["function"],"optional":false,"nullable":false},{"name":"callback.err","description":"
","types":["error"],"optional":false,"nullable":true},{"name":"callback.apiResponse","description":"
","types":["object"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]},{"id":"createTable","name":"createTable","type":"instance","description":"
","types":["string"],"optional":false,"nullable":false},{"name":"options","description":"
","types":["object"],"optional":true,"nullable":false},{"name":"options.schema","description":"
","types":["string","object"],"optional":false,"nullable":false},{"name":"callback","description":"
","types":["function"],"optional":false,"nullable":false},{"name":"callback.err","description":"
","types":["error"],"optional":false,"nullable":true},{"name":"callback.table","description":"
","types":["bigquery/table"],"optional":false,"nullable":false},{"name":"callback.apiResponse","description":"
","types":["object"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]},{"id":"delete","name":"delete","type":"instance","description":"
","types":["object"],"optional":true,"nullable":false},{"name":"options.force","description":"
","types":["boolean"],"optional":false,"nullable":false},{"name":"callback","description":"
","types":["function"],"optional":false,"nullable":false},{"name":"callback.err","description":"
","types":["error"],"optional":false,"nullable":true},{"name":"callback.apiResponse","description":"
","types":["object"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]},{"id":"getTables","name":"getTables","type":"instance","description":"autoPaginate
to false
.
","types":["object"],"optional":true,"nullable":false},{"name":"query.autoPaginate","description":"
","types":["boolean"],"optional":false,"nullable":false},{"name":"query.maxApiCalls","description":"
","types":["number"],"optional":false,"nullable":false},{"name":"query.maxResults","description":"
","types":["number"],"optional":false,"nullable":false},{"name":"query.pageToken","description":"
","types":["string"],"optional":false,"nullable":false},{"name":"callback","description":"
","types":["function"],"optional":false,"nullable":false},{"name":"callback.err","description":"
","types":["error"],"optional":false,"nullable":true},{"name":"callback.tables","description":"
","types":["bigquery/table[]"],"optional":false,"nullable":false},{"name":"callback.apiResponse","description":"
","types":["object"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]},{"id":"getTablesStream","name":"getTablesStream","type":"instance","description":"
","types":["object"],"optional":true,"nullable":false}],"exceptions":[],"returns":[{"types":["stream"],"description":""}]},{"id":"table","name":"table","type":"instance","description":"
","types":["string"],"optional":false,"nullable":false}],"exceptions":[],"returns":[{"types":["bigquery/table"],"description":""}]}],"path":"dataset.json"}
\ No newline at end of file
diff --git a/json/google-cloud/v0.51.1/bigquery/index.json b/json/google-cloud/v0.51.1/bigquery/index.json
new file mode 100644
index 00000000000..fc8fb27884b
--- /dev/null
+++ b/json/google-cloud/v0.51.1/bigquery/index.json
@@ -0,0 +1 @@
+{"id":"bigquery","type":"class","name":"BigQuery","overview":"google-cloud
is deprecated\n google-cloud
.\n @google-cloud/bigquery
.\n google-cloud
with npm:\ngoogle-cloud
— we figure that out for you.\nGoogle Cloud Platform
\nElsewhere
\ngoogle-cloud
are outlined in our Authentication guide.\nDataset
, Table
, etc.), we are going to be using a dataset from data.gov of higher education institutions.DATE
type represents a logical calendar date, independent of time zone. It does not represent a specific 24-hour time period. Rather, a given DATE value represents a different 24-hour period when interpreted in different time zones, and may represent a shorter or longer day during Daylight Savings Time transitions.
","types":["object","string"],"optional":false,"nullable":false},{"name":"value.year","description":"YYYY-[M]M-[D]D
. Otherwise, provide an object.
","types":["string","number"],"optional":false,"nullable":false},{"name":"value.month","description":"
","types":["string","number"],"optional":false,"nullable":false},{"name":"value.day","description":"
","types":["string","number"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]},{"id":"datetime","name":"datetime","type":"instance","description":"DATETIME
data type represents a point in time. Unlike a TIMESTAMP
, this does not refer to an absolute instance in time. Instead, it is the civil time, or the time that a user would see on a watch or calendar.
","types":["object","string"],"optional":false,"nullable":false},{"name":"value.year","description":"YYYY-[M]M-[D]D[ [H]H:[M]M:[S]S[.DDDDDD]]
. Otherwise, provide an object.
","types":["string","number"],"optional":false,"nullable":false},{"name":"value.month","description":"
","types":["string","number"],"optional":false,"nullable":false},{"name":"value.day","description":"
","types":["string","number"],"optional":false,"nullable":false},{"name":"value.hours","description":"
","types":["string","number"],"optional":true,"nullable":false},{"name":"value.minutes","description":"00
- 23
).
","types":["string","number"],"optional":true,"nullable":false},{"name":"value.seconds","description":"00
- 59
).
","types":["string","number"],"optional":true,"nullable":false},{"name":"value.fractional","description":"00
- 59
).
","types":["string","number"],"optional":true,"nullable":false}],"exceptions":[],"returns":[]},{"id":"time","name":"time","type":"instance","description":"TIME
data type represents a time, independent of a specific date.
","types":["object","string"],"optional":false,"nullable":false},{"name":"value.hours","description":"[H]H:[M]M:[S]S[.DDDDDD]
. Otherwise, provide an object.
","types":["string","number"],"optional":true,"nullable":false},{"name":"value.minutes","description":"00
- 23
).
","types":["string","number"],"optional":true,"nullable":false},{"name":"value.seconds","description":"00
- 59
).
","types":["string","number"],"optional":true,"nullable":false},{"name":"value.fractional","description":"00
- 59
).
","types":["string","number"],"optional":true,"nullable":false}],"exceptions":[],"returns":[]},{"id":"timestamp","name":"timestamp","type":"instance","description":"
","types":["date"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]},{"id":"createDataset","name":"createDataset","type":"instance","description":"
","types":["string"],"optional":false,"nullable":false},{"name":"options","description":"
","types":["object"],"optional":true,"nullable":false},{"name":"callback","description":"
","types":["function"],"optional":false,"nullable":false},{"name":"callback.err","description":"
","types":["error"],"optional":false,"nullable":true},{"name":"callback.dataset","description":"
","types":["bigquery/dataset"],"optional":false,"nullable":false},{"name":"callback.apiResponse","description":"
","types":["object"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]},{"id":"createQueryStream","name":"createQueryStream","type":"instance","description":"
","types":["object"],"optional":true,"nullable":false}],"exceptions":[],"returns":[{"types":["stream"],"description":""}]},{"id":"dataset","name":"dataset","type":"instance","description":"
","types":["string"],"optional":false,"nullable":false}],"exceptions":[],"returns":[{"types":["bigquery/dataset"],"description":""}]},{"id":"getDatasets","name":"getDatasets","type":"instance","description":"autoPaginate
to false
.
","types":["object"],"optional":true,"nullable":false},{"name":"query.all","description":"
","types":["boolean"],"optional":false,"nullable":false},{"name":"query.autoPaginate","description":"
","types":["boolean"],"optional":false,"nullable":false},{"name":"query.maxApiCalls","description":"
","types":["number"],"optional":false,"nullable":false},{"name":"query.maxResults","description":"
","types":["number"],"optional":false,"nullable":false},{"name":"query.pageToken","description":"
","types":["string"],"optional":false,"nullable":false},{"name":"callback","description":"
","types":["function"],"optional":false,"nullable":false},{"name":"callback.err","description":"
","types":["error"],"optional":false,"nullable":true},{"name":"callback.datasets","description":"
","types":["bigquery/dataset[]"],"optional":false,"nullable":false},{"name":"callback.apiResponse","description":"
","types":["object"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]},{"id":"getDatasetsStream","name":"getDatasetsStream","type":"instance","description":"
","types":["object"],"optional":true,"nullable":false}],"exceptions":[],"returns":[{"types":["stream"],"description":""}]},{"id":"getJobs","name":"getJobs","type":"instance","description":"autoPaginate
to false
.
","types":["object"],"optional":true,"nullable":false},{"name":"options.allUsers","description":"
","types":["boolean"],"optional":true,"nullable":false},{"name":"options.autoPaginate","description":"
","types":["boolean"],"optional":false,"nullable":false},{"name":"options.maxApiCalls","description":"
","types":["number"],"optional":false,"nullable":false},{"name":"options.maxResults","description":"
","types":["number"],"optional":true,"nullable":false},{"name":"options.pageToken","description":"
","types":["string"],"optional":true,"nullable":false},{"name":"options.projection","description":"
","types":["string"],"optional":true,"nullable":false},{"name":"options.stateFilter","description":"
","types":["string"],"optional":true,"nullable":false},{"name":"callback","description":"
","types":["function"],"optional":false,"nullable":false},{"name":"callback.err","description":"
","types":["error"],"optional":false,"nullable":true},{"name":"callback.jobs","description":"
","types":["bigquery/job[]"],"optional":false,"nullable":false},{"name":"callback.apiResponse","description":"
","types":["object"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]},{"id":"getJobsStream","name":"getJobsStream","type":"instance","description":"
","types":["object"],"optional":true,"nullable":false}],"exceptions":[],"returns":[{"types":["stream"],"description":""}]},{"id":"job","name":"job","type":"instance","description":"
","types":["string"],"optional":false,"nullable":false}],"exceptions":[],"returns":[{"types":["bigquery/job"],"description":""}]},{"id":"query","name":"query","type":"instance","description":"DATE
, DATETIME
, TIME
, or TIMESTAMP
type in \nyour query, see bigquery#date, bigquery#datetime, \nbigquery#time, and bigquery#timestamp.autoPaginate
to false
.
","types":["string","object"],"optional":false,"nullable":false},{"name":"options.autoPaginate","description":"
","types":["boolean"],"optional":false,"nullable":false},{"name":"options.maxApiCalls","description":"
","types":["number"],"optional":false,"nullable":false},{"name":"options.maxResults","description":"
","types":["number"],"optional":false,"nullable":false},{"name":"options.params","description":"
","types":["object","*[]"],"optional":false,"nullable":false},{"name":"options.query","description":"
","types":["string"],"optional":false,"nullable":false},{"name":"options.timeoutMs","description":"
","types":["number"],"optional":false,"nullable":false},{"name":"callback","description":"TIMEOUT
error.
","types":["function"],"optional":false,"nullable":false},{"name":"callback.err","description":"
","types":["error"],"optional":false,"nullable":true},{"name":"callback.rows","description":"
","types":["array"],"optional":false,"nullable":false},{"name":"callback.apiResponse","description":"
","types":["object"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]},{"id":"startQuery","name":"startQuery","type":"instance","description":"startQuery
, your query will execute in a job. Your \ncallback is executed with a bigquery/job object so that you may \ncheck for the results.
","types":["object","string"],"optional":false,"nullable":false},{"name":"options.destination","description":"configuration.query
property of a Jobs resource. If a string is provided, this is used as the query string, and all other options are defaulted.
","types":["bigquery/table"],"optional":true,"nullable":false},{"name":"options.query","description":"
","types":["string"],"optional":false,"nullable":false},{"name":"callback","description":"
","types":["function"],"optional":false,"nullable":false},{"name":"callback.err","description":"
","types":["error"],"optional":false,"nullable":true},{"name":"callback.job","description":"
","types":["bigquery/job"],"optional":false,"nullable":false},{"name":"callback.apiResponse","description":"
","types":["object"],"optional":false,"nullable":false}],"exceptions":[{"type":"Error","description":"google-cloud
is deprecated\n google-cloud
.\n @google-cloud/bigquery
.\n google-cloud
with npm:\ngoogle-cloud
— we figure that out for you.\nGoogle Cloud Platform
\nElsewhere
\ngoogle-cloud
are outlined in our Authentication guide.\n
removeAllListeners()
.
","types":["function"],"optional":false,"nullable":false},{"name":"callback.err","description":"
","types":["error"],"optional":false,"nullable":true},{"name":"callback.exists","description":"
","types":["boolean"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]},{"id":"get","name":"get","type":"instance","description":"
","types":["function"],"optional":false,"nullable":false},{"name":"callback.err","description":"
","types":["error"],"optional":false,"nullable":true},{"name":"callback.metadata","description":"
","types":["object"],"optional":false,"nullable":false},{"name":"callback.apiResponse","description":"
","types":["object"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]},{"id":"cancel","name":"cancel","type":"instance","description":"
","types":["function"],"optional":true,"nullable":false},{"name":"callback.err","description":"
","types":["error"],"optional":false,"nullable":true},{"name":"callback.apiResponse","description":"
","types":["object"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]},{"id":"getQueryResults","name":"getQueryResults","type":"instance","description":"autoPaginate
to false
.
","types":["object"],"optional":true,"nullable":false},{"name":"options.autoPaginate","description":"
","types":["boolean"],"optional":false,"nullable":false},{"name":"options.maxApiCalls","description":"
","types":["number"],"optional":false,"nullable":false},{"name":"options.maxResults","description":"
","types":["number"],"optional":false,"nullable":false},{"name":"options.pageToken","description":"
","types":["string"],"optional":false,"nullable":false},{"name":"options.startIndex","description":"nextQuery
argument of your callback.
","types":["number"],"optional":false,"nullable":false},{"name":"options.timeoutMs","description":"
","types":["number"],"optional":false,"nullable":false},{"name":"callback","description":"TIMEOUT
error.
","types":["function"],"optional":true,"nullable":false},{"name":"callback.err","description":"
","types":["error"],"optional":false,"nullable":true},{"name":"callback.rows","description":"
","types":["array"],"optional":false,"nullable":false},{"name":"callback.nextQuery","description":"
","types":["object"],"optional":false,"nullable":true},{"name":"callback.apiResponse","description":"
","types":["object"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]},{"id":"getQueryResultsStream","name":"getQueryResultsStream","type":"instance","description":"
","types":["object"],"optional":true,"nullable":false}],"exceptions":[],"returns":[{"types":["stream"],"description":""}]}],"path":"job.json"}
\ No newline at end of file
diff --git a/json/google-cloud/v0.51.1/bigquery/table.json b/json/google-cloud/v0.51.1/bigquery/table.json
new file mode 100644
index 00000000000..d5ebff7fef5
--- /dev/null
+++ b/json/google-cloud/v0.51.1/bigquery/table.json
@@ -0,0 +1 @@
+{"id":"bigquery/table","type":"class","name":"Table","overview":"google-cloud
is deprecated\n google-cloud
.\n @google-cloud/bigquery
.\n google-cloud
with npm:\ngoogle-cloud
— we figure that out for you.\nGoogle Cloud Platform
\nElsewhere
\ngoogle-cloud
are outlined in our Authentication guide.\n
","types":["function"],"optional":false,"nullable":false},{"name":"callback.err","description":"
","types":["error"],"optional":false,"nullable":true},{"name":"callback.apiResponse","description":"
","types":["object"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]},{"id":"exists","name":"exists","type":"instance","description":"
","types":["function"],"optional":false,"nullable":false},{"name":"callback.err","description":"
","types":["error"],"optional":false,"nullable":true},{"name":"callback.exists","description":"
","types":["boolean"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]},{"id":"get","name":"get","type":"instance","description":"autoCreate
set to true
. Any extra configuration that is normally required for the create
method must be contained within this object as well.
","types":["options"],"optional":true,"nullable":false},{"name":"options.autoCreate","description":"
","types":["boolean"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]},{"id":"getMetadata","name":"getMetadata","type":"instance","description":"false
","types":["function"],"optional":false,"nullable":false},{"name":"callback.err","description":"
","types":["error"],"optional":false,"nullable":true},{"name":"callback.metadata","description":"
","types":["object"],"optional":false,"nullable":false},{"name":"callback.apiResponse","description":"
","types":["object"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]},{"id":"copy","name":"copy","type":"instance","description":"configuration.copy
object for all \navailable options.
","types":["bigquery/table"],"optional":false,"nullable":false},{"name":"metadata","description":"
","types":["object"],"optional":true,"nullable":false},{"name":"callback","description":"configuration.copy
property of a Jobs resource.
","types":["function"],"optional":false,"nullable":false},{"name":"callback.err","description":"
","types":["error"],"optional":false,"nullable":true},{"name":"callback.job","description":"
","types":["bigquery/job"],"optional":false,"nullable":false},{"name":"callback.apiResponse","description":"
","types":["object"],"optional":false,"nullable":false}],"exceptions":[{"type":"Error","description":"
","types":["string","object"],"optional":true,"nullable":false}],"exceptions":[{"type":"Error","description":"configuration.load
property of a Jobs resource. If a string is given, it will be used as the filetype.options
object.options
object.
","types":["storage/file"],"optional":false,"nullable":false},{"name":"options","description":"
","types":["object"],"optional":true,"nullable":false},{"name":"options.format","description":"
","types":["string"],"optional":false,"nullable":false},{"name":"options.gzip","description":"
","types":["boolean"],"optional":false,"nullable":false},{"name":"callback","description":"
","types":["function"],"optional":false,"nullable":false},{"name":"callback.err","description":"
","types":["error"],"optional":false,"nullable":true},{"name":"callback.job","description":"
","types":["bigquery/job"],"optional":false,"nullable":false},{"name":"callback.apiResponse","description":"
","types":["object"],"optional":false,"nullable":false}],"exceptions":[{"type":"Error","description":"autoPaginate
to false
.
","types":["object"],"optional":true,"nullable":false},{"name":"options.autoPaginate","description":"
","types":["boolean"],"optional":false,"nullable":false},{"name":"options.maxApiCalls","description":"
","types":["number"],"optional":false,"nullable":false},{"name":"options.maxResults","description":"
","types":["number"],"optional":false,"nullable":false},{"name":"callback","description":"
","types":["function"],"optional":false,"nullable":false},{"name":"callback.err","description":"
","types":["error"],"optional":false,"nullable":true},{"name":"callback.rows","description":"
","types":["array"],"optional":false,"nullable":false},{"name":"callback.apiResponse","description":"
","types":["object"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]},{"id":"import","name":"import","type":"instance","description":"metadata.format
.
","types":["string","storage/file"],"optional":false,"nullable":false},{"name":"metadata","description":"
","types":["object"],"optional":true,"nullable":false},{"name":"metadata.format","description":"configuration.load
property of a Jobs resource.
","types":["string"],"optional":false,"nullable":false},{"name":"callback","description":"
","types":["function"],"optional":false,"nullable":false},{"name":"callback.err","description":"
","types":["error"],"optional":false,"nullable":true},{"name":"callback.job","description":"
","types":["bigquery/job"],"optional":false,"nullable":false},{"name":"callback.apiResponse","description":"
","types":["object"],"optional":false,"nullable":false}],"exceptions":[{"type":"Error","description":"
","types":["object","object[]"],"optional":false,"nullable":false},{"name":"options","description":"
","types":["object"],"optional":true,"nullable":false},{"name":"options.ignoreUnknownValues","description":"
","types":["boolean"],"optional":false,"nullable":false},{"name":"options.raw","description":"false
.
","types":["boolean"],"optional":false,"nullable":false},{"name":"options.skipInvalidRows","description":"true
, the rows
argument is expected to be formatted as according to the specification.
","types":["boolean"],"optional":false,"nullable":false},{"name":"options.templateSuffix","description":"false
.
","types":["string"],"optional":false,"nullable":false},{"name":"callback","description":"
","types":["function"],"optional":false,"nullable":false},{"name":"callback.err","description":"
","types":["error"],"optional":false,"nullable":true},{"name":"callback.err.errors","description":"
","types":["object[]"],"optional":false,"nullable":false},{"name":"callback.apiResponse","description":"
","types":["object"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]},{"id":"setMetadata","name":"setMetadata","type":"instance","description":"
","types":["object"],"optional":false,"nullable":false},{"name":"metadata.description","description":"
","types":["string"],"optional":false,"nullable":false},{"name":"metadata.name","description":"
","types":["string"],"optional":false,"nullable":false},{"name":"metadata.schema","description":"
","types":["string","object"],"optional":false,"nullable":false},{"name":"callback","description":"
","types":["function"],"optional":false,"nullable":false},{"name":"callback.err","description":"
","types":["error"],"optional":false,"nullable":true},{"name":"callback.apiResponse","description":"
","types":["object"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]}],"path":"table.json"}
\ No newline at end of file
diff --git a/json/google-cloud/v0.51.1/bigtable/cluster.json b/json/google-cloud/v0.51.1/bigtable/cluster.json
new file mode 100644
index 00000000000..673dfec21c2
--- /dev/null
+++ b/json/google-cloud/v0.51.1/bigtable/cluster.json
@@ -0,0 +1 @@
+{"id":"bigtable/cluster","type":"class","name":"Cluster","overview":"google-cloud
is deprecated\n google-cloud
.\n @google-cloud/bigtable
.\n google-cloud
with npm:\ngoogle-cloud
— we figure that out for you.\nGoogle Cloud Platform
\nElsewhere
\ngoogle-cloud
are outlined in our Authentication guide.\n
","types":["string"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]},{"id":"create","name":"create","type":"instance","description":"
","types":["function"],"optional":true,"nullable":false},{"name":"callback.err","description":"
","types":["error"],"optional":false,"nullable":true},{"name":"callback.apiResponse","description":"
","types":["object"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]},{"id":"exists","name":"exists","type":"instance","description":"
","types":["function"],"optional":false,"nullable":false},{"name":"callback.err","description":"
","types":["error"],"optional":false,"nullable":true},{"name":"callback.exists","description":"
","types":["boolean"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]},{"id":"get","name":"get","type":"instance","description":"
","types":["function"],"optional":false,"nullable":false},{"name":"callback.err","description":"
","types":["error"],"optional":false,"nullable":true},{"name":"callback.metadata","description":"
","types":["object"],"optional":false,"nullable":false},{"name":"callback.apiResponse","description":"
","types":["object"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]},{"id":"setMetadata","name":"setMetadata","type":"instance","description":"
","types":["object"],"optional":false,"nullable":false},{"name":"metadata.location","description":"
","types":["string"],"optional":false,"nullable":false},{"name":"metadata.nodes","description":"
","types":["number"],"optional":false,"nullable":false},{"name":"metadata.storage","description":"
","types":["string"],"optional":false,"nullable":false},{"name":"callback","description":"
","types":["function"],"optional":false,"nullable":false},{"name":"callback.err","description":"
","types":["error"],"optional":false,"nullable":true},{"name":"callback.operation","description":"
","types":["Operation"],"optional":false,"nullable":false},{"name":"callback.apiResponse","description":"
","types":["object"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]}],"path":"cluster.json"}
\ No newline at end of file
diff --git a/json/google-cloud/v0.51.1/bigtable/family.json b/json/google-cloud/v0.51.1/bigtable/family.json
new file mode 100644
index 00000000000..88f0d818a12
--- /dev/null
+++ b/json/google-cloud/v0.51.1/bigtable/family.json
@@ -0,0 +1 @@
+{"id":"bigtable/family","type":"class","name":"Family","overview":"google-cloud
is deprecated\n google-cloud
.\n @google-cloud/bigtable
.\n google-cloud
with npm:\ngoogle-cloud
— we figure that out for you.\nGoogle Cloud Platform
\nElsewhere
\ngoogle-cloud
are outlined in our Authentication guide.\n
","types":["function"],"optional":true,"nullable":false},{"name":"callback.err","description":"
","types":["error"],"optional":false,"nullable":true},{"name":"callback.apiResponse","description":"
","types":["object"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]},{"id":"exists","name":"exists","type":"instance","description":"
","types":["function"],"optional":false,"nullable":false},{"name":"callback.err","description":"
","types":["error"],"optional":false,"nullable":true},{"name":"callback.exists","description":"
","types":["boolean"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]},{"id":"get","name":"get","type":"instance","description":"autoCreate
set to true
. Any extra configuration that is normally required for the create
method must be contained within this object as well.
","types":["options"],"optional":true,"nullable":false},{"name":"options.autoCreate","description":"
","types":["boolean"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]},{"id":"getMetadata","name":"getMetadata","type":"instance","description":"false
","types":["function"],"optional":false,"nullable":false},{"name":"callback.err","description":"
","types":["error"],"optional":false,"nullable":true},{"name":"callback.metadata","description":"
","types":["object"],"optional":false,"nullable":false},{"name":"callback.apiResponse","description":"
","types":["object"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]},{"id":"setMetadata","name":"setMetadata","type":"instance","description":"
","types":["object"],"optional":false,"nullable":false},{"name":"metadata.rule","description":"
","types":["object"],"optional":true,"nullable":false},{"name":"callback","description":"
","types":["function"],"optional":false,"nullable":false},{"name":"callback.err","description":"
","types":["error"],"optional":false,"nullable":true},{"name":"callback.apiResponse","description":"
","types":["object"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]}],"path":"family.json"}
\ No newline at end of file
diff --git a/json/google-cloud/v0.51.1/bigtable/filter.json b/json/google-cloud/v0.51.1/bigtable/filter.json
new file mode 100644
index 00000000000..f578f22b762
--- /dev/null
+++ b/json/google-cloud/v0.51.1/bigtable/filter.json
@@ -0,0 +1 @@
+{"id":"bigtable/filter","type":"class","name":"Filter","overview":"google-cloud
is deprecated\n google-cloud
.\n @google-cloud/bigtable
.\n google-cloud
with npm:\ngoogle-cloud
— we figure that out for you.\nGoogle Cloud Platform
\nElsewhere
\ngoogle-cloud
are outlined in our Authentication guide.\nstrip
filter, which replaces every cell's value with the empty string.
","source":"packages/bigtable/src/filter.js#L86","resources":[],"examples":[],"params":[],"exceptions":[],"returns":[]},{"id":"all","name":"all","type":"instance","description":"","source":"packages/bigtable/src/filter.js#L246","resources":[],"examples":[{"caption":" Row Key follows:gwashington follows:jadams follows:tjefferson gwashington 1 tjefferson 1 1 jadams 1 1 filter
unset, but included for completeness.tjefferson
and \ngwashington
columns.Column Cell Limits
\nMatches only the most recent number of versions within each column. For \nexample, if the versions
is set to 2, this filter would only match \ncolumns updated at the two most recent timestamps. \nIf duplicate cells are present, as is possible when using an \nbigtable/filter#interleave filter, each copy of the cell is \ncounted separately.
start
bound is omitted it is interpreted as an empty string. \nWhen the end
bound is omitted it is interpreted as Infinity.","code":"var filter = [\n {\n column: {\n family: 'follows',\n start: 'gwashington',\n end: 'tjefferson'\n }\n }\n];"},{"caption":"By default, both the start
and end
bounds are inclusive. You can \noverride these by providing an object explicity stating whether or not it \nis inclusive
.
A filter which evaluates one of two possible filters, depending on whether or not a test
filter outputs any cells from the input row.
IMPORTANT NOTE: The test
filter does not execute atomically with the pass and fail filters, which may lead to inconsistent or unexpected results. Additionally, condition filters have poor performance, especially when filters are set for the fail condition.
In the following example we're creating a filter that will check if \ngwashington
follows tjefferson
. If he does, we'll get all of the \ngwashington
data. If he does not, we'll instead return all of the \ntjefferson
data.
Matches only cells from columns whose families satisfy the given RE2 regex. For technical reasons, the regex must not contain the ':' character, even if it is not being used as a literal. Note that, since column families cannot contain the new line character '\\n', it is sufficient to use '.' as a full wildcard when matching column family names.
","source":"packages/bigtable/src/filter.js#L468","resources":[],"examples":[{"code":"var filter = [\n {\n family: 'follows'\n }\n];"}],"params":[],"exceptions":[],"returns":[]},{"id":"interleave","name":"interleave","type":"instance","description":"Applies several filters to the data in parallel and combines the results.
The elements of "filters" all process a copy of the input row, and the results are pooled, sorted, and combined into a single output row. If multiple cells are produced with the same column and timestamp, they will all appear in the output row in an unspecified mutual order. All interleaved filters are executed atomically.
","source":"packages/bigtable/src/filter.js#L511","resources":[],"examples":[{"caption":"In the following example, we're creating a filter that will retrieve \nresults for entries that were either created between December 17th, 2015 \nand March 22nd, 2016 or entries that have data for follows:tjefferson
.
Applies the given label to all cells in the output row. This allows the client to determine which results were produced from which part of the filter.
Values must be at most 15 characters in length, and match the RE2 pattern [a-z0-9\\-]+
Due to a technical limitation, it is not currently possible to apply multiple labels to a cell. As a result, a chain filter may have no more than one sub-filter which contains a apply label transformer. It is okay for an bigtable/filter#interleave to contain multiple apply label transformers, as they will be applied to separate copies of the input. This may be relaxed in the future.
","source":"packages/bigtable/src/filter.js#L537","resources":[],"examples":[{"code":"var filter = {\n label: 'my-label'\n};"}],"params":[],"exceptions":[],"returns":[]},{"id":"row","name":"row","type":"instance","description":"","source":"packages/bigtable/src/filter.js#L644","resources":[],"examples":[{"caption":"Matches only cells from rows whose keys satisfy the given RE2 regex. In \nother words, passes through the entire row when the key matches, and \notherwise produces an empty row. \nNote that, since row keys can contain arbitrary bytes, the '\\C' escape \nsequence must be used if a true wildcard is desired. The '.' character \nwill not match the new line character '\\n', which may be present in a \nbinary key. \nIn the following example we'll use a regular expression to match all \nrow keys ending with the letters \"on\", which would then yield \ngwashington
and tjefferson
.
You can also provide a string (optionally containing regexp characters) \nfor simple key filters.
","code":"var filter = [\n {\n row: 'gwashington'\n }\n];"},{"caption":"Or you can provide an array of strings if you wish to match against \nmultiple keys.
","code":"var filter = [\n {\n row: [\n 'gwashington',\n 'tjefferson'\n ]\n }\n];"},{"caption":"If you wish to use additional row filters, consider using the following \nsyntax.
","code":"var filter = [\n {\n row: {\n key: 'gwashington'\n }\n }\n];"},{"caption":"This filter is meant for advanced use only. Hook for introspection into the filter. Outputs all cells directly to the output of the read rather than to any parent filter.
Despite being excluded by the qualifier filter, a copy of every cell that reaches the sink is present in the final result.
As with an bigtable/filter#interleave filter, duplicate cells are possible, and appear in an unspecified mutual order.
Cannot be used within bigtable/filter#condition filter.
","source":"packages/bigtable/src/filter.js#L740","resources":[],"examples":[{"caption":"Using the following filter, a copy of every cell that reaches the sink is \npresent in the final result, despite being excluded by the qualifier \nfilter
","code":"var filter = [\n {\n family: 'follows'\n },\n {\n interleave: [\n [\n {\n all: true\n }\n ],\n [\n {\n label: 'prezzy'\n },\n {\n sink: true\n }\n ]\n ]\n },\n {\n column: 'gwashington'\n }\n];"},{"caption":"As with an bigtable/filter#interleave filter, duplicate cells \nare possible, and appear in an unspecified mutual order. In this case we \nhave a duplicates with multiple gwashington
columns because one copy \npassed through the bigtable/filter#all filter while the other was \npassed through the bigtable/filter#label and sink. Note that one \ncopy has label \"prezzy\" while the other does not.
Matches only cells with timestamps within the given range.
","source":"packages/bigtable/src/filter.js#L757","resources":[],"examples":[{"code":"var filter = [\n {\n time: {\n start: new Date('December 17, 2006 03:24:00'),\n end: new Date()\n }\n }\n];"}],"params":[],"exceptions":[],"returns":[]},{"id":"value","name":"value","type":"instance","description":"Matches only cells with values that satisfy the given regular expression. Note that, since cell values can contain arbitrary bytes, the '\\C' escape sequence must be used if a true wildcard is desired. The '.' character will not match the new line character '\\n', which may be present in a binary value.
","source":"packages/bigtable/src/filter.js#L867","resources":[],"examples":[{"code":"var filter = [\n {\n value: /[0-9]/\n }\n];"},{"caption":"You can also provide a string (optionally containing regexp characters) \nfor value filters.
","code":"var filter = [\n {\n value: '1'\n }\n];"},{"caption":"Or you can provide an array of strings if you wish to match against \nmultiple values.
","code":"var filter = [\n {\n value: ['1', '9']\n }\n];"},{"caption":"start
bound is omitted it is interpreted as an empty string. \nWhen the end
bound is omitted it is interpreted as Infinity.","code":"var filter = [\n {\n value: {\n start: '1',\n end: '9'\n }\n }\n];"},{"caption":"By default, both the start
and end
bounds are inclusive. You can \noverride these by providing an object explicity stating whether or not it \nis inclusive
.
\n This class allows you interact with Cloud Bigtable.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/bigtable
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
\n$ gcloud beta emulators bigtable start \n\nBefore running your Node.js app, set the environment variables that this \nlibrary will look for to connect to the emulator: \n
\n$ $(gcloud beta emulators bigtable env-init) \n"},{"caption":"
This can also be done from either the Google Cloud Platform Console or the \ngcloud
cli tool. Please refer to the \n \nofficial Bigtable documentation for more information.
It is also possible to create your column families when creating a new \ntable.
","code":"var options = {\n families: ['follows']\n};\n\ninstance.createTable('prezzy', options, function(err, table) {});"},{"caption":"follows
is the column \nfamily and tjefferson
is the column qualifier. Together they could be \nreferred to as follows:tjefferson
.","code":"var rows = [\n {\n key: 'wmckinley',\n data: {\n follows: {\n tjefferson: 1\n }\n }\n }\n];\n\ntable.insert(rows, function(err) {\n if (!err) {\n // Your rows were successfully inserted.\n }\n});"},{"caption":"If you're not anticpating a large number of results, a callback mode \nis also available.
","code":"var callback = function(err, rows) {\n // `rows` is an array of Row objects.\n};\n\ntable.getRows(callback);"},{"caption":"A range of rows can be retrieved by providing start
and end
row keys.
Retrieve an individual row with bigtable/row#get.
","code":"var row = table.row('alincoln');\n\nrow.get(function(err) {\n // `row.data` is now populated.\n});"},{"caption":"row.data
property will be \npopulated by an object. That object will contain additional objects \nfor each family in your table that the row has data for. \nBy default, when retrieving rows, each column qualifier will provide you \nwith all previous versions of the data. So your row.data
object could \nresemble the following. \n{ \nfollows: { \nwmckinley: [ \n{ \nvalue: 1, \ntimestamp: 1466017315951 \n}, { \nvalue: 2, \ntimestamp: 1458619200000 \n} \n] \n} \n}"},{"caption":"The timestamp
field can be used to order cells from newest to oldest. \nIf you only wish to retrieve the most recent version of the data, you \ncan specify the number of cells with a bigtable/filter object.
To delete a specific set of cells, we can provide an array of \ncolumn families and qualifiers.
","code":"var cells = [\n 'follows:gwashington',\n 'traits'\n];\n\nrow.delete(cells, callback);"},{"caption":"If you omit the prefix, you can delete all rows in your table.
","code":"table.deleteRows(function(err) {\n if (!err) {\n // All rows were deleted successfully.\n }\n});"}],"params":[{"name":"options","description":" ","types":["object"],"optional":true,"nullable":false},{"name":"options.apiEndpoint","description":"Create a Compute instance.
","source":"packages/bigtable/src/index.js#L417","resources":[{"title":"Creating a Compute Instance","link":"https://cloud.google.com/bigtable/docs/creating-compute-instance"}],"examples":[{"code":"var callback = function(err, instance, operation, apiResponse) {\n if (err) {\n // Error handling omitted.\n }\n\n operation\n .on('error', console.log)\n .on('complete', function() {\n // The instance was created successfully.\n });\n};\n\nvar options = {\n displayName: 'my-sweet-instance',\n clusters: [\n {\n name: 'my-sweet-cluster',\n nodes: 3,\n location: 'us-central1-b',\n storage: 'ssd'\n }\n ]\n};\n\nbigtable.createInstance('my-instance', options, callback);"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"bigtable.createInstance('my-instance', options).then(function(data) {\n var instance = data[0];\n var operation = data[1];\n var apiResponse = data[2];\n});"}],"params":[{"name":"name","description":"Get Instance objects for all of your Compute instances.
","source":"packages/bigtable/src/index.js#L508","resources":[],"examples":[{"code":"bigtable.getInstances(function(err, instances) {\n if (!err) {\n // `instances` is an array of Instance objects.\n }\n});"},{"caption":"To control how many API requests are made and page through the results \nmanually, set autoPaginate
to false.
If the callback is omitted, we'll return a Promise.
","code":"bigtable.getInstances().then(function(data) {\n var instances = data[0];\n});"}],"params":[{"name":"query","description":"Get bigtable/instance objects for all of your Compute instances as a readable object stream.
","source":"packages/bigtable/src/index.js#L573","resources":[],"examples":[{"code":"bigtable.getInstancesStream()\n .on('error', console.error)\n .on('data', function(instance) {\n // `instance` is an Instance object.\n })\n .on('end', function() {\n // All instances retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"bigtable.getInstancesStream()\n .on('data', function(instance) {\n this.end();\n });"}],"params":[{"name":"query","description":"Get a reference to a Compute instance.
","source":"packages/bigtable/src/index.js#L582","resources":[],"examples":[],"params":[{"name":"name","description":"Get a reference to an Operation.
","source":"packages/bigtable/src/index.js#L592","resources":[],"examples":[],"params":[{"name":"name","description":"\n This class allows you interact with Cloud Bigtable.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/bigtable
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
Create an Instance object to interact with a Compute instance.
","source":"packages/bigtable/src/instance.js#L58","resources":[],"examples":[{"code":"var instance = bigtable.instance('my-instance');"}],"params":[{"name":"name","description":"Create an instance.
","source":"packages/bigtable/src/instance.js#L94","resources":[],"examples":[{"code":"instance.create(function(err, instance, operation, apiResponse) {\n if (err) {\n // Error handling omitted.\n }\n\n operation\n .on('error', console.error)\n .on('complete', function() {\n // The instance was created successfully.\n });\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"instance.create().then(function(data) {\n var instance = data[0];\n var operation = data[1];\n var apiResponse = data[2];\n});"}],"params":[{"name":"options","description":" ","types":["object"],"optional":true,"nullable":false}],"exceptions":[],"returns":[]},{"id":"delete","name":"delete","type":"instance","description":"Delete the instance.
","source":"packages/bigtable/src/instance.js#L114","resources":[],"examples":[{"code":"instance.delete(function(err, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"instance.delete().then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[{"name":"callback","description":"Check if an instance exists.
","source":"packages/bigtable/src/instance.js#L142","resources":[],"examples":[{"code":"instance.exists(function(err, exists) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"instance.exists().then(function(data) {\n var exists = data[0];\n});"}],"params":[{"name":"callback","description":"Get an instance if it exists.
","source":"packages/bigtable/src/instance.js#L160","resources":[],"examples":[{"code":"instance.get(function(err, instance, apiResponse) {\n // The `instance` data has been populated.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"instance.get().then(function(data) {\n var instance = data[0];\n var apiResponse = data[1];\n});"}],"params":[],"exceptions":[],"returns":[]},{"id":"getMetadata","name":"getMetadata","type":"instance","description":"Get the instance metadata.
","source":"packages/bigtable/src/instance.js#L182","resources":[],"examples":[{"code":"instance.getMetadata(function(err, metadata, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"instance.getMetadata().then(function(data) {\n var metadata = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"Set the instance metadata.
","source":"packages/bigtable/src/instance.js#L218","resources":[],"examples":[{"code":"var metadata = {\n displayName: 'updated-name'\n};\n\ninstance.setMetadata(metadata, function(err, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"instance.setMetadata(metadata).then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[{"name":"metadata","description":"Create a cluster.
","source":"packages/bigtable/src/instance.js#L296","resources":[],"examples":[{"code":"var callback = function(err, cluster, operation, apiResponse) {\n if (err) {\n // Error handling omitted.\n }\n\n operation\n .on('error', console.log)\n .on('complete', function() {\n // The cluster was created successfully.\n });\n};\n\nvar options = {\n location: 'us-central1-b',\n nodes: 3,\n storage: 'ssd'\n};\n\ninstance.createCluster('my-cluster', options, callback);"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"instance.createCluster('my-cluster', options).then(function(data) {\n var cluster = data[0];\n var operation = data[1];\n var apiResponse = data[2];\n});"}],"params":[{"name":"name","description":"Create a table on your Bigtable instance.
","source":"packages/bigtable/src/instance.js#L426","resources":[{"title":"Designing Your Schema","link":"https://cloud.google.com/bigtable/docs/schema-design"},{"title":"Splitting Keys","link":"https://cloud.google.com/bigtable/docs/managing-tables#splits"}],"examples":[{"code":"var callback = function(err, table, apiResponse) {\n // `table` is a Table object.\n};\n\ninstance.createTable('prezzy', callback);"},{"caption":"Optionally specify column families to be created within the table.
","code":"var options = {\n families: ['follows']\n};\n\ninstance.createTable('prezzy', options, callback);"},{"caption":"You can also specify garbage collection rules for your column families. \nSee bigtable/table#createFamily for more information about \ncolumn families and garbage collection rules.
","code":"var options = {\n families: [\n {\n name: 'follows',\n rule: {\n age: {\n seconds: 0,\n nanos: 5000\n },\n versions: 3,\n union: true\n }\n }\n ]\n};\n\ninstance.createTable('prezzy', options, callback);"},{"caption":"Pre-split the table based on the row key to spread the load across \nmultiple Cloud Bigtable nodes.
","code":"var options = {\n splits: ['10', '20']\n};\n\ninstance.createTable('prezzy', options, callback);"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"instance.createTable('prezzy', options).then(function(data) {\n var table = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"name","description":"If a name is not provided.
"}],"returns":[]},{"id":"cluster","name":"cluster","type":"instance","description":"Get a reference to a Bigtable Cluster.
","source":"packages/bigtable/src/instance.js#L502","resources":[],"examples":[],"params":[{"name":"name","description":"Get Cluster objects for all of your clusters.
","source":"packages/bigtable/src/instance.js#L551","resources":[],"examples":[{"code":"instance.getClusters(function(err, clusters) {\n if (!err) {\n // `clusters` is an array of Cluster objects.\n }\n});"},{"caption":"To control how many API requests are made and page through the results \nmanually, set autoPaginate
to false.
If the callback is omitted, we'll return a Promise.
","code":"instance.getClusters().then(function(data) {\n var clusters = data[0];\n});"}],"params":[{"name":"query","description":"Get bigtable/cluster objects for all of your clusters as a readable object stream.
","source":"packages/bigtable/src/instance.js#L619","resources":[],"examples":[{"code":"instance.getClustersStream()\n .on('error', console.error)\n .on('data', function(cluster) {\n // `cluster` is a Cluster object.\n })\n .on('end', function() {\n // All clusters retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"instance.getClustersStream()\n .on('data', function(cluster) {\n this.end();\n });"}],"params":[{"name":"query","description":"Get Table objects for all the tables in your Compute instance.
","source":"packages/bigtable/src/instance.js#L668","resources":[],"examples":[{"code":"instance.getTables(function(err, tables) {\n if (!err) {\n // `tables` is an array of Table objects.\n }\n});"},{"caption":"To control how many API requests are made and page through the results \nmanually, set autoPaginate
to false.
If the callback is omitted, we'll return a Promise.
","code":"instance.getTables().then(function(data) {\n var tables = data[0];\n});"}],"params":[{"name":"query","description":"Get bigtable/table objects for all the tables in your Compute instance as a readable object stream.
","source":"packages/bigtable/src/instance.js#L738","resources":[],"examples":[{"code":"instance.getTablesStream()\n .on('error', console.error)\n .on('data', function(table) {\n // table is a Table object.\n })\n .on('end', function() {\n // All tables retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"instance.getTablesStream()\n .on('data', function(table) {\n this.end();\n });"}],"params":[{"name":"query","description":"Get a reference to a Bigtable table.
","source":"packages/bigtable/src/instance.js#L749","resources":[],"examples":[{"code":"var table = instance.table('presidents');"}],"params":[{"name":"name","description":"\n This class allows you interact with Cloud Bigtable.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/bigtable
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
Create a Row object to interact with your table rows.
","source":"packages/bigtable/src/row.js#L68","resources":[],"examples":[{"code":"var instance = bigtable.instance('my-instance');\nvar table = instance.table('prezzy');\nvar row = table.row('gwashington');"}],"params":[],"exceptions":[],"returns":[]},{"id":"exists","name":"exists","type":"instance","description":"Check if the table row exists.
","source":"packages/bigtable/src/row.js#L89","resources":[],"examples":[{"code":"row.exists(function(err, exists) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"row.exists().then(function(data) {\n var exists = data[0];\n});"}],"params":[{"name":"callback","description":"Create a new row in your table.
","source":"packages/bigtable/src/row.js#L292","resources":[],"examples":[{"code":"var callback = function(err, apiResponse) {\n if (!err) {\n // Row successfully created\n }\n};\n\nrow.create(callback);"},{"caption":"Optionally, you can supply entry data.
","code":"row.create({\n follows: {\n alincoln: 1\n }\n}, callback);"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"row.create().then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[{"name":"entry","description":"Update a row with rules specifying how the row's contents are to be transformed into writes. Rules are applied in order, meaning that earlier rules will affect the results of later ones.
","source":"packages/bigtable/src/row.js#L370","resources":[],"examples":[{"caption":"Add an increment amount to an existing value, if the targeted cell is \nunset, it will be treated as containing a zero.
","code":"var callback = function(err, apiResponse) {\n if (!err) {\n // The rules have successfully been applied.\n }\n};\n\nvar rules = [\n {\n column: 'follows:gwashington',\n increment: 1\n }\n];\n\nrow.createRules(rules, callback);"},{"caption":"You can also create a rule that will append data to an existing value. \nIf the targeted cell is unset, it will be treated as a containing an \nempty string.
","code":"var rules = [\n {\n column: 'follows:alincoln',\n append: ' Honest Abe!'\n }\n];\n\nrow.createRules(rules, callback);"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"row.createRules(rules).then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[{"name":"rules","description":"If no rules are provided.
"}],"returns":[]},{"id":"filter","name":"filter","type":"instance","description":"Mutates a row atomically based on the output of a filter. Depending on whether or not any results are yielded, either the onMatch
or onNoMatch
callback will be executed.
Optionally, you can pass in an array of entries to be ran in the event \nthat a match is not made.
","code":"row.filter(filter, null, entries, callback);"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"row.filter(filter, null, entries).then(function(data) {\n var matched = data[0];\n});"}],"params":[{"name":"filter","description":"Deletes all cells in the row.
","source":"packages/bigtable/src/row.js#L520","resources":[],"examples":[{"code":"row.delete(function(err, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"row.delete().then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[{"name":"callback","description":"Delete specified cells from the row. See bigtable/table#mutate.
","source":"packages/bigtable/src/row.js#L570","resources":[],"examples":[{"caption":"Delete individual cells.
","code":"var callback = function(err, apiResponse) {\n if (!err) {\n // Cells were successfully deleted.\n }\n};\n\nvar cells = [\n 'follows:gwashington'\n];\n\nrow.deleteCells(cells, callback);"},{"caption":"Delete all cells within a family.
","code":"var cells = [\n 'follows',\n];\n\nrow.deleteCells(cells, callback);"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"row.deleteCells(cells).then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[{"name":"columns","description":"Get the row data. See bigtable/table#getRows.
","source":"packages/bigtable/src/row.js#L622","resources":[],"examples":[{"caption":"Use this method to grab an entire row
","code":"var callback = function(err, row, apiResponse) {\n if (!err) {\n // `row.cells` has been updated.\n }\n};\n\nrow.get(callback);"},{"caption":"Or pass in an array of column names to populate specific cells. \nUnder the hood this will create an interleave filter.
","code":"row.get([\n 'follows:gwashington',\n 'follows:alincoln'\n], callback);"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"row.get().then(function(data) {\n var row = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"columns","description":"false
it will not decode Buffer values returned from Bigtable. Default: true.Get the row's metadata.
","source":"packages/bigtable/src/row.js#L713","resources":[],"examples":[{"code":"row.getMetadata(function(err, metadata, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"row.getMetadata().then(function(data) {\n var metadata = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"options","description":"false
it will not decode Buffer values returned from Bigtable. Default: true.Increment a specific column within the row. If the column does not exist, it is automatically initialized to 0 before being incremented.
","source":"packages/bigtable/src/row.js#L768","resources":[],"examples":[{"code":"var callback = function(err, value, apiResponse) {\n if (!err) {\n // `value` is the value of the updated column.\n }\n};\n\nrow.increment('follows:gwashington', callback);"},{"caption":"Specify a custom amount to increment the column by.
","code":"row.increment('follows:gwashington', 2, callback);"},{"caption":"To decrement a column, simply supply a negative value.
","code":"row.increment('follows:gwashington', -1, callback);"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"row.increment('follows:gwashington').then(function(data) {\n var value = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"column","description":"Update the row cells.
","source":"packages/bigtable/src/row.js#L834","resources":[],"examples":[{"caption":"Update a single cell.
","code":"var callback = function(err, apiResponse) {\n if (!err) {\n // The row has been successfully updated.\n }\n};\n\nrow.save('follows:jadams', 1, callback);"},{"caption":"Or update several cells at once.
","code":"row.save({\n follows: {\n jadams: 1,\n wmckinley: 1\n }\n}, callback);"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"row.save('follows:jadams', 1).then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[{"name":"key","description":"\n This class allows you interact with Cloud Bigtable.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/bigtable
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
Create a Table object to interact with a Cloud Bigtable table.
","source":"packages/bigtable/src/table.js#L70","resources":[],"examples":[{"code":"var instance = bigtable.instance('my-instance');\nvar table = instance.table('prezzy');"}],"params":[{"name":"name","description":"Create a table.
","source":"packages/bigtable/src/table.js#L95","resources":[],"examples":[{"code":"table.create(function(err, table, apiResponse) {\n if (!err) {\n // The table was created successfully.\n }\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"table.create().then(function(data) {\n var table = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"options","description":" ","types":["object"],"optional":true,"nullable":false}],"exceptions":[],"returns":[]},{"id":"delete","name":"delete","type":"instance","description":"Delete the table.
","source":"packages/bigtable/src/table.js#L115","resources":[],"examples":[{"code":"table.delete(function(err, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"table.delete().then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[{"name":"callback","description":"Check if a table exists.
","source":"packages/bigtable/src/table.js#L143","resources":[],"examples":[{"code":"table.exists(function(err, exists) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"table.exists().then(function(data) {\n var exists = data[0];\n});"}],"params":[{"name":"callback","description":"Get a table if it exists.
You may optionally use this to "get or create" an object by providing an object with autoCreate
set to true
. Any extra configuration that is normally required for the create
method must be contained within this object as well.
If the callback is omitted, we'll return a Promise.
","code":"table.get().then(function(data) {\n var table = data[0];\n var apiResponse = data[0];\n});"}],"params":[{"name":"options","description":"false
Create a column family.
Optionally you can send garbage collection rules and when creating a family. Garbage collection executes opportunistically in the background, so it's possible for reads to return a cell even if it matches the active expression for its family.
","source":"packages/bigtable/src/table.js#L313","resources":[{"title":"Garbage Collection Proto Docs","link":"https://github.com/googleapis/googleapis/blob/master/google/bigtable/admin/table/v1/bigtable_table_data.proto#L59"}],"examples":[{"code":"var callback = function(err, family, apiResponse) {\n // `family` is a Family object\n};\n\nvar rule = {\n age: {\n seconds: 0,\n nanos: 5000\n },\n versions: 3,\n union: true\n};\n\ntable.createFamily('follows', rule, callback);"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"table.createFamily('follows').then(function(data) {\n var family = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"name","description":"If a name is not provided.
"}],"returns":[]},{"id":"createReadStream","name":"createReadStream","type":"instance","description":"Get bigtable/row objects for the rows currently in your table as a readable object stream.
","source":"packages/bigtable/src/table.js#L448","resources":[],"examples":[{"code":"table.createReadStream()\n .on('error', console.error)\n .on('data', function(row) {\n // `row` is a Row object.\n })\n .on('end', function() {\n // All rows retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing.
","code":"table.createReadStream()\n .on('data', function(row) {\n this.end();\n });"},{"caption":"Specify arbitrary keys for a non-contiguous set of rows. \nThe total size of the keys must remain under 1MB, after encoding.
","code":"table.createReadStream({\n keys: [\n 'alincoln',\n 'gwashington'\n ]\n});"},{"caption":"Scan for row keys that contain a specific prefix.
","code":"table.createReadStream({\n prefix: 'gwash'\n});"},{"caption":"Specify a contiguous range of rows to read by supplying start
and end
\nkeys. \nIf the start
key is omitted, it is interpreted as an empty string. \nIf the end
key is omitted, it is interpreted as infinity.
Specify multiple ranges.
","code":"table.createReadStream({\n ranges: [{\n start: 'alincoln',\n end: 'gwashington'\n }, {\n start: 'tjefferson',\n end: 'jadams'\n }]\n});"},{"caption":"Apply a bigtable/filter to the contents of the specified rows.
","code":"table.createReadStream({\n filter: [\n {\n column: 'gwashington'\n }, {\n value: 1\n }\n ]\n});"}],"params":[{"name":"options","description":"false
it will not decode Buffer values returned from Bigtable. Default: true.Delete all rows in the table, optionally corresponding to a particular prefix.
","source":"packages/bigtable/src/table.js#L554","resources":[],"examples":[{"caption":"You can supply a prefix to delete all corresponding rows.
","code":"var callback = function(err, apiResponse) {\n if (!err) {\n // Rows successfully deleted.\n }\n};\n\ntable.deleteRows({\n prefix: 'alincoln'\n}, callback);"},{"caption":"If you choose to omit the prefix, all rows in the table will be deleted.
","code":"table.deleteRows(callback);"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"table.deleteRows().then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[{"name":"options","description":"Get a reference to a Table Family.
","source":"packages/bigtable/src/table.js#L589","resources":[],"examples":[{"code":"var family = table.family('my-family');"}],"params":[{"name":"name","description":"If a name is not provided.
"}],"returns":[{"types":["bigtable/family"],"description":""}]},{"id":"getFamilies","name":"getFamilies","type":"instance","description":"Get Family objects for all the column familes in your table.
","source":"packages/bigtable/src/table.js#L618","resources":[],"examples":[{"code":"table.getFamilies(function(err, families, apiResponse) {\n // `families` is an array of Family objects.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"table.getFamilies().then(function(data) {\n var families = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"Get the table's metadata.
","source":"packages/bigtable/src/table.js#L659","resources":[],"examples":[{"code":"table.getMetadata(function(err, metadata, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"table.getMetadata().then(function(data) {\n var metadata = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"options","description":"Get bigtable/row objects for the rows currently in your table.
This method is not recommended for large datasets as it will buffer all rows before returning the results. Instead we recommend using the streaming API via bigtable/table#createReadStream.
","source":"packages/bigtable/src/table.js#L715","resources":[],"examples":[{"code":"table.getRows(function(err, rows) {\n if (!err) {\n // `rows` is an array of Row objects.\n }\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"table.getRows().then(function(data) {\n var rows = data[0];\n});"}],"params":[{"name":"options","description":"Insert or update rows in your table. It should be noted that gRPC only allows you to send payloads that are less than or equal to 4MB. If you're inserting more than that you may need to send smaller individual requests.
","source":"packages/bigtable/src/table.js#L797","resources":[],"examples":[{"code":"var callback = function(err) {\n if (err) {\n // An API error or partial failure occurred.\n\n if (err.name === 'PartialFailureError') {\n // err.errors[].code = 'Response code'\n // err.errors[].message = 'Error message'\n // err.errors[].entry = The original entry\n }\n }\n};\n\nvar entries = [\n {\n key: 'alincoln',\n data: {\n follows: {\n gwashington: 1\n }\n }\n }\n];\n\ntable.insert(entries, callback);"},{"caption":"By default whenever you insert new data, the server will capture a \ntimestamp of when your data was inserted. It's possible to provide a \ndate object to be used instead.
","code":"var entries = [\n {\n key: 'gwashington',\n data: {\n follows: {\n jadams: {\n value: 1,\n timestamp: new Date('March 22, 2016')\n }\n }\n }\n }\n];\n\ntable.insert(entries, callback);"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"table.insert(entries).then(function() {\n // All requested inserts have been processed.\n});\n//-"}],"params":[{"name":"entries","description":"Apply a set of changes to be atomically applied to the specified row(s). Mutations are applied in order, meaning that earlier mutations can be masked by later ones.
","source":"packages/bigtable/src/table.js#L904","resources":[],"examples":[{"caption":"Insert entities. See bigtable/table#insert.
","code":"var callback = function(err) {\n if (err) {\n // An API error or partial failure occurred.\n\n if (err.name === 'PartialFailureError') {\n // err.errors[].code = 'Response code'\n // err.errors[].message = 'Error message'\n // err.errors[].entry = The original entry\n }\n }\n};\n\nvar entries = [\n {\n method: 'insert',\n key: 'gwashington',\n data: {\n follows: {\n jadams: 1\n }\n }\n }\n];\n\ntable.mutate(entries, callback);"},{"caption":"Delete entities. See bigtable/row#deleteCells.
","code":"var entries = [\n {\n method: 'delete',\n key: 'gwashington'\n }\n];\n\ntable.mutate(entries, callback);"},{"caption":"Delete specific columns within a row.
","code":"var entries = [\n {\n method: 'delete',\n key: 'gwashington',\n data: [\n 'follows:jadams'\n ]\n }\n];\n\ntable.mutate(entries, callback);"},{"caption":"Mix and match mutations. This must contain at least one entry and at \nmost 100,000.
","code":"var entries = [\n {\n method: 'insert',\n key: 'alincoln',\n data: {\n follows: {\n gwashington: 1\n }\n }\n }, {\n method: 'delete',\n key: 'jadams',\n data: [\n 'follows:gwashington'\n ]\n }\n];\n\ntable.mutate(entries, callback);"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"table.mutate(entries).then(function() {\n // All requested mutations have been processed.\n});"}],"params":[{"name":"entries","description":"Get a reference to a table row.
","source":"packages/bigtable/src/table.js#L959","resources":[],"examples":[{"code":"var row = table.row('lincoln');"}],"params":[{"name":"key","description":"If a key is not provided.
"}],"returns":[{"types":["bigtable/row"],"description":""}]},{"id":"sampleRowKeys","name":"sampleRowKeys","type":"instance","description":"Returns a sample of row keys in the table. The returned row keys will delimit contigous sections of the table of approximately equal size, which can be used to break up the data for distributed tasks like mapreduces.
","source":"packages/bigtable/src/table.js#L994","resources":[],"examples":[{"code":"table.sampleRowKeys(function(err, keys) {\n // keys = [\n // {\n // key: '',\n // offset: '805306368'\n // },\n // ...\n // ]\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"table.sampleRowKeys().then(function(data) {\n var keys = data[0];\n});"}],"params":[{"name":"callback","description":"Returns a sample of row keys in the table as a readable object stream.
See bigtable/table#sampleRowKeys for more details.
","source":"packages/bigtable/src/table.js#L1025","resources":[],"examples":[{"code":"table.sampleRowKeysStream()\n .on('error', console.error)\n .on('data', function(key) {\n // Do something with the `key` object.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing.
","code":"table.sampleRowKeysStream()\n .on('data', function(key) {\n this.end();\n });"}],"params":[],"exceptions":[],"returns":[{"types":["stream"],"description":""}]}],"path":"table.json"} \ No newline at end of file diff --git a/json/google-cloud/v0.51.1/compute/address.json b/json/google-cloud/v0.51.1/compute/address.json new file mode 100644 index 00000000000..8d8e7552bb1 --- /dev/null +++ b/json/google-cloud/v0.51.1/compute/address.json @@ -0,0 +1 @@ +{"id":"compute/address","type":"class","name":"Address","overview":"\n This class allows you interact with Compute Engine.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/compute
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
An Address object allows you to interact with a Google Compute Engine address.
","source":"packages/compute/src/address.js#L46","resources":[{"title":"Instances and Networks","link":"https://cloud.google.com/compute/docs/instances-and-network"},{"title":"Address Resource","link":"https://cloud.google.com/compute/docs/reference/v1/addresses"}],"examples":[{"code":"var region = gce.region('region-name');\n\nvar address = region.address('address1');"}],"params":[],"exceptions":[],"returns":[]},{"id":"create","name":"create","type":"instance","description":"Create an address.
","source":"packages/compute/src/address.js#L70","resources":[],"examples":[{"code":"address.create(function(err, address, operation, apiResponse) {\n // `address` is an Address object.\n\n // `operation` is an Operation object that can be used to check the\n // of the request.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"address.create().then(function(data) {\n var address = data[0];\n var operation = data[1];\n var apiResponse = data[2];\n});"}],"params":[{"name":"options","description":" ","types":["object"],"optional":true,"nullable":false}],"exceptions":[],"returns":[]},{"id":"exists","name":"exists","type":"instance","description":"Check if the address exists.
","source":"packages/compute/src/address.js#L90","resources":[],"examples":[{"code":"address.exists(function(err, exists) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"address.exists().then(function(data) {\n var exists = data[0];\n});"}],"params":[{"name":"callback","description":"Get an address if it exists.
You may optionally use this to "get or create" an object by providing an object with autoCreate
set to true
. Any extra configuration that is normally required for the create
method must be contained within this object as well.
If the callback is omitted, we'll return a Promise.
","code":"address.get().then(function(data) {\n var address = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"options","description":"false
Get the metadata of this address.
","source":"packages/compute/src/address.js#L142","resources":[{"title":"Address Resource","link":"https://cloud.google.com/compute/docs/reference/v1/addresses"},{"title":"Addresses: get API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/addresses/get"}],"examples":[{"code":"address.getMetadata(function(err, metadata, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"address.getMetadata().then(function(data) {\n var metadata = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"Delete the address.
","source":"packages/compute/src/address.js#L184","resources":[{"title":"Addresses: delete API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/addresses/delete"}],"examples":[{"code":"address.delete(function(err, operation, apiResponse) {\n // `operation` is an Operation object that can be used to check the status\n // of the request.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"address.delete().then(function(data) {\n var operation = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"\n This class allows you interact with Compute Engine.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/compute
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
Autoscalers allow you to automatically scale virtual machine instances in managed instance groups according to an autoscaling policy that you define.
","source":"packages/compute/src/autoscaler.js#L45","resources":[{"title":"Autoscaling Groups of Instances","link":"https://cloud.google.com/compute/docs/autoscaler"}],"examples":[{"code":"var zone = gce.zone('us-central1-a');\n\nvar autoscaler = zone.autoscaler('autoscaler-name');"}],"params":[],"exceptions":[],"returns":[]},{"id":"create","name":"create","type":"instance","description":"Create an autoscaler.
","source":"packages/compute/src/autoscaler.js#L80","resources":[],"examples":[{"code":"var config = {\n coolDown: 30,\n cpu: 80,\n loadBalance: 40,\n maxReplicas: 5,\n minReplicas: 0,\n target: 'instance-group-manager-1'\n};\n\nvar callback = function(err, autoscaler, operation, apiResponse) {\n // `autoscaler` is an Autoscaler object.\n\n // `operation` is an Operation object that can be used to check the\n // of the request.\n};\n\nautoscaler.create(config, callback);"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"autoscaler.create(config).then(function(data) {\n var autoscaler = data[0];\n var operation = data[1];\n var apiResponse = data[2];\n});"}],"params":[{"name":"config","description":" ","types":["object"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]},{"id":"exists","name":"exists","type":"instance","description":"Check if the autoscaler exists.
","source":"packages/compute/src/autoscaler.js#L100","resources":[],"examples":[{"code":"autoscaler.exists(function(err, exists) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"autoscaler.exists().then(function(data) {\n var exists = data[0];\n});"}],"params":[{"name":"callback","description":"Get an autoscaler if it exists.
You may optionally use this to "get or create" an object by providing an object with autoCreate
set to true
. Any extra configuration that is normally required for the create
method must be contained within this object as well.
If the callback is omitted, we'll return a Promise.
","code":"autoscaler.get().then(function(data) {\n var autoscaler = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"options","description":"false
Get the metadata of this autoscaler.
","source":"packages/compute/src/autoscaler.js#L152","resources":[{"title":"Autoscaler Resource","link":"https://cloud.google.com/compute/docs/reference/v1/autoscalers"},{"title":"Autoscalers: get API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/autoscalers/get"}],"examples":[{"code":"autoscaler.getMetadata(function(err, metadata, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"autoscaler.getMetadata().then(function(data) {\n var metadata = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"Delete the autoscaler.
","source":"packages/compute/src/autoscaler.js#L194","resources":[{"title":"Autoscalers: delete API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/autoscalers/delete"}],"examples":[{"code":"autoscaler.delete(function(err, operation, apiResponse) {\n // `operation` is an Operation object that can be used to check the status\n // of the request.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"autoscaler.delete().then(function(data) {\n var operation = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"Set the autoscaler's metadata.
","source":"packages/compute/src/autoscaler.js#L243","resources":[{"title":"Autoscaler Resource","link":"https://cloud.google.com/compute/docs/reference/v1/autoscalers"}],"examples":[{"code":"var metadata = {\n description: 'New description'\n};\n\nautoscaler.setMetadata(metadata, function(err, operation, apiResponse) {\n // `operation` is an Operation object that can be used to check the status\n // of the request.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"autoscaler.setMetadata(metadata).then(function(data) {\n var operation = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"metadata","description":"\n This class allows you interact with Compute Engine.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/compute
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
A Disk object allows you to interact with a Google Compute Engine disk.
","source":"packages/compute/src/disk.js#L54","resources":[{"title":"Disks Overview","link":"https://cloud.google.com/compute/docs/disks"},{"title":"Disk Resource","link":"https://cloud.google.com/compute/docs/reference/v1/disks"}],"examples":[{"code":"var zone = gce.zone('zone-name');\n\nvar disk = zone.disk('disk1');"}],"params":[],"exceptions":[],"returns":[]},{"id":"create","name":"create","type":"instance","description":"Create a persistent disk.
","source":"packages/compute/src/disk.js#L82","resources":[],"examples":[{"code":"var config = {\n // ...\n};\n\ndisk.create(config, function(err, disk, operation, apiResponse) {\n // `disk` is a Disk object.\n\n // `operation` is an Operation object that can be used to check the\n // status of the request.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"disk.create(config).then(function(data) {\n var disk = data[0];\n var operation = data[1];\n var apiResponse = data[2];\n});"}],"params":[{"name":"config","description":" ","types":["object"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]},{"id":"exists","name":"exists","type":"instance","description":"Check if the disk exists.
","source":"packages/compute/src/disk.js#L102","resources":[],"examples":[{"code":"disk.exists(function(err, exists) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"disk.exists().then(function(data) {\n var exists = data[0];\n});"}],"params":[{"name":"callback","description":"Get a disk if it exists.
You may optionally use this to "get or create" an object by providing an object with autoCreate
set to true
. Any extra configuration that is normally required for the create
method must be contained within this object as well.
If the callback is omitted, we'll return a Promise.
","code":"disk.get().then(function(data) {\n var disk = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"options","description":"false
Get the disk's metadata.
","source":"packages/compute/src/disk.js#L154","resources":[{"title":"Disk Resource","link":"https://cloud.google.com/compute/docs/reference/v1/disks"},{"title":"Disks: get API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/disks/get"}],"examples":[{"code":"disk.getMetadata(function(err, metadata, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"disk.getMetadata().then(function(data) {\n var metadata = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"Create a snapshot of a disk.
","source":"packages/compute/src/disk.js#L227","resources":[{"title":"Snapshots Overview","link":"https://cloud.google.com/compute/docs/disks/persistent-disks#snapshots"},{"title":"Disks: createSnapshot API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/disks/createSnapshot"}],"examples":[{"code":"function callback(err, snapshot, operation, apiResponse) {\n // `snapshot` is a Snapshot object.\n\n // `operation` is an Operation object that can be used to check the status\n // of the request.\n}\n\ndisk.createSnapshot('new-snapshot-name', callback);"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"disk.createSnapshot('new-snapshot-name').then(function(data) {\n var snapshot = data[0];\n var operation = data[1];\n var apiResponse = data[2];\n});"}],"params":[{"name":"name","description":"Delete the disk.
","source":"packages/compute/src/disk.js#L282","resources":[{"title":"Disks: delete API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/disks/delete"}],"examples":[{"code":"disk.delete(function(err, operation, apiResponse) {\n // `operation` is an Operation object that can be used to check the status\n // of the request.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"disk.delete().then(function(data) {\n var operation = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"Get a reference to a snapshot from this disk.
","source":"packages/compute/src/disk.js#L311","resources":[{"title":"Snapshots Overview","link":"https://cloud.google.com/compute/docs/disks/persistent-disks#snapshots"}],"examples":[{"code":"var snapshot = disk.snapshot('snapshot-name');"}],"params":[{"name":"name","description":"\n This class allows you interact with Compute Engine.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/compute
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
A Firewall object allows you to interact with a Google Compute Engine firewall.
","source":"packages/compute/src/firewall.js#L44","resources":[{"title":"Firewalls Overview","link":"https://cloud.google.com/compute/docs/networking#firewalls"},{"title":"Firewall Resource","link":"https://cloud.google.com/compute/docs/reference/v1/firewalls"}],"examples":[{"code":"var firewall = gce.firewall('tcp-3000');"}],"params":[],"exceptions":[],"returns":[]},{"id":"create","name":"create","type":"instance","description":"Create a firewall.
","source":"packages/compute/src/firewall.js#L72","resources":[],"examples":[{"code":"var config = {\n // ...\n};\n\nfirewall.create(config, function(err, firewall, operation, apiResponse) {\n // `firewall` is a Firewall object.\n\n // `operation` is an Operation object that can be used to check the\n // status of the request.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"firewall.create(config).then(function(data) {\n var firewall = data[0];\n var operation = data[1];\n var apiResponse = data[2];\n});"}],"params":[{"name":"config","description":" ","types":["object"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]},{"id":"exists","name":"exists","type":"instance","description":"Check if the firewall exists.
","source":"packages/compute/src/firewall.js#L92","resources":[],"examples":[{"code":"firewall.exists(function(err, exists) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"firewall.exists().then(function(data) {\n var exists = data[0];\n});"}],"params":[{"name":"callback","description":"Get a firewall if it exists.
You may optionally use this to "get or create" an object by providing an object with autoCreate
set to true
. Any extra configuration that is normally required for the create
method must be contained within this object as well.
If the callback is omitted, we'll return a Promise.
","code":"firewall.get().then(function(data) {\n var firewall = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"options","description":"false
Get the firewall's metadata.
","source":"packages/compute/src/firewall.js#L144","resources":[{"title":"Firewalls: get API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/firewalls/get"},{"title":"Firewall Resource","link":"https://cloud.google.com/compute/docs/reference/v1/firewalls"}],"examples":[{"code":"firewall.getMetadata(function(err, metadata, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"firewall.getMetadata().then(function(data) {\n var metadata = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"Delete the firewall.
","source":"packages/compute/src/firewall.js#L187","resources":[{"title":"Firewalls: delete API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/firewalls/delete"}],"examples":[{"code":"firewall.delete(function(err, operation, apiResponse) {\n // `operation` is an Operation object that can be used to check the status\n // of the request.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"firewall.delete().then(function(data) {\n var operation = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"Set the firewall's metadata.
","source":"packages/compute/src/firewall.js#L236","resources":[{"title":"Firewall Resource","link":"https://cloud.google.com/compute/docs/reference/v1/firewalls"}],"examples":[{"code":"var metadata = {\n description: 'New description'\n};\n\nfirewall.setMetadata(metadata, function(err, operation, apiResponse) {\n // `operation` is an Operation object that can be used to check the status\n // of the request.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"firewall.setMetadata(metadata).then(function(data) {\n var operation = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"metadata","description":"\n This class allows you interact with Compute Engine.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/compute
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
Health checks ensure that Compute Engine forwards new connections only to instances that are up and ready to receive them. Compute Engine sends health check requests to each instance at the specified frequency; once an instance exceeds its allowed number of health check failures, it is no longer considered an eligible instance for receiving new traffic.
","source":"packages/compute/src/health-check.js#L52","resources":[{"title":"Health Checks Overview","link":"https://cloud.google.com/compute/docs/load-balancing/health-checks"}],"examples":[{"code":"var healthCheck = gce.healthCheck('health-check-name');"}],"params":[],"exceptions":[],"returns":[]},{"id":"create","name":"create","type":"instance","description":"Create an HTTP or HTTPS health check.
","source":"packages/compute/src/health-check.js#L76","resources":[],"examples":[{"code":"healthCheck.create(function(err, healthCheck, operation, apiResponse) {\n // `healthCheck` is a HealthCheck object.\n\n // `operation` is an Operation object that can be used to check the\n // status of the request.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"healthCheck.create().then(function(data) {\n var healthCheck = data[0];\n var operation = data[1];\n var apiResponse = data[2];\n});"}],"params":[{"name":"options","description":" ","types":["object"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]},{"id":"exists","name":"exists","type":"instance","description":"Check if the health check exists.
","source":"packages/compute/src/health-check.js#L97","resources":[],"examples":[{"code":"healthCheck.exists(function(err, exists) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"healthCheck.exists().then(function(data) {\n var exists = data[0];\n});"}],"params":[{"name":"callback","description":"Get the health check if it exists.
You may optionally use this to "get or create" an object by providing an object with autoCreate
set to true
. Any extra configuration that is normally required for the create
method must be contained within this object as well.
If the callback is omitted, we'll return a Promise.
","code":"healthCheck.get().then(function(data) {\n var healthCheck = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"options","description":"false
Get the health check's metadata.
","source":"packages/compute/src/health-check.js#L151","resources":[{"title":"HttpHealthChecks: get API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/httpHealthChecks/get"},{},{"title":"HttpsHealthChecks: get API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/httpsHealthChecks/get"},{}],"examples":[{"code":"healthCheck.getMetadata(function(err, metadata, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"healthCheck.getMetadata().then(function(data) {\n var metadata = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"Delete the health check.
","source":"packages/compute/src/health-check.js#L205","resources":[{"title":"HttpHealthCheck: delete API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/httpHealthChecks/delete"},{"title":"HttpsHealthCheck: delete API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/httpsHealthChecks/delete"}],"examples":[{"code":"healthCheck.delete(function(err, operation, apiResponse) {\n // `operation` is an Operation object that can be used to check the status\n // of the request.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"healthCheck.delete().then(function(data) {\n var operation = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"Set the health check's metadata.
","source":"packages/compute/src/health-check.js#L256","resources":[{"title":"HttpHealthCheck: insert API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/httpHealthChecks/insert"},{"title":"HttpsHealthCheck: insert API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/httpsHealthChecks/insert"}],"examples":[{"code":"var metadata = {\n description: 'New description'\n};\n\nhealthCheck.setMetadata(metadata, function(err, operation, apiResponse) {\n // `operation` is an Operation object that can be used to check the status\n // of the request.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"healthCheck.setMetadata(metadata).then(function(data) {\n var operation = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"metadata","description":" ","types":["object"],"optional":false,"nullable":false},{"name":"callback","description":"\n This class allows you interact with Compute Engine.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/compute
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
Create a firewall.
","source":"packages/compute/src/index.js#L166","resources":[{"title":"Firewalls Overview","link":"https://cloud.google.com/compute/docs/networking#firewalls"},{"title":"Firewalls: insert API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/firewalls/insert"}],"examples":[{"code":"var config = {\n protocols: {\n tcp: [3000],\n udp: [] // An empty array means all ports are allowed.\n },\n\n ranges: ['0.0.0.0/0']\n};\n\nfunction callback(err, firewall, operation, apiResponse) {\n // `firewall` is a Firewall object.\n\n // `operation` is an Operation object that can be used to check the status\n // of the request.\n}\n\ngce.createFirewall('new-firewall-name', config, callback);"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"gce.createFirewall('new-firewall-name', config).then(function(data) {\n var firewall = data[0];\n var operation = data[1];\n var apiResponse = data[2];\n});"}],"params":[{"name":"name","description":"tcp
, udp
) and the value for the key are the ports/port-ranges that are allowed to make a connection. If a true
value, that means all ports on that protocol will be opened. If false
, all traffic on that protocol will be blocked.if a name is not provided.
"},{"type":"Error","description":"if a config object is not provided.
"}],"returns":[]},{"id":"createHealthCheck","name":"createHealthCheck","type":"instance","description":"Create an HTTP or HTTPS health check.
","source":"packages/compute/src/index.js#L280","resources":[{"title":"Health Checks Overview","link":"https://cloud.google.com/compute/docs/load-balancing/health-checks"},{"title":"HttpHealthCheck: insert API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/httpHealthChecks/insert"},{"title":"HttpsHealthCheck: insert API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/httpsHealthChecks/insert"}],"examples":[{"code":"function callback(err, healthCheck, operation, apiResponse) {\n // `healthCheck` is a HealthCheck object.\n\n // `operation` is an Operation object that can be used to check the status\n // of network creation.\n}\n\ngce.createHealthCheck('new-health-check-name', callback);"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"gce.createHealthCheck('new-health-check-name').then(function(data) {\n var healthCheck = data[0];\n var operation = data[1];\n var apiResponse = data[2];\n});"}],"params":[{"name":"name","description":"false
.options.checkIntervalSec
)options.timeoutSec
)Create a network.
","source":"packages/compute/src/index.js#L376","resources":[{"title":"Networks Overview","link":"https://cloud.google.com/compute/docs/networking#networks"},{"title":"Networks: insert API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/networks/insert"}],"examples":[{"code":"var config = {\n range: '10.240.0.0/16'\n};\n\nfunction callback(err, network, operation, apiResponse) {\n // `network` is a Network object.\n\n // `operation` is an Operation object that can be used to check the status\n // of network creation.\n}\n\ngce.createNetwork('new-network', config, callback);"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"gce.createNetwork('new-network', config).then(function(data) {\n var network = data[0];\n var operation = data[1];\n var apiResponse = data[2];\n});"}],"params":[{"name":"name","description":"config.gatewayIPv4
)config.IPv4Range
)Create a global forwarding rule.
","source":"packages/compute/src/index.js#L470","resources":[{"title":"GlobalForwardingRule Resource","link":"https://cloud.google.com/compute/docs/reference/v1/globalForwardingRules#resource"},{"title":"GlobalForwardingRules: insert API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/globalForwardingRules/insert"}],"examples":[{"code":"var name = 'new-rule-name';\n\nvar config = {\n target: 'global/targetHttpProxies/my-proxy',\n range: '8080-8089'\n};\n\ngce.createRule(name, config, function (err, rule, operation, apiResponse) {\n // `rule` is a Rule object.\n\n // `operation` is an Operation object that can be used to check the status\n // of the request.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"gce.createRule(name, config).then(function(data) {\n var rule = data[0];\n var operation = data[1];\n var apiResponse = data[2];\n});"}],"params":[{"name":"name","description":"config.IPAddress
)AH
, ESP
, SCTP
, TCP
, UDP
. Default: TCP
. (Alias for config.IPProtocol
)config.portRange
)TargetHttpProxy
or TargetHttpsProxy
resource.Create a backend service.
","source":"packages/compute/src/index.js#L558","resources":[{"title":"Backend Services Overview","link":"https://cloud.google.com/compute/docs/load-balancing/http/backend-service"},{"title":"BackendServices: insert API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/backendServices/insert"}],"examples":[{"code":"var config = {\n backends: [\n {\n group: 'URL of an Instance Group resource'\n }\n ],\n healthChecks: [\n 'URL of an HTTP/HTTPS health check resource'\n ]\n};\n\nfunction callback(err, service, operation, apiResponse) {\n // `service` is a Service object.\n\n // `operation` is an Operation object that can be used to check the status\n // of network creation.\n}\n\ngce.createService('new-service', config, callback);"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"gce.createService('new-service', config).then(function(data) {\n var service = data[0];\n var operation = data[1];\n var apiResponse = data[2];\n});"}],"params":[{"name":"name","description":"Get a reference to a Google Compute Engine firewall.
See compute/network#firewall to get a Firewall object for a specific network.
","source":"packages/compute/src/index.js#L598","resources":[{"title":"Firewalls Overview","link":"https://cloud.google.com/compute/docs/networking#firewalls"}],"examples":[{"code":"var firewall = gce.firewall('firewall-name');"}],"params":[{"name":"name","description":"Get a list of addresses. For a detailed description of method's options see API reference.
","source":"packages/compute/src/index.js#L656","resources":[{"title":"Instances and Networks","link":"https://cloud.google.com/compute/docs/instances-and-network"},{"title":"Addresses: aggregatedList API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/addresses/aggregatedList"}],"examples":[{"code":"gce.getAddresses(function(err, addresses) {\n // addresses is an array of `Address` objects.\n});"},{"caption":"To control how many API requests are made and page through the results \nmanually, set autoPaginate
to false
.
If the callback is omitted, we'll return a Promise.
","code":"gce.getAddresses().then(function(data) {\n var addresses = data[0];\n});"}],"params":[{"name":"options","description":"{name} {comparison} {filterString}
.name
: the name of the field to comparecomparison
: the comparison operator, eq
(equal) or ne
(not equal)filterString
: the string to filter to. For string fields, this can be a regular expression.Get a list of compute/address objects as a readable object stream.
","source":"packages/compute/src/index.js#L728","resources":[],"examples":[{"code":"gce.getAddressesStream()\n .on('error', console.error)\n .on('data', function(address) {\n // `address` is an `Address` object.\n })\n .on('end', function() {\n // All addresses retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"gce.getAddressesStream()\n .on('data', function(address) {\n this.end();\n });"}],"params":[{"name":"options","description":"Get a list of autoscalers. For a detailed description of this method's options, see the API reference.
","source":"packages/compute/src/index.js#L786","resources":[{"title":"Managing Autoscalers","link":"https://cloud.google.com/compute/docs/autoscaler/managing-autoscalers"},{"title":"Understanding Autoscaler Decisions","link":"https://cloud.google.com/compute/docs/autoscaler/understanding-autoscaler-decisions"},{"title":"Autoscalers: aggregatedList API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/autoscalers/aggregatedList"}],"examples":[{"code":"gce.getAutoscalers(function(err, autoscalers) {\n // autoscalers is an array of `Autoscaler` objects.\n});"},{"caption":"To control how many API requests are made and page through the results \nmanually, set autoPaginate
to false
.
If the callback is omitted, we'll return a Promise.
","code":"gce.getAutoscalers().then(function(data) {\n var autoscalers = data[0];\n});"}],"params":[{"name":"options","description":"{name} {comparison} {filterString}
.name
: the name of the field to comparecomparison
: the comparison operator, eq
(equal) or ne
(not equal)filterString
: the string to filter to. For string fields, this can be a regular expression.Get a list of compute/autoscaler objects as a readable object stream.
","source":"packages/compute/src/index.js#L863","resources":[],"examples":[{"code":"gce.getAutoscalersStream()\n .on('error', console.error)\n .on('data', function(autoscaler) {\n // `autoscaler` is an `Autoscaler` object.\n })\n .on('end', function() {\n // All addresses retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"gce.getAutoscalersStream()\n .on('data', function(address) {\n this.end();\n });"}],"params":[{"name":"query","description":"Get a list of disks.
","source":"packages/compute/src/index.js#L919","resources":[{"title":"Disks Overview","link":"https://cloud.google.com/compute/docs/disks"},{"title":"Disks: aggregatedList API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/disks/aggregatedList"}],"examples":[{"code":"gce.getDisks(function(err, disks) {\n // `disks` is an array of `Disk` objects.\n});"},{"caption":"To control how many API requests are made and page through the results \nmanually, set autoPaginate
to false
.
If the callback is omitted, we'll return a Promise.
","code":"gce.getDisks().then(function(data) {\n var disks = data[0];\n});"}],"params":[{"name":"options","description":"{name} {comparison} {filterString}
.name
: the name of the field to comparecomparison
: the comparison operator, eq
(equal) or ne
(not equal)filterString
: the string to filter to. For string fields, this can be a regular expression.Get a list of compute/disk objects as a readable object stream.
","source":"packages/compute/src/index.js#L992","resources":[],"examples":[{"code":"gce.getDisksStream()\n .on('error', console.error)\n .on('data', function(disk) {\n // `disk` is a `Disk` object.\n })\n .on('end', function() {\n // All disks retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"gce.getDisksStream()\n .on('data', function(disk) {\n this.end();\n });"}],"params":[{"name":"options","description":"Get a list of instance groups.
","source":"packages/compute/src/index.js#L1048","resources":[{"title":"InstanceGroups Overview","link":"https://cloud.google.com/compute/docs/reference/v1/instanceGroups"},{"title":"InstanceGroups: aggregatedList API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/instanceGroups/aggregatedList"}],"examples":[{"code":"gce.getInstanceGroups(function(err, instanceGroups) {\n // `instanceGroups` is an array of `InstanceGroup` objects.\n});"},{"caption":"To control how many API requests are made and page through the results \nmanually, set autoPaginate
to false
.
If the callback is omitted, we'll return a Promise.
","code":"gce.getInstanceGroups().then(function(data) {\n var instanceGroups = data[0];\n});"}],"params":[{"name":"options","description":"{name} {comparison} {filterString}
.name
: the name of the field to comparecomparison
: the comparison operator, eq
(equal) or ne
(not equal)filterString
: the string to filter to. For string fields, this can be a regular expression.Get a list of compute/instanceGroup objects as a readable object stream.
","source":"packages/compute/src/index.js#L1122","resources":[],"examples":[{"code":"gce.getInstanceGroupsStream()\n .on('error', console.error)\n .on('data', function(instanceGroup) {\n // `instanceGroup` is an `InstanceGroup` object.\n })\n .on('end', function() {\n // All instance groups retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"gce.getInstanceGroupsStream()\n .on('data', function(instanceGroup) {\n this.end();\n });"}],"params":[{"name":"options","description":"Get a list of firewalls.
","source":"packages/compute/src/index.js#L1175","resources":[{"title":"Firewalls Overview","link":"https://cloud.google.com/compute/docs/networking#firewalls"},{"title":"Firewalls: list API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/firewalls/list"}],"examples":[{"code":"gce.getFirewalls(function(err, firewalls) {\n // `firewalls` is an array of `Firewall` objects.\n});"},{"caption":"To control how many API requests are made and page through the results \nmanually, set autoPaginate
to false
.
{name} {comparison} {filterString}
.name
: the name of the field to comparecomparison
: the comparison operator, eq
(equal) or ne
(not equal)filterString
: the string to filter to. For string fields, this can be a regular expression.Get a list of compute/firewall objects as a readable object stream.
","source":"packages/compute/src/index.js#L1239","resources":[],"examples":[{"code":"gce.getFirewallsStream()\n .on('error', console.error)\n .on('data', function(firewall) {\n // `firewall` is a `Firewall` object.\n })\n .on('end', function() {\n // All firewalls retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"gce.getFirewallsStream()\n .on('data', function(firewall) {\n this.end();\n });"}],"params":[{"name":"query","description":"Get a list of health checks.
","source":"packages/compute/src/index.js#L1295","resources":[{"title":"Health Checks Overview","link":"https://cloud.google.com/compute/docs/load-balancing/health-checks"},{"title":"HttpHealthCheck: list API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/httpHealthChecks/list"},{"title":"HttpsHealthCheck: list API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/httpsHealthChecks/list"}],"examples":[{"code":"gce.getHealthChecks(function(err, healthChecks) {\n // `healthChecks` is an array of `HealthCheck` objects.\n});"},{"caption":"To control how many API requests are made and page through the results \nmanually, set autoPaginate
to false
.
{name} {comparison} {filterString}
.name
: the name of the field to comparecomparison
: the comparison operator, eq
(equal) or ne
(not equal)filterString
: the string to filter to. For string fields, this can be a regular expression.false
.Get a list of compute/healthCheck objects as a readable object stream.
","source":"packages/compute/src/index.js#L1365","resources":[],"examples":[{"code":"gce.getHealthChecksStream()\n .on('error', console.error)\n .on('data', function(healthCheck) {\n // `healthCheck` is a `HealthCheck` object.\n })\n .on('end', function() {\n // All health checks retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"gce.getHealthChecksStream()\n .on('data', function(healthCheck) {\n this.end();\n });"}],"params":[{"name":"options","description":"Get a list of machine types in this project.
","source":"packages/compute/src/index.js#L1423","resources":[{"title":"MachineTypes: list API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/machineTypes/aggregatedList"},{"title":"Machine Types Overview","link":"https://cloud.google.com/compute/docs/machine-types"},{"title":"MachineType Resource","link":"https://cloud.google.com/compute/docs/reference/v1/machineTypes"}],"examples":[{"code":"gce.getMachineTypes(function(err, machineTypes) {\n // `machineTypes` is an array of `MachineType` objects.\n});"},{"caption":"To control how many API requests are made and page through the results \nmanually, set autoPaginate
to false
.
If the callback is omitted, we'll return a Promise.
","code":"gce.getMachineTypes().then(function(data) {\n var machineTypes = data[0];\n});"}],"params":[{"name":"options","description":"{name} {comparison} {filterString}
.name
: the name of the field to comparecomparison
: the comparison operator, eq
(equal) or ne
(not equal)filterString
: the string to filter to. For string fields, this can be a regular expression.Get a list of compute/machineType objects in this project as a readable object stream.
","source":"packages/compute/src/index.js#L1496","resources":[],"examples":[{"code":"gce.getMachineTypesStream()\n .on('error', console.error)\n .on('data', function(machineType) {\n // `machineType` is a `MachineType` object.\n })\n .on('end', function() {\n // All machine types retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"gce.getMachineTypesStream()\n .on('data', function(machineType) {\n this.end();\n });"}],"params":[{"name":"options","description":"Get a list of networks.
","source":"packages/compute/src/index.js#L1552","resources":[{"title":"Networks Overview","link":"https://cloud.google.com/compute/docs/networking#networks"},{"title":"Networks: list API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/networks/list"}],"examples":[{"code":"gce.getNetworks(function(err, networks) {\n // `networks` is an array of `Network` objects.\n});"},{"caption":"To control how many API requests are made and page through the results \nmanually, set autoPaginate
to false
.
If the callback is omitted, we'll return a Promise.
","code":"gce.getNetworks().then(function(data) {\n var networks = data[0];\n});"}],"params":[{"name":"options","description":"{name} {comparison} {filterString}
.name
: the name of the field to comparecomparison
: the comparison operator, eq
(equal) or ne
(not equal)filterString
: the string to filter to. For string fields, this can be a regular expression.Get a list of compute/network objects as a readable object stream.
","source":"packages/compute/src/index.js#L1615","resources":[],"examples":[{"code":"gce.getNetworksStream()\n .on('error', console.error)\n .on('data', function(network) {\n // `network` is a `Network` object.\n })\n .on('end', function() {\n // All networks retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"gce.getNetworksStream()\n .on('data', function(network) {\n this.end();\n });"}],"params":[{"name":"options","description":"Get a list of global operations.
","source":"packages/compute/src/index.js#L1670","resources":[{"title":"Global Operation Overview","link":"https://cloud.google.com/compute/docs/reference/v1/globalOperations"},{"title":"GlobalOperations: list API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/globalOperations/list"}],"examples":[{"code":"gce.getOperations(function(err, operations) {\n // `operations` is an array of `Operation` objects.\n});"},{"caption":"To control how many API requests are made and page through the results \nmanually, set autoPaginate
to false
.
If the callback is omitted, we'll return a Promise.
","code":"gce.getOperations().then(function(data) {\n var operations = data[0];\n});"}],"params":[{"name":"options","description":"{name} {comparison} {filterString}
.name
: the name of the field to comparecomparison
: the comparison operator, eq
(equal) or ne
(not equal)filterString
: the string to filter to. For string fields, this can be a regular expression.Get a list of global compute/operation objects as a readable object stream.
","source":"packages/compute/src/index.js#L1734","resources":[],"examples":[{"code":"gce.getOperationsStream()\n .on('error', console.error)\n .on('data', function(operation) {\n // `operation` is a `Operation` object.\n })\n .on('end', function() {\n // All operations retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"gce.getOperationsStream()\n .on('data', function(operation) {\n this.end();\n });"}],"params":[{"name":"options","description":"Return the regions available to your project.
","source":"packages/compute/src/index.js#L1790","resources":[{"title":"Regions & Zones Overview","link":"https://cloud.google.com/compute/docs/zones"},{"title":"Regions: list API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/regions/list"}],"examples":[{"code":"gce.getRegions(function(err, regions) {\n // `regions` is an array of `Region` objects.\n});"},{"caption":"To control how many API requests are made and page through the results \nmanually, set autoPaginate
to false
.
If the callback is omitted, we'll return a Promise.
","code":"gce.getRegions().then(function(data) {\n var regions = data[0];\n});"}],"params":[{"name":"options","description":"{name} {comparison} {filterString}
.name
: the name of the field to comparecomparison
: the comparison operator, eq
(equal) or ne
(not equal)filterString
: the string to filter to. For string fields, this can be a regular expression.Return the compute/region objects available to your project as a readable object stream.
","source":"packages/compute/src/index.js#L1852","resources":[],"examples":[{"code":"gce.getRegionsStream()\n .on('error', console.error)\n .on('data', function(region) {\n // `region` is a `Region` object.\n })\n .on('end', function() {\n // All regions retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"gce.getRegionsStream()\n .on('data', function(region) {\n this.end();\n });"}],"params":[{"name":"options","description":"Get a list of forwarding rules.
","source":"packages/compute/src/index.js#L1906","resources":[{"title":"GlobalForwardingRules: list API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/globalForwardingRules/list"}],"examples":[{"code":"gce.getRules(function(err, rules) {\n // `rules` is an array of `Rule` objects.\n});"},{"caption":"To control how many API requests are made and page through the results \nmanually, set autoPaginate
to false
.
If the callback is omitted, we'll return a Promise.
","code":"gce.getRules().then(function(data) {\n var rules = data[0];\n});"}],"params":[{"name":"options","description":"{name} {comparison} {filterString}
.name
: the name of the field to comparecomparison
: the comparison operator, eq
(equal) or ne
(not equal)filterString
: the string to filter to. For string fields, this can be a regular expression.Get a list of compute/rule objects as a readable object stream.
","source":"packages/compute/src/index.js#L1969","resources":[],"examples":[{"code":"gce.getRulesStream()\n .on('error', console.error)\n .on('data', function(rule) {\n // `rule` is a `Rule` object.\n })\n .on('end', function() {\n // All rules retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"gce.getRulesStream()\n .on('data', function(rule) {\n this.end();\n });"}],"params":[{"name":"options","description":"Get a list of backend services.
","source":"packages/compute/src/index.js#L2024","resources":[{"title":"Backend Services Overview","link":"https://cloud.google.com/compute/docs/load-balancing/http/backend-service"},{"title":"BackendServices: list API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/backendServices/list"}],"examples":[{"code":"gce.getServices(function(err, services) {\n // `services` is an array of `Service` objects.\n});"},{"caption":"To control how many API requests are made and page through the results \nmanually, set autoPaginate
to false
.
If the callback is omitted, we'll return a Promise.
","code":"gce.getServices().then(function(data) {\n var services = data[0];\n});"}],"params":[{"name":"options","description":"{name} {comparison} {filterString}
.name
: the name of the field to comparecomparison
: the comparison operator, eq
(equal) or ne
(not equal)filterString
: the string to filter to. For string fields, this can be a regular expression.Get a list of compute/service objects as a readable object stream.
","source":"packages/compute/src/index.js#L2087","resources":[],"examples":[{"code":"gce.getServicesStream()\n .on('error', console.error)\n .on('data', function(service) {\n // `service` is a `Service` object.\n })\n .on('end', function() {\n // All services retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"gce.getServicesStream()\n .on('data', function(service) {\n this.end();\n });"}],"params":[{"name":"options","description":"Get a list of snapshots.
","source":"packages/compute/src/index.js#L2142","resources":[{"title":"Snapshots Overview","link":"https://cloud.google.com/compute/docs/disks/persistent-disks#snapshots"},{"title":"Snapshots: list API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/snapshots/list"}],"examples":[{"code":"gce.getSnapshots(function(err, snapshots) {\n // `snapshots` is an array of `Snapshot` objects.\n});"},{"caption":"To control how many API requests are made and page through the results \nmanually, set autoPaginate
to false
.
If the callback is omitted, we'll return a Promise.
","code":"gce.getSnapshots().then(function(data) {\n var snapshots = data[0];\n});"}],"params":[{"name":"options","description":"{name} {comparison} {filterString}
.name
: the name of the field to comparecomparison
: the comparison operator, eq
(equal) or ne
(not equal)filterString
: the string to filter to. For string fields, this can be a regular expression.Get a list of compute/snapshot objects as a readable object stream.
","source":"packages/compute/src/index.js#L2205","resources":[],"examples":[{"code":"gce.getSnapshotsStream()\n .on('error', console.error)\n .on('data', function(snapshot) {\n // `snapshot` is a `Snapshot` object.\n })\n .on('end', function() {\n // All snapshots retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"gce.getSnapshotsStream()\n .on('data', function(snapshot) {\n this.end();\n });"}],"params":[{"name":"options","description":"Get a list of subnetworks in this project.
","source":"packages/compute/src/index.js#L2261","resources":[{"title":"Subnetworks Overview","link":"https://cloud.google.com/compute/docs/subnetworks"},{"title":"Subnetworks: list API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/subnetworks"}],"examples":[{"code":"gce.getSubnetworks(function(err, subnetworks) {\n // `subnetworks` is an array of `Subnetworks` objects.\n});"},{"caption":"To control how many API requests are made and page through the results \nmanually, set autoPaginate
to false
.
If the callback is omitted, we'll return a Promise.
","code":"gce.getSubnetworks().then(function(data) {\n var subnetworks = data[0];\n});"}],"params":[{"name":"options","description":"{name} {comparison} {filterString}
.name
: the name of the field to comparecomparison
: the comparison operator, eq
(equal) or ne
(not equal)filterString
: the string to filter to. For string fields, this can be a regular expression.Get a list of compute/subnetwork objects in this project as a readable object stream.
","source":"packages/compute/src/index.js#L2334","resources":[],"examples":[{"code":"gce.getSubnetworksStream()\n .on('error', console.error)\n .on('data', function(subnetwork) {\n // `subnetwork` is a `Subnetwork` object.\n })\n .on('end', function() {\n // All subnetworks retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"gce.getSubnetworksStream()\n .on('data', function(subnetwork) {\n this.end();\n });"}],"params":[{"name":"options","description":"Get a list of virtual machine instances.
","source":"packages/compute/src/index.js#L2389","resources":[{"title":"Instances and Networks","link":"https://cloud.google.com/compute/docs/instances-and-network"},{"title":"Instances: aggregatedList API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/instances/aggregatedList"}],"examples":[{"code":"gce.getVMs(function(err, vms) {\n // `vms` is an array of `VM` objects.\n});"},{"caption":"To control how many API requests are made and page through the results \nmanually, set autoPaginate
to false
.
If the callback is omitted, we'll return a Promise.
","code":"gce.getVMs().then(function(data) {\n var vms = data[0];\n});"}],"params":[{"name":"options","description":"{name} {comparison} {filterString}
.name
: the name of the field to comparecomparison
: the comparison operator, eq
(equal) or ne
(not equal)filterString
: the string to filter to. For string fields, this can be a regular expression.Get a list of compute/vm instances as a readable object stream.
","source":"packages/compute/src/index.js#L2461","resources":[],"examples":[{"code":"gce.getVMsStream()\n .on('error', console.error)\n .on('data', function(vm) {\n // `vm` is a `VM` object.\n })\n .on('end', function() {\n // All vms retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"gce.getVMsStream()\n .on('data', function(vm) {\n this.end();\n });"}],"params":[{"name":"options","description":"Return the zones available to your project.
","source":"packages/compute/src/index.js#L2516","resources":[{"title":"Regions & Zones Overview","link":"https://cloud.google.com/compute/docs/zones"},{"title":"Zones: list API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/zones/list"}],"examples":[{"code":"gce.getZones(function(err, zones) {\n // `zones` is an array of `Zone` objects.\n});"},{"caption":"To control how many API requests are made and page through the results \nmanually, set autoPaginate
to false
.
If the callback is omitted, we'll return a Promise.
","code":"gce.getZones().then(function(data) {\n var zones = data[0];\n});"}],"params":[{"name":"options","description":"{name} {comparison} {filterString}
.name
: the name of the field to comparecomparison
: the comparison operator, eq
(equal) or ne
(not equal)filterString
: the string to filter to. For string fields, this can be a regular expression.Return the compute/zone objects available to your project as a readable object stream.
","source":"packages/compute/src/index.js#L2578","resources":[],"examples":[{"code":"gce.getZonesStream()\n .on('error', console.error)\n .on('data', function(zone) {\n // `zone` is a `Zone` object.\n })\n .on('end', function() {\n // All zones retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"gce.getZonesStream()\n .on('data', function(zone) {\n this.end();\n });"}],"params":[{"name":"options","description":"Get a reference to a Google Compute Engine health check.
","source":"packages/compute/src/index.js#L2601","resources":[{"title":"Health Checks Overview","link":"https://cloud.google.com/compute/docs/load-balancing/health-checks"}],"examples":[{"code":"var healthCheck = gce.healthCheck('http-health-check-name');"},{"caption":"Access an HTTPS health check.
","code":"var httpsHealthCheck = gce.healthCheck('https-health-check-name', {\n https: true\n});"}],"params":[{"name":"name","description":"false
Get a reference to a Google Compute Engine network.
","source":"packages/compute/src/index.js#L2616","resources":[{"title":"Networks Overview","link":"https://cloud.google.com/compute/docs/networking#networks"}],"examples":[{"code":"var network = gce.network('network-name');"}],"params":[{"name":"name","description":"Get a reference to a global Google Compute Engine operation.
","source":"packages/compute/src/index.js#L2631","resources":[{"title":"Global Operation Overview","link":"https://cloud.google.com/compute/docs/reference/v1/globalOperations"}],"examples":[{"code":"var operation = gce.operation('operation-name');"}],"params":[{"name":"name","description":"Get a reference to a Google Compute Engine region.
","source":"packages/compute/src/index.js#L2646","resources":[{"title":"Regions & Zones Overview","link":"https://cloud.google.com/compute/docs/zones"}],"examples":[{"code":"var region = gce.region('region-name');"}],"params":[{"name":"name","description":"Get a reference to a Google Compute Engine forwading rule.
","source":"packages/compute/src/index.js#L2659","resources":[],"examples":[{"code":"var rule = gce.rule('rule-name');"}],"params":[{"name":"name","description":"Get a reference to a Google Compute Engine backend service.
","source":"packages/compute/src/index.js#L2674","resources":[{"title":"Backend Services Overview","link":"https://cloud.google.com/compute/docs/load-balancing/http/backend-service"}],"examples":[{"code":"var service = gce.service('service-name');"}],"params":[{"name":"name","description":"Get a reference to a Google Compute Engine snapshot.
","source":"packages/compute/src/index.js#L2689","resources":[{"title":"Snapshots Overview","link":"https://cloud.google.com/compute/docs/disks/persistent-disks#snapshots"}],"examples":[{"code":"var snapshot = gce.snapshot('snapshot-name');"}],"params":[{"name":"name","description":"Get a reference to a Google Compute Engine zone.
","source":"packages/compute/src/index.js#L2704","resources":[{"title":"Regions & Zones Overview","link":"https://cloud.google.com/compute/docs/zones"}],"examples":[{"code":"var zone = gce.zone('zone-name');"}],"params":[{"name":"name","description":"Register a single callback that will wait for an operation to finish before being executed.
","source":"packages/compute/src/index.js#L2716","resources":[],"examples":[],"params":[],"exceptions":[],"returns":[{"types":["function"],"description":"callback - The callback function.
"},{"types":["error"],"description":"callback.err - An error returned from the operation.
"},{"types":["object"],"description":"callback.apiResponse - The operation's final API response.
"}]}],"path":"index.json"} \ No newline at end of file diff --git a/json/google-cloud/v0.51.1/compute/instance-group.json b/json/google-cloud/v0.51.1/compute/instance-group.json new file mode 100644 index 00000000000..51d46d17266 --- /dev/null +++ b/json/google-cloud/v0.51.1/compute/instance-group.json @@ -0,0 +1 @@ +{"id":"compute/instance-group","type":"class","name":"InstanceGroup","overview":"\n This class allows you interact with Compute Engine.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/compute
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
You can create and manage groups of virtual machine instances so that you don't have to individually control each instance in your project.
","source":"packages/compute/src/instance-group.js#L50","resources":[{"title":"Creating Groups of Instances","link":"https://cloud.google.com/compute/docs/instance-groups"},{"title":"Unmanaged Instance Groups","link":"https://cloud.google.com/compute/docs/instance-groups/unmanaged-groups"}],"examples":[{"code":"var zone = gce.zone('us-central1-a');\n\nvar instanceGroup = zone.instanceGroup('web-servers');"}],"params":[],"exceptions":[],"returns":[]},{"id":"create","name":"create","type":"instance","description":"Create an instance group.
","source":"packages/compute/src/instance-group.js#L76","resources":[],"examples":[{"code":"function onCreated(err, instanceGroup, operation, apiResponse) {\n // `instanceGroup` is an InstanceGroup object.\n\n // `operation` is an Operation object that can be used to check the\n // status of the request.\n}\n\ninstanceGroup.create(onCreated);"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"instanceGroup.create().then(function(data) {\n var instanceGroup = data[0];\n var operation = data[1];\n var apiResponse = data[2];\n});"}],"params":[{"name":"options","description":" ","types":["object"],"optional":true,"nullable":false}],"exceptions":[],"returns":[]},{"id":"exists","name":"exists","type":"instance","description":"Check if the instance group exists.
","source":"packages/compute/src/instance-group.js#L97","resources":[],"examples":[{"code":"instanceGroup.exists(function(err, exists) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"instanceGroup.exists().then(function(data) {\n var exists = data[0];\n});"}],"params":[{"name":"callback","description":"Get an instance group if it exists.
You may optionally use this to "get or create" an object by providing an object with autoCreate
set to true
. Any extra configuration that is normally required for the create
method must be contained within this object as well.
If the callback is omitted, we'll return a Promise.
","code":"instanceGroup.get().then(function(data) {\n var instanceGroup = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"options","description":"false
Get the instance group's metadata.
","source":"packages/compute/src/instance-group.js#L149","resources":[{"title":"InstanceGroups: get API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/instanceGroups/get"},{"title":"InstanceGroups Resource","link":"https://cloud.google.com/compute/docs/reference/v1/instanceGroups"}],"examples":[{"code":"instanceGroup.getMetadata(function(err, metadata, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"instanceGroup.getMetadata().then(function(data) {\n var metadata = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"Add one or more VMs to this instance group.
","source":"packages/compute/src/instance-group.js#L216","resources":[{"title":"InstanceGroups: addInstances API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/instanceGroups/addInstances"}],"examples":[{"code":"var vms = [\n gce.zone('us-central1-a').vm('http-server'),\n gce.zone('us-central1-a').vm('https-server')\n];\n\ninstanceGroup.add(vms, function(err, operation, apiResponse) {\n // `operation` is an Operation object that can be used to check the status\n // of the request.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"instanceGroup.add(vms).then(function(data) {\n var operation = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"vms","description":"Delete the instance group.
","source":"packages/compute/src/instance-group.js#L267","resources":[{"title":"InstanceGroups: delete API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/instanceGroups/delete"}],"examples":[{"code":"instanceGroup.delete(function(err, operation, apiResponse) {\n // `operation` is an Operation object that can be used to check the status\n // of the request.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"instanceGroup.delete().then(function(data) {\n var operation = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"Get a list of VM instances in this instance group.
","source":"packages/compute/src/instance-group.js#L338","resources":[{"title":"InstaceGroups: listInstances API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/instanceGroups/listInstances"}],"examples":[{"code":"instanceGroup.getVMs(function(err, vms) {\n // `vms` is an array of `VM` objects.\n});"},{"caption":"To control how many API requests are made and page through the results \nmanually, set autoPaginate
to false
.
If the callback is omitted, we'll return a Promise.
","code":"instanceGroup.getVMs().then(function(data) {\n var vms = data[0];\n});"}],"params":[{"name":"options","description":"{name} {comparison} {filterString}
.name
: the name of the field to comparecomparison
: the comparison operator, eq
(equal) or ne
(not equal)filterString
: the string to filter to. For string fields, this can be a regular expression.Get a list of compute/vm instances in this instance group as a readable object stream.
","source":"packages/compute/src/instance-group.js#L412","resources":[],"examples":[{"code":"instanceGroup.getVMsStream()\n .on('error', console.error)\n .on('data', function(vm) {\n // `vm` is a `VM` object.\n })\n .on('end', function() {\n // All instances retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"instanceGroup.getVMsStream()\n .on('data', function(vm) {\n this.end();\n });"}],"params":[{"name":"options","description":"Remove one or more VMs from this instance group.
","source":"packages/compute/src/instance-group.js#L446","resources":[{"title":"InstanceGroups: removeInstances API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/instanceGroups/removeInstances"}],"examples":[{"code":"var vms = [\n gce.zone('us-central1-a').vm('http-server'),\n gce.zone('us-central1-a').vm('https-server')\n];\n\ninstanceGroup.remove(vms, function(err, operation, apiResponse) {\n // `operation` is an Operation object that can be used to check the status\n // of the request.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"instanceGroup.remove(vms).then(function(data) {\n var operation = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"vms","description":"Set the named ports for this instance group.
","source":"packages/compute/src/instance-group.js#L504","resources":[{"title":"InstanceGroups: setNamedPorts API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/instanceGroups/setNamedPorts"}],"examples":[{"code":"var ports = {\n http: 80,\n https: 443\n};\n\ninstanceGroup.setPorts(ports, function(err, operation, apiResponse) {\n // `operation` is an Operation object that can be used to check the status\n // of the request.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"instanceGroup.setPorts(ports).then(function(data) {\n var operation = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"ports","description":"\n This class allows you interact with Compute Engine.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/compute
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
A MachineType object allows you to interact with a Google Compute Engine machine type.
","source":"packages/compute/src/machine-type.js#L46","resources":[{"title":"Machine Types Overview","link":"https://cloud.google.com/compute/docs/machine-types"},{"title":"MachineType Resource","link":"https://cloud.google.com/compute/docs/reference/v1/machineTypes"}],"examples":[{"code":"var zone = gce.zone('us-central1-b');\n\nvar machineType = zone.machineType('g1-small');"}],"params":[],"exceptions":[],"returns":[]},{"id":"exists","name":"exists","type":"instance","description":"Check if the machine type exists.
","source":"packages/compute/src/machine-type.js#L67","resources":[],"examples":[{"code":"machineType.exists(function(err, exists) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"machineType.exists().then(function(data) {\n var exists = data[0];\n});"}],"params":[{"name":"callback","description":"Get a machine type if it exists.
","source":"packages/compute/src/machine-type.js#L85","resources":[],"examples":[{"code":"machineType.get(function(err, machineType, apiResponse) {\n // `machineType` is a MachineType object.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"machineType.get().then(function(data) {\n var machineType = data[0];\n var apiResponse = data[1];\n});"}],"params":[],"exceptions":[],"returns":[]},{"id":"getMetadata","name":"getMetadata","type":"instance","description":"Get the machine type's metadata.
","source":"packages/compute/src/machine-type.js#L110","resources":[{"title":"MachineTypes: get API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/machineTypes/get"},{"title":"MachineType Resource","link":"https://cloud.google.com/compute/docs/reference/v1/machineTypes"}],"examples":[{"code":"machineType.getMetadata(function(err, metadata, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"machineType.getMetadata().then(function(data) {\n var metadata = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"\n This class allows you interact with Compute Engine.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/compute
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
A Network object allows you to interact with a Google Compute Engine network.
","source":"packages/compute/src/network.js#L46","resources":[{"title":"Networks Overview","link":"https://cloud.google.com/compute/docs/networking#networks"},{"title":"Network Resource","link":"https://cloud.google.com/compute/docs/reference/v1/networks"}],"examples":[{"code":"var network = gce.network('network-name');"}],"params":[],"exceptions":[],"returns":[]},{"id":"create","name":"create","type":"instance","description":"Create a network.
","source":"packages/compute/src/network.js#L75","resources":[],"examples":[{"code":"var config = {\n // ...\n};\n\nnetwork.create(config, function(err, network, operation, apiResponse) {\n // `network` is a Network object.\n\n // `operation` is an Operation object that can be used to check the\n // status of network creation.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"network.create(config).then(function(data) {\n var network = data[0];\n var operation = data[1];\n var apiResponse = data[2];\n});"}],"params":[{"name":"config","description":" ","types":["object"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]},{"id":"exists","name":"exists","type":"instance","description":"Check if the network exists.
","source":"packages/compute/src/network.js#L95","resources":[],"examples":[{"code":"network.exists(function(err, exists) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"network.exists().then(function(data) {\n var exists = data[0];\n});"}],"params":[{"name":"callback","description":"Get a network if it exists.
You may optionally use this to "get or create" an object by providing an object with autoCreate
set to true
. Any extra configuration that is normally required for the create
method must be contained within this object as well.
If the callback is omitted, we'll return a Promise.
","code":"network.get().then(function(data) {\n var network = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"options","description":"false
Get the network's metadata.
","source":"packages/compute/src/network.js#L147","resources":[{"title":"Network Resource","link":"https://cloud.google.com/compute/docs/reference/v1/networks"},{"title":"Networks: get API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/networks/delete"}],"examples":[{"code":"network.getMetadata(function(err, metadata, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"network.getMetadata().then(function(data) {\n var metadata = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"Create a firewall for this network.
","source":"packages/compute/src/network.js#L233","resources":[{"title":"Firewalls Overview","link":"https://cloud.google.com/compute/docs/networking#firewalls"},{"title":"Firewalls: insert API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/firewalls/insert"}],"examples":[{"code":"var config = {\n protocols: {\n tcp: [3000],\n udp: [] // An empty array means all ports are allowed.\n },\n\n ranges: ['0.0.0.0/0']\n};\n\nfunction callback(err, firewall, operation, apiResponse) {\n // `firewall` is a Firewall object.\n\n // `operation` is an Operation object that can be used to check the status\n // of the request.\n}\n\nnetwork.createFirewall('new-firewall-name', config, callback);"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"network.createFirewall('new-firewall-name', config).then(function(data) {\n var firewall = data[0];\n var operation = data[1];\n var apiResponse = data[2];\n});"}],"params":[{"name":"name","description":"tcp
, udp
) and the value for the key are the ports/port-ranges that are allowed to make a connection.Create a subnetwork in this network.
","source":"packages/compute/src/network.js#L291","resources":[{"title":"Subnetwork Resource","link":"https://cloud.google.com/compute/docs/reference/v1/subnetworks#resource"},{"title":"Subnetwork: insert API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/subnetworks/insert"}],"examples":[{"code":"var region = gce.region('us-east1');\n\nvar config = {\n region: region,\n range: '10.0.1.0/24'\n};\n\nfunction callback(err, subnetwork, operation, apiResponse) {\n // `subnetwork` is a Subnetwork object.\n\n // `operation` is an Operation object that can be used to check the status\n // of the request.\n}\n\nnetwork.createSubnetwork('new-subnetwork-name', config, callback);"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"network.createSubnetwork('new-subnetwork-name', config).then(function(data) {\n var subnetwork = data[0];\n var operation = data[1];\n var apiResponse = data[2];\n});"}],"params":[{"name":"name","description":"config.ipCidrRange
)Get a list of subnetworks in this network.
","source":"packages/compute/src/network.js#L360","resources":[{"title":"Subnetworks Overview","link":"https://cloud.google.com/compute/docs/subnetworks"},{"title":"Subnetworks: list API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/subnetworks"}],"examples":[{"code":"network.getSubnetworks(function(err, subnetworks) {\n // `subnetworks` is an array of `Subnetworks` objects.\n});"},{"caption":"To control how many API requests are made and page through the results \nmanually, set autoPaginate
to false
.
If the callback is omitted, we'll return a Promise.
","code":"network.getSubnetworks().then(function(data) {\n var subnetworks = data[0];\n});"}],"params":[{"name":"options","description":"{name} {comparison} {filterString}
.name
: the name of the field to comparecomparison
: the comparison operator, eq
(equal) or ne
(not equal)filterString
: the string to filter to. For string fields, this can be a regular expression.Get a compute/subnetwork list within this network as a readable object stream.
","source":"packages/compute/src/network.js#L400","resources":[],"examples":[{"code":"network.getSubnetworksStream()\n .on('error', console.error)\n .on('data', function(subnetwork) {\n // `subnetwork` is a `Subnetwork` object.\n })\n .on('end', function() {\n // All subnetworks retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"network.getSubnetworksStream()\n .on('data', function(subnetwork) {\n this.end();\n });"}],"params":[{"name":"options","description":"Delete the network.
","source":"packages/compute/src/network.js#L433","resources":[{"title":"Networks: delete API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/networks/delete"}],"examples":[{"code":"network.delete(function(err, operation, apiResponse) {\n // `operation` is an Operation object that can be used to check the status\n // of the request.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"network.delete().then(function(data) {\n var operation = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"Get a reference to a Google Compute Engine firewall in this network.
","source":"packages/compute/src/network.js#L461","resources":[{"title":"Firewalls Overview","link":"https://cloud.google.com/compute/docs/networking#firewalls"}],"examples":[{"code":"var firewall = network.firewall('firewall-name');"}],"params":[{"name":"name","description":"Get a list of firewalls for this network.
","source":"packages/compute/src/network.js#L517","resources":[{"title":"Firewalls Overview","link":"https://cloud.google.com/compute/docs/networking#firewalls"},{"title":"Firewalls: list API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/firewalls/list"}],"examples":[{"code":"network.getFirewalls(function(err, firewalls) {\n // `firewalls` is an array of `Firewall` objects.\n});"},{"caption":"To control how many API requests are made and page through the results \nmanually, set autoPaginate
to false
.
If the callback is omitted, we'll return a Promise.
","code":"network.getFirewalls().then(function(data) {\n var firewalls = data[0];\n});"}],"params":[{"name":"options","description":"Get a list of compute/firewall objects for this network as a readable object stream.
","source":"packages/compute/src/network.js#L557","resources":[],"examples":[{"code":"network.getFirewallsStream()\n .on('error', console.error)\n .on('data', function(firewall) {\n // `firewall` is a `Firewall` object.\n })\n .on('end', function() {\n // All firewalls retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"network.getFirewallsStream()\n .on('data', function(firewall) {\n this.end();\n });"}],"params":[{"name":"options","description":"\n This class allows you interact with Compute Engine.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/compute
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
An Operation object allows you to interact with a Google Compute Engine operation.
An operation can be a GlobalOperation, RegionOperation, or ZoneOperation.
","source":"packages/compute/src/operation.js#L94","resources":[],"examples":[{"caption":"Reference a global operation.
","code":"var operation = gce.operation('operation-id');"},{"caption":"Reference a region operation.
","code":"var region = gce.region('us-central1');\nvar operation = region.operation('operation-id');"},{"caption":"Reference a zone operation.
","code":"var zone = gce.zone('us-central1-a');\nvar operation = zone.operation('operation-id');"},{"caption":"All operations are event emitters. The status of each operation is polled \ncontinuously, starting only after you register a \"complete\" listener.
","code":"operation.on('complete', function(metadata) {\n // The operation is complete.\n});"},{"caption":"You can register a listener to monitor when the operation begins running.
","code":"operation.on('running', function(metadata) {\n // The operation is running.\n});"},{"caption":"Be sure to register an error handler as well to catch any issues which \nimpeded the operation.
","code":"operation.on('error', function(err) {\n // An error occurred during the operation.\n});"},{"caption":"To force the Operation object to stop polling for updates, simply remove \nany \"complete\" listeners you've registered. \nThe easiest way to do this is with removeAllListeners()
.
Delete the operation.
","source":"packages/compute/src/operation.js#L120","resources":[{"title":"GlobalOperations: delete API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/globalOperations/delete"},{"title":"RegionOperations: delete API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/regionOperations/delete"},{"title":"ZoneOperations: delete API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/zoneOperations/delete"}],"examples":[{"code":"operation.delete(function(err, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"operation.delete().then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[{"name":"callback","description":"Check if the operation exists.
","source":"packages/compute/src/operation.js#L140","resources":[],"examples":[{"code":"operation.exists(function(err, exists) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"operation.exists().then(function(data) {\n var exists = data[0];\n});"}],"params":[{"name":"callback","description":"Get an operation if it exists.
","source":"packages/compute/src/operation.js#L158","resources":[],"examples":[{"code":"operation.get(function(err, operation, apiResponse) {\n // `operation` is an Operation object.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"operation.get().then(function(data) {\n var operation = data[0];\n var apiResponse = data[1];\n});"}],"params":[],"exceptions":[],"returns":[]},{"id":"getMetadata","name":"getMetadata","type":"instance","description":"Get the operation's metadata. For a detailed description of metadata see Operation resource.
","source":"packages/compute/src/operation.js#L200","resources":[{"title":"GlobalOperations: get API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/globalOperations/get"},{"title":"RegionOperations: get API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/regionOperations/get"},{"title":"ZoneOperations: get API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/zoneOperations/get"}],"examples":[{"code":"operation.getMetadata(function(err, metadata, apiResponse) {\n // `metadata.error`: Contains errors if the operation failed.\n // `metadata.warnings`: Contains warnings.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"operation.getMetadata().then(function(data) {\n var metadata = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"\n This class allows you interact with Compute Engine.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/compute
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
A Region object allows you to interact with a Google Compute Engine region.
","source":"packages/compute/src/region.js#L75","resources":[{"title":"Regions & Zones Overview","link":"https://cloud.google.com/compute/docs/zones"},{"title":"Region Resource","link":"https://cloud.google.com/compute/docs/reference/v1/regions"}],"examples":[{"code":"var region = gce.region('us-central1');"}],"params":[],"exceptions":[],"returns":[]},{"id":"exists","name":"exists","type":"instance","description":"Check if the region exists.
","source":"packages/compute/src/region.js#L95","resources":[],"examples":[{"code":"region.exists(function(err, exists) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"region.exists().then(function(data) {\n var exists = data[0];\n});"}],"params":[{"name":"callback","description":"Get a region.
","source":"packages/compute/src/region.js#L113","resources":[],"examples":[{"code":"region.get(function(err, region, apiResponse) {\n // `region` is a Region object.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"region.get().then(function(data) {\n var region = data[0];\n var apiResponse = data[1];\n});"}],"params":[],"exceptions":[],"returns":[]},{"id":"getMetadata","name":"getMetadata","type":"instance","description":"Get the region's metadata.
","source":"packages/compute/src/region.js#L138","resources":[{"title":"Region Resource","link":"https://cloud.google.com/compute/docs/reference/v1/regions"},{"title":"Regions: get API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/regions/get"}],"examples":[{"code":"region.getMetadata(function(err, metadata, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"region.getMetadata().then(function(data) {\n var metadata = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"Get a reference to a Google Compute Engine address in this region.
","source":"packages/compute/src/region.js#L173","resources":[{"title":"Instances and Networks","link":"https://cloud.google.com/compute/docs/instances-and-network"}],"examples":[{"code":"var address = region.address('address-name');"}],"params":[{"name":"name","description":"Create an address in this region.
","source":"packages/compute/src/region.js#L214","resources":[{"title":"Instances and Networks","link":"https://cloud.google.com/compute/docs/instances-and-network"},{"title":"Address Resource","link":"https://cloud.google.com/compute/docs/reference/v1/addresses"},{"title":"Addresses: insert API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/addresses/insert"}],"examples":[{"code":"function callback(err, address, operation, apiResponse) {\n // `address` is an Address object.\n\n // `operation` is an Operation object that can be used to check the status\n // of the request.\n}\n\nregion.createAddress('new-address', callback);"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"region.createAddress('new-address').then(function(data) {\n var address = data[0];\n var operation = data[1];\n var apiResponse = data[2];\n});"}],"params":[{"name":"name","description":"Create a subnetwork in this region.
","source":"packages/compute/src/region.js#L291","resources":[{"title":"Subnetwork Resource","link":"https://cloud.google.com/compute/docs/reference/v1/subnetworks#resource"},{"title":"Subnetwork: insert API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/subnetworks/insert"}],"examples":[{"code":"var config = {\n network: 'network1',\n range: '10.0.1.0/24'\n};\n\nfunction callback(err, subnetwork, operation, apiResponse) {\n // `subnetwork` is a Subnetwork object.\n\n // `operation` is an Operation object that can be used to check the status\n // of the request.\n}\n\nregion.createSubnetwork('new-subnetwork-name', config, callback);"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"region.createSubnetwork('new-subnetwork-name', config).then(function(data) {\n var subnetwork = data[0];\n var operation = data[1];\n var apiResponse = data[2];\n});"}],"params":[{"name":"name","description":"config.ipCidrRange
)Create a forwarding rule in this region.
","source":"packages/compute/src/region.js#L383","resources":[{"title":"ForwardingRule Resource","link":"https://cloud.google.com/compute/docs/reference/v1/forwardingRules#resource"},{"title":"ForwardingRules: insert API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/forwardingRules/insert"}],"examples":[{"code":"var name = 'new-rule-name';\n\nvar cfg = {\n target: 'zones/us-central1-a/targetInstances/my-target-instance',\n range: '8080-8089'\n};\n\nregion.createRule(name, cfg, function (err, rule, operation, apiResponse) {\n // `rule` is a Rule object.\n\n // `operation` is an Operation object that can be used to check the status\n // of the request.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"region.createRule(name, cfg).then(function(data) {\n var rule = data[0];\n var operation = data[1];\n var apiResponse = data[2];\n});"}],"params":[{"name":"name","description":"config.IPAddress
)AH
, ESP
, SCTP
, TCP
, UDP
. Default: TCP
. (Alias for config.IPProtocol
)config.portRange
)Get a list of addresses in this region.
","source":"packages/compute/src/region.js#L440","resources":[{"title":"Instances and Networks","link":"https://cloud.google.com/compute/docs/instances-and-network"},{"title":"Addresses: list API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/addresses/list"}],"examples":[{"code":"region.getAddresses(function(err, addresses) {\n // `addresses` is an array of `Address` objects.\n});"},{"caption":"To control how many API requests are made and page through the results \nmanually, set autoPaginate
to false
.
If the callback is omitted, we'll return a Promise.
","code":"region.getAddresses().then(function(data) {\n var addresses = data[0];\n});"}],"params":[{"name":"options","description":"{name} {comparison} {filterString}
.name
: the name of the field to comparecomparison
: the comparison operator, eq
(equal) or ne
(not equal)filterString
: the string to filter to. For string fields, this can be a regular expression.Get a list of compute/address objects in this region as a readable object stream.
","source":"packages/compute/src/region.js#L504","resources":[],"examples":[{"code":"region.getAddressesStream()\n .on('error', console.error)\n .on('data', function(address) {\n // `address` is an `Address` object.\n })\n .on('end', function() {\n // All addresses retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"region.getAddressesStream()\n .on('data', function(address) {\n this.end();\n });"}],"params":[{"name":"options","description":"Get a list of operations for this region.
","source":"packages/compute/src/region.js#L560","resources":[{"title":"Region Operation Overview","link":"https://cloud.google.com/compute/docs/reference/v1/regionOperations"},{"title":"RegionOperations: list API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/regionOperations/list"}],"examples":[{"code":"region.getOperations(function(err, operations) {\n // `operations` is an array of `Operation` objects.\n});"},{"caption":"To control how many API requests are made and page through the results \nmanually, set autoPaginate
to false
.
If the callback is omitted, we'll return a Promise.
","code":"region.getOperations().then(function(data) {\n var operations = data[0];\n});"}],"params":[{"name":"options","description":"{name} {comparison} {filterString}
.name
: the name of the field to comparecomparison
: the comparison operator, eq
(equal) or ne
(not equal)filterString
: the string to filter to. For string fields, this can be a regular expression.Get a list of compute/operation objects for this region as a readable object stream.
","source":"packages/compute/src/region.js#L624","resources":[],"examples":[{"code":"region.getOperationsStream()\n .on('error', console.error)\n .on('data', function(operation) {\n // `operation` is an `Operation` object.\n })\n .on('end', function() {\n // All operations retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"region.getOperationsStream()\n .on('data', function(operation) {\n this.end();\n });"}],"params":[{"name":"options","description":"Get a list of forwading rules in this region.
","source":"packages/compute/src/region.js#L679","resources":[{"title":"ForwardingRules: list API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/forwardingRules/list"}],"examples":[{"code":"region.getRules(function(err, rules) {\n // `rules` is an array of `Rule` objects.\n});"},{"caption":"To control how many API requests are made and page through the results \nmanually, set autoPaginate
to false
.
If the callback is omitted, we'll return a Promise.
","code":"region.getRules().then(function(data) {\n var rules = data[0];\n});"}],"params":[{"name":"options","description":"{name} {comparison} {filterString}
.name
: the name of the field to comparecomparison
: the comparison operator, eq
(equal) or ne
(not equal)filterString
: the string to filter to. For string fields, this can be a regular expression.Get a list of compute/rule objects in this region as a readable object stream.
","source":"packages/compute/src/region.js#L743","resources":[],"examples":[{"code":"region.getRulesStream()\n .on('error', console.error)\n .on('data', function(rule) {\n // `rule` is a `Rule` object.\n })\n .on('end', function() {\n // All rules retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"region.getRulesStream()\n .on('data', function(rule) {\n this.end();\n });"}],"params":[{"name":"options","description":"Get a list of subnetworks in this region.
","source":"packages/compute/src/region.js#L798","resources":[{"title":"Subnetworks Overview","link":"https://cloud.google.com/compute/docs/subnetworks"},{"title":"Subnetworks: list API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/subnetworks"}],"examples":[{"code":"region.getSubnetworks(function(err, subnetworks) {\n // `subnetworks` is an array of `Subnetwork` objects.\n});"},{"caption":"To control how many API requests are made and page through the results \nmanually, set autoPaginate
to false
.
If the callback is omitted, we'll return a Promise.
","code":"region.getSubnetworks().then(function(data) {\n var subnetworks = data[0];\n});"}],"params":[{"name":"options","description":"{name} {comparison} {filterString}
.name
: the name of the field to comparecomparison
: the comparison operator, eq
(equal) or ne
(not equal)filterString
: the string to filter to. For string fields, this can be a regular expression.Get a list of compute/subnetwork objects in this region as a readable object stream.
","source":"packages/compute/src/region.js#L862","resources":[],"examples":[{"code":"region.getSubnetworksStream()\n .on('error', console.error)\n .on('data', function(subnetwork) {\n // `subnetwork` is a `Subnetwork` object.\n })\n .on('end', function() {\n // All subnetworks retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"region.getSubnetworksStream()\n .on('data', function(subnetwork) {\n this.end();\n });"}],"params":[{"name":"options","description":"Get a reference to a Google Compute Engine region operation.
","source":"packages/compute/src/region.js#L876","resources":[{"title":"Region Operation Overview","link":"https://cloud.google.com/compute/docs/reference/v1/regionOperations"}],"examples":[{"code":"var operation = region.operation('operation-name');"}],"params":[{"name":"name","description":"Get a reference to a Google Compute Engine forwarding rule in this region.
","source":"packages/compute/src/region.js#L889","resources":[],"examples":[{"code":"var rule = region.rule('rule-name');"}],"params":[{"name":"name","description":"Get a reference to a Google Compute Engine subnetwork in this region.
","source":"packages/compute/src/region.js#L904","resources":[{"title":"Subnetworks Overview","link":"https://cloud.google.com/compute/docs/subnetworks"}],"examples":[{"code":"var subnetwork = region.subnetwork('subnetwork-name');"}],"params":[{"name":"name","description":"\n This class allows you interact with Compute Engine.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/compute
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
Forwarding rules work in conjunction with target pools and target instances to support load balancing and protocol forwarding features. To use load balancing and protocol forwarding, you must create a forwarding rule that directs traffic to specific target pools (for load balancing) or target instances (for protocol forwarding).
","source":"packages/compute/src/rule.js#L56","resources":[{"title":"Forwarding rules","link":"https://cloud.google.com/compute/docs/load-balancing/network/forwarding-rules"}],"examples":[{"caption":"Reference a global rule.
","code":"var rule = gce.rule('rule-name');"},{"caption":"Reference a region rule.
","code":"var region = gce.region('us-central1');\nvar rule = region.rule('rule-name');"}],"params":[],"exceptions":[],"returns":[]},{"id":"create","name":"create","type":"instance","description":"Create a forwarding rule.
","source":"packages/compute/src/rule.js#L91","resources":[],"examples":[{"code":"var config = {\n // `target` will be different depending of this is a Regional or Global\n // forwarding rule\n target: 'global/targetHttpProxies/my-proxy',\n portRange: '8080-8089'\n};\n\nrule.create(config, function(err, rule, operation, apiResponse) {\n // `rule` is a Rule object.\n\n // `operation` is an Operation object that can be used to check the\n // of the request.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"rule.create(config).then(function(data) {\n var rule = data[0];\n var operation = data[1];\n var apiResponse = data[2];\n});"}],"params":[{"name":"config","description":"Check if the forwarding rule exists.
","source":"packages/compute/src/rule.js#L111","resources":[],"examples":[{"code":"rule.exists(function(err, exists) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"rule.exists().then(function(data) {\n var exists = data[0];\n});"}],"params":[{"name":"callback","description":"Get a forwarding rule if it exists.
You may optionally use this to "get or create" an object by providing an object with autoCreate
set to true
. Any extra configuration that is normally required for the create
method must be contained within this object as well.
If the callback is omitted, we'll return a Promise.
","code":"rule.get().then(function(data) {\n var rule = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"options","description":"false
Get the metadata of this rule.
","source":"packages/compute/src/rule.js#L165","resources":[{"title":"GlobalForwardingRule Resource","link":"https://cloud.google.com/compute/docs/reference/v1/globalForwardingRules#resource"},{"title":"ForwardingRule Resource","link":"https://cloud.google.com/compute/docs/reference/v1/globalForwardingRules#resource"},{"title":"GlobalForwardingRules: get API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/globalForwardingRules/get"},{"title":"ForwardingRules: get API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/forwardingRules/get"}],"examples":[{"code":"rule.getMetadata(function(err, metadata, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"rule.getMetadata().then(function(data) {\n var metadata = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"Delete the rule.
","source":"packages/compute/src/rule.js#L207","resources":[{"title":"GlobalForwardingRules: delete API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/globalForwardingRules/delete"},{"title":"ForwardingRules: delete API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/forwardingRules/delete"}],"examples":[{"code":"rule.delete(function(err, operation, apiResponse) {\n // `operation` is an Operation object that can be used to check the status\n // of the request.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"rule.delete().then(function(data) {\n var operation = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"Set the target for this forwarding rule.
","source":"packages/compute/src/rule.js#L254","resources":[{"title":"GlobalForwardingRules: setTarget API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/globalForwardingRules/setTarget"},{"title":"ForwardingRules: setTarget API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/forwardingRules/setTarget"}],"examples":[{"code":"rule.setTarget('new-target', function(err, operation, apiResponse) {\n // `operation` is an Operation object that can be used to check the status\n // of the request.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"rule.setTarget('new-target').then(function(data) {\n var operation = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"target","description":"TargetHttpProxy
resource.\n This class allows you interact with Compute Engine.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/compute
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
An HTTP(S) load balancing backend service is a centralized service for managing backends, which in turn manage instances that handle user requests. You configure your load balancing service to route requests to your backend service. The backend service in turn knows which instances it can use, how much traffic they can handle, and how much traffic they are currently handling. In addition, the backend service monitors health checking and does not send traffic to unhealthy instances.
","source":"packages/compute/src/service.js#L52","resources":[{"title":"Backend Services Overview","link":"https://cloud.google.com/compute/docs/load-balancing/http/backend-service"}],"examples":[{"code":"var service = gce.service('service-name');"}],"params":[],"exceptions":[],"returns":[]},{"id":"create","name":"create","type":"instance","description":"Create a backend service.
","source":"packages/compute/src/service.js#L87","resources":[],"examples":[{"code":"var config = {\n backends: [\n {\n group: 'URL of an Instance Group resource'\n }\n ],\n healthChecks: [\n 'URL of an HTTP/HTTPS health check resource'\n ]\n};\n\nservice.create(config, function(err, service, operation, apiResponse) {\n // `service` is a Service object.\n\n // `operation` is an Operation object that can be used to check the\n // of the request.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"service.create(config).then(function(data) {\n var service = data[0];\n var operation = data[1];\n var apiResponse = data[2];\n});"}],"params":[{"name":"config","description":" ","types":["object"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]},{"id":"exists","name":"exists","type":"instance","description":"Check if the backend service exists.
","source":"packages/compute/src/service.js#L108","resources":[],"examples":[{"code":"service.exists(function(err, exists) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"service.exists().then(function(data) {\n var exists = data[0];\n});"}],"params":[{"name":"callback","description":"Get a Service object if it exists.
You may optionally use this to "get or create" an object by providing an object with autoCreate
set to true
. Any extra configuration that is normally required for the create
method must be contained within this object as well.
If the callback is omitted, we'll return a Promise.
","code":"service.get().then(function(data) {\n var service = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"options","description":"false
Get the metadata of this backend service.
","source":"packages/compute/src/service.js#L160","resources":[{"title":"BackendService Resource","link":"https://cloud.google.com/compute/docs/reference/v1/backendServices#resource"},{"title":"BackendService: get API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/backendServices/get"}],"examples":[{"code":"service.getMetadata(function(err, metadata, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"service.getMetadata().then(function(data) {\n var metadata = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"Delete the backend service.
","source":"packages/compute/src/service.js#L202","resources":[{"title":"BackendServices: delete API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/backendServices/delete"}],"examples":[{"code":"service.delete(function(err, operation, apiResponse) {\n // `operation` is an Operation object that can be used to check the status\n // of the request.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"service.delete().then(function(data) {\n var operation = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"Get the most recent health check results.
","source":"packages/compute/src/service.js#L263","resources":[{"title":"BackendServices: getHealth API Documentation","link":"https://cloud.google.com/compute/docs/reference/latest/backendServices/getHealth"}],"examples":[{"code":"var group = {\n name: 'instance-group-name',\n zone: 'us-central1-a'\n};\n\nservice.getHealth(group, function(err, status, apiResponse) {\n if (!err) {\n // status = [\n // {\n // ipAddress: '...',\n // instance: '...',\n // healthState: '...',\n // port: '...'\n // }\n // ]\n }\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"service.getHealth(group).then(function(data) {\n var status = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"group","description":"Set the backend service's metadata.
","source":"packages/compute/src/service.js#L320","resources":[{"title":"BackendService Resource","link":"https://cloud.google.com/compute/docs/reference/v1/backendServices#resource"}],"examples":[{"code":"var metadata = {\n description: 'New description'\n};\n\nservice.setMetadata(metadata, function(err, operation, apiResponse) {\n // `operation` is an Operation object that can be used to check the status\n // of the request.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"service.setMetadata(metadata).then(function(data) {\n var operation = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"metadata","description":"\n This class allows you interact with Compute Engine.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/compute
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
A Snapshot object allows you to interact with a Google Compute Engine snapshot.
","source":"packages/compute/src/snapshot.js#L51","resources":[{"title":"Snapshots Overview","link":"https://cloud.google.com/compute/docs/disks/persistent-disks#snapshots"},{"title":"Snapshot Resource","link":"https://cloud.google.com/compute/docs/reference/v1/snapshots"}],"examples":[{"code":"var snapshot = gce.snapshot('snapshot-name');"},{"caption":"Or, access through a disk.
","code":"var disk = gce.zone('us-central1-a').disk('disk-name');\nvar snapshot = disk.snapshot('disk-snapshot-name');"}],"params":[],"exceptions":[],"returns":[]},{"id":"exists","name":"exists","type":"instance","description":"Check if the snapshot exists.
","source":"packages/compute/src/snapshot.js#L66","resources":[],"examples":[{"code":"snapshot.exists(function(err, exists) {});"}],"params":[{"name":"callback","description":"Get a snapshot if it exists.
If you access this snapshot through a Disk object, this can be used as a "get or create" method. Pass an object with autoCreate
set to true
. Any extra configuration that is normally required for the create
method must be contained within this object as well.
If the callback is omitted, we'll return a Promise.
","code":"snapshot.get().then(function(data) {\n var snapshot = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"options","description":"false
Get the snapshot's metadata.
","source":"packages/compute/src/snapshot.js#L118","resources":[{"title":"Snapshot Resource","link":"https://cloud.google.com/compute/docs/reference/v1/snapshots"},{"title":"Snapshots: get API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/snapshots/get"}],"examples":[{"code":"snapshot.getMetadata(function(err, metadata, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"snapshot.getMetadata().then(function(data) {\n var metadata = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"Create a snapshot.
This is only available if you accessed this object through compute/disk#snapshot.
","source":"packages/compute/src/snapshot.js#L157","resources":[],"examples":[{"code":"snapshot.create(function(err, snapshot, operation, apiResponse) {\n // `snapshot` is a Snapshot object.\n\n // `operation` is an Operation object that can be used to check the\n // status of the request.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"snapshot.create().then(function(data) {\n var snapshot = data[0];\n var operation = data[1];\n var apiResponse = data[2];\n});"}],"params":[{"name":"config","description":" ","types":["object"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]},{"id":"delete","name":"delete","type":"instance","description":"Delete the snapshot.
","source":"packages/compute/src/snapshot.js#L193","resources":[{"title":"Snapshots: delete API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/snapshots/delete"}],"examples":[{"code":"snapshot.delete(function(err, operation, apiResponse) {\n // `operation` is an Operation object that can be used to check the status\n // of the request.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"snapshot.delete().then(function(data) {\n var operation = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"\n This class allows you interact with Compute Engine.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/compute
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
An Subnetwork object allows you to interact with a Google Compute Engine subnetwork.
","source":"packages/compute/src/subnetwork.js#L46","resources":[{"title":"Subnetworks Overview","link":"https://cloud.google.com/compute/docs/subnetworks"},{"title":"Subnetwork Resource","link":"https://cloud.google.com/compute/docs/reference/v1/subnetworks"}],"examples":[{"code":"var region = gce.region('region-name');\n\nvar subnetwork = region.subnetwork('subnetwork1');"}],"params":[],"exceptions":[],"returns":[]},{"id":"create","name":"create","type":"instance","description":"Create a subnetwork.
","source":"packages/compute/src/subnetwork.js#L79","resources":[],"examples":[{"code":"var config = {\n // ...\n};\n\nfunction callback(err, subnetwork, operation, apiResponse) {\n // `subnetwork` is a Subnetwork object.\n\n // `operation` is an Operation object that can be used to check the\n // status of the request.\n}\n\nsubnetwork.create(config, callback);"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"subnetwork.create(config).then(function(data) {\n var subnetwork = data[0];\n var operation = data[1];\n var apiResponse = data[2];\n});"}],"params":[{"name":"config","description":" ","types":["object"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]},{"id":"exists","name":"exists","type":"instance","description":"Check if the subnetwork exists.
","source":"packages/compute/src/subnetwork.js#L99","resources":[],"examples":[{"code":"subnetwork.exists(function(err, exists) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"subnetwork.exists().then(function(data) {\n var exists = data[0];\n});"}],"params":[{"name":"callback","description":"Get a subnetwork if it exists.
You may optionally use this to "get or create" an object by providing an object with autoCreate
set to true
. Any extra configuration that is normally required for the create
method must be contained within this object as well.
If the callback is omitted, we'll return a Promise.
","code":"subnetwork.get().then(function(data) {\n var subnetwork = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"options","description":"false
Get the metadata of this subnetwork.
","source":"packages/compute/src/subnetwork.js#L151","resources":[{"title":"Subnetwork Resource","link":"https://cloud.google.com/compute/docs/reference/v1/subnetwork"},{"title":"Subnetwork: get API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/subnetwork/get"}],"examples":[{"code":"subnetwork.getMetadata(function(err, metadata, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"subnetwork.getMetadata().then(function(data) {\n var metadata = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"Delete the subnetwork.
","source":"packages/compute/src/subnetwork.js#L190","resources":[{"title":"Subnetworks: delete API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/subnetworks/delete"}],"examples":[{"code":"subnetwork.delete(function(err, operation, apiResponse) {\n // `operation` is an Operation object that can be used to check the status\n // of the request.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"subnetwork.delete().then(function(data) {\n var operation = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"\n This class allows you interact with Compute Engine.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/compute
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
An Instance object allows you to interact with a Google Compute Engine instance.
","source":"packages/compute/src/vm.js#L99","resources":[{"title":"Instances and Networks","link":"https://cloud.google.com/compute/docs/instances-and-network"},{"title":"Instance Resource","link":"https://cloud.google.com/compute/docs/reference/v1/instances"}],"examples":[{"code":"var zone = gce.zone('zone-name');\n\nvar vm = zone.vm('vm-name');"}],"params":[],"exceptions":[],"returns":[]},{"id":"create","name":"create","type":"instance","description":"Create a virtual machine.
","source":"packages/compute/src/vm.js#L140","resources":[],"examples":[{"code":"var config = {\n // ...\n};\n\nvm.create(config, function(err, vm, operation, apiResponse) {\n // `vm` is a VM object.\n\n // `operation` is an Operation object that can be used to check the\n // status of the request.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"vm.create(config).then(function(data) {\n var vm = data[0];\n var operation = data[1];\n var apiResponse = data[2];\n});"}],"params":[{"name":"config","description":" ","types":["object"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]},{"id":"exists","name":"exists","type":"instance","description":"Check if the vm exists.
","source":"packages/compute/src/vm.js#L160","resources":[],"examples":[{"code":"vm.exists(function(err, exists) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"vm.exists().then(function(data) {\n var exists = data[0];\n});"}],"params":[{"name":"callback","description":"Get a virtual machine if it exists.
You may optionally use this to "get or create" an object by providing an object with autoCreate
set to true
. Any extra configuration that is normally required for the create
method must be contained within this object as well.
If the callback is omitted, we'll return a Promise.
","code":"vm.get().then(function(data) {\n var vm = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"options","description":"false
Get the instance's metadata.
","source":"packages/compute/src/vm.js#L212","resources":[{"title":"Instance Resource","link":"https://cloud.google.com/compute/docs/reference/v1/instances"},{"title":"Instance: get API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/instances/get"}],"examples":[{"code":"vm.getMetadata(function(err, metadata, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"vm.getMetadata().then(function(data) {\n var metadata = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"Attach a disk to the instance.
","source":"packages/compute/src/vm.js#L275","resources":[{"title":"Disks Overview","link":"https://cloud.google.com/compute/docs/disks"},{"title":"Disk Resource","link":"https://cloud.google.com/compute/docs/reference/v1/disks"},{"title":"Instance: attachDisk API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/instances/attachDisk"}],"examples":[{"code":"var disk = zone.disk('my-disk');\n\nfunction callback(err, operation, apiResponse) {\n // `operation` is an Operation object that can be used to check the status\n // of the request.\n}\n\nvm.attachDisk(disk, callback);"},{"caption":"Provide an options object to customize the request.
","code":"var options = {\n autoDelete: true,\n readOnly: true\n};\n\nvm.attachDisk(disk, options, callback);"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"vm.attachDisk(disk, options).then(function(data) {\n var operation = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"disk","description":"options.mode = READ_ONLY
)if a compute/disk is not provided.
"}],"returns":[]},{"id":"delete","name":"delete","type":"instance","description":"Delete the instance.
","source":"packages/compute/src/vm.js#L329","resources":[{"title":"Instance: delete API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/instances/delete"}],"examples":[{"code":"vm.delete(function(err, operation, apiResponse) {\n // `operation` is an Operation object that can be used to check the status\n // of the request.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"vm.delete().then(function(data) {\n var operation = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"Detach a disk from the instance.
","source":"packages/compute/src/vm.js#L366","resources":[{"title":"Instance: detachDisk API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/instances/detachDisk"}],"examples":[{"code":"var disk = zone.disk('my-disk');\n\nvm.detachDisk(disk, function(err, operation, apiResponse) {\n // `operation` is an Operation object that can be used to check the status\n // of the request.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"vm.detachDisk(disk).then(function(data) {\n var operation = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"deviceName","description":"Returns the serial port output for the instance.
","source":"packages/compute/src/vm.js#L437","resources":[{"title":"Instances: getSerialPortOutput API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/instances/getSerialPortOutput"}],"examples":[{"code":"vm.getSerialPortOutput(function(err, output, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"vm.getSerialPortOutput().then(function(data) {\n var output = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"port","description":"1
.Get the instance's tags and their fingerprint.
This method wraps compute/vm#getMetadata, returning only the tags
property.
If the callback is omitted, we'll return a Promise.
","code":"vm.getTags().then(function(data) {\n var tags = data[0];\n var fingerprint = data[1];\n var apiResponse = data[2];\n});"}],"params":[{"name":"callback","description":"Reset the instance.
","source":"packages/compute/src/vm.js#L522","resources":[{"title":"Instances: reset API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/instances/reset"}],"examples":[{"code":"vm.reset(function(err, operation, apiResponse) {\n // `operation` is an Operation object that can be used to check the status\n // of the request.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"vm.reset().then(function(data) {\n var operation = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"Set the machine type for this instance, stopping and restarting the VM as necessary.
For a list of the standard, high-memory, and high-CPU machines you may choose from, see Predefined machine types\">https://cloud.google.com/compute/docs/machine-types#predefined_machine_types}.
In order to change the machine type, the VM must not be running. This method will automatically stop the VM if it is running before changing the machine type. After it is sucessfully changed, the VM will be started.
","source":"packages/compute/src/vm.js#L583","resources":[{"title":"Instances: setMachineType API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/instances/setMachineType"},{"title":"Predefined machine types","link":"https://cloud.google.com/compute/docs/machine-types#predefined_machine_types"}],"examples":[{"code":"vm.resize('n1-standard-1', function(err, apiResponse) {\n if (!err) {\n // The VM is running and its machine type was changed successfully.\n }\n});"},{"caption":"By default, calling resize
will start your server after updating its \nmachine type. If you want to leave it stopped, set options.start
to \nfalse
.
If the callback is omitted, we'll return a Promise.
","code":"vm.resize('ns-standard-1', options).then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[{"name":"machineType","description":"false
.Set the metadata for this instance.
","source":"packages/compute/src/vm.js#L667","resources":[{"title":"Instances: setMetadata API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/instances/setMetadata"}],"examples":[{"code":"var metadata = {\n 'startup-script': '...'\n};\n\nvm.setMetadata(metadata, function(err, operation, apiResponse) {\n // `operation` is an Operation object that can be used to check the status\n // of the request.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"vm.setMetadata(metadata).then(function(data) {\n var operation = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"metadata","description":"Set the instance's tags.
","source":"packages/compute/src/vm.js#L739","resources":[{"title":"Instances: setTags API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/instances/setTags"}],"examples":[{"code":"vm.getTags(function(err, tags, fingerprint) {\n tags.push('new-tag');\n\n vm.setTags(tags, fingerprint, function(err, operation, apiResponse) {\n // `operation` is an Operation object that can be used to check the\n // status of the request.\n });\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"vm.getTags().then(function(data) {\n var tags = data[0];\n var fingerprint = data[1];\n\n tags.push('new-tag');\n\n return vm.setTags(tags, fingerprint);\n}).then(function(data) {\n var operation = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"tags","description":"Start the instance.
","source":"packages/compute/src/vm.js#L777","resources":[{"title":"Instances: start API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/instances/start"}],"examples":[{"code":"vm.start(function(err, operation, apiResponse) {\n // `operation` is an Operation object that can be used to check the status\n // of the request.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"vm.start().then(function(data) {\n var operation = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"Stop the instance.
","source":"packages/compute/src/vm.js#L809","resources":[{"title":"Instances: stop API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/instances/stop"}],"examples":[{"code":"vm.stop(function(err, operation, apiResponse) {\n // `operation` is an Operation object that can be used to check the status\n // of the request.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"vm.stop().then(function(data) {\n var operation = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"This function will callback when the VM is in the specified state.
Will time out after the specified time (default: 300 seconds).
","source":"packages/compute/src/vm.js#L867","resources":[],"examples":[{"code":"vm.waitFor('RUNNING', function(err, metadata) {\n if (!err) {\n // The VM is running.\n }\n});"},{"caption":"By default, waitFor
will timeout after 300 seconds while waiting for the \ndesired state to occur. This can be changed to any number between 0 and \n600. If the timeout is set to 0, it will poll once for status and then \ntimeout if the desired state is not reached.
If the callback is omitted, we'll return a Promise.
","code":"vm.waitFor('RUNNING', options).then(function(data) {\n var metadata = data[0];\n});"}],"params":[{"name":"status","description":"0
and 600
. Default: 300
\n This class allows you interact with Compute Engine.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/compute
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
A Zone object allows you to interact with a Google Compute Engine zone.
","source":"packages/compute/src/zone.js#L85","resources":[{"title":"Regions & Zones Overview","link":"https://cloud.google.com/compute/docs/zones"},{"title":"Zone Resource","link":"https://cloud.google.com/compute/docs/reference/v1/zones"}],"examples":[{"code":"var zone = gce.zone('us-central1-a');"}],"params":[],"exceptions":[],"returns":[]},{"id":"exists","name":"exists","type":"instance","description":"Check if the zone exists.
","source":"packages/compute/src/zone.js#L105","resources":[],"examples":[{"code":"zone.exists(function(err, exists) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"zone.exists().then(function(data) {\n var exists = data[0];\n});"}],"params":[{"name":"callback","description":"Get a zone.
","source":"packages/compute/src/zone.js#L123","resources":[],"examples":[{"code":"zone.get(function(err, zone, apiResponse) {\n // `zone` is a Zone object.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"zone.get().then(function(data) {\n var zone = data[0];\n var apiResponse = data[1];\n});"}],"params":[],"exceptions":[],"returns":[]},{"id":"getMetadata","name":"getMetadata","type":"instance","description":"Get the zone's metadata.
","source":"packages/compute/src/zone.js#L148","resources":[{"title":"Zone Resource","link":"https://cloud.google.com/compute/docs/reference/v1/zones"},{"title":"Zones: get API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/zones/get"}],"examples":[{"code":"zone.getMetadata(function(err, metadata, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"zone.getMetadata().then(function(data) {\n var metadata = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"Get a reference to a Google Compute Engine autoscaler in this zone.
","source":"packages/compute/src/zone.js#L177","resources":[],"examples":[{"code":"var autoscaler = zone.autoscaler('autoscaler-name');"}],"params":[{"name":"name","description":"Create an autoscaler in this zone.
","source":"packages/compute/src/zone.js#L246","resources":[{"title":"Load Balancing and Scaling","link":"https://cloud.google.com/compute/docs/load-balancing-and-autoscaling"},{"title":"Autoscaler Resource","link":"https://cloud.google.com/compute/docs/reference/v1/autoscalers"},{"title":"Autoscalers: insert API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/autoscalers/insert"}],"examples":[{"code":"var config = {\n coolDown: 30,\n cpu: 80,\n loadBalance: 40,\n maxReplicas: 5,\n minReplicas: 0,\n target: 'instance-group-manager-1'\n};\n\nfunction callback(err, autoscaler, operation, apiResponse) {\n // `autoscaler` is an Autoscaler object.\n\n // `operation` is an Operation object that can be used to check the status\n // of the request.\n}\n\nzone.createAutoscaler('name', config, callback);"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"zone.createAutoscaler('name', config).then(function(data) {\n var autoscaler = data[0];\n var operation = data[1];\n var apiResponse = data[2];\n});"}],"params":[{"name":"name","description":"config.autoscalingPolicy.coolDownPeriodSec
.config.autoscalingPolicy.cpuUtilization.utilizationTarget
.config.autoscalingPolicy.loadBalancingUtilization.utilizationTarget
.config.autoscalingPolicy.maxNumReplicas
.config.autoscalingPolicy.minNumReplicas
.If config.target
is not provided.
Create a persistent disk in this zone.
","source":"packages/compute/src/zone.js#L371","resources":[{"title":"Disk Resource","link":"https://cloud.google.com/compute/docs/reference/v1/disks"},{"title":"Disks: insert API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/disks/insert"}],"examples":[{"caption":"Create a persistent disk using the latest Ubuntu version \nas the source image.
","code":"var config = {\n os: 'ubuntu',\n sizeGb: 10\n};"},{"caption":"Create a persistent disk using the latest Ubuntu version from your project \nas the source image.
","code":"var config = {\n os: 'your-project-id-or-name/ubuntu',\n sizeGb: 10\n};\n\nzone.createDisk('name', config, function(err, disk, operation, apiResponse) {\n // `disk` is a Disk object.\n\n // `operation` is an Operation object that can be used to check the status\n // of the request.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"zone.createDisk('name', config).then(function(data) {\n var disk = data[0];\n var operation = data[1];\n var apiResponse = data[2];\n});"}],"params":[{"name":"name","description":"Create an instance group in this zone.
","source":"packages/compute/src/zone.js#L457","resources":[{"title":"InstanceGroup Resource","link":"https://cloud.google.com/compute/docs/reference/v1/instanceGroups#resource"},{"title":"InstanceGroups: insert API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/instanceGroups/insert"}],"examples":[{"code":"function onCreated(err, instanceGroup, operation, apiResponse) {\n // `instanceGroup` is an InstanceGroup object.\n\n // `operation` is an Operation object that can be used to check the status\n // of the request.\n}\n\nzone.createInstanceGroup('instance-group-name', onCreated);"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"zone.createInstanceGroup('instance-group-name', config).then(function(data) {\n var instanceGroup = data[0];\n var operation = data[1];\n var apiResponse = data[2];\n});"}],"params":[{"name":"name","description":"options.namedPorts
.Create a virtual machine in this zone.
","source":"packages/compute/src/zone.js#L595","resources":[{"title":"Instance Resource","link":"https://cloud.google.com/compute/docs/reference/v1/instances"},{"title":"Instances: insert API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/instances/insert"}],"examples":[{"caption":"Create a new instance using the latest Debian version from your project \nas the source image for a new boot disk.
","code":"var config = {\n os: 'your-project-id-or-name/debian',\n http: true,\n tags: ['debian-server']\n};"},{"caption":"Create a new instance using the latest Debian version as the source image \nfor a new boot disk.
","code":"var config = {\n os: 'debian',\n http: true,\n tags: ['debian-server']\n};"},{"caption":"The above object will auto-expand behind the scenes to something like the \nfollowing. The Debian version may be different when you run the command.
","code":"var config = {\n machineType: 'n1-standard-1',\n disks: [\n {\n boot: true,\n initializeParams: {\n sourceImage:\n 'https://www.googleapis.com/compute/v1/projects' +\n '/debian-cloud/global/images/debian-7-wheezy-v20150710'\n }\n }\n ],\n networkInterfaces: [\n {\n network: 'global/networks/default'\n }\n ],\n tags: [\n {\n items: [\n 'debian-server',\n 'http-server'\n ]\n }\n ]\n};\n\nfunction callback(err, vm, operation, apiResponse) {\n // `vm` is a VM object.\n\n // `operation` is an Operation object that can be used to check the status\n // of the request.\n}\n\nzone.createVM('new-vm-name', config, callback);"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"zone.createVM('new-vm-name', config).then(function(data) {\n var vm = data[0];\n var operation = data[1];\n var apiResponse = data[2];\n});"}],"params":[{"name":"name","description":"false
false
[ { network: 'global/networks/default' } ]
n1-standard-16
. Refer to Available Machine Types. Default: n1-standard-1
Get a reference to a Google Compute Engine disk in this zone.
","source":"packages/compute/src/zone.js#L723","resources":[{"title":"Disks Overview","link":"https://cloud.google.com/compute/docs/disks"}],"examples":[{"code":"var disk = zone.disk('disk1');"}],"params":[{"name":"name","description":"Get a list of autoscalers from this zone.
","source":"packages/compute/src/zone.js#L781","resources":[{"title":"Managing Autoscalers","link":"https://cloud.google.com/compute/docs/autoscaler/managing-autoscalers"},{"title":"Understanding Autoscaler Decisions","link":"https://cloud.google.com/compute/docs/autoscaler/understanding-autoscaler-decisions"},{"title":"Autoscalers: aggregatedList API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/autoscalers/list"}],"examples":[{"code":"zone.getAutoscalers(function(err, autoscalers) {\n // autoscalers is an array of `Autoscaler` objects.\n});"},{"caption":"To control how many API requests are made and page through the results \nmanually, set autoPaginate
to false
.
If the callback is omitted, we'll return a Promise.
","code":"zone.getAutoscalers().then(function(data) {\n var autoscalers = data[0];\n});"}],"params":[{"name":"options","description":"{name} {comparison} {filterString}
.name
: the name of the field to comparecomparison
: the comparison operator, eq
(equal) or ne
(not equal)filterString
: the string to filter to. For string fields, this can be a regular expression.Get a list of compute/autoscaler objects from this zone as a readable object stream.
","source":"packages/compute/src/zone.js#L846","resources":[],"examples":[{"code":"zone.getAutoscalersStream()\n .on('error', console.error)\n .on('data', function(autoscaler) {\n // `autoscaler` is an `Autoscaler` object.\n })\n .on('end', function() {\n // All autoscalers retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"zone.getAutoscalersStream()\n .on('data', function(autoscaler) {\n this.end();\n });"}],"params":[{"name":"options","description":"Get a list of disks in this zone.
","source":"packages/compute/src/zone.js#L901","resources":[{"title":"Disks Overview","link":"https://cloud.google.com/compute/docs/disks"},{"title":"Disks: list API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/disks/list"}],"examples":[{"code":"zone.getDisks(function(err, disks) {\n // `disks` is an array of `Disk` objects.\n});"},{"caption":"To control how many API requests are made and page through the results \nmanually, set autoPaginate
to false
.
If the callback is omitted, we'll return a Promise.
","code":"zone.getDisks().then(function(data) {\n var disks = data[0];\n});"}],"params":[{"name":"options","description":"{name} {comparison} {filterString}
.name
: the name of the field to comparecomparison
: the comparison operator, eq
(equal) or ne
(not equal)filterString
: the string to filter to. For string fields, this can be a regular expression.Get a list of compute/disk objects in this zone as a readable object stream.
","source":"packages/compute/src/zone.js#L965","resources":[],"examples":[{"code":"zone.getDisksStream()\n .on('error', console.error)\n .on('data', function(disk) {\n // `disk` is a `Disk` object.\n })\n .on('end', function() {\n // All disks retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"zone.getDisksStream()\n .on('data', function(disk) {\n this.end();\n });"}],"params":[{"name":"options","description":"Get a list of instance groups for this zone.
","source":"packages/compute/src/zone.js#L1021","resources":[{"title":"InstanceGroups Overview","link":"https://cloud.google.com/compute/docs/reference/v1/instanceGroups"},{"title":"InstanceGroups: list API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/instanceGroups/list"}],"examples":[{"code":"zone.getInstanceGroups(function(err, instanceGroups) {\n // `instanceGroups` is an array of `InstanceGroup` objects.\n});"},{"caption":"To control how many API requests are made and page through the results \nmanually, set autoPaginate
to false
.
If the callback is omitted, we'll return a Promise.
","code":"zone.getInstanceGroups().then(function(data) {\n var instanceGroups = data[0];\n});"}],"params":[{"name":"options","description":"{name} {comparison} {filterString}
.name
: the name of the field to comparecomparison
: the comparison operator, eq
(equal) or ne
(not equal)filterString
: the string to filter to. For string fields, this can be a regular expression.Get a list of compute/instanceGroup objects for this zone as a readable object stream.
","source":"packages/compute/src/zone.js#L1085","resources":[],"examples":[{"code":"zone.getInstanceGroupsStream()\n .on('error', console.error)\n .on('data', function(instanceGroup) {\n // `instanceGroup` is an `InstanceGroup` object.\n })\n .on('end', function() {\n // All instance groups retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"zone.getInstanceGroupsStream()\n .on('data', function(instanceGroup) {\n this.end();\n });"}],"params":[{"name":"options","description":"Get a list of machine types for this zone.
","source":"packages/compute/src/zone.js#L1136","resources":[{"title":"MachineTypes: list API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/machineTypes/list"},{"title":"Machine Types Overview","link":"https://cloud.google.com/compute/docs/machine-types"},{"title":"MachineType Resource","link":"https://cloud.google.com/compute/docs/reference/v1/machineTypes"}],"examples":[{"code":"zone.getMachineTypes(function(err, machineTypes) {\n // `machineTypes` is an array of `MachineType` objects.\n});"},{"caption":"To control how many API requests are made and page through the results \nmanually, set autoPaginate
to false
.
If the callback is omitted, we'll return a Promise.
","code":"zone.getMachineTypes().then(function(data) {\n var machineTypes = data[0];\n});"}],"params":[{"name":"options","description":"Get a list of compute/machineType objects for this zone as a readable object stream.
","source":"packages/compute/src/zone.js#L1176","resources":[],"examples":[{"code":"zone.getMachineTypesStream()\n .on('error', console.error)\n .on('data', function(machineType) {\n // `machineType` is a `MachineType` object.\n })\n .on('end', function() {\n // All machine types retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"zone.getMachineTypesStream()\n .on('data', function(machineType) {\n this.end();\n });"}],"params":[{"name":"options","description":"Get a list of operations for this zone.
","source":"packages/compute/src/zone.js#L1232","resources":[{"title":"Zone Operation Overview","link":"https://cloud.google.com/compute/docs/reference/v1/zoneOperations"},{"title":"ZoneOperations: list API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/zoneOperations/list"}],"examples":[{"code":"zone.getOperations(function(err, operations) {\n // `operations` is an array of `Operation` objects.\n});"},{"caption":"To control how many API requests are made and page through the results \nmanually, set autoPaginate
to false
.
If the callback is omitted, we'll return a Promise.
","code":"zone.getOperations().then(function(data) {\n var operations = data[0];\n});"}],"params":[{"name":"options","description":"{name} {comparison} {filterString}
.name
: the name of the field to comparecomparison
: the comparison operator, eq
(equal) or ne
(not equal)filterString
: the string to filter to. For string fields, this can be a regular expression.Get a list of compute/operation objects for this zone as a readable object stream.
","source":"packages/compute/src/zone.js#L1296","resources":[],"examples":[{"code":"zone.getOperationsStream()\n .on('error', console.error)\n .on('data', function(operation) {\n // `operation` is an `Operation` object.\n })\n .on('end', function() {\n // All operations retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"zone.getOperationsStream()\n .on('data', function(operation) {\n this.end();\n });"}],"params":[{"name":"options","description":"Get a list of VM instances in this zone.
","source":"packages/compute/src/zone.js#L1349","resources":[{"title":"Instances and Networks","link":"https://cloud.google.com/compute/docs/instances-and-network"},{"title":"Instances: list API Documentation","link":"https://cloud.google.com/compute/docs/reference/v1/instances/list"}],"examples":[{"code":"zone.getVMs(function(err, vms) {\n // `vms` is an array of `VM` objects.\n});"},{"caption":"To control how many API requests are made and page through the results \nmanually, set autoPaginate
to false
.
If the callback is omitted, we'll return a Promise.
","code":"zone.getVMs().then(function(data) {\n var vms = data[0];\n});"}],"params":[{"name":"options","description":"{name} {comparison} {filterString}
.name
: the name of the field to comparecomparison
: the comparison operator, eq
(equal) or ne
(not equal)filterString
: the string to filter to. For string fields, this can be a regular expression.Get a list of compute/vm instances in this zone as a readable object stream.
","source":"packages/compute/src/zone.js#L1413","resources":[],"examples":[{"code":"zone.getVMsStream()\n .on('error', console.error)\n .on('data', function(vm) {\n // `vm` is a `VM` object.\n })\n .on('end', function() {\n // All instances retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"zone.getVMsStream()\n .on('data', function(vm) {\n this.end();\n });"}],"params":[{"name":"options","description":"Get a reference to a Google Compute Engine instance group.
","source":"packages/compute/src/zone.js#L1426","resources":[{"title":"InstanceGroups Overview","link":"https://cloud.google.com/compute/docs/reference/v1/instanceGroups"}],"examples":[{"code":"var instanceGroup = zone.instanceGroup('my-instance-group');"}],"params":[{"name":"name","description":"Get a reference to a Google Compute Engine machine type.
","source":"packages/compute/src/zone.js#L1442","resources":[{"title":"Machine Types Overview","link":"https://cloud.google.com/compute/docs/machine-types"},{"title":"MachineType Resource","link":"https://cloud.google.com/compute/docs/reference/v1/machineTypes"}],"examples":[{"code":"var machienType = zone.machineType('g1-small');"}],"params":[{"name":"name","description":"Get a reference to a Google Compute Engine zone operation.
","source":"packages/compute/src/zone.js#L1457","resources":[{"title":"Zone Operation Overview","link":"https://cloud.google.com/compute/docs/reference/v1/zoneOperations"}],"examples":[{"code":"var operation = zone.operation('operation-1445532685163-8b137d2a-1822afe7');"}],"params":[{"name":"name","description":"Get a reference to a Google Compute Engine virtual machine instance.
","source":"packages/compute/src/zone.js#L1472","resources":[{"title":"Instances and Networks","link":"https://cloud.google.com/compute/docs/instances-and-network"}],"examples":[{"code":"var vm = zone.vm('vm-name');"}],"params":[{"name":"name","description":"\n This class allows you interact with Cloud Datastore.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/datastore
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
\n$ gcloud beta emulators datastore start --no-legacy \n\nYou will see the following printed: \n
\n[datastore] API endpoint: http://localhost:8005 \n[datastore] If you are using a library that supports the \nDATASTORE_EMULATOR_HOST environment variable, run: \n[datastore] \n[datastore] export DATASTORE_EMULATOR_HOST=localhost:8005 \n[datastore] \n[datastore] Dev App Server is now running. \n\nSet that environment variable and your localhost Datastore will \nautomatically be used. You can also pass this address in manually with \n
apiEndpoint
. \nAdditionally, DATASTORE_PROJECT_ID
is recognized. If you have this set, \nyou don't need to provide a projectId
."},{"caption":"kind
\nvalue, and either a numeric id
value, or a string name
value. \nA single record can be retrieved with datastore#key and \ndatastore#get.","code":"var key = datastore.key(['Company', 'Google']);\n\ndatastore.get(key, function(err, entity) {\n // entity = The record.\n // entity[datastore.KEY] = The key for this entity.\n});"},{"caption":"Multiple records can be found that match criteria with \ndatastore/query#filter.
","code":"query.filter('location', 'CA');"},{"caption":"Records can also be ordered with datastore/query#order.
","code":"query.order('name');"},{"caption":"The number of records returned can be specified with \ndatastore/query#limit.
","code":"query.limit(5);"},{"caption":"Records' key structures can also be queried with \ndatastore/query#hasAncestor.
","code":"var ancestorKey = datastore.key(['ParentCompany', 'Alphabet']);\n\nquery.hasAncestor(ancestorKey);"},{"caption":"Run the query with datastore#runQuery.
","code":"datastore.runQuery(query, function(err, entities) {\n // entities = An array of records.\n\n // Access the Key object for an entity.\n var firstEntityKey = entities[0][datastore.KEY];\n});"},{"caption":"name
identifier, \"Google\".","code":"var key = datastore.key(['Company', 'Google']);\n\nvar data = {\n name: 'Google',\n location: 'CA'\n};\n\ndatastore.save({\n key: key,\n data: data\n}, function(err) {\n if (!err) {\n // Record saved successfully.\n }\n});"},{"caption":"We can verify the data was saved by using datastore#get.
","code":"datastore.get(key, function(err, entity) {\n // entity = {\n // name: 'Google',\n // location: 'CA'\n // }\n});"},{"caption":"If we want to update this record, we can modify the data object and re- \nsave it.
","code":"data.symbol = 'GOOG';\n\ndatastore.save({\n key: key, // defined above (datastore.key(['Company', 'Google']))\n data: data\n}, function(err, entity) {\n if (!err) {\n // Record updated successfully.\n }\n});"},{"caption":"done
function is called.","code":"var transaction = datastore.transaction();\n\ntransaction.run(function(err) {\n if (err) {\n // Error handling omitted.\n }\n\n var key = datastore.key(['Company', 'Google']);\n\n transaction.get(key, function(err, entity) {\n if (err) {\n // Error handling omitted.\n }\n\n entity.symbol = 'GOOG';\n\n transaction.save(entity);\n\n transaction.commit(function(err) {\n if (!err) {\n // Transaction committed successfully.\n }\n });\n });\n});"}],"params":[{"name":"options","description":" ","types":["object"],"optional":true,"nullable":false},{"name":"options.apiEndpoint","description":"Helper function to get a Datastore Double object.
","source":"packages/datastore/src/index.js#L336","resources":[],"examples":[{"code":"var threeDouble = datastore.double(3.0);"}],"params":[{"name":"value","description":"Helper function to get a Datastore Geo Point object.
","source":"packages/datastore/src/index.js#L356","resources":[],"examples":[{"code":"var coordinates = {\n latitude: 40.6894,\n longitude: -74.0447\n};\n\nvar geoPoint = datastore.geoPoint(coordinates);"}],"params":[{"name":"coordinates","description":"Helper function to get a Datastore Integer object.
This is also useful when using an ID outside the bounds of a JavaScript Number object.
","source":"packages/datastore/src/index.js#L380","resources":[],"examples":[{"code":"var sevenInteger = datastore.int(7);"},{"caption":"Create an Int to support long Key IDs.
","code":"var key = datastore.key([\n 'Kind',\n datastore.int('100000000000001234')\n]);"}],"params":[{"name":"value","description":"Access the Key from an Entity object.
","source":"packages/datastore/src/index.js#L389","resources":[],"examples":[],"params":[],"exceptions":[],"returns":[]},{"id":"MORE_RESULTS_AFTER_CURSOR","name":"MORE_RESULTS_AFTER_CURSOR","type":"instance","description":"This is one of three values which may be returned from datastore#runQuery, transaction#runQuery, and datastore/query#run as info.moreResults
.
There may be more results after the specified end cursor.
","source":"packages/datastore/src/index.js#L400","resources":[],"examples":[],"params":[],"exceptions":[],"returns":[]},{"id":"MORE_RESULTS_AFTER_LIMIT","name":"MORE_RESULTS_AFTER_LIMIT","type":"instance","description":"This is one of three values which may be returned from datastore#runQuery, transaction#runQuery, and datastore/query#run as info.moreResults
.
There may be more results after the specified limit.
","source":"packages/datastore/src/index.js#L412","resources":[],"examples":[],"params":[],"exceptions":[],"returns":[]},{"id":"NO_MORE_RESULTS","name":"NO_MORE_RESULTS","type":"instance","description":"This is one of three values which may be returned from datastore#runQuery, transaction#runQuery, and datastore/query#run as info.moreResults
.
There are no more results left to query for.
","source":"packages/datastore/src/index.js#L424","resources":[],"examples":[],"params":[],"exceptions":[],"returns":[]},{"id":"createQuery","name":"createQuery","type":"instance","description":"Create a query for the specified kind. See datastore/query for all of the available methods.
","source":"packages/datastore/src/index.js#L442","resources":[{"title":"Datastore Queries","link":"https://cloud.google.com/datastore/docs/concepts/queries"}],"examples":[{"code":"var query = datastore.createQuery('Company');"}],"params":[{"name":"namespace","description":"Helper to create a Key object, scoped to the instance's namespace by default.
You may also specify a configuration object to define a namespace and path.
","source":"packages/datastore/src/index.js#L497","resources":[],"examples":[{"caption":"Create an incomplete key with a kind value of Company
.
Create a complete key with a kind value of Company
and id 123
.
If the ID integer is outside the bounds of a JavaScript Number object, \ncreate an Int.
","code":"var key = datastore.key([\n 'Company',\n datastore.int('100000000000001234')\n]);"},{"caption":"Create a complete key with a kind value of Company
and name Google
. \nNote: id
is used for numeric identifiers and name
is used otherwise.
Create a complete key from a provided namespace and path.
","code":"var key = datastore.key({\n namespace: 'My-NS',\n path: ['Company', 123]\n});"}],"params":[{"name":"options","description":"A newly created Key from the options given.
"}]},{"id":"allocateIds","name":"allocateIds","type":"instance","description":"Generate IDs without creating entities.
","source":"packages/datastore/src/request.js#L171","resources":[],"examples":[{"code":"var incompleteKey = datastore.key(['Company']);"},{"caption":"The following call will create 100 new IDs from the Company kind, which \nexists under the default namespace.
","code":"datastore.allocateIds(incompleteKey, 100, function(err, keys) {});"},{"caption":"Or, if you're using a transaction object.
","code":"var transaction = datastore.transaction();\n\ntransaction.run(function(err) {\n if (err) {\n // Error handling omitted.\n }\n\n transaction.allocateIds(incompleteKey, 100, function(err, keys) {\n if (err) {\n // Error handling omitted.\n }\n\n transaction.commit(function(err) {\n if (!err) {\n // Transaction committed successfully.\n }\n });\n });\n});"},{"caption":"You may prefer to create IDs from a non-default namespace by providing an \nincomplete key with a namespace. Similar to the previous example, the call \nbelow will create 100 new IDs, but from the Company kind that exists under \nthe \"ns-test\" namespace.
","code":"var incompleteKey = datastore.key({\n namespace: 'ns-test',\n path: ['Company']\n});\n\nfunction callback(err, keys, apiResponse) {}\n\ndatastore.allocateIds(incompleteKey, 100, callback);"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"datastore.allocateIds(incompleteKey, 100).then(function(data) {\n var keys = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"incompleteKey","description":"Retrieve the entities as a readable object stream.
","source":"packages/datastore/src/request.js#L226","resources":[],"examples":[{"code":"var keys = [\n datastore.key(['Company', 123]),\n datastore.key(['Product', 'Computer'])\n];\n\ndatastore.createReadStream(keys)\n .on('error', function(err) {})\n .on('data', function(entity) {\n // entity is an entity object.\n })\n .on('end', function() {\n // All entities retrieved.\n });"}],"params":[{"name":"keys","description":"If at least one Key object is not provided.
"}],"returns":[]},{"id":"delete","name":"delete","type":"instance","description":"Delete all entities identified with the specified key(s).
","source":"packages/datastore/src/request.js#L337","resources":[],"examples":[{"code":"var key = datastore.key(['Company', 123]);\ndatastore.delete(key, function(err, apiResp) {});"},{"caption":"Or, if you're using a transaction object.
","code":"var transaction = datastore.transaction();\n\ntransaction.run(function(err) {\n if (err) {\n // Error handling omitted.\n }\n\n transaction.delete(key);\n\n transaction.commit(function(err) {\n if (!err) {\n // Transaction committed successfully.\n }\n });\n});"},{"caption":"Delete multiple entities at once.
","code":"datastore.delete([\n datastore.key(['Company', 123]),\n datastore.key(['Product', 'Computer'])\n], function(err, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"datastore.delete().then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[{"name":"key","description":"Retrieve the entities identified with the specified key(s) in the current transaction. Get operations require a valid key to retrieve the key-identified entity from Datastore.
","source":"packages/datastore/src/request.js#L445","resources":[],"examples":[{"caption":"Get a single entity.
","code":"var key = datastore.key(['Company', 123]);\n\ndatastore.get(key, function(err, entity) {});"},{"caption":"Or, if you're using a transaction object.
","code":"var transaction = datastore.transaction();\n\ntransaction.run(function(err) {\n if (err) {\n // Error handling omitted.\n }\n\n transaction.get(key, function(err, entity) {\n if (err) {\n // Error handling omitted.\n }\n\n transaction.commit(function(err) {\n if (!err) {\n // Transaction committed successfully.\n }\n });\n });\n});"},{"caption":"Get multiple entities at once with a callback.
","code":"var keys = [\n datastore.key(['Company', 123]),\n datastore.key(['Product', 'Computer'])\n];\n\ndatastore.get(keys, function(err, entities) {});"},{"caption":"Here's how you would update the value of an entity with the help of the \nsave
method.
If the callback is omitted, we'll return a Promise.
","code":"datastore.get(keys).then(function(data) {\n var entities = data[0];\n});"}],"params":[{"name":"keys","description":"strong
or eventual
. If not specified, default values are chosen by Datastore for the operation. Learn more about strong and eventual consistency here.If at least one Key object is not provided.
"}],"returns":[]},{"id":"runQuery","name":"runQuery","type":"instance","description":"Datastore allows you to query entities by kind, filter them by property filters, and sort them by a property name. Projection and pagination are also supported.
The query is run, and the results are returned as the second argument to your callback. A third argument may also exist, which is a query object that uses the end cursor from the previous query as the starting cursor for the next query. You can pass that object back to this method to see if more results exist.
","source":"packages/datastore/src/request.js#L561","resources":[],"examples":[{"caption":"Where you see transaction
, assume this is the context that's relevant to \nyour use, whether that be a Datastore or a Transaction object.
Or, if you're using a transaction object.
","code":"var transaction = datastore.transaction();\n\ntransaction.run(function(err) {\n if (err) {\n // Error handling omitted.\n }\n\n transaction.runQuery(query, function(err, entities) {\n if (err) {\n // Error handling omitted.\n }\n\n transaction.commit(function(err) {\n if (!err) {\n // Transaction committed successfully.\n }\n });\n });\n});"},{"caption":"A keys-only query returns just the keys of the result entities instead of \nthe entities themselves, at lower latency and cost.
","code":"var keysOnlyQuery = datastore.createQuery('Lion').select('__key__');\n\ndatastore.runQuery(keysOnlyQuery, function(err, entities) {\n var keys = entities.map(function(entity) {\n return entity[datastore.KEY];\n });\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"datastore.runQuery(query).then(function(data) {\n var entities = data[0];\n});"}],"params":[{"name":"query","description":"strong
or eventual
. If not specified, default values are chosen by Datastore for the operation. Learn more about strong and eventual consistency here.Get a list of entities as a readable object stream.
See datastore#runQuery for a list of all available options.
","source":"packages/datastore/src/request.js#L610","resources":[],"examples":[{"code":"datastore.runQueryStream(query)\n .on('error', console.error)\n .on('data', function(entity) {\n // Access the Key object for this entity.\n var key = entity[datastore.KEY];\n })\n .on('info', function(info) {})\n .on('end', function() {\n // All entities retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"datastore.runQueryStream(query)\n .on('data', function(entity) {\n this.end();\n });"}],"params":[{"name":"query","description":"Insert or update the specified object(s). If a key is incomplete, its associated object is inserted and the original Key object is updated to contain the generated ID.
This method will determine the correct Datastore method to execute (upsert
, insert
, or update
) by using the key(s) provided. For example, if you provide an incomplete key (one without an ID), the request will create a new entity and have its ID automatically assigned. If you provide a complete key, the entity will be updated with the data specified.
By default, all properties are indexed. To prevent a property from being included in all indexes, you must supply an entity's data
property as an array. See below for an example.
Save a single entity. \nNotice that we are providing an incomplete key. After saving, the original \nKey object used to save will be updated to contain the path with its \ngenerated ID.
","code":"var key = datastore.key('Company');\nvar entity = {\n key: key,\n data: {\n rating: '10'\n }\n};\n\ndatastore.save(entity, function(err) {\n console.log(key.path); // [ 'Company', 5669468231434240 ]\n console.log(key.namespace); // undefined\n});"},{"caption":"Save a single entity using a provided name instead of auto-generated ID. \nHere we are providing a key with name instead of an ID. After saving, the \noriginal Key object used to save will be updated to contain the path with \nthe name instead of a generated ID.
","code":"var key = datastore.key(['Company', 'donutshack']);\nvar entity = {\n key: key,\n data: {\n name: 'DonutShack',\n rating: 8\n }\n};\n\ndatastore.save(entity, function(err) {\n console.log(key.path); // ['Company', 'donutshack']\n console.log(key.namespace); // undefined\n});"},{"caption":"Save a single entity with a provided namespace. Namespaces allow for \nmultitenancy. To read more about this, see \n[the Datastore docs on key concepts](https://goo.gl/M1LUAu). \nHere we are providing a key with namespace.
","code":"var key = datastore.key({\n namespace: 'my-namespace',\n path: ['Company', 'donutshack']\n});\n\nvar entity = {\n key: key,\n data: {\n name: 'DonutShack',\n rating: 8\n }\n};\n\ndatastore.save(entity, function(err) {\n console.log(key.path); // ['Company', 'donutshack']\n console.log(key.namespace); // 'my-namespace'\n});"},{"caption":"Save different types of data, including ints, doubles, dates, booleans, \nblobs, and lists. \nNotice that we are providing an incomplete key. After saving, the original \nKey object used to save will be updated to contain the path with its \ngenerated ID.
","code":"var key = datastore.key('Company');\nvar entity = {\n key: key,\n data: {\n name: 'DonutShack',\n rating: datastore.int(10),\n worth: datastore.double(123456.78),\n location: datastore.geoPoint({\n latitude: 40.6894,\n longitude: -74.0447\n }),\n numDonutsServed: 45,\n founded: new Date('Tue May 12 2015 15:30:00 GMT-0400 (EDT)'),\n isStartup: true,\n donutEmoji: new Buffer('\\uD83C\\uDF69'),\n keywords: [\n 'donut',\n 'coffee',\n 'yum'\n ]\n }\n};\n\ndatastore.save(entity, function(err, apiResponse) {});"},{"caption":"To specify an excludeFromIndexes
value for a Datastore entity, pass in \nan array for the key's data.
Save multiple entities at once.
","code":"var companyKey = datastore.key(['Company', 123]);\nvar productKey = datastore.key(['Product', 'Computer']);\nvar entities = [\n {\n key: companyKey,\n data: {\n HQ: 'Dallas, TX'\n }\n },\n {\n key: productKey,\n data: {\n vendor: 'Dell'\n }\n }\n];\n\ndatastore.save(entities, function(err, apiResponse) {});"},{"caption":"Explicitly attempt to 'insert' a specific entity.
","code":"var userKey = datastore.key(['User', 'chilts']);\nvar entity = {\n key: userKey,\n method: 'insert',\n data: {\n fullName: 'Andrew Chilton'\n }\n};\n\ndatastore.save(entity, function(err, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"datastore.save(entity).then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[{"name":"entities","description":"name
for the name of the property and value
for its value. You may also specify an excludeFromIndexes
property, set to true
or false
.If an unrecognized method is provided.
"}],"returns":[]}],"path":"index.json"} \ No newline at end of file diff --git a/json/google-cloud/v0.51.1/datastore/query.json b/json/google-cloud/v0.51.1/datastore/query.json new file mode 100644 index 00000000000..2dc7099b19b --- /dev/null +++ b/json/google-cloud/v0.51.1/datastore/query.json @@ -0,0 +1 @@ +{"id":"datastore/query","type":"class","name":"Query","overview":"\n This class allows you interact with Cloud Datastore.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/datastore
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
Build a Query object.
Queries are built with datastore#createQuery and transaction#createQuery.
","source":"packages/datastore/src/query.js#L47","resources":[{"title":"Datastore Queries","link":"http://goo.gl/Cag0r6"}],"examples":[{"code":"var query = datastore.createQuery('AnimalNamespace', 'Lion');"}],"params":[{"name":"namespace","description":"Datastore allows querying on properties. Supported comparison operators are =
, <
, >
, <=
, and >=
. "Not equal" and IN
operators are currently not supported.
To filter by ancestors, see datastore/query#hasAncestor.
","source":"packages/datastore/src/query.js#L104","resources":[{"title":"Datastore Filters","link":"https://cloud.google.com/datastore/docs/concepts/queries#datastore-property-filter-nodejs"}],"examples":[{"caption":"List all companies that are located in California.
","code":"var caliQuery = query.filter('state', 'CA');"},{"caption":"List all companies named Google that have less than 400 employees.
","code":"var companyQuery = query\n .filter('name', 'Google')\n .filter('size', '<', 400);"},{"caption":"To filter by key, use __key__
for the property name. Filter on keys \nstored as properties is not currently supported.
=
Filter a query by ancestors.
","source":"packages/datastore/src/query.js#L130","resources":[{"title":"Datastore Ancestor Filters","link":"https://cloud.google.com/datastore/docs/concepts/queries#datastore-ancestor-query-nodejs"}],"examples":[{"code":"var ancestoryQuery = query.hasAncestor(datastore.key(['Parent', 123]));"}],"params":[{"name":"key","description":"Sort the results by a property name in ascending or descending order. By default, an ascending sort order will be used.
","source":"packages/datastore/src/query.js#L156","resources":[{"title":"Datastore Sort Orders","link":"https://cloud.google.com/datastore/docs/concepts/queries#datastore-ascending-sort-nodejs"}],"examples":[{"code":"// Sort by size ascendingly.\nvar companiesAscending = companyQuery.order('size');\n\n// Sort by size descendingly.\nvar companiesDescending = companyQuery.order('size', {\n descending: true\n});"}],"params":[{"name":"property","description":"false
.Group query results by a list of properties.
","source":"packages/datastore/src/query.js#L172","resources":[],"examples":[{"code":"var groupedQuery = companyQuery.groupBy(['name', 'size']);"}],"params":[{"name":"properties","description":"Retrieve only select properties from the matched entities.
Queries that select a subset of properties are called Projection Queries.
","source":"packages/datastore/src/query.js#L195","resources":[{"title":"Projection Queries","link":"https://cloud.google.com/datastore/docs/concepts/projectionqueries"}],"examples":[{"code":"// Only retrieve the name property.\nvar selectQuery = companyQuery.select('name');\n\n// Only retrieve the name and size properties.\nvar selectQuery = companyQuery.select(['name', 'size']);"}],"params":[{"name":"fieldNames","description":"Set a starting cursor to a query.
","source":"packages/datastore/src/query.js#L214","resources":[{"title":"Query Cursors","link":"https://cloud.google.com/datastore/docs/concepts/queries#cursors_limits_and_offsets"}],"examples":[{"code":"var cursorToken = 'X';\n\n// Retrieve results starting from cursorToken.\nvar startQuery = companyQuery.start(cursorToken);"}],"params":[{"name":"cursorToken","description":"Set an ending cursor to a query.
","source":"packages/datastore/src/query.js#L233","resources":[{"title":"Query Cursors","link":"https://cloud.google.com/datastore/docs/concepts/queries#Datastore_Query_cursors"}],"examples":[{"code":"var cursorToken = 'X';\n\n// Retrieve results limited to the extent of cursorToken.\nvar endQuery = companyQuery.end(cursorToken);"}],"params":[{"name":"cursorToken","description":"Set a limit on a query.
","source":"packages/datastore/src/query.js#L250","resources":[{"title":"Query Limits","link":"https://cloud.google.com/datastore/docs/concepts/queries#datastore-limit-nodejs"}],"examples":[{"code":"// Limit the results to 10 entities.\nvar limitQuery = companyQuery.limit(10);"}],"params":[{"name":"n","description":"Set an offset on a query.
","source":"packages/datastore/src/query.js#L267","resources":[{"title":"Query Offsets","link":"https://cloud.google.com/datastore/docs/concepts/queries#datastore-limit-nodejs"}],"examples":[{"code":"// Start from the 101st result.\nvar offsetQuery = companyQuery.offset(100);"}],"params":[{"name":"n","description":"Run the query.
","source":"packages/datastore/src/query.js#L322","resources":[],"examples":[{"code":"query.run(function(err, entities, info) {\n // entities = An array of records.\n\n // Access the Key object for an entity.\n var firstEntityKey = entities[0][datastore.KEY];\n});"},{"caption":"A keys-only query returns just the keys of the result entities instead of \nthe entities themselves, at lower latency and cost.
","code":"query.select('__key__');\n\nquery.run(function(err, entities) {\n var keys = entities.map(function(entity) {\n return entity[datastore.KEY];\n });\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"query.run().then(function(data) {\n var entities = data[0];\n});"}],"params":[{"name":"options","description":"strong
or eventual
. If not specified, default values are chosen by Datastore for the operation. Learn more about strong and eventual consistency here.Run the query as a readable object stream.
","source":"packages/datastore/src/query.js#L357","resources":[],"examples":[{"code":"query.runStream()\n .on('error', console.error)\n .on('data', function (entity) {\n // Access the Key object for this entity.\n var key = entity[datastore.KEY];\n })\n .on('info', function(info) {})\n .on('end', function() {\n // All entities retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"query.runStream()\n .on('data', function (entity) {\n this.end();\n });"}],"params":[{"name":"options","description":"\n This class allows you interact with Cloud Datastore.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/datastore
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
A transaction is a set of Datastore operations on one or more entities. Each transaction is guaranteed to be atomic, which means that transactions are never partially applied. Either all of the operations in the transaction are applied, or none of them are applied.
","source":"packages/datastore/src/transaction.js#L54","resources":[{"title":"Transactions Reference","link":"https://cloud.google.com/datastore/docs/concepts/transactions"}],"examples":[{"code":"var transaction = datastore.transaction();"}],"params":[],"exceptions":[],"returns":[]},{"id":"commit","name":"commit","type":"instance","description":"Commit the remote transaction and finalize the current transaction instance.
If the commit request fails, we will automatically rollback the transaction.
","source":"packages/datastore/src/transaction.js#L108","resources":[],"examples":[{"code":"transaction.commit(function(err, apiResponse) {\n if (err) {\n // Transaction could not be committed.\n }\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"transaction.commit().then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[{"name":"callback","description":"Create a query for the specified kind. See datastore/query for all of the available methods.
","source":"packages/datastore/src/transaction.js#L245","resources":[{"title":"Datastore Queries","link":"https://cloud.google.com/datastore/docs/concepts/queries"}],"examples":[{"code":"// Run the query inside the transaction.\ntransaction.run(function(err) {\n if (err) {\n // Error handling omitted.\n }\n\n var query = transaction.createQuery('Company');\n\n query.run(function(err, entities) {\n if (err) {\n // Error handling omitted.\n }\n\n transaction.commit(function(err) {\n if (!err) {\n // Transaction committed successfully.\n }\n });\n });\n});"}],"params":[{"name":"namespace","description":"Delete all entities identified with the specified key(s) in the current transaction.
","source":"packages/datastore/src/transaction.js#L277","resources":[],"examples":[{"code":"transaction.run(function(err) {\n if (err) {\n // Error handling omitted.\n }\n\n // Delete a single entity.\n transaction.delete(datastore.key(['Company', 123]));\n\n // Delete multiple entities at once.\n transaction.delete([\n datastore.key(['Company', 123]),\n datastore.key(['Product', 'Computer'])\n ]);\n\n transaction.commit(function(err) {\n if (!err) {\n // Transaction committed successfully.\n }\n });\n});"}],"params":[{"name":"key","description":"Reverse a transaction remotely and finalize the current transaction instance.
","source":"packages/datastore/src/transaction.js#L318","resources":[],"examples":[{"code":"transaction.run(function(err) {\n if (err) {\n // Error handling omitted.\n }\n\n transaction.rollback(function(err) {\n if (!err) {\n // Transaction rolled back successfully.\n }\n });\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"transaction.rollback().then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[{"name":"callback","description":"Begin a remote transaction. In the callback provided, run your transactional commands.
","source":"packages/datastore/src/transaction.js#L375","resources":[],"examples":[{"code":"transaction.run(function(err, transaction) {\n // Perform Datastore transactional operations.\n var key = datastore.key(['Company', 123]);\n\n transaction.get(key, function(err, entity) {\n entity.name = 'Google';\n\n transaction.save({\n key: key,\n data: entity\n });\n\n transaction.commit(function(err) {\n if (!err) {\n // Data saved successfully.\n }\n });\n });\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"transaction.run().then(function(data) {\n var transaction = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"Insert or update the specified object(s) in the current transaction. If a key is incomplete, its associated object is inserted and the original Key object is updated to contain the generated ID.
This method will determine the correct Datastore method to execute (upsert
, insert
, or update
) by using the key(s) provided. For example, if you provide an incomplete key (one without an ID), the request will create a new entity and have its ID automatically assigned. If you provide a complete key, the entity will be updated with the data specified.
By default, all properties are indexed. To prevent a property from being included in all indexes, you must supply an entity's data
property as an array. See below for an example.
Save a single entity. \nNotice that we are providing an incomplete key. After the transaction is \ncommitted, the Key object held by the key
variable will be populated \nwith a path containing its generated ID.
To specify an excludeFromIndexes
value for a Datastore entity, pass in \nan array for the key's data. The above example would then look like:
Save multiple entities at once.
","code":"var companyKey = datastore.key(['Company', 123]);\nvar productKey = datastore.key(['Product', 'Computer']);\n\ntransaction.run(function(err) {\n if (err) {\n // Error handling omitted.\n }\n\n transaction.save([\n {\n key: companyKey,\n data: {\n HQ: 'Dallas, TX'\n }\n },\n {\n key: productKey,\n data: {\n vendor: 'Dell'\n }\n }\n ]);\n\n transaction.commit(function(err) {\n if (!err) {\n // Data saved successfully.\n }\n });\n});"}],"params":[{"name":"entities","description":"name
for the name of the property and value
for its value. You may also specify an excludeFromIndexes
property, set to true
or false
.Generate IDs without creating entities.
","source":"packages/datastore/src/request.js#L171","resources":[],"examples":[{"code":"var incompleteKey = datastore.key(['Company']);"},{"caption":"The following call will create 100 new IDs from the Company kind, which \nexists under the default namespace.
","code":"datastore.allocateIds(incompleteKey, 100, function(err, keys) {});"},{"caption":"Or, if you're using a transaction object.
","code":"var transaction = datastore.transaction();\n\ntransaction.run(function(err) {\n if (err) {\n // Error handling omitted.\n }\n\n transaction.allocateIds(incompleteKey, 100, function(err, keys) {\n if (err) {\n // Error handling omitted.\n }\n\n transaction.commit(function(err) {\n if (!err) {\n // Transaction committed successfully.\n }\n });\n });\n});"},{"caption":"You may prefer to create IDs from a non-default namespace by providing an \nincomplete key with a namespace. Similar to the previous example, the call \nbelow will create 100 new IDs, but from the Company kind that exists under \nthe \"ns-test\" namespace.
","code":"var incompleteKey = datastore.key({\n namespace: 'ns-test',\n path: ['Company']\n});\n\nfunction callback(err, keys, apiResponse) {}\n\ndatastore.allocateIds(incompleteKey, 100, callback);"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"datastore.allocateIds(incompleteKey, 100).then(function(data) {\n var keys = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"incompleteKey","description":"Retrieve the entities as a readable object stream.
","source":"packages/datastore/src/request.js#L226","resources":[],"examples":[{"code":"var keys = [\n datastore.key(['Company', 123]),\n datastore.key(['Product', 'Computer'])\n];\n\ndatastore.createReadStream(keys)\n .on('error', function(err) {})\n .on('data', function(entity) {\n // entity is an entity object.\n })\n .on('end', function() {\n // All entities retrieved.\n });"}],"params":[{"name":"keys","description":"If at least one Key object is not provided.
"}],"returns":[]},{"id":"get","name":"get","type":"instance","description":"Retrieve the entities identified with the specified key(s) in the current transaction. Get operations require a valid key to retrieve the key-identified entity from Datastore.
","source":"packages/datastore/src/request.js#L445","resources":[],"examples":[{"caption":"Get a single entity.
","code":"var key = datastore.key(['Company', 123]);\n\ndatastore.get(key, function(err, entity) {});"},{"caption":"Or, if you're using a transaction object.
","code":"var transaction = datastore.transaction();\n\ntransaction.run(function(err) {\n if (err) {\n // Error handling omitted.\n }\n\n transaction.get(key, function(err, entity) {\n if (err) {\n // Error handling omitted.\n }\n\n transaction.commit(function(err) {\n if (!err) {\n // Transaction committed successfully.\n }\n });\n });\n});"},{"caption":"Get multiple entities at once with a callback.
","code":"var keys = [\n datastore.key(['Company', 123]),\n datastore.key(['Product', 'Computer'])\n];\n\ndatastore.get(keys, function(err, entities) {});"},{"caption":"Here's how you would update the value of an entity with the help of the \nsave
method.
If the callback is omitted, we'll return a Promise.
","code":"datastore.get(keys).then(function(data) {\n var entities = data[0];\n});"}],"params":[{"name":"keys","description":"strong
or eventual
. If not specified, default values are chosen by Datastore for the operation. Learn more about strong and eventual consistency here.If at least one Key object is not provided.
"}],"returns":[]},{"id":"runQuery","name":"runQuery","type":"instance","description":"Datastore allows you to query entities by kind, filter them by property filters, and sort them by a property name. Projection and pagination are also supported.
The query is run, and the results are returned as the second argument to your callback. A third argument may also exist, which is a query object that uses the end cursor from the previous query as the starting cursor for the next query. You can pass that object back to this method to see if more results exist.
","source":"packages/datastore/src/request.js#L561","resources":[],"examples":[{"caption":"Where you see transaction
, assume this is the context that's relevant to \nyour use, whether that be a Datastore or a Transaction object.
Or, if you're using a transaction object.
","code":"var transaction = datastore.transaction();\n\ntransaction.run(function(err) {\n if (err) {\n // Error handling omitted.\n }\n\n transaction.runQuery(query, function(err, entities) {\n if (err) {\n // Error handling omitted.\n }\n\n transaction.commit(function(err) {\n if (!err) {\n // Transaction committed successfully.\n }\n });\n });\n});"},{"caption":"A keys-only query returns just the keys of the result entities instead of \nthe entities themselves, at lower latency and cost.
","code":"var keysOnlyQuery = datastore.createQuery('Lion').select('__key__');\n\ndatastore.runQuery(keysOnlyQuery, function(err, entities) {\n var keys = entities.map(function(entity) {\n return entity[datastore.KEY];\n });\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"datastore.runQuery(query).then(function(data) {\n var entities = data[0];\n});"}],"params":[{"name":"query","description":"strong
or eventual
. If not specified, default values are chosen by Datastore for the operation. Learn more about strong and eventual consistency here.Get a list of entities as a readable object stream.
See datastore#runQuery for a list of all available options.
","source":"packages/datastore/src/request.js#L610","resources":[],"examples":[{"code":"datastore.runQueryStream(query)\n .on('error', console.error)\n .on('data', function(entity) {\n // Access the Key object for this entity.\n var key = entity[datastore.KEY];\n })\n .on('info', function(info) {})\n .on('end', function() {\n // All entities retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"datastore.runQueryStream(query)\n .on('data', function(entity) {\n this.end();\n });"}],"params":[{"name":"query","description":"\n This class allows you interact with Cloud DNS.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/dns
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
Check if the change exists.
","source":"packages/dns/src/change.js#L57","resources":[],"examples":[{"code":"change.exists(function(err, exists) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"change.exists().then(function(data) {\n var exists = data[0];\n});"}],"params":[{"name":"callback","description":"Get a change if it exists.
You may optionally use this to "get or create" an object by providing an object with autoCreate
set to true
. Any extra configuration that is normally required for the create
method must be contained within this object as well.
If the callback is omitted, we'll return a Promise.
","code":"change.get().then(function(data) {\n var change = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"options","description":"false
Get the metadata for the change in the zone.
","source":"packages/dns/src/change.js#L119","resources":[{"title":"Changes: get API Documentation","link":"https://cloud.google.com/dns/api/v1/changes/get"}],"examples":[{"code":"change.getMetadata(function(err, metadata, apiResponse) {\n if (!err) {\n // metadata = {\n // kind: 'dns#change',\n // additions: [{...}],\n // deletions: [{...}],\n // startTime: '2015-07-21T14:40:06.056Z',\n // id: '1',\n // status: 'done'\n // }\n }\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"change.getMetadata().then(function(data) {\n var metadata = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"Create a change.
","source":"packages/dns/src/change.js#L159","resources":[],"examples":[{"code":"var config = {\n add: {\n // ...\n }\n};\n\nchange.create(config, function(err, change, apiResponse) {\n if (!err) {\n // The change was created successfully.\n }\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"change.create(config).then(function(data) {\n var change = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"config","description":" ","types":["object"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]}],"path":"change.json"} \ No newline at end of file diff --git a/json/google-cloud/v0.51.1/dns/index.json b/json/google-cloud/v0.51.1/dns/index.json new file mode 100644 index 00000000000..1fcf31b8c22 --- /dev/null +++ b/json/google-cloud/v0.51.1/dns/index.json @@ -0,0 +1 @@ +{"id":"dns","type":"class","name":"DNS","overview":"\n This class allows you interact with Cloud DNS.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/dns
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
Cloud DNS is a high- performance, resilient, global DNS service that provides a cost-effective way to make your applications and services available to your users. This programmable, authoritative DNS service can be used to easily publish and manage DNS records using the same infrastructure relied upon by Google.
","source":"packages/dns/src/index.js#L49","resources":[{"title":"What is Cloud DNS?","link":"https://cloud.google.com/dns/what-is-cloud-dns"}],"examples":[],"params":[{"name":"options","description":" ","types":["object"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]},{"id":"createZone","name":"createZone","type":"instance","description":"Create a managed zone.
","source":"packages/dns/src/index.js#L106","resources":[{"title":"ManagedZones: create API Documentation","link":"https://cloud.google.com/dns/api/v1/managedZones/create"}],"examples":[{"code":"var config = {\n dnsName: 'example.com.', // note the period at the end of the domain.\n description: 'This zone is awesome!'\n};\n\ndns.createZone('my-awesome-zone', config, function(err, zone, apiResponse) {\n if (!err) {\n // The zone was created successfully.\n }\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"dns.createZone('my-awesome-zone', config).then(function(data) {\n var zone = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"name","description":"If a zone name is not provided.
"},{"type":"error","description":"If a zone dnsName is not provided.
"}],"returns":[]},{"id":"getZones","name":"getZones","type":"instance","description":"Gets a list of managed zones for the project.
","source":"packages/dns/src/index.js#L166","resources":[{"title":"ManagedZones: list API Documentation","link":"https://cloud.google.com/dns/api/v1/managedZones/list"}],"examples":[{"code":"dns.getZones(function(err, zones, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"dns.getZones().then(function(data) {\n var zones = data[0];\n});"}],"params":[{"name":"query","description":"Gets a list of dns/zone objects for the project as a readable object stream.
","source":"packages/dns/src/index.js#L228","resources":[],"examples":[{"code":"dns.getZonesStream()\n .on('error', console.error)\n .on('data', function(zone) {\n // zone is a Zone object.\n })\n .on('end', function() {\n // All zones retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"dns.getZonesStream()\n .on('data', function(zone) {\n this.end();\n });"}],"params":[{"name":"query","description":"Create a zone object representing a managed zone.
","source":"packages/dns/src/index.js#L241","resources":[],"examples":[{"code":"var zone = dns.zone('my-zone');"}],"params":[{"name":"name","description":"If a zone name is not provided.
"}],"returns":[{"types":["dns/zone"],"description":""}]}],"path":"index.json"} \ No newline at end of file diff --git a/json/google-cloud/v0.51.1/dns/record.json b/json/google-cloud/v0.51.1/dns/record.json new file mode 100644 index 00000000000..c8c6c07bf1c --- /dev/null +++ b/json/google-cloud/v0.51.1/dns/record.json @@ -0,0 +1 @@ +{"id":"dns/record","type":"class","name":"Record","overview":"\n This class allows you interact with Cloud DNS.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/dns
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
Create a Resource Record object.
","source":"packages/dns/src/record.js#L53","resources":[],"examples":[{"code":"var zone = dns.zone('my-awesome-zone');\n\nvar record = zone.record('a', {\n name: 'example.com.',\n ttl: 86400,\n data: '1.2.3.4'\n});"}],"params":[{"name":"type","description":"A
, AAAA
, MX
.www.example.com.
.Delete this record by creating a change on your zone. This is a convenience method for:
zone.createChange({ delete: record }, function(err, change, apiResponse) {});
","source":"packages/dns/src/record.js#L130","resources":[{"title":"ManagedZones: create API Documentation","link":"https://cloud.google.com/dns/api/v1/managedZones/create"}],"examples":[{"code":"record.delete(function(err, change, apiResponse) {\n if (!err) {\n // Delete change modification was created.\n }\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"record.delete().then(function(data) {\n var change = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"\n This class allows you interact with Cloud DNS.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/dns
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
A Zone object is used to interact with your project's managed zone. It will help you add or delete records, delete your zone, and many other convenience methods.
","source":"packages/dns/src/zone.js#L55","resources":[],"examples":[{"code":"var zone = dns.zone('zone-id');"}],"params":[],"exceptions":[],"returns":[]},{"id":"create","name":"create","type":"instance","description":"Create a zone.
","source":"packages/dns/src/zone.js#L82","resources":[],"examples":[{"code":"var config = {\n dnsName: 'example.com.',\n // ...\n};\n\nzone.create(config, function(err, zone, apiResponse) {\n if (!err) {\n // The zone was created successfully.\n }\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"zone.create(config).then(function(data) {\n var zone = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"config","description":"Check if the zone exists.
","source":"packages/dns/src/zone.js#L102","resources":[],"examples":[{"code":"zone.exists(function(err, exists) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"zone.exists().then(function(data) {\n var exists = data[0];\n});"}],"params":[{"name":"callback","description":"Get a zone if it exists.
You may optionally use this to "get or create" an object by providing an object with autoCreate
set to true
. Any extra configuration that is normally required for the create
method must be contained within this object as well.
If the callback is omitted, we'll return a Promise.
","code":"zone.get().then(function(data) {\n var zone = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"options","description":"false
Get the metadata for the zone.
","source":"packages/dns/src/zone.js#L152","resources":[{"title":"ManagedZones: get API Documentation","link":"https://cloud.google.com/dns/api/v1/managedZones/get"}],"examples":[{"code":"zone.getMetadata(function(err, metadata, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"zone.getMetadata().then(function(data) {\n var metadata = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"Add records to this zone. This is a convenience wrapper around dns/zone#createChange.
","source":"packages/dns/src/zone.js#L180","resources":[{"title":"ManagedZones: create API Documentation","link":"https://cloud.google.com/dns/api/v1/managedZones/create"}],"examples":[],"params":[{"name":"record","description":"Create a reference to a change object in this zone.
","source":"packages/dns/src/zone.js#L195","resources":[],"examples":[{"code":"var change = zone.change('change-id');"}],"params":[{"name":"id","description":"Create a change of resource record sets for the zone.
","source":"packages/dns/src/zone.js#L247","resources":[{"title":"ManagedZones: create API Documentation","link":"https://cloud.google.com/dns/api/v1/managedZones/create"}],"examples":[{"code":"var oldARecord = zone.record('a', {\n name: 'example.com.',\n data: '1.2.3.4',\n ttl: 86400\n});\n\nvar newARecord = zone.record('a', {\n name: 'example.com.',\n data: '5.6.7.8',\n ttl: 86400\n});\n\nvar config = {\n add: newARecord,\n delete: oldARecord\n};\n\nzone.createChange(config, function(err, change, apiResponse) {\n if (!err) {\n // The change was created successfully.\n }\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"zone.createChange(config).then(function(data) {\n var change = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"config","description":"Delete the zone.
Only empty zones can be deleted. Set options.force to true
to call dns/zone#empty before deleting the zone. Two API calls will then be made (one to empty, another to delete), which means this is not an atomic request.
Use force
to first empty the zone before deleting it.
If the callback is omitted, we'll return a Promise.
","code":"zone.delete().then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[{"name":"options","description":"Delete records from this zone. This is a convenience wrapper around dns/zone#createChange.
This method accepts dns/record objects or string record types in its place. This means that you can delete all A records or NS records, etc. If used this way, two API requests are made (one to get, then another to delete), which means the operation is not atomic and could result in unexpected changes.
","source":"packages/dns/src/zone.js#L408","resources":[{"title":"ManagedZones: create API Documentation","link":"https://cloud.google.com/dns/api/v1/managedZones/create"}],"examples":[{"code":"var oldARecord = zone.record('a', {\n name: 'example.com.',\n data: '1.2.3.4',\n ttl: 86400\n});\n\nvar callback = function(err, change, apiResponse) {\n if (!err) {\n // Delete change modification was created.\n }\n};\n\nzone.deleteRecords(oldARecord, callback);"},{"caption":"Delete multiple records at once.
","code":"var oldNs1Record = zone.record('ns', {\n name: 'example.com.',\n data: 'ns-cloud1.googledomains.com.',\n ttl: 86400\n});\n\nvar oldNs2Record = zone.record('ns', {\n name: 'example.com.',\n data: 'ns-cloud2.googledomains.com.',\n ttl: 86400\n});\n\nzone.deleteRecords([\n oldNs1Record,\n oldNs2Record\n], callback);"},{"caption":"Possibly a simpler way to perform the above change is deleting records by \ntype.
","code":"zone.deleteRecords('ns', callback);"},{"caption":"You can also delete records of multiple types.
","code":"zone.deleteRecords(['ns', 'a'], callback);"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"zone.deleteRecords(oldARecord).then(function(data) {\n var change = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"record","description":"Emptying your zone means leaving only 'NS' and 'SOA' records. This method will first fetch the non-NS and non-SOA records from your zone using dns/zone#getRecords, then use dns/zone#createChange to create a deletion change.
","source":"packages/dns/src/zone.js#L434","resources":[{"title":"ManagedZones: create API Documentation","link":"https://cloud.google.com/dns/api/v1/managedZones/create"}],"examples":[],"params":[{"name":"callback","description":"Provide a path to a zone file to copy records into the zone.
","source":"packages/dns/src/zone.js#L478","resources":[{"title":"ResourceRecordSets: list API Documentation","link":"https://cloud.google.com/dns/api/v1/resourceRecordSets/list"}],"examples":[{"code":"var zoneFilename = '/Users/stephen/zonefile.zone';\n\nzone.export(zoneFilename, function(err) {\n if (!err) {\n // The zone file was created successfully.\n }\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"zone.export(zoneFilename).then(function() {});"}],"params":[{"name":"localPath","description":"Get the list of changes associated with this zone. A change is an atomic update to a collection of records.
","source":"packages/dns/src/zone.js#L538","resources":[{"title":"Changes: get API Documentation","link":"https://cloud.google.com/dns/api/v1/changes/get"}],"examples":[{"code":"var callback = function(err, changes, nextQuery, apiResponse) {\n // The `metadata` property is populated for you with the metadata at the\n // time of fetching.\n changes[0].metadata;\n\n // However, in cases where you are concerned the metadata could have\n // changed, use the `getMetadata` method.\n changes[0].getMetadata(function(err, metadata) {});\n\n if (nextQuery) {\n // nextQuery will be non-null if there are more results.\n zone.getChanges(nextQuery, callback);\n }\n};\n\nzone.getChanges(callback);"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"zone.getChanges().then(function(data) {\n var changes = data[0];\n});"}],"params":[{"name":"query","description":"Get the list of dns/change objects associated with this zone as a readable object stream.
","source":"packages/dns/src/zone.js#L604","resources":[],"examples":[{"code":"zone.getChangesStream()\n .on('error', console.error)\n .on('data', function(change) {\n // change is a Change object.\n })\n .on('end', function() {\n // All changes retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"zone.getChangesStream()\n .on('data', function(change) {\n this.end();\n });"}],"params":[{"name":"query","description":"Get the list of records for this zone.
","source":"packages/dns/src/zone.js#L678","resources":[{"title":"ResourceRecordSets: list API Documentation","link":"https://cloud.google.com/dns/api/v1/resourceRecordSets/list"}],"examples":[{"code":"var callback = function(err, records, nextQuery, apiResponse) {\n if (!err) {\n // records is an array of Record objects.\n }\n\n if (nextQuery) {\n zone.getRecords(nextQuery, callback);\n }\n};\n\nzone.getRecords(callback);"},{"caption":"Provide a query for further customization.
","code":"// Get the namespace records for example.com.\nvar query = {\n name: 'example.com.',\n type: 'NS'\n};\n\nzone.getRecords(query, callback);"},{"caption":"If you only want records of a specific type or types, provide them in \nplace of the query object.
","code":"zone.getRecords('ns', function(err, records) {\n if (!err) {\n // records is an array of NS Record objects in your zone.\n }\n});"},{"caption":"You can also specify multiple record types.
","code":"zone.getRecords(['ns', 'a', 'cname'], function(err, records) {\n if (!err) {\n // records is an array of NS, A, and CNAME records in your zone.\n }\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"zone.getRecords(query).then(function(data) {\n var records = data[0];\n});"}],"params":[{"name":"query","description":"Get the list of dns/record objects for this zone as a readable object stream.
","source":"packages/dns/src/zone.js#L759","resources":[],"examples":[{"code":"zone.getRecordsStream()\n .on('error', console.error)\n .on('data', function(record) {\n // record is a Record object.\n })\n .on('end', function() {\n // All records retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"zone.getRecordsStream()\n .on('data', function(change) {\n this.end();\n });"}],"params":[{"name":"query","description":"Copy the records from a zone file into this zone.
","source":"packages/dns/src/zone.js#L789","resources":[{"title":"ManagedZones: create API Documentation","link":"https://cloud.google.com/dns/api/v1/managedZones/create"}],"examples":[{"code":"var zoneFilename = '/Users/dave/zonefile.zone';\n\nzone.import(zoneFilename, function(err, change, apiResponse) {\n if (!err) {\n // The change was created successfully.\n }\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"zone.import(zoneFilename).then(function(data) {\n var change = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"localPath","description":"A dns/record object can be used to construct a record you want to add to your zone, or to refer to an existing one.
Note that using this method will not itself make any API requests. You will use the object returned in other API calls, for example to add a record to your zone or to delete an existing one.
","source":"packages/dns/src/zone.js#L861","resources":[],"examples":[{"caption":"Reference an existing record to delete from your zone.
","code":"var oldARecord = zone.record('a', {\n name: 'example.com.',\n data: '1.2.3.4',\n ttl: 86400\n});"},{"caption":"Construct a record to add to your zone.
","code":"var newARecord = zone.record('a', {\n name: 'example.com.',\n data: '5.6.7.8',\n ttl: 86400\n});"},{"caption":"Use these records together to create a change.
","code":"zone.createChange({\n add: newARecord,\n delete: oldARecord\n}, function(err, change, apiResponse) {});"}],"params":[{"name":"type","description":"www.example.com.
.Provide a record type that should be deleted and replaced with other records.
This is not an atomic request. Two API requests are made (one to get records of the type that you've requested, then another to replace them), which means the operation is not atomic and could result in unexpected changes.
","source":"packages/dns/src/zone.js#L915","resources":[{"title":"ManagedZones: create API Documentation","link":"https://cloud.google.com/dns/api/v1/managedZones/create"}],"examples":[{"code":"var newNs1Record = zone.record('ns', {\n name: 'example.com.',\n data: 'ns-cloud1.googledomains.com.',\n ttl: 86400\n});\n\nvar newNs2Record = zone.record('ns', {\n name: 'example.com.',\n data: 'ns-cloud2.googledomains.com.',\n ttl: 86400\n});\n\nvar newNsRecords = [\n newNs1Record,\n newNs2Record\n];\n\nzone.replaceRecords('ns', newNsRecords, function(err, change, apiResponse) {\n if (!err) {\n // The change was created successfully.\n }\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"zone.replaceRecords('ns', newNsRecords).then(function(data) {\n var change = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"recordTypes","description":"\n This class allows you interact with Google Cloud.\n
\n\n\n\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
Analyze Big Data in the cloud with Google BigQuery. Run fast, SQL-like queries against multi-terabyte datasets in seconds. Scalable and easy to use, BigQuery gives you real-time insights about your data.
","source":"packages/google-cloud/src/index.js#L49","resources":[],"examples":[{"code":"var gcloud = require('google-cloud');\nvar bigquery = gcloud.bigquery({\n projectId: 'grape-spaceship-123',\n keyFilename: '/path/to/keyfile.json'\n});"}],"params":[],"exceptions":[],"returns":[{"types":["bigquery"],"description":""}]},{"id":"bigtable","name":"bigtable","type":"instance","description":"Cloud Bigtable is Google's NoSQL Big Data database service. It's the same database that powers many core Google services, including Search, Analytics, Maps, and Gmail.
","source":"packages/google-cloud/src/index.js#L69","resources":[],"examples":[{"code":"var gcloud = require('google-cloud');\nvar bigtable = gcloud.bigtable({\n projectId: 'grape-spaceship-123',\n keyFilename: '/path/to/keyfile.json',\n zone: 'us-central1-b',\n cluster: 'google-cloud-node'\n});"}],"params":[],"exceptions":[],"returns":[{"types":["bigtable"],"description":""}]},{"id":"compute","name":"compute","type":"instance","description":"With Compute Engine, you can run large-scale workloads on virtual machines hosted on Google's infrastructure. Choose a VM that fits your needs and gain the performance of Google’s worldwide fiber network.
","source":"packages/google-cloud/src/index.js#L88","resources":[],"examples":[{"code":"var gcloud = require('google-cloud');\nvar gce = gcloud.compute({\n projectId: 'grape-spaceship-123',\n keyFilename: '/path/to/keyfile.json'\n});"}],"params":[],"exceptions":[],"returns":[{"types":["compute"],"description":""}]},{"id":"datastore","name":"datastore","type":"instance","description":"Cloud Datastore is a fully managed, schemaless database for storing non-relational data. Use this object to create a Dataset to interact with your data, an "Int", and a "Double" representation.
","source":"packages/google-cloud/src/index.js#L107","resources":[],"examples":[{"code":"var gcloud = require('google-cloud');\nvar datastore = gcloud.datastore({\n projectId: 'grape-spaceship-123',\n keyFilename: '/path/to/keyfile.json'\n});"}],"params":[],"exceptions":[],"returns":[{"types":["datastore"],"description":""}]},{"id":"dns","name":"dns","type":"instance","description":"Cloud DNS is a high-performance, resilient, global DNS service that provides a cost- effective way to make your applications and services available to your users. This programmable, authoritative DNS service can be used to easily publish and manage DNS records using the same infrastructure relied upon by Google.
","source":"packages/google-cloud/src/index.js#L128","resources":[],"examples":[{"code":"var gcloud = require('google-cloud');\nvar dns = gcloud.dns({\n projectId: 'grape-spaceship-123',\n keyFilename: '/path/to/keyfile.json'\n});"}],"params":[],"exceptions":[],"returns":[{"types":["dns"],"description":""}]},{"id":"language","name":"language","type":"instance","description":"The Cloud Natural Language API provides natural language understanding technologies to developers, including sentiment analysis, entity recognition, and syntax analysis.
","source":"packages/google-cloud/src/index.js#L146","resources":[],"examples":[{"code":"var gcloud = require('google-cloud');\nvar language = gcloud.language({\n projectId: 'grape-spaceship-123',\n keyFilename: '/path/to/keyfile.json'\n});"}],"params":[],"exceptions":[],"returns":[{"types":["language"],"description":""}]},{"id":"logging","name":"logging","type":"instance","description":"Stackdriver Logging allows you to store, search, analyze, monitor, and alert on log data and events from Google Cloud Platform and Amazon Web Services (AWS).
","source":"packages/google-cloud/src/index.js#L164","resources":[],"examples":[{"code":"var gcloud = require('google-cloud');\nvar logging = gcloud.logging({\n projectId: 'grape-spaceship-123',\n keyFilename: '/path/to/keyfile.json'\n});"}],"params":[],"exceptions":[],"returns":[{"types":["logging"],"description":""}]},{"id":"monitoring","name":"monitoring","type":"instance","description":"Stackdriver Monitoring collects metrics, events, and metadata from Google Cloud Platform, Amazon Web Services (AWS), hosted uptime probes, application instrumentation, and a variety of common application components including Cassandra, Nginx, Apache Web Server, Elasticsearch and many others. Stackdriver ingests that data and generates insights via dashboards, charts, and alerts.
It does not follow the conventions you're familiar with from other parts of our library. A handwritten layer is not yet available.
The example below shows you how to instantiate the generated client. For further documentation, please browse the Monitoring .proto files on GitHub.
","source":"packages/google-cloud/src/index.js#L195","resources":[],"examples":[{"code":"var gcloud = require('google-cloud');\nvar monitoring = gcloud.monitoring.v3({\n projectId: 'grape-spaceship-123',\n keyFilename: '/path/to/keyfile.json'\n});"}],"params":[],"exceptions":[],"returns":[{"types":["monitoring"],"description":""}]},{"id":"prediction","name":"prediction","type":"instance","description":"The Google Prediction API provides pattern-matching and machine learning capabilities. Given a set of data examples to train against, you can create applications that can perform the following tasks:
Cloud Pub/Sub is a reliable, many-to-many, asynchronous messaging service from Cloud Platform.
","source":"packages/google-cloud/src/index.js#L240","resources":[],"examples":[{"code":"var gcloud = require('google-cloud');\nvar pubsub = gcloud.pubsub({\n projectId: 'grape-spaceship-123',\n keyFilename: '/path/to/keyfile.json'\n});"}],"params":[],"exceptions":[],"returns":[{"types":["pubsub"],"description":""}]},{"id":"resource","name":"resource","type":"instance","description":"The Cloud Resource Manager provides methods that you can use to programmatically manage your projects in the Google Cloud Platform. With this API, you can do the following:
Cloud Spanner is a highly scalable, transactional, managed, NewSQL database service. Cloud Spanner solves the need for a horizontally-scaling database with consistent global transaction and SQL semantics. With Cloud Spanner you don't need to choose between consistency and horizontal scaling — you get both.
","source":"packages/google-cloud/src/index.js#L284","resources":[],"examples":[{"code":"var gcloud = require('google-cloud');\nvar spanner = gcloud.spanner({\n projectId: 'grape-spaceship-123',\n keyFilename: '/path/to/keyfile.json'\n});"}],"params":[],"exceptions":[],"returns":[{"types":["spanner"],"description":""}]},{"id":"speech","name":"speech","type":"instance","description":"The Cloud Speech API enables easy integration of Google speech recognition technologies into developer applications. Send audio and receive a text transcription from the Cloud Speech API service.
","source":"packages/google-cloud/src/index.js#L303","resources":[],"examples":[{"code":"var gcloud = require('google-cloud');\nvar speech = gcloud.speech({\n projectId: 'grape-spaceship-123',\n keyFilename: '/path/to/keyfile.json'\n});"}],"params":[],"exceptions":[],"returns":[{"types":["speech"],"description":""}]},{"id":"storage","name":"storage","type":"instance","description":"Cloud Storage allows you to store data on Google infrastructure. Read Cloud Storage API docs for more information.
","source":"packages/google-cloud/src/index.js#L321","resources":[],"examples":[{"code":"var gcloud = require('google-cloud');\nvar gcs = gcloud.storage({\n projectId: 'grape-spaceship-123',\n keyFilename: '/path/to/keyfile.json'\n});"}],"params":[],"exceptions":[],"returns":[{"types":["storage"],"description":""}]},{"id":"translate","name":"translate","type":"instance","description":"With Cloud Translation, you can dynamically translate text between thousands of language pairs.
This API lets websites and programs integrate with Cloud Translation API programmatically.
","source":"packages/google-cloud/src/index.js#L340","resources":[],"examples":[{"code":"var gcloud = require('google-cloud');\nvar translate = gcloud.translate({\n key: 'API Key'\n});"}],"params":[],"exceptions":[],"returns":[{"types":["translate"],"description":""}]},{"id":"vision","name":"vision","type":"instance","description":"The Cloud Vision API allows easy integration of vision detection features, including image labeling, face and landmark detection, optical character recognition (OCR), and tagging of explicit content.
To learn more about the Vision API, see the Getting Started guide.
","source":"packages/google-cloud/src/index.js#L361","resources":[],"examples":[{"code":"var gcloud = require('google-cloud')({\n keyFilename: '/path/to/keyfile.json',\n projectId: 'grape-spaceship-123'\n});\n\nvar vision = gcloud.vision();"}],"params":[],"exceptions":[],"returns":[]},{"id":"gcloud","name":"gcloud","type":"constructor","description":"There are two key ways to use the gcloud
module.
Provide connection & configuration details up-front.
Provide them at the time of instantiation of sub-modules, e.g. a Datastore dataset, a Cloud Storage bucket, etc.
All of the returned modules hold a special interceptors
array you can use to have control over the flow of the internal operations of this library. As of now, we support a request interceptor, allowing you to tweak all of the API request options before the HTTP request is sent.
Note: If you are using the maxApiCalls
option with a method, your request interceptor will still be called, even if the maxApiCalls
limit was reached. The request to the API will still be prevented.
See the example below for more.
","source":"packages/google-cloud/src/index.js#L509","resources":[],"examples":[{"code":"var gcloud = require('google-cloud')({\n projectId: 'grape-spaceship-123',\n keyFilename: '/path/to/keyfile.json'\n});"},{"caption":"From the same authentication credentials, you may now access your Google \nCloud Storage buckets, for example.
","code":"var gcs = gcloud.storage();\nvar bucket = gcs.bucket('photos');"},{"caption":"However, if you need to override the global credentials, you may provide \nnew ones.
","code":"var otherGcs = gcloud.storage({\n keyFilename: '/path/to/other/keyfile.json'\n});\nvar otherBucket = otherGcs.bucket('other-photos');"},{"caption":"gcs
and otherGcs
will use their respective credentials for all future \nAPI requests. \n
request
interceptor to set a custom HTTP header on your requests.","code":"gcloud.interceptors.push({\n request: function(requestOptions) {\n requestOptions.headers = requestOptions.headers || {};\n requestOptions.headers['X-Cloud-Trace-Context'] = 'I will be overridden';\n return requestOptions;\n }\n});"},{"caption":"You can also set an interceptor on the service level, like a Storage \nobject.
","code":"gcs.interceptors.push({\n request: function(requestOptions) {\n requestOptions.headers = requestOptions.headers || {};\n requestOptions.headers['X-Cloud-Trace-Context'] = 'I will be overridden';\n return requestOptions;\n }\n});"},{"caption":"Additionally, set one on the service object level, such as a Bucket.
","code":"bucket.interceptors.push({\n request: function(requestOptions) {\n requestOptions.headers = requestOptions.headers || {};\n requestOptions.headers['X-Cloud-Trace-Context'] = 'I win!';\n return requestOptions;\n }\n});"},{"caption":"The following request will combine all of the headers, executed in the \norder from when they were assigned, respecting the hierarchy: \nglobal before service before service object.
","code":"bucket.getMetadata(function() {\n // This HTTP request was sent with the 'I win!' header specified above.\n});"},{"caption":"By default any methods that return a Promise object will use the native \nPromise constructor. If you wish to use a third-party library such as \nBluebird, you can specify this via the promise
option.
GCLOUD_PROJECT
for your project ID. If your app is running in an environment which supports Application Default Credentials, your project ID will be detected automatically.projectId
option above is not necessary. NOTE: .pem and .p12 require you to specify options.email
as well.\n This class allows you interact with Cloud Natural Language.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/language
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
Create a Natural Language Document object. From this object, you will be able to run multiple detections.
","source":"packages/language/src/document.js#L63","resources":[],"examples":[{"code":"var textToAnalyze = [\n 'Google is an American multinational technology company specializing in',\n 'Internet-related services and products.'\n].join(' ');\n\nvar document = language.document(textToAnalyze);"},{"caption":"Create a Document object with pre-defined configuration, such as its \nlanguage.
","code":"var spanishDocument = language.document('¿Dónde está la sede de Google?', {\n language: 'es'\n});"}],"params":[{"name":"config","description":"config
as an object to specify the language of the document, use this property to pass the inline content of the document or a Storage File object.Run an annotation of the text from the document.
By default, all annotation types are requested:
See the examples below for how to request a subset of those types.
If you only need one type of annotation, you may appreciate one of these other methods from our API:
","source":"packages/language/src/document.js#L389","resources":[{"title":"documents.annotateText API Documentation","link":"https://cloud.google.com/natural-language/reference/rest/v1/documents/annotateText"}],"examples":[{"code":"document.annotate(function(err, annotation) {\n if (err) {\n // Error handling omitted.\n }\n\n // annotation = {\n // language: 'en',\n // sentiment: {\n // magnitude: 0.5,\n // score: 0.5\n // },\n // entities: [\n // {\n // name: 'Google',\n // type: 'ORGANIZATION',\n // metadata: {\n // mid: '/m/045c7b',\n // wikipedia_url: 'http://en.wikipedia.org/wiki/Google'\n // },\n // salience: 0.7532734870910645,\n // mentions: [\n // {\n // text: {\n // content: 'Google',\n // beginOffset: -1\n // },\n // type: 'PROPER'\n // },\n // // ...\n // }\n // }\n // ],\n // sentences: [\n // {\n // text: {\n // content: 'Google is an American multinational technology...',\n // beginOffset: -1\n // },\n // sentiment: {\n // magnitude: 0.5,\n // score: 0.5\n // }\n // }\n // ],\n // tokens: [\n // {\n // text: {\n // content: 'Google',\n // beginOffset: -1\n // },\n // partOfSpeech: {\n // tag: 'NOUN',\n // aspect: 'ASPECT_UNKNOWN',\n // case: 'CASE_UNKNOWN',\n // form: 'FORM_UNKNOWN',\n // gender: 'GENDER_UNKNOWN',\n // mood: 'MOOD_UNKNOWN',\n // number: 'SINGULAR',\n // person: 'PERSON_UNKNOWN',\n // proper: 'PROPER',\n // reciprocity: 'RECIPROCITY_UNKNOWN',\n // tense: 'TENSE_UNKNOWN',\n // voice: 'VOICE_UNKNOWN'\n // },\n // dependencyEdge: {\n // headTokenIndex: 1,\n // label: 'NSUBJ'\n // },\n // lemma: 'Google'\n // },\n // // ...\n // ]\n // }\n});"},{"caption":"To request only certain annotation types, provide an options object.
","code":"var options = {\n entities: true,\n sentiment: true\n};\n\ndocument.annotate(function(err, annotation) {\n if (err) {\n // Error handling omitted.\n }\n\n // annotation = {\n // language: 'en',\n // sentiment: {\n // magnitude: 0.5,\n // score: 0.5\n // },\n // entities: [\n // {\n // name: 'Google',\n // type: 'ORGANIZATION',\n // metadata: {\n // mid: '/m/045c7b',\n // wikipedia_url: 'http://en.wikipedia.org/wiki/Google'\n // },\n // salience: 0.7532734870910645,\n // mentions: [\n // {\n // text: {\n // content: 'Google',\n // beginOffset: -1\n // },\n // type: 'PROPER'\n // },\n // // ...\n // }\n // }\n // ]\n // }\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"document.annotate().then(function(data) {\n var annotation = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"options","description":"UTF8
(also, buffer
), UTF16
(also string
), or UTF32
. (Alias for options.encodingType
). Default: 'UTF8' if a Buffer, otherwise 'UTF16'. See EncodingType
entities
, sentiment
, and syntax
) are enabled. By overriding any of these values, all defaults are switched to false
. (Alias for options.extractEntities
)entities
, sentiment
, and syntax
) are enabled. By overriding any of these values, all defaults are switched to false
. (Alias for options.extractSentiment
)entities
, sentiment
, and syntax
) are enabled. By overriding any of these values, all defaults are switched to false
. (Alias for options.extractDocumentSyntax
)Detect entities from the document.
","source":"packages/language/src/document.js#L514","resources":[{"title":"documents.analyzeEntities API Documentation","link":"https://cloud.google.com/natural-language/reference/rest/v1/documents/analyzeEntities"}],"examples":[{"code":"document.detectEntities(function(err, entities) {\n if (err) {\n // Error handling omitted.\n }\n\n // entities = [\n // {\n // name: 'Google',\n // type: 'ORGANIZATION',\n // metadata: {\n // mid: '/m/045c7b',\n // wikipedia_url: 'http://en.wikipedia.org/wiki/Google'\n // },\n // salience: 0.7532734870910645,\n // mentions: [\n // {\n // text: {\n // content: 'Google',\n // beginOffset: -1\n // },\n // type: 'PROPER'\n // },\n // // ...\n // }\n // },\n // // ...\n // ]\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"document.detectEntities().then(function(data) {\n var entities = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"options","description":"UTF8
(also, buffer
), UTF16
(also string
), or UTF32
. (Alias for options.encodingType
). Default: 'UTF8' if a Buffer, otherwise 'UTF16'. See EncodingType
false
Detect the sentiment of the text in this document.
","source":"packages/language/src/document.js#L570","resources":[{"title":"documents.analyzeSentiment API Documentation","link":"https://cloud.google.com/natural-language/reference/rest/v1/documents/analyzeSentiment"}],"examples":[{"code":"document.detectSentiment(function(err, sentiment) {\n if (err) {\n // Error handling omitted.\n }\n\n // sentiment = {\n // magnitude: 0.5,\n // score: 0.5\n // }\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"document.detectSentiment().then(function(data) {\n var sentiment = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"options","description":"UTF8
(also, buffer
), UTF16
(also string
), or UTF32
. (Alias for options.encodingType
). Default: 'UTF8' if a Buffer, otherwise 'UTF16'. See EncodingType
Detect syntax from the document.
","source":"packages/language/src/document.js#L649","resources":[{"title":"documents.analyzeSyntax API Documentation","link":"https://cloud.google.com/natural-language/reference/rest/v1/documents/analyzeSyntax"}],"examples":[{"code":"document.detectSyntax(function(err, syntax) {\n if (err) {\n // Error handling omitted.\n }\n\n // syntax = [\n // {\n // text: {\n // content: 'Google',\n // beginOffset: -1\n // },\n // partOfSpeech: {\n // tag: 'NOUN',\n // aspect: 'ASPECT_UNKNOWN',\n // case: 'CASE_UNKNOWN',\n // form: 'FORM_UNKNOWN',\n // gender: 'GENDER_UNKNOWN',\n // mood: 'MOOD_UNKNOWN',\n // number: 'SINGULAR',\n // person: 'PERSON_UNKNOWN',\n // proper: 'PROPER',\n // reciprocity: 'RECIPROCITY_UNKNOWN',\n // tense: 'TENSE_UNKNOWN',\n // voice: 'VOICE_UNKNOWN'\n // },\n // dependencyEdge: {\n // headTokenIndex: 1,\n // label: 'NSUBJ'\n // },\n // lemma: 'Google'\n // },\n // // ...\n // ]\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"document.detectSyntax().then(function(data) {\n var syntax = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"options","description":"UTF8
(also, buffer
), UTF16
(also string
), or UTF32
. (Alias for options.encodingType
). Default: 'UTF8' if a Buffer, otherwise 'UTF16'. See EncodingType
Check if the user provided an encodingType, and map it to its API value.
","source":"packages/language/src/document.js#L678","resources":[],"examples":[],"params":[{"name":"options","description":"UTF8
(also, buffer
), UTF16
(also string
), or UTF32
. (Alias for options.encodingType
). Default: 'UTF8' if a Buffer, otherwise 'UTF16'. See EncodingType
\n This class allows you interact with Cloud Natural Language.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/language
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
The Cloud Natural Language API provides natural language understanding technologies to developers, including sentiment analysis, entity recognition, and syntax analysis. This API is part of the larger Cloud Machine Learning API.
The Cloud Natural Language API currently supports English, Spanish, and Japanese for sentiment analysis, entity analysis and syntax analysis.
","source":"packages/language/src/index.js#L64","resources":[{"title":"Cloud Natural Language API Documentation","link":"https://cloud.google.com/natural-language/docs"}],"examples":[],"params":[{"name":"options","description":" ","types":["object"],"optional":false,"nullable":false},{"name":"options.apiVersion","description":"v1
or v1beta2
. v1beta2
is a newer release than v1
, and still in beta. By choosing it, you are opting into new, back-end behavior which is not officially supported by the design of this API. (Default: v1
)Run an annotation of a block of text.
NOTE: This is a convenience method which doesn't require creating a language/document object. If you are only running a single detection, this may be more convenient. However, if you plan to run multiple detections, it's easier to create a language/document object.
","source":"packages/language/src/index.js#L157","resources":[{"title":"documents.annotate API Documentation","link":"https://cloud.google.com/natural-language/reference/rest/v1/documents/annotateText"}],"examples":[{"caption":"See language/document#annotate for a detailed breakdown of \nthe arguments your callback will be executed with.
","code":"function callback(err, entities, apiResponse) {}\n\nlanguage.annotate('Hello!', callback);"},{"caption":"Or, provide a reference to a file hosted on Cloud Storage.
","code":"var gcs = require('@google-cloud/storage')({\n projectId: 'grape-spaceship-123'\n});\nvar bucket = gcs.bucket('my-bucket');\nvar file = bucket.file('my-file');\n\nlanguage.annotate(file, callback);"},{"caption":"Specify HTML content.
","code":"var options = {\n type: 'html'\n};\n\nlanguage.annotate('Hello!', options, callback);"},{"caption":"Specify the language the text is written in.
","code":"var options = {\n language: 'es',\n entities: true\n};\n\nlanguage.annotate('¿Dónde está la sede de Google?', options, callback);"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"language.annotate('Hello!').then(function(data) {\n var entities = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"content","description":"UTF8
(also, buffer
), UTF16
(also string
), or UTF32
. (Alias for options.encodingType
). Default: 'UTF8' if a Buffer, otherwise 'UTF16'. See EncodingType
html
or text
.Detect the entities from a block of text.
NOTE: This is a convenience method which doesn't require creating a language/document object. If you are only running a single detection, this may be more convenient. However, if you plan to run multiple detections, it's easier to create a language/document object.
","source":"packages/language/src/index.js#L239","resources":[{"title":"documents.analyzeEntities API Documentation","link":"https://cloud.google.com/natural-language/reference/rest/v1/documents/analyzeEntities"}],"examples":[{"caption":"See language/document#detectEntities for a detailed breakdown of \nthe arguments your callback will be executed with.
","code":"function callback(err, entities, apiResponse) {}\n\nlanguage.detectEntities('Axel Foley is from Detroit', callback);"},{"caption":"Or, provide a reference to a file hosted on Cloud Storage.
","code":"var gcs = require('@google-cloud/storage')({\n projectId: 'grape-spaceship-123'\n});\nvar bucket = gcs.bucket('my-bucket');\nvar file = bucket.file('my-file');\n\nlanguage.detectEntities(file, callback);"},{"caption":"Specify HTML content.
","code":"var options = {\n type: 'html'\n};\n\nlanguage.detectEntities('Axel Foley is from Detroit', options, callback);"},{"caption":"Specify the language the text is written in.
","code":"var options = {\n language: 'es'\n};\n\nlanguage.detectEntities('Axel Foley es de Detroit', options, callback);"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"language.detectEntities('Axel Foley is from Detroit').then(function(data) {\n var entities = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"content","description":"UTF8
(also, buffer
), UTF16
(also string
), or UTF32
. (Alias for options.encodingType
). Default: 'UTF8' if a Buffer, otherwise 'UTF16'. See EncodingType
html
or text
.Detect the sentiment of a block of text.
NOTE: This is a convenience method which doesn't require creating a language/document object. If you are only running a single detection, this may be more convenient. However, if you plan to run multiple detections, it's easier to create a language/document object.
","source":"packages/language/src/index.js#L312","resources":[{"title":"documents.analyzeSentiment API Documentation","link":"https://cloud.google.com/natural-language/reference/rest/v1/documents/analyzeSentiment"}],"examples":[{"caption":"See language/document#detectSentiment for a detailed breakdown of \nthe arguments your callback will be executed with.
","code":"function callback(err, sentiment, apiResponse) {}\n\nlanguage.detectSentiment('Hello!', callback);"},{"caption":"Or, provide a reference to a file hosted on Cloud Storage.
","code":"var gcs = require('@google-cloud/storage')({\n projectId: 'grape-spaceship-123'\n});\nvar bucket = gcs.bucket('my-bucket');\nvar file = bucket.file('my-file');\n\nlanguage.detectSentiment(file, callback);"},{"caption":"Specify HTML content.
","code":"var options = {\n type: 'html'\n};\n\nlanguage.detectSentiment('<h1>Document Title</h1>', options, callback);"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"language.detectSentiment('Hello!').then(function(data) {\n var sentiment = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"content","description":"UTF8
(also, buffer
), UTF16
(also string
), or UTF32
. (Alias for options.encodingType
). Default: 'UTF8' if a Buffer, otherwise 'UTF16'. See EncodingType
html
or text
.Detect the syntax of a block of text.
NOTE: This is a convenience method which doesn't require creating a language/document object. If you are only running a single detection, this may be more convenient. However, if you plan to run multiple detections, it's easier to create a language/document object.
","source":"packages/language/src/index.js#L394","resources":[{"title":"documents.analyzeSyntax API Documentation","link":"https://cloud.google.com/natural-language/reference/rest/v1/documents/analyzeSyntax"}],"examples":[{"caption":"See language/document#detectSyntax for a detailed breakdown of \nthe arguments your callback will be executed with.
","code":"function callback(err, syntax, apiResponse) {}\n\nlanguage.detectSyntax('Axel Foley is from Detroit', callback);"},{"caption":"Or, provide a reference to a file hosted on Cloud Storage.
","code":"var gcs = require('@google-cloud/storage')({\n projectId: 'grape-spaceship-123'\n});\nvar bucket = gcs.bucket('my-bucket');\nvar file = bucket.file('my-file');\n\nlanguage.detectSyntax(file, callback);"},{"caption":"Specify HTML content.
","code":"var options = {\n type: 'html'\n};\n\nlanguage.detectSyntax('Axel Foley is from Detroit', options, callback);"},{"caption":"Specify the language the text is written in.
","code":"var options = {\n language: 'es'\n};\n\nlanguage.detectSyntax('Axel Foley es de Detroit', options, callback);"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"language.detectSyntax('Axel Foley is from Detroit').then(function(data) {\n var syntax = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"content","description":"UTF8
(also, buffer
), UTF16
(also string
), or UTF32
. (Alias for options.encodingType
). Default: 'UTF8' if a Buffer, otherwise 'UTF16'. See EncodingType
html
or text
.Create a Document object for an unknown type. If you know the type, use the appropriate method below:
Or, provide a reference to a file hosted on Cloud Storage.
","code":"var gcs = require('@google-cloud/storage')({\n projectId: 'grape-spaceship-123'\n});\nvar bucket = gcs.bucket('my-bucket');\nvar file = bucket.file('my-file');\n\nvar document = language.document(file);"},{"caption":"Create a Document object with pre-defined configuration, such as its \nlanguage.
","code":"var document = language.document('¿Dónde está la sede de Google?', {\n language: 'es'\n});"},{"caption":"You can now run detections on the document. \nSee language/document for a complete list of methods available.
","code":"document.detectEntities(function(err, entities) {});"}],"params":[{"name":"config","description":"config
as an object to specify the encoding and/or language of the document, use this property to pass the inline content of the document or a Storage File object.Create a Document object from an HTML document. You may provide either inline HTML content or a Storage File object (see storage/file).
","source":"packages/language/src/index.js#L496","resources":[],"examples":[{"code":"var document = language.html('<h1>Document Title</h1>');"},{"caption":"Or, provide a reference to a file hosted on Cloud Storage.
","code":"var gcs = require('@google-cloud/storage')({\n projectId: 'grape-spaceship-123'\n});\nvar bucket = gcs.bucket('my-bucket');\nvar file = bucket.file('my-file.html');\n\nvar document = language.html(file);"},{"caption":"Create a Document object with pre-defined configuration, such as its \nlanguage.
","code":"var document = language.html('<h1>Titulo del documento</h1>', {\n language: 'es'\n});"},{"caption":"You can now run detections on the document. \nSee language/document for a complete list of methods available.
","code":"document.detectEntities(function(err, entities) {});"}],"params":[{"name":"content","description":"Create a Document object from a text-based document. You may provide either inline text content or a Storage File object (see storage/file).
","source":"packages/language/src/index.js#L544","resources":[],"examples":[{"code":"var document = language.text('This is using inline text content.');"},{"caption":"Or, provide a reference to a file hosted on Cloud Storage.
","code":"var gcs = require('@google-cloud/storage')({\n projectId: 'grape-spaceship-123'\n});\nvar bucket = gcs.bucket('my-bucket');\nvar file = bucket.file('my-file.txt');\n\nvar document = language.text(file);"},{"caption":"Create a Document object with pre-defined configuration, such as its \nlanguage.
","code":"var document = language.text('¿Dónde está la sede de Google?', {\n language: 'es'\n});"},{"caption":"You can now run detections on the document. \nSee language/document for a complete list of methods available.
","code":"document.detectEntities(function(err, entities) {});"}],"params":[{"name":"content","description":"\n This class allows you interact with Cloud Logging.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/logging
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
Create an entry object to define new data to insert into a log.
","source":"packages/logging/src/entry.js#L87","resources":[{"title":"LogEntry JSON representation","link":"https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry"}],"examples":[{"code":"var syslog = logging.log('syslog');\n\nvar metadata = {\n resource: {\n type: 'gce_instance',\n labels: {\n zone: 'global',\n instance_id: '3'\n }\n }\n};\n\nvar entry = syslog.entry(metadata, {\n delegate: 'my_username'\n});\n\nsyslog.alert(entry, function(err, apiResponse) {\n if (!error) {\n // Log entry inserted successfully.\n }\n});"},{"caption":"You will also receive Entry
objects when using \nlogging#getEntries and logging/log#getEntries.
The data to use as the value for this log entry.
If providing an object, these value types are supported:
String
Number
Boolean
Buffer
Object
Array
Any other types are stringified with String(value)
.
\n This class allows you interact with Cloud Logging.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/logging
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
Stackdriver Logging allows you to store, search, analyze, monitor, and alert on log data and events from Google Cloud Platform and Amazon Web Services (AWS).
","source":"packages/logging/src/index.js#L66","resources":[{"title":"What is Stackdriver Logging?","link":"https://cloud.google.com/logging/docs"},{"title":"Introduction to the Stackdriver Logging API","link":"https://cloud.google.com/logging/docs/api"}],"examples":[],"params":[{"name":"options","description":" ","types":["object"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]},{"id":"createSink","name":"createSink","type":"instance","description":"Create a sink.
","source":"packages/logging/src/index.js#L132","resources":[{"title":"Sink Overview","link":"https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks"},{"title":"Advanced Logs Filters","link":"https://cloud.google.com/logging/docs/view/advanced_filters"},{"title":"projects.sinks.create API Documentation","link":"https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks/create"}],"examples":[{"code":"var gcs = require('@google-cloud/storage')({\n projectId: 'grape-spaceship-123'\n});\n\nvar config = {\n destination: gcs.bucket('logging-bucket'),\n filter: 'severity = ALERT'\n};\n\nfunction callback(err, sink, apiResponse) {\n // `sink` is a Sink object.\n}\n\nlogging.createSink('new-sink-name', config, callback);"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"logging.createSink('new-sink-name', config).then(function(data) {\n var sink = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"name","description":"if a name is not provided.
"},{"type":"Error","description":"if a config object is not provided.
"}],"returns":[]},{"id":"entry","name":"entry","type":"instance","description":"Create an entry object.
Note that using this method will not itself make any API requests. You will use the object returned in other API calls, such as logging/log#write.
","source":"packages/logging/src/index.js#L226","resources":[{"title":"LogEntry JSON representation","link":"https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry"}],"examples":[{"code":"var resource = {\n type: 'gce_instance',\n labels: {\n zone: 'global',\n instance_id: '3'\n }\n};\n\nvar entry = logging.entry(resource, {\n delegate: 'my_username'\n});\n\nentry.toJSON();\n// {\n// resource: {\n// type: 'gce_instance',\n// labels: {\n// zone: 'global',\n// instance_id: '3'\n// }\n// },\n// jsonPayload: {\n// delegate: 'my_username'\n// }\n// }"}],"params":[{"name":"resource","description":"List the entries in your logs.
","source":"packages/logging/src/index.js#L282","resources":[{"title":"entries.list API Documentation","link":"https://cloud.google.com/logging/docs/reference/v2/rest/v2/entries/list"}],"examples":[{"code":"logging.getEntries(function(err, entries) {\n // `entries` is an array of Stackdriver Logging entry objects.\n // See the `data` property to read the data from the entry.\n});"},{"caption":"To control how many API requests are made and page through the results \nmanually, set autoPaginate
to false
.
If the callback is omitted, we'll return a Promise.
","code":"logging.getEntries().then(function(data) {\n var entries = data[0];\n});"}],"params":[{"name":"options","description":"timestamp
(oldest first) and timestamp desc
(newest first, default).List the logging/entry objects in your logs as a readable object stream.
","source":"packages/logging/src/index.js#L346","resources":[],"examples":[{"code":"logging.getEntriesStream()\n .on('error', console.error)\n .on('data', function(entry) {\n // `entry` is a Stackdriver Logging entry object.\n // See the `data` property to read the data from the entry.\n })\n .on('end', function() {\n // All entries retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"logging.getEntriesStream()\n .on('data', function(entry) {\n this.end();\n });"}],"params":[{"name":"options","description":"Get the sinks associated with this project.
","source":"packages/logging/src/index.js#L419","resources":[{"title":"projects.sinks.list API Documentation","link":"https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks/list"}],"examples":[{"code":"logging.getSinks(function(err, sinks) {\n // sinks is an array of Sink objects.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"logging.getSinks().then(function(data) {\n var sinks = data[0];\n});"}],"params":[{"name":"options","description":"Get the logging/sink objects associated with this project as a readable object stream.
","source":"packages/logging/src/index.js#L485","resources":[],"examples":[{"code":"logging.getSinksStream()\n .on('error', console.error)\n .on('data', function(sink) {\n // `sink` is a Sink object.\n })\n .on('end', function() {\n // All sinks retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"logging.getSinksStream()\n .on('data', function(sink) {\n this.end();\n });"}],"params":[{"name":"options","description":"Get a reference to a Stackdriver Logging log.
","source":"packages/logging/src/index.js#L543","resources":[{"title":"Log Overview","link":"https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.logs"}],"examples":[{"code":"var log = logging.log('my-log');"}],"params":[{"name":"name","description":"[Circular]
. (Default: false)Get a reference to a Stackdriver Logging sink.
","source":"packages/logging/src/index.js#L558","resources":[{"title":"Sink Overview","link":"https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks"}],"examples":[{"code":"var sink = logging.sink('my-sink');"}],"params":[{"name":"name","description":"Funnel all API requests through this method, to be sure we have a project ID.
","source":"packages/logging/src/index.js#L571","resources":[],"examples":[],"params":[{"name":"config","description":"\n This class allows you interact with Cloud Logging.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/logging
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
A log is a named collection of entries, each entry representing a timestamped event. Logs can be produced by Google Cloud Platform services, by third-party services, or by your applications. For example, the log apache-access
is produced by the Apache Web Server, but the log compute.googleapis.com/activity_log
is produced by Google Compute Engine.
[Circular]
. (Default: false)Write a log entry with a severity of "ALERT".
This is a simple wrapper around logging/log#write. All arguments are the same as documented there.
","source":"packages/logging/src/log.js#L136","resources":[],"examples":[{"code":"var entry = log.entry('gce_instance', {\n instance: 'my_instance'\n});\n\nlog.alert(entry, function(err, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"log.alert(entry).then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[],"exceptions":[],"returns":[]},{"id":"critical","name":"critical","type":"instance","description":"Write a log entry with a severity of "CRITICAL".
This is a simple wrapper around logging/log#write. All arguments are the same as documented there.
","source":"packages/logging/src/log.js#L160","resources":[],"examples":[{"code":"var entry = log.entry('gce_instance', {\n instance: 'my_instance'\n});\n\nlog.critical(entry, function(err, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"log.critical(entry).then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[],"exceptions":[],"returns":[]},{"id":"debug","name":"debug","type":"instance","description":"Write a log entry with a severity of "DEBUG".
This is a simple wrapper around logging/log#write. All arguments are the same as documented there.
","source":"packages/logging/src/log.js#L185","resources":[],"examples":[{"code":"var entry = log.entry('gce_instance', {\n instance: 'my_instance'\n});\n\nlog.debug(entry, function(err, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"log.debug(entry).then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[],"exceptions":[],"returns":[]},{"id":"delete","name":"delete","type":"instance","description":"Delete the log.
","source":"packages/logging/src/log.js#L215","resources":[{"title":"projects.logs.delete API Documentation","link":"https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.logs/delete"}],"examples":[{"code":"log.delete(function(err, apiResponse) {\n if (!err) {\n // The log was deleted.\n }\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"log.delete().then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[{"name":"gaxOptions","description":"Write a log entry with a severity of "EMERGENCY".
This is a simple wrapper around logging/log#write. All arguments are the same as documented there.
","source":"packages/logging/src/log.js#L253","resources":[],"examples":[{"code":"var entry = log.entry('gce_instance', {\n instance: 'my_instance'\n});\n\nlog.emergency(entry, function(err, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"log.emergency(entry).then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[],"exceptions":[],"returns":[]},{"id":"entry","name":"entry","type":"instance","description":"Create an entry object for this log.
Note that using this method will not itself make any API requests. You will use the object returned in other API calls, such as logging/log#write.
","source":"packages/logging/src/log.js#L303","resources":[{"title":"LogEntry JSON representation","link":"https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry"}],"examples":[{"code":"var metadata = {\n resource: {\n type: 'gce_instance',\n labels: {\n zone: 'global',\n instance_id: '3'\n }\n }\n};\n\nvar entry = log.entry(metadata, {\n delegate: 'my_username'\n});\n\nentry.toJSON();\n// {\n// logName: 'projects/grape-spaceship-123/logs/syslog',\n// resource: {\n// type: 'gce_instance',\n// labels: {\n// zone: 'global',\n// instance_id: '3'\n// }\n// },\n// jsonPayload: {\n// delegate: 'my_username'\n// }\n// }"}],"params":[{"name":"metadata","description":"Write a log entry with a severity of "ERROR".
This is a simple wrapper around logging/log#write. All arguments are the same as documented there.
","source":"packages/logging/src/log.js#L336","resources":[],"examples":[{"code":"var entry = log.entry('gce_instance', {\n instance: 'my_instance'\n});\n\nlog.error(entry, function(err, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"log.error(entry).then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[],"exceptions":[],"returns":[]},{"id":"getEntries","name":"getEntries","type":"instance","description":"This method is a wrapper around logging#getEntries, but with a filter specified to only return entries from this log.
","source":"packages/logging/src/log.js#L393","resources":[{"title":"entries.list API Documentation","link":"https://cloud.google.com/logging/docs/reference/v2/rest/v2/entries/list"}],"examples":[{"code":"log.getEntries(function(err, entries) {\n // `entries` is an array of Stackdriver Logging entry objects.\n // See the `data` property to read the data from the entry.\n});"},{"caption":"To control how many API requests are made and page through the results \nmanually, set autoPaginate
to false
.
If the callback is omitted, we'll return a Promise.
","code":"log.getEntries().then(function(data) {\n var entries = data[0];\n});"}],"params":[{"name":"options","description":"timestamp
(oldest first) and timestamp desc
(newest first, default).This method is a wrapper around logging#getEntriesStream, but with a filter specified to only return logging/entry objects from this log.
","source":"packages/logging/src/log.js#L434","resources":[],"examples":[{"code":"log.getEntriesStream()\n .on('error', console.error)\n .on('data', function(entry) {\n // `entry` is a Stackdriver Logging entry object.\n // See the `data` property to read the data from the entry.\n })\n .on('end', function() {\n // All entries retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"log.getEntriesStream()\n .on('data', function(entry) {\n this.end();\n });"}],"params":[{"name":"options","description":"Write a log entry with a severity of "INFO".
This is a simple wrapper around logging/log#write. All arguments are the same as documented there.
","source":"packages/logging/src/log.js#L462","resources":[],"examples":[{"code":"var entry = log.entry('gce_instance', {\n instance: 'my_instance'\n});\n\nlog.info(entry, function(err, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"log.info(entry).then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[],"exceptions":[],"returns":[]},{"id":"notice","name":"notice","type":"instance","description":"Write a log entry with a severity of "NOTICE".
This is a simple wrapper around logging/log#write. All arguments are the same as documented there.
","source":"packages/logging/src/log.js#L486","resources":[],"examples":[{"code":"var entry = log.entry('gce_instance', {\n instance: 'my_instance'\n});\n\nlog.notice(entry, function(err, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"log.notice(entry).then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[],"exceptions":[],"returns":[]},{"id":"warning","name":"warning","type":"instance","description":"Write a log entry with a severity of "WARNING".
This is a simple wrapper around logging/log#write. All arguments are the same as documented there.
","source":"packages/logging/src/log.js#L510","resources":[],"examples":[{"code":"var entry = log.entry('gce_instance', {\n instance: 'my_instance'\n});\n\nlog.warning(entry, function(err, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"log.warning(entry).then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[],"exceptions":[],"returns":[]},{"id":"write","name":"write","type":"instance","description":"Write log entries to Stackdriver Logging.
While you may write a single entry at a time, batching multiple entries together is preferred to avoid reaching the queries per second limit.
","source":"packages/logging/src/log.js#L588","resources":[{"title":"entries.write API Documentation","link":"https://cloud.google.com/logging/docs/reference/v2/rest/v2/entries/write"}],"examples":[{"code":"var entry = log.entry('gce_instance', {\n instance: 'my_instance'\n});\n\nlog.write(entry, function(err, apiResponse) {\n if (!err) {\n // The log entry was written.\n }\n});"},{"caption":"You may also pass multiple log entries to write.
","code":"var secondEntry = log.entry('compute.googleapis.com', {\n user: 'my_username'\n});\n\nlog.write([\n entry,\n secondEntry\n], function(err, apiResponse) {\n if (!err) {\n // The log entries were written.\n }\n});"},{"caption":"To save some steps, you can also pass in plain values as your entries. \nNote, however, that you must provide a configuration object to specify the \nresource.
","code":"var entries = [\n {\n user: 'my_username'\n },\n {\n home: process.env.HOME\n }\n];\n\nvar options = {\n resource: 'compute.googleapis.com'\n};\n\nlog.write(entries, options, function(err, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"log.write(entries).then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[{"name":"entry","description":"\n This class allows you interact with Cloud Logging.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/logging
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
A sink is an object that lets you to specify a set of log entries to export to a particular destination. Stackdriver Logging lets you export log entries to destinations including Cloud Storage buckets (for long term log storage), Google BigQuery datasets (for log analysis), Google Pub/Sub (for streaming to other applications).
","source":"packages/logging/src/sink.js#L48","resources":[{"title":"Introduction to Sinks","link":"https://cloud.google.com/logging/docs/basic-concepts#sinks"}],"examples":[{"code":"var sink = logging.sink('my-sink');"}],"params":[{"name":"options","description":" ","types":["object"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]},{"id":"create","name":"create","type":"instance","description":"Create a sink.
","source":"packages/logging/src/sink.js#L80","resources":[],"examples":[{"code":"var config = {\n destination: {\n // ...\n }\n};\n\nsink.create(config, function(err, sink, apiResponse) {\n if (!err) {\n // The sink was created successfully.\n }\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"sink.create(config).then(function(data) {\n var sink = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"config","description":"Delete the sink.
","source":"packages/logging/src/sink.js#L110","resources":[{"title":"projects.sink.delete API Documentation","link":"https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks/delete"}],"examples":[{"code":"sink.delete(function(err, apiResponse) {\n if (!err) {\n // The log was deleted.\n }\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"sink.delete().then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[{"name":"gaxOptions","description":"Get the sink's metadata.
","source":"packages/logging/src/sink.js#L153","resources":[{"title":"Sink Resource","link":"https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks#LogSink"},{"title":"projects.sink.get API Documentation","link":"https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks/get"}],"examples":[{"code":"sink.getMetadata(function(err, metadata, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"sink.getMetadata().then(function(data) {\n var metadata = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"gaxOptions","description":"Set the sink's filter.
This will override any filter that was previously set.
","source":"packages/logging/src/sink.js#L204","resources":[{"title":"Advanced Logs Filters","link":"https://cloud.google.com/logging/docs/view/advanced_filters"}],"examples":[{"code":"var filter = 'metadata.severity = ALERT';\n\nsink.setFilter(filter, function(err, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"sink.setFilter(filter).then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[{"name":"filter","description":"Set the sink's metadata.
","source":"packages/logging/src/sink.js#L239","resources":[{"title":"Sink Resource","link":"https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks#LogSink"},{"title":"projects.sink.update API Documentation","link":"https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks/update"}],"examples":[{"code":"var metadata = {\n filter: 'metadata.severity = ALERT'\n};\n\nsink.setMetadata(metadata, function(err, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"sink.setMetadata(metadata).then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[{"name":"metadata","description":"\n This class allows you interact with Cloud Monitoring.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/monitoring
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
Stackdriver Monitoring collects metrics, events, and metadata from Google Cloud Platform, Amazon Web Services (AWS), hosted uptime probes, application instrumentation, and a variety of common application components including Cassandra, Nginx, Apache Web Server, Elasticsearch and many others. Stackdriver ingests that data and generates insights via dashboards, charts, and alerts.
It does not follow the conventions you're familiar with from other parts of our library. A handwritten layer is not yet available.
The example below shows you how to instantiate the generated client. For further documentation, please browse the Monitoring .proto files on GitHub.
","source":"packages/monitoring/src/index.js#L44","resources":[],"examples":[],"params":[],"exceptions":[],"returns":[]}],"path":"index.json"} \ No newline at end of file diff --git a/json/google-cloud/v0.51.1/prediction/index.json b/json/google-cloud/v0.51.1/prediction/index.json new file mode 100644 index 00000000000..3b993a4fd7b --- /dev/null +++ b/json/google-cloud/v0.51.1/prediction/index.json @@ -0,0 +1 @@ +{"id":"prediction","type":"class","name":"Prediction","overview":"\n This class allows you interact with Prediction API.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/prediction
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
The Google Prediction API provides pattern-matching and machine learning capabilities. Given a set of data examples to train against, you can create applications that can perform the following tasks:
Create a trained model.
You may optionally provide a storage/file as a data source to train the new model. If you have a CSV file, but haven't put it in a bucket yet, you will need to reference a bucket with storage/bucket, a file with storage/file, and upload it with storage/file#upload.
","source":"packages/prediction/src/index.js#L133","resources":[{"title":"Trainedmodels: insert API Documentation","link":"https://cloud.google.com/prediction/docs/reference/v1.6/trainedmodels/insert"}],"examples":[{"code":"prediction.createModel('my-model', function(err, model, apiResponse) {\n // `model` is a Model object.\n});"},{"caption":"Create a model, using an existing CSV file in a Cloud Storage \nbucket as training data.
","code":"var gcs = require('@google-cloud/storage')({\n projectId: 'grape-spaceship-123'\n});\nvar bucket = gcs.bucket('my-bucket');\nvar modelDataCsv = bucket.file('my-model.csv');\n\nprediction.createModel('my-model', {\n data: modelDataCsv\n}, function(err, model, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"prediction.createModel('my-model').then(function(data) {\n var model = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"id","description":"classification
(categorical, text labels) or regression
(numeric labels). Learn more about these options in the Developers Guide.If a model ID is not provided.
"}],"returns":[]},{"id":"getModels","name":"getModels","type":"instance","description":"Gets a list of trained models for the project.
","source":"packages/prediction/src/index.js#L236","resources":[{"title":"Trainedmodels: list API Documentation","link":"https://cloud.google.com/prediction/docs/reference/v1.6/trainedmodels/list"}],"examples":[{"code":"prediction.getModels(function(err, models) {\n if (!err) {\n // models is an array of Model objects.\n }\n});"},{"caption":"To control how many API requests are made and page through the results \nmanually, set autoPaginate
to false
.
If the callback is omitted, we'll return a Promise.
","code":"prediction.getModels().then(function(data) {\n var models = data[0];\n});"}],"params":[{"name":"query","description":"Gets a list of prediction/model objects for the project as a readable object stream.
","source":"packages/prediction/src/index.js#L298","resources":[],"examples":[{"code":"prediction.getModelsStream()\n .on('error', console.error)\n .on('data', function(model) {\n // model is a Model object.\n })\n .on('end', function() {\n // All models retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"prediction.getModelsStream()\n .on('data', function(model) {\n this.end();\n });"}],"params":[{"name":"query","description":"Create a model object representing a trained model.
","source":"packages/prediction/src/index.js#L311","resources":[],"examples":[{"code":"var model = prediction.model('my-model');"}],"params":[{"name":"id","description":"If a model ID is not provided.
"}],"returns":[{"types":["prediction/model"],"description":""}]}],"path":"index.json"} \ No newline at end of file diff --git a/json/google-cloud/v0.51.1/prediction/model.json b/json/google-cloud/v0.51.1/prediction/model.json new file mode 100644 index 00000000000..c8df736ec01 --- /dev/null +++ b/json/google-cloud/v0.51.1/prediction/model.json @@ -0,0 +1 @@ +{"id":"prediction/model","type":"class","name":"Model","overview":"\n This class allows you interact with Prediction API.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/prediction
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
A Model object represents a trained model. You can train it by using prediction/model#train or ask for predictions with prediction/model#query.
","source":"packages/prediction/src/model.js#L50","resources":[{"title":"Developer's Guide: Training Your Model","link":"https://cloud.google.com/prediction/docs/developer-guide#trainingtheapi"},{"title":"Model Resource","link":"https://cloud.google.com/prediction/docs/reference/v1.6/trainedmodels"}],"examples":[{"code":"var model = prediction.model('my-model');"}],"params":[],"exceptions":[],"returns":[]},{"id":"create","name":"create","type":"instance","description":"Create a trained model.
","source":"packages/prediction/src/model.js#L72","resources":[],"examples":[{"code":"model.create(function(err, model, apiResponse) {\n if (!err) {\n // The model was created successfully.\n }\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"model.create().then(function(data) {\n var model = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"options","description":" ","types":["object"],"optional":true,"nullable":false}],"exceptions":[],"returns":[]},{"id":"delete","name":"delete","type":"instance","description":"Delete the model.
","source":"packages/prediction/src/model.js#L94","resources":[{"title":"Trainedmodels: delete API Documentation","link":"https://cloud.google.com/prediction/docs/reference/v1.6/trainedmodels/delete"}],"examples":[{"code":"model.delete(function(err, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"model.delete().then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[{"name":"callback","description":"Check if the model exists.
","source":"packages/prediction/src/model.js#L114","resources":[],"examples":[{"code":"model.exists(function(err, exists) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"model.exists().then(function(data) {\n var exists = data[0];\n});"}],"params":[{"name":"callback","description":"Get a model if it exists.
You may optionally use this to "get or create" an object by providing an object with autoCreate
set to true
. Any extra configuration that is normally required for the create
method must be contained within this object as well.
If the callback is omitted, we'll return a Promise.
","code":"model.get().then(function(data) {\n var model = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"options","description":"false
Get the metadata for the model.
","source":"packages/prediction/src/model.js#L164","resources":[{"title":"Trainedmodels: get API Documentation","link":"https://cloud.google.com/prediction/docs/reference/v1.6/trainedmodels/get"}],"examples":[{"code":"model.getMetadata(function(err, metadata, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"model.getMetadata().then(function(data) {\n var metadata = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"Sets the metadata of the Model object.
NOTE: What you probably want is prediction/model#train, which wraps this method.
","source":"packages/prediction/src/model.js#L197","resources":[{"title":"Trainedmodels: update API Documentation","link":"https://cloud.google.com/prediction/docs/reference/v1.6/trainedmodels/update"}],"examples":[{"code":"var metadata = {\n output: 'english',\n csvInstance: [\n 'Hello, this is an English sentence!'\n ]\n};\n\nmodel.setMetadata(metadata, function(err, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"model.setMetadata(metadata).then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[{"name":"metadata","description":"Get an analysis of the model and the data it was trained on.
","source":"packages/prediction/src/model.js#L245","resources":[{"title":"Trainedmodels: analyze API Documentation","link":"https://cloud.google.com/prediction/docs/reference/v1.6/trainedmodels/analyze"}],"examples":[{"code":"model.analyze(function(err, analysis, apiResponse) {\n if (!err) {\n // `analysis.data` == {...}\n // `analysis.model` == {...}\n }\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"model.analyze().then(function(data) {\n var analysis = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"Create a writable stream to train the model with new data.
This is a wrapper around prediction/model#train.
","source":"packages/prediction/src/model.js#L287","resources":[],"examples":[{"code":"var stream = model.createWriteStream('english');\n\nstream\n .on('error', function(err) {\n // Uh oh, an error occurred!\n })\n .on('finish', function() {\n // The model will now be processing the new data.\n });\n\nstream.write('Hello, this is an English sentence!');\nstream.write('...yeah, I assumed that when I was able to read it.');\nstream.end();"}],"params":[{"name":"label","description":"Query the stored data in your model.
","source":"packages/prediction/src/model.js#L377","resources":[{"title":"Trainedmodels:predict API Documentation","link":"https://cloud.google.com/prediction/docs/reference/v1.6/trainedmodels/predict"}],"examples":[{"caption":"Assuming this is a model used to return a language name that matches any \ngiven input, this will ask for the prediction results of an english \nsentence.
","code":"model.query('Hello', function(err, results) {\n if (!err) {\n // `results.winner` == 'english'\n // `results.scores` == [\n // {\n // label: 'english',\n // score: 1\n // },\n // ...other results and their scores are listed here.\n // ]\n }\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"model.query('Hello').then(function(data) {\n var results = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"input","description":" querying a regression model.
Update the stored data with new input.
","source":"packages/prediction/src/model.js#L437","resources":[{"title":"Trainedmodels: update API Documentation","link":"https://cloud.google.com/prediction/docs/reference/v1.6/trainedmodels/update"}],"examples":[{"code":"model.train('english', 'Hello from Stephen!', function(err, apiResponse) {\n if (!err) {\n // New data was inserted successfully.\n }\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"model.train('english', 'Hello from Stephen!').then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[{"name":"label","description":"\n This class allows you interact with Cloud Pub/Sub.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/pubsub
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
Cloud Pub/Sub is a reliable, many-to-many, asynchronous messaging service from Cloud Platform.
The PUBSUB_EMULATOR_HOST
environment variable from the gcloud SDK is honored, otherwise the actual API endpoint will be used.
Create a topic with the given name.
","source":"packages/pubsub/src/index.js#L112","resources":[{"title":"Topics: create API Documentation","link":"https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics/create"}],"examples":[{"code":"pubsub.createTopic('my-new-topic', function(err, topic, apiResponse) {\n if (!err) {\n // The topic was created successfully.\n }\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"pubsub.createTopic('my-new-topic').then(function(data) {\n var topic = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"name","description":"Get a list of the subscriptions registered to all of your project's topics. You may optionally provide a query object as the first argument to customize the response.
Your provided callback will be invoked with an error object if an API error occurred or an array of pubsub/subscription objects.
To get subscriptions for a topic, see pubsub/topic.
","source":"packages/pubsub/src/index.js#L196","resources":[{"title":"Subscriptions: list API Documentation","link":"https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.subscriptions/list"}],"examples":[{"code":"pubsub.getSubscriptions(function(err, subscriptions) {\n if (!err) {\n // subscriptions is an array of Subscription objects.\n }\n});"},{"caption":"To control how many API requests are made and page through the results \nmanually, set autoPaginate
to false
.
If the callback is omitted, we'll return a Promise.
","code":"pubsub.getSubscriptions().then(function(data) {\n var subscriptions = data[0];\n});"}],"params":[{"name":"options","description":"Get a list of the pubsub/subscription objects registered to all of your project's topics as a readable object stream.
","source":"packages/pubsub/src/index.js#L284","resources":[],"examples":[{"code":"pubsub.getSubscriptionsStream()\n .on('error', console.error)\n .on('data', function(subscription) {\n // subscription is a Subscription object.\n })\n .on('end', function() {\n // All subscriptions retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"pubsub.getSubscriptionsStream()\n .on('data', function(topic) {\n this.end();\n });"}],"params":[{"name":"options","description":"Get a list of the topics registered to your project. You may optionally provide a query object as the first argument to customize the response.
","source":"packages/pubsub/src/index.js#L342","resources":[{"title":"Topics: list API Documentation","link":"https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics/list"}],"examples":[{"code":"pubsub.getTopics(function(err, topics) {\n if (!err) {\n // topics is an array of Topic objects.\n }\n});"},{"caption":"Customize the query.
","code":"pubsub.getTopics({\n pageSize: 3\n}, function(err, topics) {});"},{"caption":"To control how many API requests are made and page through the results \nmanually, set autoPaginate
to false
.
If the callback is omitted, we'll return a Promise.
","code":"pubsub.getTopics().then(function(data) {\n var topics = data[0];\n});"}],"params":[{"name":"query","description":"Get a list of the pubsub/topic objects registered to your project as a readable object stream.
","source":"packages/pubsub/src/index.js#L408","resources":[],"examples":[{"code":"pubsub.getTopicsStream()\n .on('error', console.error)\n .on('data', function(topic) {\n // topic is a Topic object.\n })\n .on('end', function() {\n // All topics retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"pubsub.getTopicsStream()\n .on('data', function(topic) {\n this.end();\n });"}],"params":[{"name":"query","description":"Create a subscription to a topic.
All generated subscription names share a common prefix, autogenerated-
.
Subscribe to a topic. (Also see pubsub/topic#subscribe).
","code":"var topic = 'messageCenter';\nvar name = 'newMessages';\n\npubsub.subscribe(topic, name, function(err, subscription, apiResponse) {});"},{"caption":"Omit the name to have one generated automatically. All generated names \nshare a common prefix, autogenerated-
.
Customize the subscription.
","code":"pubsub.subscribe(topic, name, {\n ackDeadlineSeconds: 90,\n autoAck: true,\n interval: 30\n}, function(err, subscription, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"pubsub.subscribe(topic, name).then(function(data) {\n var subscription = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"topic","description":"If a Topic instance or topic name is not provided.
"},{"type":"Error","description":"If a subName is not provided.
"}],"returns":[]},{"id":"subscription","name":"subscription","type":"instance","description":"Create a Subscription object. This command by itself will not run any API requests. You will receive a pubsub/subscription object, which will allow you to interact with a subscription.
All generated names share a common prefix, autogenerated-
.
Create a Topic object. See pubsub/createTopic to create a topic.
","source":"packages/pubsub/src/index.js#L606","resources":[],"examples":[{"code":"var topic = pubsub.topic('my-topic');\n\ntopic.publish({\n data: 'New message!'\n}, function(err) {});"}],"params":[{"name":"name","description":"If a name is not provided.
"}],"returns":[{"types":["pubsub/topic"],"description":""}]}],"path":"index.json"} \ No newline at end of file diff --git a/json/google-cloud/v0.51.1/pubsub/subscription.json b/json/google-cloud/v0.51.1/pubsub/subscription.json new file mode 100644 index 00000000000..eef0dc81657 --- /dev/null +++ b/json/google-cloud/v0.51.1/pubsub/subscription.json @@ -0,0 +1 @@ +{"id":"pubsub/subscription","type":"class","name":"Subscription","overview":"\n This class allows you interact with Cloud Pub/Sub.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/pubsub
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
A Subscription object will give you access to your Cloud Pub/Sub subscription.
Subscriptions are sometimes retrieved when using various methods:
Subscription objects may be created directly with:
All Subscription objects are instances of an EventEmitter. The subscription will pull for messages automatically as long as there is at least one listener assigned for the message
event.
From pubsub#getSubscriptions:
","code":"pubsub.getSubscriptions(function(err, subscriptions) {\n // `subscriptions` is an array of Subscription objects.\n});"},{"caption":"From pubsub/topic#getSubscriptions:
","code":"var topic = pubsub.topic('my-topic');\ntopic.getSubscriptions(function(err, subscriptions) {\n // `subscriptions` is an array of Subscription objects.\n});"},{"caption":"From pubsub/topic#subscribe:
","code":"var topic = pubsub.topic('my-topic');\ntopic.subscribe('new-subscription', function(err, subscription) {\n // `subscription` is a Subscription object.\n});"},{"caption":"From pubsub/topic#subscription:
","code":"var topic = pubsub.topic('my-topic');\nvar subscription = topic.subscription('my-subscription');\n// `subscription` is a Subscription object."},{"caption":"Once you have obtained a subscription object, you may begin to register \nlisteners. This will automatically trigger pulling for messages.
","code":"// Register an error handler.\nsubscription.on('error', function(err) {});\n\n// Register a listener for `message` events.\nfunction onMessage(message) {\n // Called every time a message is received.\n\n // message.id = ID of the message.\n // message.ackId = ID used to acknowledge the message receival.\n // message.data = Contents of the message.\n // message.attributes = Attributes of the message.\n // message.timestamp = Timestamp when Pub/Sub received the message.\n\n // Ack the message:\n // message.ack(callback);\n\n // Skip the message. This is useful with `maxInProgress` option when\n // creating your subscription. This doesn't ack the message, but allows\n // more messages to be retrieved if your limit was hit.\n // message.skip();\n}\nsubscription.on('message', onMessage);\n\n// Remove the listener from receiving `message` events.\nsubscription.removeListener('message', onMessage);"}],"params":[],"exceptions":[],"returns":[]},{"id":"exists","name":"exists","type":"instance","description":"Check if the subscription exists.
","source":"packages/pubsub/src/subscription.js#L171","resources":[],"examples":[{"code":"subscription.exists(function(err, exists) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"subscription.exists().then(function(data) {\n var exists = data[0];\n});"}],"params":[{"name":"callback","description":"Get a subscription if it exists.
You may optionally use this to "get or create" an object by providing an object with autoCreate
set to true
. Any extra configuration that is normally required for the create
method must be contained within this object as well.
autoCreate
is only available if you accessed this object through pubsub/topic#subscription.
If the callback is omitted, we'll return a Promise.
","code":"subscription.get().then(function(data) {\n var subscription = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"options","description":"false
Get the metadata for the subscription.
","source":"packages/pubsub/src/subscription.js#L226","resources":[{"title":"Subscriptions: get API Documentation","link":"https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.subscriptions/get"}],"examples":[{"code":"subscription.getMetadata(function(err, metadata, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"subscription.getMetadata().then(function(data) {\n var metadata = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"Create a subscription.
This is only available if you accessed this object through pubsub/topic#subscription.
","source":"packages/pubsub/src/subscription.js#L271","resources":[],"examples":[{"code":"subscription.create(function(err, subscription, apiResponse) {\n if (!err) {\n // The subscription was created successfully.\n }\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"subscription.create().then(function(data) {\n var subscription = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"config","description":"IAM (Identity and Access Management) allows you to set permissions on individual resources and offers a wider range of roles: editor, owner, publisher, subscriber, and viewer. This gives you greater flexibility and allows you to set more fine-grained access control.
The IAM access control features described in this document are Beta, including the API methods to get and set IAM policies, and to test IAM permissions. Cloud Pub/Sub's use of IAM features is not covered by any SLA or deprecation policy, and may be subject to backward-incompatible changes.
","source":"packages/pubsub/src/subscription.js#L330","resources":[{"title":"Access Control Overview","link":"https://cloud.google.com/pubsub/access_control"},{"title":"What is Cloud IAM?","link":"https://cloud.google.com/iam/"}],"examples":[{"caption":"Get the IAM policy for your subscription.
","code":"subscription.iam.getPolicy(function(err, policy) {\n console.log(policy);\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"subscription.iam.getPolicy().then(function(data) {\n var policy = data[0];\n var apiResponse = data[1];\n});"}],"params":[],"exceptions":[],"returns":[]},{"id":"ack","name":"ack","type":"instance","description":"Acknowledge to the backend that the message was retrieved. You must provide either a single ackId or an array of ackIds.
","source":"packages/pubsub/src/subscription.js#L429","resources":[{"title":"Subscriptions: acknowledge API Documentation","link":"https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.subscriptions/acknowledge"}],"examples":[{"code":"var ackId = 'ePHEESyhuE8e...';\n\nsubscription.ack(ackId, function(err, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"subscription.ack(ackId).then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[{"name":"ackIds","description":"If at least one ackId is not provided.
"}],"returns":[]},{"id":"delete","name":"delete","type":"instance","description":"Delete the subscription. Pull requests from the current subscription will be errored once unsubscription is complete.
","source":"packages/pubsub/src/subscription.js#L526","resources":[{"title":"Subscriptions: delete API Documentation","link":"https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.subscriptions/delete"}],"examples":[{"code":"subscription.delete(function(err, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"subscription.delete().then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[{"name":"callback","description":"Pull messages from the subscribed topic. If messages were found, your callback is executed with an array of message objects.
Note that messages are pulled automatically once you register your first event listener to the subscription, thus the call to pull
is handled for you. If you don't want to start pulling, simply don't register a subscription.on('message', function() {})
event handler.
Pull all available messages.
","code":"subscription.pull(function(err, messages) {\n // messages = [\n // {\n // ackId: '', // ID used to acknowledge its receival.\n // id: '', // Unique message ID.\n // data: '', // Contents of the message.\n // attributes: {} // Attributes of the message.\n //\n // Helper functions:\n // ack(callback): // Ack the message.\n // skip(): // Free up 1 slot on the sub's maxInProgress value.\n // },\n // // ...\n // ]\n});"},{"caption":"Pull a single message.
","code":"var opts = {\n maxResults: 1\n};\n\nsubscription.pull(opts, function(err, messages, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"subscription.pull(opts).then(function(data) {\n var messages = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"options","description":"Modify the ack deadline for a specific message. This method is useful to indicate that more time is needed to process a message by the subscriber, or to make the message available for redelivery if the processing was interrupted.
","source":"packages/pubsub/src/subscription.js#L699","resources":[{"title":"Subscriptions: modifyAckDeadline API Documentation","link":"https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.subscriptions/modifyAckDeadline"}],"examples":[{"code":"var options = {\n ackIds: ['abc'],\n seconds: 10 // Expire in 10 seconds from call.\n};\n\nsubscription.setAckDeadline(options, function(err, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"subscription.setAckDeadline(options).then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[{"name":"options","description":"Get the IAM policy
","source":"packages/pubsub/src/iam.js#L112","resources":[{"title":"Topics: getIamPolicy API Documentation","link":"https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics/getIamPolicy"},{"title":"Subscriptions: getIamPolicy API Documentation","link":"https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.subscriptions/getIamPolicy"}],"examples":[{"code":"topic.iam.getPolicy(function(err, policy, apiResponse) {});\n\nsubscription.iam.getPolicy(function(err, policy, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"topic.iam.getPolicy().then(function(data) {\n var policy = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"Set the IAM policy
","source":"packages/pubsub/src/iam.js#L165","resources":[{"title":"Topics: setIamPolicy API Documentation","link":"https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics/setIamPolicy"},{"title":"Subscriptions: setIamPolicy API Documentation","link":"https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.subscriptions/setIamPolicy"},{"title":"Policy","link":"https://cloud.google.com/pubsub/docs/reference/rest/Shared.Types/Policy"}],"examples":[{"code":"var myPolicy = {\n bindings: [\n {\n role: 'roles/pubsub.subscriber',\n members: ['serviceAccount:myotherproject@appspot.gserviceaccount.com']\n }\n ]\n};\n\ntopic.iam.setPolicy(myPolicy, function(err, policy, apiResponse) {});\n\nsubscription.iam.setPolicy(myPolicy, function(err, policy, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"topic.iam.setPolicy(myPolicy).then(function(data) {\n var policy = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"policy","description":"If no policy is provided.
"}],"returns":[]},{"id":"iam.testPermissions","name":"iam.testPermissions","type":"instance","description":"Test a set of permissions for a resource.
Permissions with wildcards such as *
or storage.*
are not allowed.
Test a single permission.
","code":"var test = 'pubsub.topics.update';\n\ntopic.iam.testPermissions(test, function(err, permissions, apiResponse) {\n console.log(permissions);\n // {\n // \"pubsub.topics.update\": true\n // }\n});"},{"caption":"Test several permissions at once.
","code":"var tests = [\n 'pubsub.subscriptions.consume',\n 'pubsub.subscriptions.update'\n];\n\nsubscription.iam.testPermissions(tests, function(err, permissions) {\n console.log(permissions);\n // {\n // \"pubsub.subscriptions.consume\": true,\n // \"pubsub.subscriptions.update\": false\n // }\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"topic.iam.testPermissions(test).then(function(data) {\n var permissions = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"permissions","description":"If permissions are not provided.
"}],"returns":[]}],"path":"subscription.json"} \ No newline at end of file diff --git a/json/google-cloud/v0.51.1/pubsub/topic.json b/json/google-cloud/v0.51.1/pubsub/topic.json new file mode 100644 index 00000000000..3ca40b3c422 --- /dev/null +++ b/json/google-cloud/v0.51.1/pubsub/topic.json @@ -0,0 +1 @@ +{"id":"pubsub/topic","type":"class","name":"Topic","overview":"\n This class allows you interact with Cloud Pub/Sub.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/pubsub
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
A Topic object allows you to interact with a Cloud Pub/Sub topic.
","source":"packages/pubsub/src/topic.js#L50","resources":[],"examples":[{"code":"var topic = pubsub.topic('my-topic');"}],"params":[],"exceptions":[],"returns":[]},{"id":"create","name":"create","type":"instance","description":"Create a topic.
","source":"packages/pubsub/src/topic.js#L75","resources":[],"examples":[{"code":"topic.create(function(err, topic, apiResponse) {\n if (!err) {\n // The topic was created successfully.\n }\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"topic.create().then(function(data) {\n var topic = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"config","description":"Delete the topic. This will not delete subscriptions to this topic.
","source":"packages/pubsub/src/topic.js#L94","resources":[{"title":"Topics: delete API Documentation","link":"https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics/delete"}],"examples":[{"code":"topic.delete(function(err, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"topic.delete().then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[{"name":"callback","description":"Check if the topic exists.
","source":"packages/pubsub/src/topic.js#L122","resources":[],"examples":[{"code":"topic.exists(function(err, exists) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"topic.exists().then(function(data) {\n var exists = data[0];\n});"}],"params":[{"name":"callback","description":"Get a topic if it exists.
You may optionally use this to "get or create" an object by providing an object with autoCreate
set to true
. Any extra configuration that is normally required for the create
method must be contained within this object as well.
If the callback is omitted, we'll return a Promise.
","code":"topic.get().then(function(data) {\n var topic = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"options","description":"false
Get the official representation of this topic from the API.
","source":"packages/pubsub/src/topic.js#L173","resources":[{"title":"Topics: get API Documentation","link":"https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics/get"}],"examples":[{"code":"topic.getMetadata(function(err, metadata, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"topic.getMetadata().then(function(data) {\n var metadata = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"IAM (Identity and Access Management) allows you to set permissions on individual resources and offers a wider range of roles: editor, owner, publisher, subscriber, and viewer. This gives you greater flexibility and allows you to set more fine-grained access control.
The IAM access control features described in this document are Beta, including the API methods to get and set IAM policies, and to test IAM permissions. Cloud Pub/Sub's use of IAM features is not covered by any SLA or deprecation policy, and may be subject to backward-incompatible changes.
","source":"packages/pubsub/src/topic.js#L225","resources":[{"title":"Access Control Overview","link":"https://cloud.google.com/pubsub/access_control"},{"title":"What is Cloud IAM?","link":"https://cloud.google.com/iam/"}],"examples":[{"caption":"Get the IAM policy for your topic.
","code":"topic.iam.getPolicy(function(err, policy) {\n console.log(policy);\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"topic.iam.getPolicy().then(function(data) {\n var policy = data[0];\n var apiResponse = data[1];\n});"}],"params":[],"exceptions":[],"returns":[]},{"id":"getSubscriptions","name":"getSubscriptions","type":"instance","description":"Get a list of the subscriptions registered to this topic. You may optionally provide a query object as the first argument to customize the response.
Your provided callback will be invoked with an error object if an API error occurred or an array of pubsub/subscription objects.
","source":"packages/pubsub/src/topic.js#L313","resources":[{"title":"Subscriptions: list API Documentation","link":"https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics.subscriptions/list"}],"examples":[{"code":"topic.getSubscriptions(function(err, subscriptions) {\n // subscriptions is an array of `Subscription` objects.\n});\n\n// Customize the query.\ntopic.getSubscriptions({\n pageSize: 3\n}, callback);"},{"caption":"To control how many API requests are made and page through the results \nmanually, set autoPaginate
to false
.
If the callback is omitted, we'll return a Promise.
","code":"topic.getSubscriptions().then(function(data) {\n var subscriptions = data[0];\n});"}],"params":[{"name":"options","description":"Get a list of the pubsub/subscription objects registered to this topic as a readable object stream.
","source":"packages/pubsub/src/topic.js#L352","resources":[],"examples":[{"code":"topic.getSubscriptionsStream()\n .on('error', console.error)\n .on('data', function(subscription) {\n // subscription is a Subscription object.\n })\n .on('end', function() {\n // All subscriptions retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"topic.getSubscriptionsStream()\n .on('data', function(subscription) {\n this.end();\n });"}],"params":[{"name":"query","description":"Publish the provided message or array of messages. On success, an array of messageIds is returned in the response.
","source":"packages/pubsub/src/topic.js#L436","resources":[{"title":"Topics: publish API Documentation","link":"https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics/publish"}],"examples":[{"code":"topic.publish('Hello, world!', function(err, messageIds, apiResponse) {});"},{"caption":"You can also publish a JSON object.
","code":"var registerMessage = {\n userId: 3,\n name: 'Stephen',\n event: 'new user'\n};\n\ntopic.publish(registerMessage, function(err, messageIds, apiResponse) {});"},{"caption":"You can publish a batch of messages at once by supplying an array.
","code":"var purchaseMessage = {\n data: {\n userId: 3,\n product: 'computer',\n event: 'purchase'\n }\n};\n\ntopic.publish([\n registerMessage,\n purchaseMessage\n], function(err, messageIds, apiResponse) {});"},{"caption":"Set attributes with your message.
","code":"var message = {\n data: {\n userId: 3,\n product: 'book',\n event: 'rent'\n },\n attributes: {\n key: 'value',\n hello: 'world'\n }\n};\n\nvar options = {\n raw: true\n};\n\ntopic.publish(message, options, function(err, messageIds, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"topic.publish(message).then(function(data) {\n var messageIds = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"message","description":"options.raw
, then box your message in to an object with a data
and attributes
property. data
will be the raw message value you want to publish, and attributes
is a key/value pair of attributes to apply to the message.If no message is provided.
"}],"returns":[]},{"id":"subscribe","name":"subscribe","type":"instance","description":"Create a subscription to this topic.
All generated subscription names share a common prefix, autogenerated-
.
Omit the name to have one generated automatically. All generated names \nshare a common prefix, autogenerated-
.
If the callback is omitted, we'll return a Promise.
","code":"topic.subscribe('newMessages').then(function(data) {\n var subscription = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"subName","description":"Create a Subscription object. This command by itself will not run any API requests. You will receive a pubsub/subscription object, which will allow you to interact with a subscription.
","source":"packages/pubsub/src/topic.js#L563","resources":[],"examples":[{"code":"var subscription = topic.subscription('my-subscription');\n\n// Register a listener for `message` events.\nsubscription.on('message', function(message) {\n // Called every time a message is received.\n // message.id = ID of the message.\n // message.ackId = ID used to acknowledge the message receival.\n // message.data = Contents of the message.\n // message.attributes = Attributes of the message.\n // message.timestamp = Timestamp when Pub/Sub received the message.\n});"}],"params":[{"name":"name","description":"Get the IAM policy
","source":"packages/pubsub/src/iam.js#L112","resources":[{"title":"Topics: getIamPolicy API Documentation","link":"https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics/getIamPolicy"},{"title":"Subscriptions: getIamPolicy API Documentation","link":"https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.subscriptions/getIamPolicy"}],"examples":[{"code":"topic.iam.getPolicy(function(err, policy, apiResponse) {});\n\nsubscription.iam.getPolicy(function(err, policy, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"topic.iam.getPolicy().then(function(data) {\n var policy = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"Set the IAM policy
","source":"packages/pubsub/src/iam.js#L165","resources":[{"title":"Topics: setIamPolicy API Documentation","link":"https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics/setIamPolicy"},{"title":"Subscriptions: setIamPolicy API Documentation","link":"https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.subscriptions/setIamPolicy"},{"title":"Policy","link":"https://cloud.google.com/pubsub/docs/reference/rest/Shared.Types/Policy"}],"examples":[{"code":"var myPolicy = {\n bindings: [\n {\n role: 'roles/pubsub.subscriber',\n members: ['serviceAccount:myotherproject@appspot.gserviceaccount.com']\n }\n ]\n};\n\ntopic.iam.setPolicy(myPolicy, function(err, policy, apiResponse) {});\n\nsubscription.iam.setPolicy(myPolicy, function(err, policy, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"topic.iam.setPolicy(myPolicy).then(function(data) {\n var policy = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"policy","description":"If no policy is provided.
"}],"returns":[]},{"id":"iam.testPermissions","name":"iam.testPermissions","type":"instance","description":"Test a set of permissions for a resource.
Permissions with wildcards such as *
or storage.*
are not allowed.
Test a single permission.
","code":"var test = 'pubsub.topics.update';\n\ntopic.iam.testPermissions(test, function(err, permissions, apiResponse) {\n console.log(permissions);\n // {\n // \"pubsub.topics.update\": true\n // }\n});"},{"caption":"Test several permissions at once.
","code":"var tests = [\n 'pubsub.subscriptions.consume',\n 'pubsub.subscriptions.update'\n];\n\nsubscription.iam.testPermissions(tests, function(err, permissions) {\n console.log(permissions);\n // {\n // \"pubsub.subscriptions.consume\": true,\n // \"pubsub.subscriptions.update\": false\n // }\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"topic.iam.testPermissions(test).then(function(data) {\n var permissions = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"permissions","description":"If permissions are not provided.
"}],"returns":[]}],"path":"topic.json"} \ No newline at end of file diff --git a/json/google-cloud/v0.51.1/resource/index.json b/json/google-cloud/v0.51.1/resource/index.json new file mode 100644 index 00000000000..4105c2a63fa --- /dev/null +++ b/json/google-cloud/v0.51.1/resource/index.json @@ -0,0 +1 @@ +{"id":"resource","type":"class","name":"Resource","overview":"\n This class allows you interact with Cloud Resource Manager.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/resource
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
* The Cloud Resource Manager provides methods that you can use to programmatically manage your projects in the Google Cloud Platform. With this API, you can do the following:
Create a project.
This method only works if you are authenticated as yourself, e.g. using the gcloud SDK.
","source":"packages/resource/src/index.js#L125","resources":[{"title":"Projects Overview","link":"https://cloud.google.com/compute/docs/networking#networks"},{"title":"projects: create API Documentation","link":"https://cloud.google.com/resource-manager/reference/rest/v1/projects/create"}],"examples":[{"code":"var id = 'new-project-id';\n\nresource.createProject(id, function(err, project, operation, apiResponse) {\n if (err) {\n // Error handling omitted.\n }\n\n // `project` is a new Project instance.\n // `operation` will emit `error` or `complete` when the status updates.\n\n operation\n .on('error', function(err) {})\n .on('complete', function() {\n // Project was created successfully!\n });\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"resource.createProject(id)\n .then(function(data) {\n var project = data[0];\n var operation = data[1];\n var apiResponse = data[2];\n\n return operation.promise();\n })\n .then(function(data) {\n var operationMetadata = data[0];\n\n // Project created successfully!\n });"}],"params":[{"name":"id","description":"Get a list of projects.
","source":"packages/resource/src/index.js#L202","resources":[{"title":"Projects Overview","link":"https://cloud.google.com/resource-manager/reference/rest/v1/projects"},{"title":"projects: list API Documentation","link":"https://cloud.google.com/resource-manager/reference/rest/v1/projects/list"}],"examples":[{"code":"resource.getProjects(function(err, projects) {\n // `projects` is an array of `Project` objects.\n});"},{"caption":"To control how many API requests are made and page through the results \nmanually, set autoPaginate
to false
.
If the callback is omitted, we'll return a Promise.
","code":"resource.getProjects().then(function(data) {\n var projects = data[0];\n});"}],"params":[{"name":"options","description":"Get a list of resource/project objects as a readable object stream.
","source":"packages/resource/src/index.js#L265","resources":[],"examples":[{"code":"resource.getProjectsStream()\n .on('error', console.error)\n .on('data', function(project) {\n // `project` is a `Project` object.\n })\n .on('end', function() {\n // All projects retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"resource.getProjectsStream()\n .on('data', function(project) {\n this.end();\n });"}],"params":[{"name":"query","description":"Get a reference to an existing operation.
","source":"packages/resource/src/index.js#L282","resources":[],"examples":[{"code":"var operation = resource.operation('68850831366825');"}],"params":[{"name":"name","description":"If a name is not provided.
"}],"returns":[]},{"id":"project","name":"project","type":"instance","description":"Create a Project object. See resoucemanager/createProject to create a project.
","source":"packages/resource/src/index.js#L305","resources":[],"examples":[{"code":"var project = resource.project('grape-spaceship-123');"}],"params":[{"name":"id","description":"grape-spaceship-123
).If an ID is not provided.
"}],"returns":[{"types":["resource/project"],"description":""}]}],"path":"index.json"} \ No newline at end of file diff --git a/json/google-cloud/v0.51.1/resource/project.json b/json/google-cloud/v0.51.1/resource/project.json new file mode 100644 index 00000000000..ed1d73da17c --- /dev/null +++ b/json/google-cloud/v0.51.1/resource/project.json @@ -0,0 +1 @@ +{"id":"resource/project","type":"class","name":"Project","overview":"\n This class allows you interact with Cloud Resource Manager.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/resource
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
A Project object allows you to interact with a Google Cloud Platform project.
","source":"packages/resource/src/project.js#L43","resources":[{"title":"Projects Overview","link":"https://cloud.google.com/resource-manager/reference/rest/v1/projects"},{"title":"Project Resource","link":"https://cloud.google.com/resource-manager/reference/rest/v1/projects#Project"}],"examples":[{"code":"var project = resource.project('grape-spaceship-123');"}],"params":[],"exceptions":[],"returns":[]},{"id":"create","name":"create","type":"instance","description":"Create a project.
","source":"packages/resource/src/project.js#L82","resources":[],"examples":[{"code":"project.create(function(err, project, operation, apiResponse) {\n if (err) {\n // Error handling omitted.\n }\n\n // `operation` will emit `error` or `complete` when the status updates.\n\n operation\n .on('error', function(err) {})\n .on('complete', function() {\n // Project was created successfully!\n });\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"project.create()\n .then(function(data) {\n var project = data[0];\n var operation = data[1];\n var apiResponse = data[2];\n\n return operation.promise();\n })\n .then(function(data) {\n var operationMetadata = data[0];\n\n // Project created successfully!\n });"}],"params":[{"name":"config","description":" ","types":["object"],"optional":true,"nullable":false}],"exceptions":[],"returns":[]},{"id":"delete","name":"delete","type":"instance","description":"Delete the project.
This method only works if you are authenticated as yourself, e.g. using the gcloud SDK.
","source":"packages/resource/src/project.js#L111","resources":[{"title":"projects: delete API Documentation","link":"https://cloud.google.com/resource-manager/reference/rest/v1/projects/delete"}],"examples":[{"code":"project.delete(function(err, apiResponse) {\n if (!err) {\n // The project was deleted!\n }\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"project.delete().then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[{"name":"callback","description":"Check if the project exists.
","source":"packages/resource/src/project.js#L131","resources":[],"examples":[{"code":"project.exists(function(err, exists) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"project.exists().then(function(data) {\n var exists = data[0];\n});"}],"params":[{"name":"callback","description":"Get a project if it exists.
You may optionally use this to "get or create" an object by providing an object with autoCreate
set to true
. Any extra configuration that is normally required for the create
method must be contained within this object as well.
If the callback is omitted, we'll return a Promise.
","code":"project.get().then(function(data) {\n var project = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"options","description":"false
Get the metadata for the project.
","source":"packages/resource/src/project.js#L183","resources":[{"title":"projects: get API Documentation","link":"https://cloud.google.com/resource-manager/reference/rest/v1/projects/get"}],"examples":[{"code":"project.getMetadata(function(err, metadata, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"project.getMetadata().then(function(data) {\n var metadata = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"Set the project's metadata.
This method only works if you are authenticated as yourself, e.g. using the gcloud SDK.
","source":"packages/resource/src/project.js#L219","resources":[{"title":"projects: update API Documentation","link":"https://cloud.google.com/resource-manager/reference/rest/v1/projects/update"},{"title":"Project Resource","link":"https://cloud.google.com/resource-manager/reference/rest/v1/projects#Project"}],"examples":[{"code":"var metadata = {\n name: 'New name'\n};\n\nproject.setMetadata(metadata, function(err, apiResponse) {\n if (!err) {\n // The project has been successfully updated.\n }\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"project.setMetadata(metadata).then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[{"name":"metadata","description":"Restore a project.
This method only works if you are authenticated as yourself, e.g. using the gcloud SDK.
","source":"packages/resource/src/project.js#L263","resources":[{"title":"projects: undelete API Documentation","link":"https://cloud.google.com/resource-manager/reference/rest/v1/projects/undelete"}],"examples":[{"code":"project.restore(function(err, apiResponse) {\n if (!err) {\n // Project restored.\n }\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"project.restore().then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[{"name":"callback","description":"\n This class allows you interact with Cloud Spanner.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/spanner
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
Create a Database object to interact with a Cloud Spanner database.
","source":"packages/spanner/src/database.js#L94","resources":[],"examples":[{"code":"var instance = spanner.instance('my-instance');\nvar database = instance.database('my-database');"}],"params":[{"name":"name","description":"0
, a timeout will not occur. (Default: 0
)false
)0
)Create a database.
","source":"packages/spanner/src/database.js#L134","resources":[],"examples":[{"code":"database.create(function(err, database, operation, apiResponse) {\n if (err) {\n // Error handling omitted.\n }\n\n operation\n .on('error', function(err) {})\n .on('complete', function() {\n // Database created successfully.\n });\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"database.create()\n .then(function(data) {\n var operation = data[0];\n var apiResponse = data[1];\n\n return operation.promise();\n })\n .then(function() {\n // Database created successfully.\n });"}],"params":[{"name":"options","description":" ","types":["object"],"optional":true,"nullable":false}],"exceptions":[],"returns":[]},{"id":"exists","name":"exists","type":"instance","description":"Check if a database exists.
","source":"packages/spanner/src/database.js#L154","resources":[],"examples":[{"code":"database.exists(function(err, exists) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"database.exists().then(function(data) {\n var exists = data[0];\n});"}],"params":[{"name":"callback","description":"Get a database if it exists.
You may optionally use this to "get or create" an object by providing an object with autoCreate
set to true
. Any extra configuration that is normally required for the create
method must be contained within this object as well.
If the callback is omitted, we'll return a Promise.
","code":"database.get().then(function(data) {\n var database = data[0];\n var apiResponse = data[0];\n});"}],"params":[{"name":"options","description":"false
Close the database connection and destroy all sessions associated with it.
","source":"packages/spanner/src/database.js#L234","resources":[],"examples":[{"code":"database.close(function(err) {\n if (err) {\n // Error handling omitted.\n }\n});"}],"params":[{"name":"callback","description":"Create a table.
","source":"packages/spanner/src/database.js#L288","resources":[],"examples":[{"code":"var schema =\n 'CREATE TABLE Singers (' +\n ' SingerId INT64 NOT NULL,' +\n ' FirstName STRING(1024),' +\n ' LastName STRING(1024),' +\n ' SingerInfo BYTES(MAX),' +\n ') PRIMARY KEY(SingerId)';\n\ndatabase.createTable(schema, function(err, table, operation, apiResponse) {\n if (err) {\n // Error handling omitted.\n }\n\n operation\n .on('error', function(err) {})\n .on('complete', function() {\n // Table created successfully.\n });\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"database.createTable(schema)\n .then(function(data) {\n var table = data[0];\n var operation = data[1];\n\n return operation.promise();\n })\n .then(function() {\n // Table created successfully.\n });"}],"params":[{"name":"schema","description":"Delete the database.
","source":"packages/spanner/src/database.js#L329","resources":[{}],"examples":[{"code":"database.delete(function(err, apiResponse) {\n if (err) {\n // Error handling omitted.\n }\n\n // Database was deleted successfully.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"database.delete().then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[{"name":"callback","description":"Get the database's metadata.
","source":"packages/spanner/src/database.js#L362","resources":[{}],"examples":[{"code":"database.getMetadata(function(err, metadata, apiResponse) {\n if (err) {\n // Error handling omitted.\n }\n\n // Database was deleted successfully.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"database.getMetadata().then(function(data) {\n var metadata = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"Get this database's schema as a list of formatted DDL statements.
","source":"packages/spanner/src/database.js#L390","resources":[{},{}],"examples":[{"code":"database.getSchema(function(err, statements, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"database.getSchema().then(function(data) {\n var statements = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"Execute a SQL statement on this database.
","source":"packages/spanner/src/database.js#L485","resources":[{},{}],"examples":[{"code":"var query = 'SELECT * FROM Singers';\n\ndatabase.run(query, function(err, rows) {\n if (err) {\n // Error handling omitted.\n }\n\n var row1 = rows[0];\n\n // row1 = [\n // {\n // name: 'SingerId',\n // value: '1'\n // },\n // {\n // name: 'Name',\n // value: 'Eddie Wilson'\n // }\n // ]\n});"},{"caption":"Rows are returned as an array of object arrays. Each object has a name
\nand value
property. To get a serialized object, call toJSON()
.
The SQL query string can contain parameter placeholders. A parameter \nplaceholder consists of '@' followed by the parameter name.
","code":"var query = {\n sql: 'SELECT * FROM Singers WHERE name = @name',\n params: {\n name: 'Eddie Wilson'\n }\n};\n\ndatabase.run(query, function(err, rows) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"database.run(query).then(function(data) {\n var rows = data[0];\n});"}],"params":[{"name":"query","description":"exactStaleness
old.true
, returns the read timestamp.name
and value
property. To get a serialized object, call toJSON()
.Create a readable object stream to receive resulting rows from a SQL statement.
","source":"packages/spanner/src/database.js#L588","resources":[{},{}],"examples":[{"code":"var query = 'SELECT * FROM Singers';\n\ndatabase.runStream(query)\n .on('error', function(err) {})\n .on('data', function(row) {\n // row = [\n // {\n // name: 'SingerId',\n // value: '1'\n // },\n // {\n // name: 'Name',\n // value: 'Eddie Wilson'\n // }\n // ]\n // ]\n })\n .on('end', function() {\n // All results retrieved.\n });"},{"caption":"Rows are returned as an array of objects. Each object has a name
and \nvalue
property. To get a serialized object, call toJSON()
.
The SQL query string can contain parameter placeholders. A parameter \nplaceholder consists of '@' followed by the parameter name.
","code":"var query = {\n sql: 'SELECT * FROM Singers WHERE name = @name',\n params: {\n name: 'Eddie Wilson'\n }\n};\n\ndatabase.runStream(query)\n .on('error', function(err) {})\n .on('data', function(row) {})\n .on('end', function() {});"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"database.runStream(query)\n .on('data', function(row) {\n this.end();\n });"}],"params":[{"name":"query","description":"exactStaleness
old.true
, returns the read timestamp.A transaction in Cloud Spanner is a set of reads and writes that execute atomically at a single logical point in time across columns, rows, and tables in a database.
The callback you provide to this function will become the "run function". It will be executed with either an error or a spanner/transaction object. The Transaction object will let you run queries and queue mutations until you are ready to spanner/transaction#commit.
For a more complete listing of functionality available to a Transaction, see the spanner/transaction API documentation. For a general overview of transactions within Cloud Spanner, see Transactions from the official Cloud Spanner documentation.
","source":"packages/spanner/src/database.js#L718","resources":[{},{}],"examples":[{"code":"database.runTransaction(function(err, transaction) {\n if (err) {\n // Error handling omitted.\n }\n\n // Run a transactional query.\n transaction.run('SELECT * FROM Singers', function(err, rows) {\n if (err) {\n // Error handling omitted.\n }\n\n // Queue a mutation (note that there is no callback passed to `insert`).\n transaction.insert('Singers', {\n SingerId: 'Id3b',\n Name: 'Joe West'\n });\n\n // Commit the transaction.\n transaction.commit(function(err) {\n if (!err) {\n // Transaction committed successfully.\n }\n });\n });\n});"},{"caption":"For read-only transactions, use the transaction.end()
function to \nrelease the transaction.
exactStaleness
old.true
, returns the read timestamp.Get a reference to a Table object.
","source":"packages/spanner/src/database.js#L747","resources":[],"examples":[{"code":"var table = database.table('Singers');"}],"params":[{"name":"name","description":"If a name is not provided.
"}],"returns":[{"types":["spanner/table"],"description":"Update the schema of the database by creating/altering/dropping tables, columns, indexes, etc.
This method immediately responds with an Operation object. Register event handlers for the "error" and "complete" events to see how the operation finishes. Follow along with the examples below.
","source":"packages/spanner/src/database.js#L810","resources":[{},{},{}],"examples":[{"code":"var statements = [\n 'CREATE TABLE Singers (' +\n ' SingerId INT64 NOT NULL,' +\n ' FirstName STRING(1024),' +\n ' LastName STRING(1024),' +\n ' SingerInfo BYTES(MAX),' +\n ') PRIMARY KEY(SingerId)'\n];\n\ndatabase.updateSchema(statements, function(err, operation, apiResponse) {\n if (err) {\n // Error handling omitted.\n }\n\n operation\n .on('error', function(err) {})\n .on('complete', function() {\n // Database schema updated successfully.\n });\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"database.updateSchema(statements)\n .then(function(data) {\n var operation = data[0];\n return operation.promise();\n })\n .then(function() {\n // Database schema updated successfully.\n });"}],"params":[{"name":"statements","description":"UpdateDatabaseDdlRequest
object.\n This class allows you interact with Cloud Spanner.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/spanner
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
Cloud Spanner is a highly scalable, transactional, managed, NewSQL database service. Cloud Spanner solves the need for a horizontally-scaling database with consistent global transaction and SQL semantics. With Cloud Spanner you don't need to choose between consistency and horizontal scaling — you get both.
","source":"packages/spanner/src/index.js#L61","resources":[{},{}],"examples":[],"params":[{"name":"options","description":" ","types":["object"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]},{"id":"date","name":"date","type":"instance","description":"Helper function to get a Cloud Spanner Date object.
","source":"packages/spanner/src/index.js#L107","resources":[],"examples":[{"code":"var date = spanner.date('08-20-1969');"}],"params":[{"name":"value","description":"Helper function to get a Cloud Spanner Float64 object.
","source":"packages/spanner/src/index.js#L120","resources":[],"examples":[{"code":"var date = spanner.float(10);"}],"params":[{"name":"value","description":"Helper function to get a Cloud Spanner Int64 object.
","source":"packages/spanner/src/index.js#L133","resources":[],"examples":[{"code":"var date = spanner.int(10);"}],"params":[{"name":"value","description":"Create an instance.
","source":"packages/spanner/src/index.js#L191","resources":[{}],"examples":[{"code":"var config = {\n config: 'regional-us-central1',\n nodes: 1\n};\n\nfunction callback(err, instance, operation, apiResponse) {\n if (err) {\n // Error handling omitted.\n }\n\n operation\n .on('error', function(err) {})\n .on('complete', function() {\n // Instance created successfully.\n });\n}\n\nspanner.createInstance('new-instance-name', config, callback);"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"spanner.createInstance('new-instance-name', config)\n .then(function(data) {\n var instance = data[0];\n var operation = data[1];\n return operation.promise();\n })\n .then(function() {\n // Instance created successfully.\n });"}],"params":[{"name":"name","description":"If a name is not provided.
"},{"type":"Error","description":"If a configuration object is not provided.
"}],"returns":[]},{"id":"getInstances","name":"getInstances","type":"instance","description":"Get a list of instances.
","source":"packages/spanner/src/index.js#L299","resources":[{}],"examples":[{"code":"spanner.getInstances(function(err, instances) {\n // `instances` is an array of `Instance` objects.\n});"},{"caption":"To control how many API requests are made and page through the results \nmanually, set autoPaginate
to false
.
If the callback is omitted, we'll return a Promise.
","code":"spanner.getInstances().then(function(data) {\n var instances = data[0];\n});"}],"params":[{"name":"query","description":"An expression for filtering the results of the request. Filter rules are case insensitive. The fields eligible for filtering are:
name
display_name
labels.key
where key is the name of a label
Some examples of using filters are:
name:*
The instance has a name.name:Howl
The instance's name is howl.labels.env:*
The instance has the label env.labels.env:dev
The instance's label env has the value dev.name:howl labels.env:dev
The instance's name is howl and it has the label env with value dev.Get a list of spanner/instance objects as a readable object stream.
","source":"packages/spanner/src/index.js#L352","resources":[{}],"examples":[{"code":"spanner.getInstancesStream()\n .on('error', console.error)\n .on('data', function(instance) {\n // `instance` is an `Instance` object.\n })\n .on('end', function() {\n // All instances retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"spanner.getInstancesStream()\n .on('data', function(instance) {\n this.end();\n });"}],"params":[{"name":"options","description":"Get a list of instance configs.
","source":"packages/spanner/src/index.js#L404","resources":[{}],"examples":[{"code":"spanner.getInstanceConfigs(function(err, instanceConfigs) {\n // `instanceConfigs` is an array of instance configuration descriptors.\n});"},{"caption":"To control how many API requests are made and page through the results \nmanually, set autoPaginate
to false
.
If the callback is omitted, we'll return a Promise.
","code":"spanner.getInstanceConfigs().then(function(data) {\n var instanceConfigs = data[0];\n});"}],"params":[{"name":"query","description":"Get a list of instance configs as a readable object stream.
","source":"packages/spanner/src/index.js#L443","resources":[{}],"examples":[{"code":"spanner.getInstanceConfigsStream()\n .on('error', console.error)\n .on('data', function(instanceConfig) {})\n .on('end', function() {\n // All instances retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"spanner.getInstanceConfigsStream()\n .on('data', function(instanceConfig) {\n this.end();\n });"}],"params":[{"name":"options","description":"Get a reference to an Instance object.
","source":"packages/spanner/src/index.js#L462","resources":[],"examples":[{"code":"var instance = spanner.instance('my-instance');"}],"params":[{"name":"name","description":"If a name is not provided.
"}],"returns":[{"types":["spanner/instance"],"description":"Get a reference to an Operation object.
","source":"packages/spanner/src/index.js#L481","resources":[],"examples":[{"code":"var operation = spanner.operation('operation-name');"}],"params":[{"name":"name","description":"If a name is not provided.
"}],"returns":[{"types":["Operation"],"description":"\n This class allows you interact with Cloud Spanner.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/spanner
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
Create an Instance object to interact with a Cloud Spanner instance.
","source":"packages/spanner/src/instance.js#L48","resources":[],"examples":[{"code":"var instance = spanner.instance('my-instance');"}],"params":[{"name":"name","description":"Create an instance.
","source":"packages/spanner/src/instance.js#L87","resources":[],"examples":[{"code":"instance.create(function(err, instance, operation, apiResponse) {\n if (err) {\n // Error handling omitted.\n }\n\n operation\n .on('error', function(err) {})\n .on('complete', function() {\n // Instance created successfully.\n });\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"instance.create()\n .then(function(data) {\n var operation = data[0];\n var apiResponse = data[1];\n\n return operation.promise();\n })\n .then(function() {\n // Instance created successfully.\n });"}],"params":[{"name":"config","description":" ","types":["object"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]},{"id":"exists","name":"exists","type":"instance","description":"Check if an instance exists.
","source":"packages/spanner/src/instance.js#L107","resources":[],"examples":[{"code":"instance.exists(function(err, exists) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"instance.exists().then(function(data) {\n var exists = data[0];\n});"}],"params":[{"name":"callback","description":"Get an instance if it exists.
You may optionally use this to "get or create" an object by providing an object with autoCreate
set to true
. Any extra configuration that is normally required for the create
method must be contained within this object as well.
If the callback is omitted, we'll return a Promise.
","code":"instance.get().then(function(data) {\n var instance = data[0];\n var apiResponse = data[0];\n});"}],"params":[{"name":"options","description":"false
Create a database in this instance.
","source":"packages/spanner/src/instance.js#L229","resources":[{}],"examples":[{"code":"function callback(err, database, operation, apiResponse) {\n if (err) {\n // Error handling omitted.\n }\n\n operation\n .on('error', function(err) {})\n .on('complete', function() {\n // Database created successfully.\n });\n}\n\ninstance.createDatabase('new-database-name', callback);"},{"caption":"Set the schema for the database.
","code":"instance.createDatabase('new-database-name', {\n schema:\n 'CREATE TABLE Singers (' +\n ' SingerId STRING(1024) NOT NULL,' +\n ' Name STRING(1024),' +\n ') PRIMARY KEY(SingerId)'\n}, callback);"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"instance.createDatabase('new-database-name')\n .then(function(data) {\n var database = data[0];\n var operation = data[1];\n return operation.promise();\n })\n .then(function() {\n // Database created successfully.\n });"}],"params":[{"name":"name","description":"If a name is not provided.
"}],"returns":[]},{"id":"database","name":"database","type":"instance","description":"Get a reference to a Database object.
","source":"packages/spanner/src/instance.js#L281","resources":[],"examples":[{"code":"var database = instance.database('my-database');"}],"params":[{"name":"name","description":"If a name is not provided.
"}],"returns":[{"types":["spanner/database"],"description":"Delete the instance.
","source":"packages/spanner/src/instance.js#L314","resources":[{}],"examples":[{"code":"instance.delete(function(err, apiResponse) {\n if (err) {\n // Error handling omitted.\n }\n\n // Instance was deleted successfully.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"instance.delete().then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[{"name":"callback","description":"Get a list of databases.
","source":"packages/spanner/src/instance.js#L365","resources":[{}],"examples":[{"code":"instance.getDatabases(function(err, databases) {\n // `databases` is an array of `Database` objects.\n});"},{"caption":"To control how many API requests are made and page through the results \nmanually, set autoPaginate
to false
.
If the callback is omitted, we'll return a Promise.
","code":"instance.getDatabases().then(function(data) {\n var databases = data[0];\n});"}],"params":[{"name":"query","description":"Get a list of databases as a readable object stream.
","source":"packages/spanner/src/instance.js#L418","resources":[{}],"examples":[{"code":"instance.getDatabasesStream()\n .on('error', console.error)\n .on('data', function(database) {\n // `database` is a `Database` object.\n })\n .on('end', function() {\n // All databases retrieved.\n });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"instance.getDatabasesStream()\n .on('data', function(database) {\n this.end();\n });"}],"params":[{"name":"options","description":"Get the instance's metadata.
","source":"packages/spanner/src/instance.js#L442","resources":[{}],"examples":[{"code":"instance.getMetadata(function(err, metadata, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"instance.getMetadata().then(function(data) {\n var metadata = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"Update the metadata for this instance. Note that this method follows PATCH semantics, so previously-configured settings will persist.
","source":"packages/spanner/src/instance.js#L486","resources":[{}],"examples":[{"code":"var metadata = {\n displayName: 'My Instance'\n};\n\ninstance.setMetadata(metadata, function(err, operation, apiResponse) {\n if (err) {\n // Error handling omitted.\n }\n\n operation\n .on('error', function(err) {})\n .on('complete', function() {\n // Metadata updated successfully.\n });\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"instance.setMetadata(metadata).then(function(data) {\n var operation = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"metadata","description":"\n This class allows you interact with Cloud Spanner.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/spanner
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
Create a Table object to interact with a table in a Cloud Spanner database.
","source":"packages/spanner/src/table.js#L47","resources":[],"examples":[{"code":"var instance = spanner.instance('my-instance');\nvar database = instance.database('my-database');\nvar table = database.table('my-table');"}],"params":[{"name":"name","description":"Create a table.
","source":"packages/spanner/src/table.js#L101","resources":[],"examples":[{"code":"var schema =\n 'CREATE TABLE Singers (' +\n ' SingerId INT64 NOT NULL,' +\n ' FirstName STRING(1024),' +\n ' LastName STRING(1024),' +\n ' SingerInfo BYTES(MAX),' +\n ') PRIMARY KEY(SingerId)';\n\ntable.create(schema, function(err, table, operation, apiResponse) {\n if (err) {\n // Error handling omitted.\n }\n\n operation\n .on('error', function(err) {})\n .on('complete', function() {\n // Table created successfully.\n });\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"table.create(schema)\n .then(function(data) {\n var table = data[0];\n var operation = data[1];\n\n return operation.promise();\n })\n .then(function() {\n // Table created successfully.\n });"}],"params":[{"name":"schema","description":"Create a readable object stream to receive rows from the database using key lookups and scans.
","source":"packages/spanner/src/table.js#L182","resources":[{},{}],"examples":[{"code":"table.createReadStream({\n keys: ['1'],\n columns: ['SingerId', 'name']\n })\n .on('error', function(err) {})\n .on('data', function(row) {\n // row = {\n // SingerId: '1',\n // Name: 'Eddie Wilson'\n // }\n })\n .on('end', function() {\n // All results retrieved.\n });"},{"caption":"Provide an array for query.keys
to read with a composite key.
If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"table.createReadStream({\n keys: ['1'],\n columns: ['SingerId', 'name']\n })\n .on('data', function(row) {\n this.end();\n });"}],"params":[{"name":"table","description":"ReadRequest
.exactStaleness
old.true
, returns the read timestamp.Delete the table.
","source":"packages/spanner/src/table.js#L233","resources":[],"examples":[{"code":"table.delete(function(err, operation, apiResponse) {\n if (err) {\n // Error handling omitted.\n }\n\n operation\n .on('error', function(err) {})\n .on('complete', function() {\n // Table deleted successfully.\n });\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"table.delete()\n .then(function(data) {\n var operation = data[0];\n return operation.promise();\n })\n .then(function() {\n // Table deleted successfully.\n });"}],"params":[{"name":"callback","description":"Delete rows from this table.
","source":"packages/spanner/src/table.js#L275","resources":[{}],"examples":[{"code":"var keys = ['Id1', 'Id2', 'Id3'];\n\ntable.deleteRows(keys, function(err, apiResponse) {});"},{"caption":"Provide an array for keys
to delete rows with a composite key.
If the callback is omitted, we'll return a Promise.
","code":"table.deleteRows(keys)\n .then(function(data) {\n var apiResponse = data[0];\n });"}],"params":[{"name":"keys","description":"Insert rows of data into this table.
","source":"packages/spanner/src/table.js#L327","resources":[{}],"examples":[{"code":"var row = {\n SingerId: 'Id3',\n Name: 'Eddie Wilson'\n};\n\ntable.insert(row, function(err, apiResponse) {\n if (err) {\n // Error handling omitted.\n }\n\n // Rows inserted successfully.\n});"},{"caption":"Multiple rows can be inserted at once.
","code":"var row2 = {\n SingerId: 'Id3b',\n Name: 'Joe West'\n};\n\ntable.insert([\n row,\n row2\n], function(err, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"table.insert(row)\n .then(function(data) {\n var apiResponse = data[0];\n });"}],"params":[{"name":"keyVals","description":"Receive rows from the database using key lookups and scans.
This method wraps the streaming method, spanner/table#createReadStream for your convenience. All rows will be stored in memory before being released to your callback. If you intend on receiving a lot of results from your query, consider using the streaming method, so you can free each result from memory after consuming it.
","source":"packages/spanner/src/table.js#L438","resources":[],"examples":[{"code":"var query = {\n keys: ['1'],\n columns: ['SingerId', 'name']\n};\n\ntable.read(query, function(err, rows) {\n if (err) {\n // Error handling omitted.\n }\n\n var row1 = rows[0];\n\n // row1 = [\n // {\n // name: 'SingerId',\n // value: '1'\n // },\n // {\n // name: 'Name',\n // value: 'Eddie Wilson'\n // }\n // ]\n});"},{"caption":"Provide an array for query.keys
to read with a composite key.
Rows are returned as an array of object arrays. Each object has a name
\nand value
property. To get a serialized object, call toJSON()
.
If the callback is omitted, we'll return a Promise.
","code":"table.read(query)\n .then(function(data) {\n var apiResponse = data[0];\n });"}],"params":[{"name":"query","description":"exactStaleness
old.true
, returns the read timestamp.name
and value
property. To get a serialized object, call toJSON()
.Replace rows of data within this table.
","source":"packages/spanner/src/table.js#L490","resources":[{}],"examples":[{"code":"var row = {\n SingerId: 'Id3',\n Name: 'Joe West'\n};\n\ntable.replace(row, function(err, apiResponse) {\n if (err) {\n // Error handling omitted.\n }\n\n // Row replaced successfully.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"table.replace(row)\n .then(function(data) {\n var apiResponse = data[0];\n });"}],"params":[{"name":"keyVals","description":"Update rows of data within this table.
","source":"packages/spanner/src/table.js#L528","resources":[{}],"examples":[{"code":"var row = {\n SingerId: 'Id3',\n Name: 'Joe West'\n};\n\ntable.update(row, function(err, apiResponse) {\n if (err) {\n // Error handling omitted.\n }\n\n // Row updated successfully.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"table.update(row)\n .then(function(data) {\n var apiResponse = data[0];\n });"}],"params":[{"name":"keyVals","description":"Insert or update rows of data within this table.
","source":"packages/spanner/src/table.js#L566","resources":[{}],"examples":[{"code":"var row = {\n SingerId: 'Id3',\n Name: 'Joe West'\n};\n\ntable.update(row, function(err, apiResponse) {\n if (err) {\n // Error handling omitted.\n }\n\n // Row inserted or updated successfully.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"table.update(row)\n .then(function(data) {\n var apiResponse = data[0];\n });"}],"params":[{"name":"keyVals","description":"\n This class allows you interact with Cloud Spanner.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/spanner
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
Use a Transaction object to read and write against inside of your Cloud Spanner database.
This object is created and returned from database/runTransaction.
","source":"packages/spanner/src/transaction.js#L92","resources":[],"examples":[{"code":"var instance = spanner.instance('my-instance');\nvar database = instance.database('my-database');\n\ndatabase.runTransaction(function(err, transaction) {\n // The `transaction` object is ready for use.\n});"}],"params":[{"name":"options","description":" ","types":["object"],"optional":true,"nullable":false},{"name":"options.exactStaleness","description":"exactStaleness
old.true
, returns the read timestamp.Commit the transaction.
","source":"packages/spanner/src/transaction.js#L225","resources":[{}],"examples":[{"code":"database.runTransaction(function(err, transaction) {\n if (err) {\n // Error handling omitted.\n }\n\n // Queue a mutation (note that there is no callback passed to `insert`).\n transaction.insert('Singers', {\n SingerId: 'Id3b',\n Name: 'Joe West'\n });\n\n // Commit the transaction.\n transaction.commit(function(err) {\n if (!err) {\n // Mutations were committed successfully.\n }\n });\n});"}],"params":[{"name":"callback","description":"Roll back a transaction, releasing any locks it holds. It is a good idea to call this for any transaction that includes one or more queries that you decide not to commit.
","source":"packages/spanner/src/transaction.js#L325","resources":[{}],"examples":[{"code":"database.runTransaction(function(err, transaction) {\n if (err) {\n // Error handling omitted.\n }\n\n transaction.rollback(function(err) {\n if (!err) {\n // Transaction rolled back successfully.\n }\n });\n});"}],"params":[{"name":"callback","description":"Execute a SQL statement on this database inside of a transaction.
This method wraps the streaming method, spanner/transaction#run for your convenience. All rows will be stored in memory before being released to your callback. If you intend on receiving a lot of results from your query, consider using the streaming method, so you can free each result from memory after consuming it.
","source":"packages/spanner/src/transaction.js#L410","resources":[{},{}],"examples":[{"code":"var query = 'SELECT * FROM Singers';\n\ndatabase.runTransaction(function(err, transaction) {\n if (err) {\n // Error handling omitted.\n }\n\n transaction.run(query, function(err, rows) {\n if (err) {\n // Error handling omitted.\n }\n\n // rows = [\n // {\n // SingerId: '1',\n // Name: 'Eddie Wilson'\n // }\n // ]\n });\n});"},{"caption":"The SQL query string can contain parameter placeholders. A parameter \nplaceholder consists of '@' followed by the parameter name.
","code":"database.runTransaction(function(err, transaction) {\n if (err) {\n // Error handling omitted.\n }\n\n var query = {\n sql: 'SELECT * FROM Singers WHERE name = @name',\n params: {\n name: 'Eddie Wilson'\n }\n };\n\n transaction.run(query, function(err, rows) {});\n});"}],"params":[{"name":"query","description":"ExecuteSqlRequest
object.Create a readable object stream to receive resulting rows from a SQL statement.
","source":"packages/spanner/src/transaction.js#L494","resources":[{},{}],"examples":[{"code":"var query = 'SELECT * FROM Singers';\n\ndatabase.runTransaction(function(err, transaction) {\n if (err) {\n // Error handling omitted.\n }\n\n transaction.runStream(query)\n .on('error', function(err) {})\n .on('data', function(row) {\n // row = {\n // SingerId: '1',\n // Name: 'Eddie Wilson'\n // }\n })\n .on('end', function() {\n // All results retrieved.\n });\n});"},{"caption":"The SQL query string can contain parameter placeholders. A parameter \nplaceholder consists of '@' followed by the parameter name.
","code":"database.runTransaction(function(err, transaction) {\n if (err) {\n // Error handling omitted.\n }\n\n var query = {\n sql: 'SELECT * FROM Singers WHERE name = @name',\n params: {\n name: 'Eddie Wilson'\n }\n };\n\n transaction.runStream(query)\n .on('error', function(err) {})\n .on('data', function(row) {})\n .on('end', function() {});\n});"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"database.runTransaction(function(err, transaction) {\n if (err) {\n // Error handling omitted.\n }\n\n transaction.runStream(query)\n .on('data', function(row) {\n this.end();\n })\n .on('end', function() {});\n});"}],"params":[{"name":"query","description":"ExecuteSqlRequest
object.Let the client know you're done with a particular transaction. This should only be called for read-only transactions.
","source":"packages/spanner/src/transaction.js#L579","resources":[],"examples":[{"code":"var options = {\n readOnly: true\n};\n\ndatabase.runTransaction(options, function(err, transaction) {\n if (err) {\n // Error handling omitted.\n }\n\n transaction.run('SELECT * FROM Singers', function(err, rows) {\n if (err) {\n // Error handling omitted.\n }\n\n // End the transaction. Note that no callback is provided.\n transaction.end();\n });\n});"}],"params":[],"exceptions":[],"returns":[]},{"id":"createReadStream","name":"createReadStream","type":"instance","description":"Create a readable object stream to receive rows from the database using key lookups and scans.
","source":"packages/spanner/src/transaction-request.js#L209","resources":[{},{}],"examples":[{"code":"database.runTransaction(function(err, transaction) {\n if (err) {\n // Error handling omitted.\n }\n\n transaction.createReadStream('Singers', {\n keys: ['1'],\n columns: ['SingerId', 'name']\n })\n .on('error', function(err) {})\n .on('data', function(row) {\n // row = [\n // {\n // name: 'SingerId',\n // value: '1'\n // },\n // {\n // name: 'Name',\n // value: 'Eddie Wilson'\n // }\n // ]\n })\n .on('end', function() {\n // All results retrieved.\n });\n});"},{"caption":"Provide an array for query.keys
to read with a composite key.
Rows are returned as an array of object arrays. Each object has a name
\nand value
property. To get a serialized object, call toJSON()
.
If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"database.runTransaction(function(err, transaction) {\n if (err) {\n // Error handling omitted.\n }\n\n transaction.createReadStream('Singers', {\n keys: ['1'],\n columns: ['SingerId', 'name']\n })\n .on('data', function(row) {\n this.end();\n });\n});"}],"params":[{"name":"table","description":"ReadRequest
.Delete rows from a table.
","source":"packages/spanner/src/transaction-request.js#L295","resources":[{}],"examples":[{"code":"var keys = ['Id1', 'Id2', 'Id3'];\n\ndatabase.runTransaction(function(err, transaction) {\n if (err) {\n // Error handling omitted.\n }\n\n // Queue this mutation until later calling `commit`.\n // Note that a callback is not passed to `deleteRows`.\n transaction.deleteRows('Singers', keys);\n\n // Commit the transaction.\n transaction.commit(function(err) {\n if (!err) {\n // The rows were deleted successfully.\n }\n });\n});"},{"caption":"Provide an array for keys
to delete rows with a composite key.
Insert rows of data into this table.
","source":"packages/spanner/src/transaction-request.js#L387","resources":[{}],"examples":[{"code":"var row = {\n SingerId: 'Id3',\n Name: 'Eddie Wilson'\n};\n\ndatabase.runTransaction(function(err, transaction) {\n if (err) {\n // Error handling omitted.\n }\n\n // Queue this mutation until later calling `commit`.\n // Note that a callback is not passed to `insert`.\n transaction.insert('Singers', row);\n\n // Commit the transaction.\n transaction.commit(function(err) {\n if (!err) {\n // The row was inserted successfully.\n }\n });\n});"},{"caption":"Multiple rows can be inserted at once.
","code":"var row2 = {\n SingerId: 'Id3b',\n Name: 'Joe West'\n};\n\ndatabase.runTransaction(function(err, transaction) {\n if (err) {\n // Error handling omitted.\n }\n\n // Queue multiple mutations until later calling `commit`.\n // Note that a callback is not passed to `insert`.\n transaction.insert('Singers', [\n row,\n row2\n ]);\n\n // Commit the transaction.\n transaction.commit(function(err) {\n if (!err) {\n // The rows were inserted successfully.\n }\n });\n});"}],"params":[{"name":"table","description":"Performs a read request against the specified Table.
","source":"packages/spanner/src/transaction-request.js#L487","resources":[],"examples":[{"code":"var query = {\n keys: ['1'],\n columns: ['SingerId', 'name']\n};\n\ndatabase.runTransaction(function(err, transaction) {\n if (err) {\n // Error handling omitted.\n }\n\n transaction.read('Singers', query, function(err, rows) {\n if (err) {\n // Error handling omitted.\n }\n\n var row1 = rows[0];\n\n // row1 = [\n // {\n // name: 'SingerId',\n // value: '1'\n // },\n // {\n // name: 'Name',\n // value: 'Eddie Wilson'\n // }\n // ]\n\n // End the transaction. Note that no callback is provided.\n transaction.end();\n });\n});"},{"caption":"Provide an array for query.keys
to read with a composite key.
Rows are returned as an array of object arrays. Each object has a name
\nand value
property. To get a serialized object, call toJSON()
.
name
and value
property. To get a serialized object, call toJSON()
.Replace rows of data within a table.
","source":"packages/spanner/src/transaction-request.js#L536","resources":[{}],"examples":[{"code":"var row = {\n SingerId: 'Id3',\n Name: 'Joe West'\n};\n\ndatabase.runTransaction(function(err, transaction) {\n if (err) {\n // Error handling omitted.\n }\n\n // Queue this mutation until later calling `commit`.\n // Note that a callback is not passed to `replace`.\n transaction.replace('Singers', row);\n\n // Commit the transaction.\n transaction.commit(function(err) {\n if (!err) {\n // The row was replaced successfully.\n }\n });\n});"}],"params":[{"name":"table","description":"Update rows of data within a table.
","source":"packages/spanner/src/transaction-request.js#L594","resources":[{}],"examples":[{"code":"var row = {\n SingerId: 'Id3',\n Name: 'Joe West'\n};\n\ndatabase.runTransaction(function(err, transaction) {\n if (err) {\n // Error handling omitted.\n }\n\n // Queue this mutation until later calling `commit`.\n // Note that a callback is not passed to `update`.\n transaction.update('Singers', row);\n\n // Commit the transaction.\n transaction.commit(function(err) {\n if (!err) {\n // The row was updated successfully.\n }\n });\n});"}],"params":[{"name":"table","description":"Insert or update rows of data within a table.
","source":"packages/spanner/src/transaction-request.js#L634","resources":[{}],"examples":[{"code":"var row = {\n SingerId: 'Id3',\n Name: 'Joe West'\n};\n\ndatabase.runTransaction(function(err, transaction) {\n if (err) {\n // Error handling omitted.\n }\n\n // Queue this mutation until later calling `commit`.\n // Note that a callback is not passed to `upsert`.\n transaction.upsert('Singers', row);\n\n // Commit the transaction.\n transaction.commit(function(err) {\n if (!err) {\n // The row was updated or inserted successfully.\n }\n });\n});"}],"params":[{"name":"table","description":"\n This class allows you interact with Cloud Speech API.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/speech
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
To learn more about the Speech API, see the Getting Started guide.
","source":"packages/speech/src/index.js","parent":null,"children":["speech/v1"],"methods":[{"id":"Speech","name":"Speech","type":"constructor","description":"The Cloud Speech API enables easy integration of Google speech recognition technologies into developer applications. Send audio and receive a text transcription from the Cloud Speech API service.
","source":"packages/speech/src/index.js#L58","resources":[{"title":"Getting Started","link":"https://cloud.google.com/speech/docs/getting-started"},{"title":"Speech Best Practices","link":"https://cloud.google.com/speech/docs/best-practices"}],"examples":[],"params":[{"name":"options","description":" ","types":["object"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]},{"id":"eventTypes","name":"eventTypes","type":"instance","description":"The event types that the Speech API will return while processing a speech#createRecognizeStream request. You can track the progress of audio recognition by comparing the data.eventType
property with these values.
Speech.eventTypes.ENDPOINTER_EVENT_UNSPECIFIED
: No event specified.Speech.eventTypes.END_OF_SINGLE_UTTERANCE
: This event is only sent when config.singleUtterance
passed to speech#createRecognizeStream is true
. It indicates that the server has detected the end of the user's speech utterance and expects no additional speech. Therefore, the server will not process additional audio. The client should stop sending additional audio data.Perform bidirectional streaming speech-recognition: receive results while sending audio.
Each emitted data
event is a StreamingRecognizeResponse
object, containing these properties:
eventType
See speech#eventTypes.results
By default, a combined string of transcripts. When config.verbose
is enabled, this is an object including a transcript
property, a confidence
score from 0
- 100
, and an alternatives
array consisting of other transcription possibilities.Cloud Speech sets the limits for the audio duration. For more information, see Content Limits\">https://cloud.google.com/speech/limits#content}.
","source":"packages/speech/src/index.js#L439","resources":[{"title":"StreamingRecognize API Reference","link":"https://cloud.google.com/speech/reference/rpc/google.cloud.speech.v1beta1#google.cloud.speech.v1beta1.Speech.StreamingRecognize"},{"title":"StreamingRecognizeRequest API Reference","link":"https://cloud.google.com/speech/reference/rpc/google.cloud.speech.v1beta1#google.cloud.speech.v1beta1.StreamingRecognizeRequest"},{"title":"Content Limits","link":"https://cloud.google.com/speech/limits#content"}],"examples":[{"code":"var fs = require('fs');"},{"caption":"See \nStreamingRecognizeRequest
for all of the available configuration \noptions.
Enable verbose mode for more detailed results.
","code":"var request = {\n config: {\n encoding: 'LINEAR16',\n languageCode: 'en-US',\n sampleRateHertz: 16000\n },\n singleUtterance: false,\n interimResults: false,\n verbose: true\n};\n\nfs.createReadStream('./system-test/data/bridge.raw')\n .on('error', console.error)\n .pipe(speech.createRecognizeStream(request))\n .on('error', console.error)\n .on('data', function(data) {\n // data.results = \"how old is the Brooklyn Bridge\"\n });"}],"params":[{"name":"config","description":"StreamingRecognitionConfig
object. See StreamingRecognitionConfig
.190
, is sufficient for audio input of 60 seconds or less. If your input is longer, consider using a higher timeout value.false
.Get a reference to an existing operation.
","source":"packages/speech/src/index.js#L523","resources":[],"examples":[{"code":"var operation = speech.operation('68850831366825');"}],"params":[{"name":"name","description":"If a name is not provided.
"}],"returns":[]},{"id":"recognize","name":"recognize","type":"instance","description":"Perform synchronous speech recognition and receive results after all audio has been sent and processed. This is ideal for files 1 MB or below. For larger files, you will need to use speech#startRecognition or speech#createRecognizeStream.
","source":"packages/speech/src/index.js#L640","resources":[{"title":"Recognize API Reference","link":"https://cloud.google.com/speech/reference/rpc/google.cloud.speech.v1beta1#google.cloud.speech.v1beta1.Speech.Recognize"},{"title":"RecognizeRequest API Reference","link":"https://cloud.google.com/speech/reference/rpc/google.cloud.speech.v1beta1#google.cloud.speech.v1beta1.RecognizeRequest"}],"examples":[{"code":"var config = {\n encoding: 'LINEAR16',\n languageCode: 'en-US',\n sampleRateHertz: 16000\n};\n\nfunction callback(err, transcript, apiResponse) {\n if (err) {\n // Error handling omitted.\n }\n\n // transcript = \"how old is the Brooklyn Bridge\"\n}"},{"caption":"Run speech detection over a local file.
","code":"speech.recognize('./bridge.raw', config, callback);"},{"caption":"Run speech recognition over a file in Cloud Storage.
","code":"speech.recognize('gs://your-bucket-name/bridge.raw', config, callback);"},{"caption":"Run speech recognition over raw file contents.
","code":"speech.recognize({\n content: fs.readFileSync('./bridge.raw')\n}, config, callback);"},{"caption":"Run speech recognition over a remote file. \nNote: This is not an officially supported feature of the Speech API. \nThis library will make a request to the URL given and send the file \ncontents to the upstream API.
","code":"speech.recognize('https://example.com/files/bridge.raw', config, callback);"},{"caption":"Enable verbose mode for more detailed results.
","code":"var config = {\n encoding: 'LINEAR16',\n languageCode: 'en-US',\n sampleRateHertz: 16000,\n verbose: true\n};\n\nspeech.recognize('./bridge.raw', config, function(err, results) {\n if (err) {\n // Error handling omitted.\n }\n\n // results = [\n // {\n // transcript: \"how old is the Brooklyn Bridge\",\n // confidence: 88.15,\n // alternatives: [\n // {\n // transcript: \"how old is the Brooklyn brim\",\n // confidence: 22.39\n // }\n // ]\n // }\n // ]\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"speech.recognize('./bridge.raw', config).then(function(data) {\n var results = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"file","description":"RecognitionAudio
object.RecognitionConfig
object. See RecognitionConfig
.false
.config.verbose
is enabled, this is an object including a transcript
property, a confidence
score from 0
- 100
, and an alternatives
array consisting of other transcription possibilities. See the examples below for more.RecognizeResponse
.Perform asynchronous speech recognition.
This method sends audio to the Speech API, which immediately responds with an Operation object. Register event handlers for the "error" and "complete" events to see how the operation finishes. Follow along with the examples below.
","source":"packages/speech/src/index.js#L796","resources":[{"title":"LongRunningRecognize API Reference","link":"https://cloud.google.com/speech/reference/rpc/google.cloud.speech.v1beta1#google.cloud.speech.v1.Speech.LongRunningRecognize"},{"title":"LongRunningRecognize API Reference","link":"https://cloud.google.com/speech/reference/rpc/google.cloud.speech.v1beta1#google.cloud.speech.v1.LongRunningRecognizeRequest"},{"title":"LongRunningRecognize API Reference","link":"https://cloud.google.com/speech/reference/rpc/google.cloud.speech.v1beta1#google.cloud.speech.v1.LongRunningRecognizeResponse"}],"examples":[{"code":"var config = {\n encoding: 'LINEAR16',\n languageCode: 'en-US',\n sampleRateHertz: 16000\n};\n\nfunction callback(err, operation, apiResponse) {\n if (err) {\n // Error handling omitted.\n }\n\n operation\n .on('error', function(err) {})\n .on('complete', function(transcript) {\n // transcript = \"how old is the Brooklyn Bridge\"\n });\n}"},{"caption":"Run speech detection over a local file.
","code":"speech.startRecognition('./bridge.raw', config, callback);"},{"caption":"Run speech detection over a file in Cloud Storage.
","code":"var file = 'gs://your-bucket-name/bridge.raw';\nspeech.startRecognition(file, config, callback);"},{"caption":"Run speech detection over raw file contents.
","code":"speech.startRecognition({\n content: fs.readFileSync('./bridge.raw')\n}, config, callback);"},{"caption":"Run speech detection over a remote file. \nNote: This is not an officially supported feature of the Speech API. \nThis library will make a request to the URL given and send the file \ncontents to the upstream API.
","code":"var file = 'https://example.com/files/bridge.raw';\n\nspeech.startRecognition(file, config, callback);"},{"caption":"Enable verbose mode for more detailed results.
","code":"var config = {\n encoding: 'LINEAR16',\n languageCode: 'en-US',\n sampleRateHertz: 16000,\n verbose: true\n};\n\nspeech.startRecognition('./bridge.raw', config, function(err, operation) {\n if (err) {\n // Error handling omitted.\n }\n\n operation\n .on('error', function(err) {})\n .on('complete', function(results) {\n // results = [\n // {\n // transcript: \"how old is the Brooklyn Bridge\",\n // confidence: 88.15\n // }\n // ]\n });\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"speech.startRecognition('./bridge.raw', config).then(function(data) {\n var operation = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"file","description":"RecognitionAudio
object.RecognitionConfig
object. See RecognitionConfig
.false
.\n This class allows you interact with Cloud Storage.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/storage
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
Create a Bucket object to interact with a Cloud Storage bucket.
","source":"packages/storage/src/bucket.js#L71","resources":[],"examples":[{"code":"var bucket = gcs.bucket('albums');"}],"params":[{"name":"options","description":"credentials
object.keyFilename
.Create a bucket.
","source":"packages/storage/src/bucket.js#L93","resources":[],"examples":[{"code":"bucket.create(function(err, zone, apiResponse) {\n if (!err) {\n // The zone was created successfully.\n }\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"bucket.create().then(function(data) {\n var zone = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"config","description":"Delete the bucket.
","source":"packages/storage/src/bucket.js#L115","resources":[{"title":"Buckets: delete API Documentation","link":"https://cloud.google.com/storage/docs/json_api/v1/buckets/delete"}],"examples":[{"code":"bucket.delete(function(err, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"bucket.delete().then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[{"name":"callback","description":"Check if the bucket exists.
","source":"packages/storage/src/bucket.js#L135","resources":[],"examples":[{"code":"bucket.exists(function(err, exists) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"bucket.exists().then(function(data) {\n var exists = data[0];\n});"}],"params":[{"name":"callback","description":"Get a bucket if it exists.
You may optionally use this to "get or create" an object by providing an object with autoCreate
set to true
. Any extra configuration that is normally required for the create
method must be contained within this object as well.
If the callback is omitted, we'll return a Promise.
","code":"bucket.get().then(function(data) {\n var bucket = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"options","description":"false
Get the bucket's metadata.
To set metadata, see storage/bucket#setMetadata.
","source":"packages/storage/src/bucket.js#L188","resources":[{"title":"Buckets: get API Documentation","link":"https://cloud.google.com/storage/docs/json_api/v1/buckets/get"}],"examples":[{"code":"bucket.getMetadata(function(err, metadata, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"bucket.getMetadata().then(function(data) {\n var metadata = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"Set the bucket's metadata.
","source":"packages/storage/src/bucket.js#L230","resources":[{"title":"Buckets: patch API Documentation","link":"https://cloud.google.com/storage/docs/json_api/v1/buckets/patch"}],"examples":[{"caption":"Set website metadata field on the bucket.
","code":"var metadata = {\n website: {\n mainPageSuffix: 'http://example.com',\n notFoundPage: 'http://example.com/404.html'\n }\n};\n\nbucket.setMetadata(metadata, function(err, apiResponse) {});"},{"caption":"Enable versioning for your bucket.
","code":"bucket.setMetadata({\n versioning: {\n enabled: true\n }\n}, function(err, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"bucket.setMetadata(metadata).then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[{"name":"metadata","description":"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.
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, READ
or WRITE
); the entity defines who the permission applies to (for example, a specific user or group of users).
The acl
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.
Buckets also have default ACLs 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 storage/bucket#acl.default.
","source":"packages/storage/src/bucket.js#L291","resources":[{"title":"About Access Control Lists","link":"http://goo.gl/6qBBPO"},{"title":"Default ACLs","link":"https://cloud.google.com/storage/docs/access-control/lists#default"}],"examples":[{"caption":"Make a bucket's contents publicly readable.
","code":"var myBucket = gcs.bucket('my-bucket');\n\nvar options = {\n entity: 'allUsers',\n role: gcs.acl.READER_ROLE\n};\n\nmyBucket.acl.add(options, function(err, aclObject) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"myBucket.acl.add(options).then(function(data) {\n var aclObject = data[0];\n var apiResponse = data[1];\n});"}],"params":[],"exceptions":[],"returns":[]},{"id":"acl.default","name":"acl.default","type":"instance","description":"Cloud Storage Buckets have default ACLs 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 default
.
Combine multiple files into one new file.
","source":"packages/storage/src/bucket.js#L354","resources":[{"title":"Objects: compose API Documentation","link":"https://cloud.google.com/storage/docs/json_api/v1/objects/compose"}],"examples":[{"code":"var logBucket = gcs.bucket('log-bucket');\n\nvar sources = [\n logBucket.file('2013-logs.txt'),\n logBucket.file('2014-logs.txt')\n];\n\nvar allLogs = logBucket.file('all-logs.txt');\n\nlogBucket.combine(sources, allLogs, function(err, newFile, apiResponse) {\n // newFile === allLogs\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"logBucket.combine(sources, allLogs).then(function(data) {\n var newFile = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"sources","description":"if a non-array is provided as sources argument.
"},{"type":"Error","description":"if less than two sources are provided.
"},{"type":"Error","description":"if no destination is provided.
"},{"type":"Error","description":"if content type can't be determined for the destination file.
"}],"returns":[]},{"id":"createChannel","name":"createChannel","type":"instance","description":"Create a channel that will be notified when objects in this bucket changes.
","source":"packages/storage/src/bucket.js#L458","resources":[{"title":"Objects: watchAll API Documentation","link":"https://cloud.google.com/storage/docs/json_api/v1/objects/watchAll"}],"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});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"bucket.createChannel(id, config).then(function(data) {\n var channel = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"id","description":"If an ID is not provided.
"},{"type":"Error","description":"If an address is not provided.
"}],"returns":[]},{"id":"deleteFiles","name":"deleteFiles","type":"instance","description":"Iterate over the bucket's files, calling file.delete()
on each.
This is not an atomic request. 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.
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 { force: true }
to suppress the errors until all files have had a chance to be processed.
The query
object passed as the first argument will also be passed to storage/bucket#getFiles.
Delete all of the files in the bucket.
","code":"bucket.deleteFiles(function(err) {});"},{"caption":"By default, if a file cannot be deleted, this method will stop deleting \nfiles from your bucket. You can override this setting with force: true
.
The first argument to this method acts as a query to \nstorage/bucket#getFiles. As an example, you can delete files \nwhich match a prefix.
","code":"bucket.deleteFiles({\n prefix: 'images/'\n}, function(err) {\n if (!err) {\n // All files in the `images` directory have been deleted.\n }\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"bucket.deleteFiles().then(function() {});"}],"params":[{"name":"query","description":"Create a File object. See storage/file to see how to handle the different use cases you may have.
","source":"packages/storage/src/bucket.js#L612","resources":[],"examples":[{"code":"var file = bucket.file('my-existing-file.png');"}],"params":[{"name":"name","description":"Get File objects for the files currently in the bucket.
","source":"packages/storage/src/bucket.js#L694","resources":[{"title":"Objects: list API Documentation","link":"https://cloud.google.com/storage/docs/json_api/v1/objects/list"}],"examples":[{"code":"bucket.getFiles(function(err, files) {\n if (!err) {\n // files is an array of File objects.\n }\n});"},{"caption":"If your bucket has versioning enabled, you can get all of your files \nscoped to their generation.
","code":"bucket.getFiles({\n versions: true\n}, function(err, files) {\n // Each file is scoped to its generation.\n});"},{"caption":"To control how many API requests are made and page through the results \nmanually, set autoPaginate
to false
.
If the callback is omitted, we'll return a Promise.
","code":"bucket.getFiles().then(function(data) {\n var files = data[0];\n});"}],"params":[{"name":"query","description":"apiResponse.prefixes
. Duplicate prefixes are omitted.Get storage/file objects for the files currently in the bucket as a readable object stream.
","source":"packages/storage/src/bucket.js#L762","resources":[],"examples":[{"code":"bucket.getFilesStream()\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":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"bucket.getFilesStream()\n .on('data', function(file) {\n this.end();\n });"}],"params":[{"name":"query","description":"Make the bucket listing private.
You may also choose to make the contents of the bucket private by specifying includeFiles: true
. This will automatically run storage/file#makePrivate for every file in the bucket.
When specifying includeFiles: true
, use force: true
to delay execution of your callback until all files have been processed. By default, the callback is executed after the first error. Use force
to queue such errors until all files have been processed, after which they will be returned as an array as the first argument to your callback.
NOTE: This may cause the process to be long-running and use a high number of requests. Use with caution.
","source":"packages/storage/src/bucket.js#L836","resources":[{"title":"Buckets: patch API Documentation","link":"https://cloud.google.com/storage/docs/json_api/v1/buckets/patch"}],"examples":[{"caption":"Make the bucket private.
","code":"bucket.makePrivate(function(err) {});"},{"caption":"Make the bucket and its contents private.
","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":"Make the bucket and its contents private, using force to suppress errors \nuntil all files have been processed.
","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});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"bucket.makePrivate(opts).then(function(data) {\n var files = data[0];\n});"}],"params":[{"name":"options","description":"false
.Make the bucket publicly readable.
You may also choose to make the contents of the bucket publicly readable by specifying includeFiles: true
. This will automatically run storage/file#makePublic for every file in the bucket.
When specifying includeFiles: true
, use force: true
to delay execution of your callback until all files have been processed. By default, the callback is executed after the first error. Use force
to queue such errors until all files have been processed, after which they will be returned as an array as the first argument to your callback.
NOTE: This may cause the process to be long-running and use a high number of requests. Use with caution.
","source":"packages/storage/src/bucket.js#L959","resources":[{"title":"Buckets: patch API Documentation","link":"https://cloud.google.com/storage/docs/json_api/v1/buckets/patch"}],"examples":[{"caption":"Make the bucket publicly readable.
","code":"bucket.makePublic(function(err) {});"},{"caption":"Make the bucket and its contents publicly readable.
","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":"Make the bucket and its contents publicly readable, using force to \nsuppress errors until all files have been processed.
","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});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"bucket.makePublic(opts).then(function(data) {\n var files = data[0];\n});"}],"params":[{"name":"options","description":"false
.Upload a file to the bucket. This is a convenience method that wraps storage/file#createWriteStream.
You can specify whether or not an upload is resumable by setting options.resumable
. Resumable uploads are enabled by default if your input file is larger than 5 MB.
For faster crc32c computation, you must manually install fast-crc32c
:
$ npm install --save fast-crc32c
","source":"packages/storage/src/bucket.js#L1169","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"}],"examples":[{"caption":"The easiest way to upload a file.
","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":"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.
","code":"var options = {\n destination: 'new-image.png',\n resumable: true,\n validation: 'crc32c',\n metadata: {\n metadata: {\n event: 'Fall trip to the zoo'\n }\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":"You can also have a file gzip'd on the fly.
","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":"You may also re-use a File object, storage/file, that references \nthe file you wish to create or overwrite.
","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});"},{"caption":"To use \n \nCustomer-supplied Encryption Keys, provide the encryptionKey
option.
If the callback is omitted, we'll return a Promise.
","code":"bucket.upload('local-image.png').then(function(data) {\n var file = data[0];\n});"}],"params":[{"name":"localPath","description":"options.metadata.contentEncoding
to gzip
.Apply a predefined set of access controls to this object.
Acceptable values are:
authenticatedRead
- Object owner gets OWNER
access, and allAuthenticatedUsers
get READER
access.
bucketOwnerFullControl
- Object owner gets OWNER
access, and project team owners get OWNER
access.
bucketOwnerRead
- Object owner gets OWNER
access, and project team owners get READER
access.
private
- Object owner gets OWNER
access.
projectPrivate
- Object owner gets OWNER
access, and project team members get access according to their roles.
publicRead
- Object owner gets OWNER
access, and allUsers
get READER
access.
options.predefinedAcl = 'private'
)options.predefinedAcl = 'publicRead'
)"md5"
, "crc32c"
, or false
. 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 not recommended.An object of convenience methods to add or delete owner ACL permissions for a given entity.
The supported methods include:
myFile.acl.owners.addAllAuthenticatedUsers
myFile.acl.owners.deleteAllAuthenticatedUsers
myFile.acl.owners.addAllUsers
myFile.acl.owners.deleteAllUsers
myFile.acl.owners.addDomain
myFile.acl.owners.deleteDomain
myFile.acl.owners.addGroup
myFile.acl.owners.deleteGroup
myFile.acl.owners.addProject
myFile.acl.owners.deleteProject
myFile.acl.owners.addUser
myFile.acl.owners.deleteUser
Add a user as an owner of a file.
","code":"var myBucket = gcs.bucket('my-bucket');\nvar myFile = myBucket.file('my-file');\nmyFile.acl.owners.addUser('email@example.com', function(err, aclObject) {});"},{"caption":"For reference, the above command is the same as running the following.
","code":"myFile.acl.add({\n entity: 'user-email@example.com',\n role: gcs.acl.OWNER_ROLE\n}, function(err, aclObject) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"myFile.acl.owners.addUser('email@example.com').then(function(data) {\n var aclObject = data[0];\n var apiResponse = data[1];\n});"}],"params":[],"exceptions":[],"returns":[{"types":["object"],"description":""}]},{"id":"acl.readers","name":"acl.readers","type":"instance","description":"An object of convenience methods to add or delete reader ACL permissions for a given entity.
The supported methods include:
myFile.acl.readers.addAllAuthenticatedUsers
myFile.acl.readers.deleteAllAuthenticatedUsers
myFile.acl.readers.addAllUsers
myFile.acl.readers.deleteAllUsers
myFile.acl.readers.addDomain
myFile.acl.readers.deleteDomain
myFile.acl.readers.addGroup
myFile.acl.readers.deleteGroup
myFile.acl.readers.addProject
myFile.acl.readers.deleteProject
myFile.acl.readers.addUser
myFile.acl.readers.deleteUser
Add a user as a reader of a file.
","code":"myFile.acl.readers.addUser('email@example.com', function(err, aclObject) {});"},{"caption":"For reference, the above command is the same as running the following.
","code":"myFile.acl.add({\n entity: 'user-email@example.com',\n role: gcs.acl.READER_ROLE\n}, function(err, aclObject) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"myFile.acl.readers.addUser('email@example.com').then(function(data) {\n var aclObject = data[0];\n var apiResponse = data[1];\n});"}],"params":[],"exceptions":[],"returns":[{"types":["object"],"description":""}]},{"id":"acl.writers","name":"acl.writers","type":"instance","description":"An object of convenience methods to add or delete writer ACL permissions for a given entity.
The supported methods include:
myFile.acl.writers.addAllAuthenticatedUsers
myFile.acl.writers.deleteAllAuthenticatedUsers
myFile.acl.writers.addAllUsers
myFile.acl.writers.deleteAllUsers
myFile.acl.writers.addDomain
myFile.acl.writers.deleteDomain
myFile.acl.writers.addGroup
myFile.acl.writers.deleteGroup
myFile.acl.writers.addProject
myFile.acl.writers.deleteProject
myFile.acl.writers.addUser
myFile.acl.writers.deleteUser
Add a user as a writer of a file.
","code":"myFile.acl.writers.addUser('email@example.com', function(err, aclObject) {});"},{"caption":"For reference, the above command is the same as running the following.
","code":"myFile.acl.add({\n entity: 'user-email@example.com',\n role: gcs.acl.WRITER_ROLE\n}, function(err, aclObject) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"myFile.acl.writers.addUser('email@example.com').then(function(data) {\n var aclObject = data[0];\n var apiResponse = data[1];\n});"}],"params":[],"exceptions":[],"returns":[{"types":["object"],"description":""}]},{"id":"acl.add","name":"acl.add","type":"instance","description":"Add access controls on a storage/bucket or storage/file.
","source":"packages/storage/src/acl.js#L258","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"}],"examples":[{"code":"var options = {\n entity: 'user-useremail@example.com',\n role: gcs.acl.OWNER_ROLE\n};\n\nmyBucket.acl.add(options, function(err, aclObject, apiResponse) {});"},{"caption":"For file ACL operations, you can also specify a generation
property. \nHere is how you would grant ownership permissions to a user on a specific \nrevision of a file.
If the callback is omitted, we'll return a Promise.
","code":"myBucket.acl.add(options).then(function(data) {\n var aclObject = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"options","description":"Delete access controls on a storage/bucket or storage/file.
","source":"packages/storage/src/acl.js#L319","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"}],"examples":[{"code":"myBucket.acl.delete({\n entity: 'user-useremail@example.com'\n}, function(err, apiResponse) {});"},{"caption":"For file ACL operations, you can also specify a generation
property.
If the callback is omitted, we'll return a Promise.
","code":"myFile.acl.delete().then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[{"name":"options","description":"Get access controls on a storage/bucket or storage/file. If an entity is omitted, you will receive an array of all applicable access controls.
","source":"packages/storage/src/acl.js#L387","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"}],"examples":[{"code":"myBucket.acl.get({\n entity: 'user-useremail@example.com'\n}, function(err, aclObject, apiResponse) {});"},{"caption":"Get all access controls.
","code":"myBucket.acl.get(function(err, aclObjects, apiResponse) {\n // aclObjects = [\n // {\n // entity: 'user-useremail@example.com',\n // role: 'owner'\n // }\n // ]\n});"},{"caption":"For file ACL operations, you can also specify a generation
property.
If the callback is omitted, we'll return a Promise.
","code":"myBucket.acl.get().then(function(data) {\n var aclObject = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"options","description":"Update access controls on a storage/bucket or storage/file.
","source":"packages/storage/src/acl.js#L466","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"}],"examples":[{"code":"var options = {\n entity: 'user-useremail@example.com',\n role: gcs.acl.WRITER_ROLE\n};\n\nmyBucket.acl.update(options, function(err, aclObject, apiResponse) {});"},{"caption":"For file ACL operations, you can also specify a generation
property.
If the callback is omitted, we'll return a Promise.
","code":"myFile.acl.update(options).then(function(data) {\n var aclObject = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"options","description":"An object of convenience methods to add or delete owner ACL permissions for a given entity.
The supported methods include:
myFile.acl.owners.addAllAuthenticatedUsers
myFile.acl.owners.deleteAllAuthenticatedUsers
myFile.acl.owners.addAllUsers
myFile.acl.owners.deleteAllUsers
myFile.acl.owners.addDomain
myFile.acl.owners.deleteDomain
myFile.acl.owners.addGroup
myFile.acl.owners.deleteGroup
myFile.acl.owners.addProject
myFile.acl.owners.deleteProject
myFile.acl.owners.addUser
myFile.acl.owners.deleteUser
Add a user as an owner of a file.
","code":"var myBucket = gcs.bucket('my-bucket');\nvar myFile = myBucket.file('my-file');\nmyFile.acl.owners.addUser('email@example.com', function(err, aclObject) {});"},{"caption":"For reference, the above command is the same as running the following.
","code":"myFile.acl.add({\n entity: 'user-email@example.com',\n role: gcs.acl.OWNER_ROLE\n}, function(err, aclObject) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"myFile.acl.owners.addUser('email@example.com').then(function(data) {\n var aclObject = data[0];\n var apiResponse = data[1];\n});"}],"params":[],"exceptions":[],"returns":[{"types":["object"],"description":""}]},{"id":"acl.default.readers","name":"acl.default.readers","type":"instance","description":"An object of convenience methods to add or delete reader ACL permissions for a given entity.
The supported methods include:
myFile.acl.readers.addAllAuthenticatedUsers
myFile.acl.readers.deleteAllAuthenticatedUsers
myFile.acl.readers.addAllUsers
myFile.acl.readers.deleteAllUsers
myFile.acl.readers.addDomain
myFile.acl.readers.deleteDomain
myFile.acl.readers.addGroup
myFile.acl.readers.deleteGroup
myFile.acl.readers.addProject
myFile.acl.readers.deleteProject
myFile.acl.readers.addUser
myFile.acl.readers.deleteUser
Add a user as a reader of a file.
","code":"myFile.acl.readers.addUser('email@example.com', function(err, aclObject) {});"},{"caption":"For reference, the above command is the same as running the following.
","code":"myFile.acl.add({\n entity: 'user-email@example.com',\n role: gcs.acl.READER_ROLE\n}, function(err, aclObject) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"myFile.acl.readers.addUser('email@example.com').then(function(data) {\n var aclObject = data[0];\n var apiResponse = data[1];\n});"}],"params":[],"exceptions":[],"returns":[{"types":["object"],"description":""}]},{"id":"acl.default.writers","name":"acl.default.writers","type":"instance","description":"An object of convenience methods to add or delete writer ACL permissions for a given entity.
The supported methods include:
myFile.acl.writers.addAllAuthenticatedUsers
myFile.acl.writers.deleteAllAuthenticatedUsers
myFile.acl.writers.addAllUsers
myFile.acl.writers.deleteAllUsers
myFile.acl.writers.addDomain
myFile.acl.writers.deleteDomain
myFile.acl.writers.addGroup
myFile.acl.writers.deleteGroup
myFile.acl.writers.addProject
myFile.acl.writers.deleteProject
myFile.acl.writers.addUser
myFile.acl.writers.deleteUser
Add a user as a writer of a file.
","code":"myFile.acl.writers.addUser('email@example.com', function(err, aclObject) {});"},{"caption":"For reference, the above command is the same as running the following.
","code":"myFile.acl.add({\n entity: 'user-email@example.com',\n role: gcs.acl.WRITER_ROLE\n}, function(err, aclObject) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"myFile.acl.writers.addUser('email@example.com').then(function(data) {\n var aclObject = data[0];\n var apiResponse = data[1];\n});"}],"params":[],"exceptions":[],"returns":[{"types":["object"],"description":""}]},{"id":"acl.default.add","name":"acl.default.add","type":"instance","description":"Add access controls on a storage/bucket or storage/file.
","source":"packages/storage/src/acl.js#L258","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"}],"examples":[{"code":"var options = {\n entity: 'user-useremail@example.com',\n role: gcs.acl.OWNER_ROLE\n};\n\nmyBucket.acl.add(options, function(err, aclObject, apiResponse) {});"},{"caption":"For file ACL operations, you can also specify a generation
property. \nHere is how you would grant ownership permissions to a user on a specific \nrevision of a file.
If the callback is omitted, we'll return a Promise.
","code":"myBucket.acl.add(options).then(function(data) {\n var aclObject = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"options","description":"Delete access controls on a storage/bucket or storage/file.
","source":"packages/storage/src/acl.js#L319","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"}],"examples":[{"code":"myBucket.acl.delete({\n entity: 'user-useremail@example.com'\n}, function(err, apiResponse) {});"},{"caption":"For file ACL operations, you can also specify a generation
property.
If the callback is omitted, we'll return a Promise.
","code":"myFile.acl.delete().then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[{"name":"options","description":"Get access controls on a storage/bucket or storage/file. If an entity is omitted, you will receive an array of all applicable access controls.
","source":"packages/storage/src/acl.js#L387","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"}],"examples":[{"code":"myBucket.acl.get({\n entity: 'user-useremail@example.com'\n}, function(err, aclObject, apiResponse) {});"},{"caption":"Get all access controls.
","code":"myBucket.acl.get(function(err, aclObjects, apiResponse) {\n // aclObjects = [\n // {\n // entity: 'user-useremail@example.com',\n // role: 'owner'\n // }\n // ]\n});"},{"caption":"For file ACL operations, you can also specify a generation
property.
If the callback is omitted, we'll return a Promise.
","code":"myBucket.acl.get().then(function(data) {\n var aclObject = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"options","description":"Update access controls on a storage/bucket or storage/file.
","source":"packages/storage/src/acl.js#L466","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"}],"examples":[{"code":"var options = {\n entity: 'user-useremail@example.com',\n role: gcs.acl.WRITER_ROLE\n};\n\nmyBucket.acl.update(options, function(err, aclObject, apiResponse) {});"},{"caption":"For file ACL operations, you can also specify a generation
property.
If the callback is omitted, we'll return a Promise.
","code":"myFile.acl.update(options).then(function(data) {\n var aclObject = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"options","description":"\n This class allows you interact with Cloud Storage.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/storage
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
Create a channel object to interact with a Cloud Storage channel.
","source":"packages/storage/src/channel.js#L44","resources":[{"title":"Object Change Notification","link":"https://cloud.google.com/storage/docs/object-change-notification"}],"examples":[{"code":"var channel = gcs.channel('id', 'resource-id');"}],"params":[{"name":"id","description":"Stop this channel.
","source":"packages/storage/src/channel.js#L87","resources":[],"examples":[{"code":"channel.stop(function(err, apiResponse) {\n if (!err) {\n // Channel stopped successfully.\n }\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"channel.stop().then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[{"name":"callback","description":"\n This class allows you interact with Cloud Storage.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/storage
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
A File object is created from your Bucket object using storage/bucket#file.
","source":"packages/storage/src/file.js#L98","resources":[],"examples":[{"code":"var myBucket = gcs.bucket('my-bucket');\n\nvar file = myBucket.file('my-file');"}],"params":[],"exceptions":[],"returns":[]},{"id":"delete","name":"delete","type":"instance","description":"Delete the file.
","source":"packages/storage/src/file.js#L138","resources":[{"title":"Objects: delete API Documentation","link":"https://cloud.google.com/storage/docs/json_api/v1/objects/delete"}],"examples":[{"code":"file.delete(function(err, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"file.delete().then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[{"name":"callback","description":"Check if the file exists.
","source":"packages/storage/src/file.js#L162","resources":[],"examples":[{"code":"file.exists(function(err, exists) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"file.exists().then(function(data) {\n var exists = data[0];\n});"}],"params":[{"name":"callback","description":"Get a file object and its metadata if it exists.
","source":"packages/storage/src/file.js#L180","resources":[],"examples":[{"code":"file.get(function(err, file, apiResponse) {\n // file.metadata` has been populated.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"file.get().then(function(data) {\n var file = data[0];\n var apiResponse = data[1];\n});"}],"params":[],"exceptions":[],"returns":[]},{"id":"getMetadata","name":"getMetadata","type":"instance","description":"Get the file's metadata.
","source":"packages/storage/src/file.js#L204","resources":[{"title":"Objects: get API Documentation","link":"https://cloud.google.com/storage/docs/json_api/v1/objects/get"}],"examples":[{"code":"file.getMetadata(function(err, metadata, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"file.getMetadata().then(function(data) {\n var metadata = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"callback","description":"Merge the given metadata with the current remote file's metadata. This will set metadata if it was previously unset or update previously set metadata. To unset previously set metadata, set its value to null.
You can set custom key/value pairs in the metadata key of the given object, however the other properties outside of this object must adhere to the official API documentation.
See the examples below for more information.
","source":"packages/storage/src/file.js#L258","resources":[{"title":"Objects: patch API Documentation","link":"https://cloud.google.com/storage/docs/json_api/v1/objects/patch"}],"examples":[{"code":"var metadata = {\n contentType: 'application/x-font-ttf',\n metadata: {\n my: 'custom',\n properties: 'go here'\n }\n};\n\nfile.setMetadata(metadata, function(err, apiResponse) {});\n\n// Assuming current metadata = { hello: 'world', unsetMe: 'will do' }\nfile.setMetadata({\n metadata: {\n abc: '123', // will be set.\n unsetMe: null, // will be unset (deleted).\n hello: 'goodbye' // will be updated from 'hello' to 'goodbye'.\n }\n}, function(err, apiResponse) {\n // metadata should now be { abc: '123', hello: 'goodbye' }\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"file.setMetadata(metadata).then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[{"name":"metadata","description":"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.
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, READ
or WRITE
); the entity defines who the permission applies to (for example, a specific user or group of users).
The acl
object on a File instance provides methods to get you a list of the ACLs defined on your bucket, as well as set, update, and delete them.
Make a file publicly readable.
","code":"var options = {\n entity: 'allUsers',\n role: gcs.acl.READER_ROLE\n};\n\nfile.acl.add(options, function(err, aclObject) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"file.acl.add(options).then(function(data) {\n var aclObject = data[0];\n var apiResponse = data[1];\n});"}],"params":[],"exceptions":[],"returns":[]},{"id":"copy","name":"copy","type":"instance","description":"Copy this file to another file. By default, this will copy the file to the same bucket, but you can choose to copy it to another Bucket by providing a Bucket or File object or a URL starting with "gs://".
","source":"packages/storage/src/file.js#L424","resources":[{"title":"Objects: copy API Documentation","link":"https://cloud.google.com/storage/docs/json_api/v1/objects/copy"}],"examples":[{"caption":"You can pass in a variety of types for the destination. \nFor all of the below examples, assume we are working with the following \nBucket and File objects.
","code":"var bucket = gcs.bucket('my-bucket');\nvar file = bucket.file('my-image.png');"},{"caption":"If you pass in a string for the destination, the file is copied to its \ncurrent bucket, under the new name provided.
","code":"file.copy('my-image-copy.png', function(err, copiedFile, apiResponse) {\n // `my-bucket` now contains:\n // - \"my-image.png\"\n // - \"my-image-copy.png\"\n\n // `copiedFile` is an instance of a File object that refers to your new\n // file.\n});"},{"caption":"If you pass in a string starting with \"gs:\n\" for the destination, the \nfile is copied to the other bucket and under the new name provided.
","code":"var newLocation = 'gs://another-bucket/my-image-copy.png';\nfile.copy(newLocation, function(err, copiedFile, apiResponse) {\n // `my-bucket` still contains:\n // - \"my-image.png\"\n //\n // `another-bucket` now contains:\n // - \"my-image-copy.png\"\n\n // `copiedFile` is an instance of a File object that refers to your new\n // file.\n});"},{"caption":"If you pass in a Bucket object, the file will be copied to that bucket \nusing the same name.
","code":"var anotherBucket = gcs.bucket('another-bucket');\nfile.copy(anotherBucket, function(err, copiedFile, apiResponse) {\n // `my-bucket` still contains:\n // - \"my-image.png\"\n //\n // `another-bucket` now contains:\n // - \"my-image.png\"\n\n // `copiedFile` is an instance of a File object that refers to your new\n // file.\n});"},{"caption":"If you pass in a File object, you have complete control over the new \nbucket and filename.
","code":"var anotherFile = anotherBucket.file('my-awesome-image.png');\nfile.copy(anotherFile, function(err, copiedFile, apiResponse) {\n // `my-bucket` still contains:\n // - \"my-image.png\"\n //\n // `another-bucket` now contains:\n // - \"my-awesome-image.png\"\n\n // Note:\n // The `copiedFile` parameter is equal to `anotherFile`.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"file.copy(newLocation).then(function(data) {\n var newFile = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"destination","description":"If the destination file is not provided.
"}],"returns":[]},{"id":"createReadStream","name":"createReadStream","type":"instance","description":"Create a readable stream to read the contents of the remote file. It can be piped to a writable stream or listened to for 'data' events to read a file's contents.
In the unlikely event there is a mismatch between what you downloaded and the version in your Bucket, your error handler will receive an error with code "CONTENT_DOWNLOAD_MISMATCH". If you receive this error, the best recourse is to try downloading the file again.
For faster crc32c computation, you must manually install fast-crc32c
:
$ npm install --save fast-crc32c
NOTE: Readable streams will emit the end
event when the file is fully downloaded.
To limit the downloaded data to only a byte range, pass an options object.
","code":"var logFile = myBucket.file('access_log');\nlogFile.createReadStream({\n start: 10000,\n end: 20000\n })\n .on('error', function(err) {})\n .pipe(fs.createWriteStream('/Users/stephen/logfile.txt'));"},{"caption":"To read a tail byte range, specify only options.end
as a negative \nnumber.
"md5"
, "crc32c"
, or false
. By default, data integrity is validated with a CRC32c checksum. You may use MD5 if preferred, but that hash is not supported for composite objects. An error will be raised if MD5 is specified but is not available. You may also choose to skip validation completely, however this is not recommended.options.start = 0
and options.end = 999
represent the first 1000 bytes in a file or object. NOTE: when specifying a byte range, data integrity is not available.options.start = 0
and options.end = 999
represent the first 1000 bytes in a file or object. NOTE: when specifying a byte range, data integrity is not available.Create a unique resumable upload session URI. This is the first step when performing a resumable upload.
See the Resumable upload guide for more on how the entire process works.
If you are just looking to perform a resumable upload without worrying about any of the details, see storage/createWriteStream. Resumable uploads are performed by default.
","source":"packages/storage/src/file.js#L803","resources":[{"title":"Resumable upload guide","link":"https://cloud.google.com/storage/docs/json_api/v1/how-tos/resumable-upload"}],"examples":[{"code":"file.createResumableUpload(function(err, uri) {\n if (!err) {\n // `uri` can be used to PUT data to.\n }\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"file.createResumableUpload().then(function(data) {\n var uri = data[0];\n});"}],"params":[{"name":"options","description":"Apply a predefined set of access controls to this object.
Acceptable values are:
authenticatedRead
- Object owner gets OWNER
access, and allAuthenticatedUsers
get READER
access.
bucketOwnerFullControl
- Object owner gets OWNER
access, and project team owners get OWNER
access.
bucketOwnerRead
- Object owner gets OWNER
access, and project team owners get READER
access.
private
- Object owner gets OWNER
access.
projectPrivate
- Object owner gets OWNER
access, and project team members get access according to their roles.
publicRead
- Object owner gets OWNER
access, and allUsers
get READER
access.
options.predefinedAcl = 'private'
)options.predefinedAcl = 'publicRead'
)Create a writable stream to overwrite the contents of the file in your bucket.
A File object can also be used to create files for the first time.
Resumable uploads are automatically enabled and must be shut off explicitly by setting options.resumable
to false
.
There is some overhead when using a resumable upload that can cause noticeable performance degradation while uploading a series of small files. When uploading files less than 10MB, it is recommended that the resumable feature is disabled.
For faster crc32c computation, you must manually install fast-crc32c
:
$ npm install --save fast-crc32c
NOTE: Writable streams will emit the finish
event when the file is fully uploaded.
Downloading the file with createReadStream
will automatically decode the \nfile.
options.metadata.contentEncoding
to gzip
.Apply a predefined set of access controls to this object.
Acceptable values are:
authenticatedRead
- Object owner gets OWNER
access, and allAuthenticatedUsers
get READER
access.
bucketOwnerFullControl
- Object owner gets OWNER
access, and project team owners get OWNER
access.
bucketOwnerRead
- Object owner gets OWNER
access, and project team owners get READER
access.
private
- Object owner gets OWNER
access.
projectPrivate
- Object owner gets OWNER
access, and project team members get access according to their roles.
publicRead
- Object owner gets OWNER
access, and allUsers
get READER
access.
options.predefinedAcl = 'private'
)options.predefinedAcl = 'publicRead'
)"md5"
, "crc32c"
, or false
. By default, data integrity is validated with a CRC32c checksum. You may use MD5 if preferred, but that hash is not supported for composite objects. An error will be raised if MD5 is specified but is not available. You may also choose to skip validation completely, however this is not recommended.Convenience method to download a file into memory or to a local destination.
","source":"packages/storage/src/file.js#L1106","resources":[],"examples":[{"caption":"Download a file into memory. The contents will be available as the second \nargument in the demonstration below, contents
.
Download a file to a local destination.
","code":"file.download({\n destination: '/Users/me/Desktop/file-backup.txt'\n}, function(err) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"file.download().then(function(data) {\n var contents = data[0];\n});"}],"params":[{"name":"options","description":"The Storage API allows you to use a custom key for server-side encryption.
","source":"packages/storage/src/file.js#L1163","resources":[{"title":"Customer-supplied Encryption Keys","link":"https://cloud.google.com/storage/docs/encryption#customer-supplied"}],"examples":[{"code":"var crypto = require('crypto');\nvar encryptionKey = crypto.randomBytes(32);\n\nvar fileWithCustomEncryption = myBucket.file('my-file');\nfileWithCustomEncryption.setEncryptionKey(encryptionKey);\n\nvar fileWithoutCustomEncryption = myBucket.file('my-file');\n\nfileWithCustomEncryption.save('data', function(err) {\n // Try to download with the File object that hasn't had\n // `setEncryptionKey()` called:\n fileWithoutCustomEncryption.download(function(err) {\n // We will receive an error:\n // err.message === 'Bad Request'\n\n // Try again with the File object we called `setEncryptionKey()` on:\n fileWithCustomEncryption.download(function(err, contents) {\n // contents.toString() === 'data'\n });\n });\n});"}],"params":[{"name":"encryptionKey","description":"Get a signed policy document to allow a user to upload data with a POST request.
","source":"packages/storage/src/file.js#L1247","resources":[{"title":"Policy Document Reference","link":"https://cloud.google.com/storage/docs/xml-api/post-object#policydocument"}],"examples":[{"code":"var options = {\n equals: ['$Content-Type', 'image/jpeg'],\n expires: '10-25-2022',\n contentLengthRange: {\n min: 0,\n max: 1024\n }\n};\n\nfile.getSignedPolicy(options, function(err, policy) {\n // policy.string: the policy document in plain text.\n // policy.base64: the policy document in base64.\n // policy.signature: the policy signature in base64.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"file.getSignedPolicy(options).then(function(data) {\n var policy = data[0];\n});"}],"params":[{"name":"options","description":"new Date()
.If an expiration timestamp from the past is given.
"},{"type":"Error","description":"If options.equals has an array with less or more than two members.
"},{"type":"Error","description":"If options.startsWith has an array with less or more than two members.
"}],"returns":[]},{"id":"getSignedUrl","name":"getSignedUrl","type":"instance","description":"Get a signed URL to allow limited time access to the file.
","source":"packages/storage/src/file.js#L1440","resources":[{"title":"Signed URLs Reference","link":"https://cloud.google.com/storage/docs/access-control/signed-urls"}],"examples":[{"caption":"Generate a URL that allows temporary access to download your file.
","code":"var request = require('request');\n\nvar config = {\n action: 'read',\n expires: '03-17-2025'\n};\n\nfile.getSignedUrl(config, function(err, url) {\n if (err) {\n console.error(err);\n return;\n }\n\n // The file is now available to read from this URL.\n request(url, function(err, resp) {\n // resp.statusCode = 200\n });\n});"},{"caption":"Generate a URL to allow write permissions. This means anyone with this URL \ncan send a POST request with new data that will overwrite the file.
","code":"file.getSignedUrl({\n action: 'write',\n expires: '03-17-2025'\n}, function(err, url) {\n if (err) {\n console.error(err);\n return;\n }\n\n // The file is now available to be written to.\n var writeStream = request.put(url);\n writeStream.end('New data');\n\n writeStream.on('complete', function(resp) {\n // Confirm the new content was saved.\n file.download(function(err, fileContents) {\n console.log('Contents:', fileContents.toString());\n // Contents: New data\n });\n });\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"file.getSignedUrl(config).then(function(data) {\n var url = data[0];\n});"}],"params":[{"name":"config","description":"new Date()
.config.responseDisposition
is set.if an expiration timestamp from the past is given.
"}],"returns":[]},{"id":"makePrivate","name":"makePrivate","type":"instance","description":"Make a file private to the project and remove all other permissions. Set options.strict
to true to make the file private to only the owner.
Set the file private so only project maintainers can see and modify it.
","code":"file.makePrivate(function(err) {});"},{"caption":"Set the file private so only the owner can see and modify it.
","code":"file.makePrivate({ strict: true }, function(err) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"file.makePrivate().then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[{"name":"options","description":"Set a file to be publicly readable and maintain all previous permissions.
","source":"packages/storage/src/file.js#L1618","resources":[{"title":"ObjectAccessControls: insert API Documentation","link":"https://cloud.google.com/storage/docs/json_api/v1/objectAccessControls/insert"}],"examples":[{"code":"file.makePublic(function(err, apiResponse) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"file.makePublic().then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[{"name":"callback","description":"Move this file to another location. By default, this will move the file to the same bucket, but you can choose to move it to another Bucket by providing a Bucket or File object or a URL beginning with "gs://".
Warning: There is currently no atomic move
method in the Cloud Storage API, so this method is a composition of storage/file#copy (to the new location) and storage/file#delete (from the old location). While unlikely, it is possible that an error returned to your callback could be triggered from either one of these API calls failing, which could leave a duplicate file lingering.
You can pass in a variety of types for the destination. \nFor all of the below examples, assume we are working with the following \nBucket and File objects.
","code":"var bucket = gcs.bucket('my-bucket');\nvar file = bucket.file('my-image.png');"},{"caption":"If you pass in a string for the destination, the file is moved to its \ncurrent bucket, under the new name provided.
","code":"file.move('my-image-new.png', function(err, destinationFile, apiResponse) {\n // `my-bucket` no longer contains:\n // - \"my-image.png\"\n // but contains instead:\n // - \"my-image-new.png\"\n\n // `destinationFile` is an instance of a File object that refers to your\n // new file.\n});"},{"caption":"If you pass in a string starting with \"gs:\n\" for the destination, the \nfile is copied to the other bucket and under the new name provided.
","code":"var newLocation = 'gs://another-bucket/my-image-new.png';\nfile.move(newLocation, function(err, destinationFile, apiResponse) {\n // `my-bucket` no longer contains:\n // - \"my-image.png\"\n //\n // `another-bucket` now contains:\n // - \"my-image-new.png\"\n\n // `destinationFile` is an instance of a File object that refers to your\n // new file.\n});"},{"caption":"If you pass in a Bucket object, the file will be moved to that bucket \nusing the same name.
","code":"var anotherBucket = gcs.bucket('another-bucket');\n\nfile.move(anotherBucket, function(err, destinationFile, apiResponse) {\n // `my-bucket` no longer contains:\n // - \"my-image.png\"\n //\n // `another-bucket` now contains:\n // - \"my-image.png\"\n\n // `destinationFile` is an instance of a File object that refers to your\n // new file.\n});"},{"caption":"If you pass in a File object, you have complete control over the new \nbucket and filename.
","code":"var anotherFile = anotherBucket.file('my-awesome-image.png');\n\nfile.move(anotherFile, function(err, destinationFile, apiResponse) {\n // `my-bucket` no longer contains:\n // - \"my-image.png\"\n //\n // `another-bucket` now contains:\n // - \"my-awesome-image.png\"\n\n // Note:\n // The `destinationFile` parameter is equal to `anotherFile`.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"file.move('my-image-new.png').then(function(data) {\n var destinationFile = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"destination","description":"If the destination file is not provided.
"}],"returns":[]},{"id":"save","name":"save","type":"instance","description":"Write arbitrary data to a file.
This is a convenience method which wraps storage/file#createWriteStream.
","source":"packages/storage/src/file.js#L1785","resources":[],"examples":[{"code":"var contents = 'This is the contents of the file.';\n\nfile.save(contents, function(err) {\n if (!err) {\n // File written successfully.\n }\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"file.save(contents).then(function() {});"}],"params":[{"name":"data","description":"options
parameter.Set the storage class for this file.
","source":"packages/storage/src/file.js#L1822","resources":[{"title":"Per-Object Storage Class","link":"https://cloud.google.com/storage/docs/per-object-storage-class"},{"title":"Storage Classes","link":"https://cloud.google.com/storage/docs/storage-classes"}],"examples":[{"code":"file.setStorageClass('regional', function(err, apiResponse) {\n if (err) {\n // Error handling omitted.\n }\n\n // The storage class was updated successfully.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"file.setStorageClass('regional').then(function() {});"}],"params":[{"name":"storageClass","description":"multi_regional
, regional
, nearline
, coldline
)An object of convenience methods to add or delete owner ACL permissions for a given entity.
The supported methods include:
myFile.acl.owners.addAllAuthenticatedUsers
myFile.acl.owners.deleteAllAuthenticatedUsers
myFile.acl.owners.addAllUsers
myFile.acl.owners.deleteAllUsers
myFile.acl.owners.addDomain
myFile.acl.owners.deleteDomain
myFile.acl.owners.addGroup
myFile.acl.owners.deleteGroup
myFile.acl.owners.addProject
myFile.acl.owners.deleteProject
myFile.acl.owners.addUser
myFile.acl.owners.deleteUser
Add a user as an owner of a file.
","code":"var myBucket = gcs.bucket('my-bucket');\nvar myFile = myBucket.file('my-file');\nmyFile.acl.owners.addUser('email@example.com', function(err, aclObject) {});"},{"caption":"For reference, the above command is the same as running the following.
","code":"myFile.acl.add({\n entity: 'user-email@example.com',\n role: gcs.acl.OWNER_ROLE\n}, function(err, aclObject) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"myFile.acl.owners.addUser('email@example.com').then(function(data) {\n var aclObject = data[0];\n var apiResponse = data[1];\n});"}],"params":[],"exceptions":[],"returns":[{"types":["object"],"description":""}]},{"id":"acl.readers","name":"acl.readers","type":"instance","description":"An object of convenience methods to add or delete reader ACL permissions for a given entity.
The supported methods include:
myFile.acl.readers.addAllAuthenticatedUsers
myFile.acl.readers.deleteAllAuthenticatedUsers
myFile.acl.readers.addAllUsers
myFile.acl.readers.deleteAllUsers
myFile.acl.readers.addDomain
myFile.acl.readers.deleteDomain
myFile.acl.readers.addGroup
myFile.acl.readers.deleteGroup
myFile.acl.readers.addProject
myFile.acl.readers.deleteProject
myFile.acl.readers.addUser
myFile.acl.readers.deleteUser
Add a user as a reader of a file.
","code":"myFile.acl.readers.addUser('email@example.com', function(err, aclObject) {});"},{"caption":"For reference, the above command is the same as running the following.
","code":"myFile.acl.add({\n entity: 'user-email@example.com',\n role: gcs.acl.READER_ROLE\n}, function(err, aclObject) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"myFile.acl.readers.addUser('email@example.com').then(function(data) {\n var aclObject = data[0];\n var apiResponse = data[1];\n});"}],"params":[],"exceptions":[],"returns":[{"types":["object"],"description":""}]},{"id":"acl.writers","name":"acl.writers","type":"instance","description":"An object of convenience methods to add or delete writer ACL permissions for a given entity.
The supported methods include:
myFile.acl.writers.addAllAuthenticatedUsers
myFile.acl.writers.deleteAllAuthenticatedUsers
myFile.acl.writers.addAllUsers
myFile.acl.writers.deleteAllUsers
myFile.acl.writers.addDomain
myFile.acl.writers.deleteDomain
myFile.acl.writers.addGroup
myFile.acl.writers.deleteGroup
myFile.acl.writers.addProject
myFile.acl.writers.deleteProject
myFile.acl.writers.addUser
myFile.acl.writers.deleteUser
Add a user as a writer of a file.
","code":"myFile.acl.writers.addUser('email@example.com', function(err, aclObject) {});"},{"caption":"For reference, the above command is the same as running the following.
","code":"myFile.acl.add({\n entity: 'user-email@example.com',\n role: gcs.acl.WRITER_ROLE\n}, function(err, aclObject) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"myFile.acl.writers.addUser('email@example.com').then(function(data) {\n var aclObject = data[0];\n var apiResponse = data[1];\n});"}],"params":[],"exceptions":[],"returns":[{"types":["object"],"description":""}]},{"id":"acl.add","name":"acl.add","type":"instance","description":"Add access controls on a storage/bucket or storage/file.
","source":"packages/storage/src/acl.js#L258","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"}],"examples":[{"code":"var options = {\n entity: 'user-useremail@example.com',\n role: gcs.acl.OWNER_ROLE\n};\n\nmyBucket.acl.add(options, function(err, aclObject, apiResponse) {});"},{"caption":"For file ACL operations, you can also specify a generation
property. \nHere is how you would grant ownership permissions to a user on a specific \nrevision of a file.
If the callback is omitted, we'll return a Promise.
","code":"myBucket.acl.add(options).then(function(data) {\n var aclObject = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"options","description":"Delete access controls on a storage/bucket or storage/file.
","source":"packages/storage/src/acl.js#L319","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"}],"examples":[{"code":"myBucket.acl.delete({\n entity: 'user-useremail@example.com'\n}, function(err, apiResponse) {});"},{"caption":"For file ACL operations, you can also specify a generation
property.
If the callback is omitted, we'll return a Promise.
","code":"myFile.acl.delete().then(function(data) {\n var apiResponse = data[0];\n});"}],"params":[{"name":"options","description":"Get access controls on a storage/bucket or storage/file. If an entity is omitted, you will receive an array of all applicable access controls.
","source":"packages/storage/src/acl.js#L387","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"}],"examples":[{"code":"myBucket.acl.get({\n entity: 'user-useremail@example.com'\n}, function(err, aclObject, apiResponse) {});"},{"caption":"Get all access controls.
","code":"myBucket.acl.get(function(err, aclObjects, apiResponse) {\n // aclObjects = [\n // {\n // entity: 'user-useremail@example.com',\n // role: 'owner'\n // }\n // ]\n});"},{"caption":"For file ACL operations, you can also specify a generation
property.
If the callback is omitted, we'll return a Promise.
","code":"myBucket.acl.get().then(function(data) {\n var aclObject = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"options","description":"Update access controls on a storage/bucket or storage/file.
","source":"packages/storage/src/acl.js#L466","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"}],"examples":[{"code":"var options = {\n entity: 'user-useremail@example.com',\n role: gcs.acl.WRITER_ROLE\n};\n\nmyBucket.acl.update(options, function(err, aclObject, apiResponse) {});"},{"caption":"For file ACL operations, you can also specify a generation
property.
If the callback is omitted, we'll return a Promise.
","code":"myFile.acl.update(options).then(function(data) {\n var aclObject = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"options","description":"\n This class allows you interact with Cloud Storage.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/storage
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
To learn more about ACLs, read this overview on Access Control.
","source":"packages/storage/src/index.js#L72","resources":[{"title":"Cloud Storage overview","link":"https://cloud.google.com/storage/docs/overview"},{"title":"Access Control","link":"https://cloud.google.com/storage/docs/access-control"}],"examples":[],"params":[{"name":"options","description":" ","types":["object"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]},{"id":"acl","name":"acl","type":"instance","description":"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.
This object provides constants to refer to the three permission levels that can be granted to an entity:
gcs.acl.OWNER_ROLE
- ("OWNER")gcs.acl.READER_ROLE
- ("READER")gcs.acl.WRITER_ROLE
- ("WRITER")Make all of the files currently in a bucket publicly readable.
","code":"var options = {\n entity: 'allUsers',\n role: gcs.acl.READER_ROLE\n};\n\nalbums.acl.add(options, function(err, aclObject) {});"},{"caption":"Make any new objects added to a bucket publicly readable.
","code":"albums.acl.default.add(options, function(err, aclObject) {});"},{"caption":"Grant a user ownership permissions to a bucket.
","code":"albums.acl.add({\n entity: 'user-useremail@example.com',\n role: gcs.acl.OWNER_ROLE\n}, function(err, aclObject) {});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"albums.acl.add(options).then(function(data) {\n var aclObject = data[0];\n var apiResponse = data[1];\n});"}],"params":[],"exceptions":[],"returns":[]},{"id":"bucket","name":"bucket","type":"instance","description":"Get a reference to a Cloud Storage bucket.
","source":"packages/storage/src/index.js#L160","resources":[],"examples":[{"code":"var albums = gcs.bucket('albums');\nvar photos = gcs.bucket('photos');"}],"params":[{"name":"name","description":"Reference a channel to receive notifications about changes to your bucket.
","source":"packages/storage/src/index.js#L178","resources":[],"examples":[{"code":"var channel = gcs.channel('id', 'resource-id');"}],"params":[{"name":"id","description":"Create a bucket.
Cloud Storage uses a flat namespace, so you can't create a bucket with a name that is already in use. For more information, see Bucket Naming Guidelines.
","source":"packages/storage/src/index.js#L247","resources":[{"title":"Buckets: insert API Documentation","link":"https://cloud.google.com/storage/docs/json_api/v1/buckets/insert"},{"title":"Storage Classes","link":"https://cloud.google.com/storage/docs/storage-classes"}],"examples":[{"code":"var callback = function(err, bucket, apiResponse) {\n // `bucket` is a Bucket object.\n};\n\ngcs.createBucket('new-bucket', callback);"},{"caption":"Create a bucket in a specific location and region. See the \nOfficial JSON API docs for complete details on the location
option. \n
Enable versioning on a new bucket.
","code":"var metadata = {\n versioning: {\n enabled: true\n }\n};\n\ngcs.createBucket('new-bucket', metadata, callback);"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"gcs.createBucket('new-bucket').then(function(data) {\n var bucket = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"name","description":"If a name is not provided.
"}],"returns":[]},{"id":"getBuckets","name":"getBuckets","type":"instance","description":"Get Bucket objects for all of the buckets in your project.
","source":"packages/storage/src/index.js#L354","resources":[{"title":"Buckets: list API Documentation","link":"https://cloud.google.com/storage/docs/json_api/v1/buckets/list"}],"examples":[{"code":"gcs.getBuckets(function(err, buckets) {\n if (!err) {\n // buckets is an array of Bucket objects.\n }\n});"},{"caption":"To control how many API requests are made and page through the results \nmanually, set autoPaginate
to false
.
If the callback is omitted, we'll return a Promise.
","code":"gcs.getBuckets().then(function(data) {\n var buckets = data[0];\n});"}],"params":[{"name":"query","description":"Get storage/bucket objects for all of the buckets in your project as a readable object stream.
","source":"packages/storage/src/index.js#L415","resources":[],"examples":[{"code":"gcs.getBucketsStream()\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 });"},{"caption":"If you anticipate many results, you can end a stream early to prevent \nunnecessary processing and API requests.
","code":"gcs.getBucketsStream()\n .on('data', function(bucket) {\n this.end();\n });"}],"params":[{"name":"query","description":"\n This class allows you interact with Cloud Translation API.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/translate
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
With Google Translate, you can dynamically translate text between thousands of language pairs.
The Google Translate API lets websites and programs integrate with Google Translate programmatically.
","source":"packages/translate/src/index.js#L57","resources":[{"title":"Getting Started","link":"https://cloud.google.com/translate/v2/getting_started"},{"title":"Identifying your application to Google","link":"https://cloud.google.com/translate/v2/using_rest#auth"}],"examples":[{"caption":"GOOGLE_CLOUD_TRANSLATE_ENDPOINT
, is honored as \na custom backend which our library will send requests to."}],"params":[{"name":"options","description":" ","types":["object"],"optional":false,"nullable":false},{"name":"options.key","description":"Detect the language used in a string or multiple strings.
","source":"packages/translate/src/index.js#L153","resources":[{"title":"Detect Language","link":"https://cloud.google.com/translate/v2/using_rest#detect-language"}],"examples":[{"caption":"Detect the language from a single string input.
","code":"translate.detect('Hello', function(err, results) {\n if (!err) {\n // results = {\n // language: 'en',\n // confidence: 1,\n // input: 'Hello'\n // }\n }\n});"},{"caption":"Detect the languages used in multiple strings. Note that the results are \nnow provied as an array.
","code":"translate.detect([\n 'Hello',\n 'Hola'\n], function(err, results) {\n if (!err) {\n // results = [\n // {\n // language: 'en',\n // confidence: 1,\n // input: 'Hello'\n // },\n // {\n // language: 'es',\n // confidence: 1,\n // input: 'Hola'\n // }\n // ]\n }\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"translate.detect('Hello').then(function(data) {\n var results = data[0];\n var apiResponse = data[2];\n});"}],"params":[{"name":"input","description":"Get an array of all supported languages.
","source":"packages/translate/src/index.js#L256","resources":[{"title":"Discovering Supported Languages","link":"https://cloud.google.com/translate/v2/discovering-supported-languages-with-rest"}],"examples":[{"code":"translate.getLanguages(function(err, languages) {\n if (!err) {\n // languages = [\n // {\n // code: 'af',\n // name: 'Afrikaans'\n // },\n // {\n // code: 'ar',\n // name: 'Arabic'\n // },\n // {\n // code: 'az',\n // name: 'Azerbaijani'\n // },\n // ...\n // ]\n }\n});"},{"caption":"Get the language names in a language other than English.
","code":"translate.getLanguages('es', function(err, languages) {\n if (!err) {\n // languages = [\n // {\n // code: 'af',\n // name: 'afrikáans'\n // },\n // {\n // code: 'ar',\n // name: 'árabe'\n // },\n // {\n // code: 'az',\n // name: 'azerí'\n // },\n // ...\n // ]\n }\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"translate.getLanguages().then(function(data) {\n var languages = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"target","description":"target
option described above.Translate a string or multiple strings into another language.
","source":"packages/translate/src/index.js#L370","resources":[{}],"examples":[{"caption":"Pass a string and a language code to get the translation.
","code":"translate.translate('Hello', 'es', function(err, translation) {\n if (!err) {\n // translation = 'Hola'\n }\n});"},{"caption":"The source language is auto-detected by default. To manually set it, \nprovide an object.
","code":"var options = {\n from: 'en',\n to: 'es'\n};\n\ntranslate.translate('Hello', options, function(err, translation) {\n if (!err) {\n // translation = 'Hola'\n }\n});"},{"caption":"Translate multiple strings of input. Note that the results are \nnow provied as an array.
","code":"var input = [\n 'Hello',\n 'How are you today?'\n];\n\ntranslate.translate(input, 'es', function(err, translations) {\n if (!err) {\n // translations = [\n // 'Hola',\n // 'Como estas hoy?'\n // ]\n }\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"translate.translate('Hello', 'es').then(function(data) {\n var translation = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"input","description":"en
for English). If an object, you may also specify the source language.html
or text
. If not provided, we will try to auto-detect if the text given is HTML. If not, we set the format as text
.If options
is provided as an object without a to
property.
\n This class allows you interact with Cloud Vision.\n
\n\n\ngoogle-cloud
is deprecated\n \n Due to the scope of our API rapidly increasing, you may notice a decrease in performance if you continue to use the bundled module, google-cloud
.\n
\n Going forward, please install only the individual service modules that you need, such as @google-cloud/vision
.\n
\n The instructions below are here for reference, however, we will soon stop releasing updates to the bundled package.\n
\n\n First, install google-cloud
with npm:\n
\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to google-cloud
— we figure that out for you.\n
\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n
\n\n\n The full set of options which can be passed to google-cloud
are outlined in our Authentication guide.\n
The Cloud Vision API allows easy integration of vision detection features, including image labeling, face and landmark detection, optical character recognition (OCR), and tagging of explicit content.
","source":"packages/vision/src/index.js#L57","resources":[{"title":"Getting Started","link":"https://cloud.google.com/vision/docs/getting-started"},{"title":"Image Best Practices","link":"https://cloud.google.com/vision/docs/image-best-practices"}],"examples":[],"params":[{"name":"options","description":" ","types":["object"],"optional":false,"nullable":false}],"exceptions":[],"returns":[]},{"id":"annotate","name":"annotate","type":"instance","description":"Run image detection and annotation for an image or batch of images.
This is an advanced API method that requires raw AnnotateImageRequest
objects to be provided. If that doesn't sound like what you're looking for, you'll probably appreciate vision#detect.
If the callback is omitted, we'll return a Promise.
","code":"vision.annotate(annotateImageReq).then(function(data) {\n var annotations = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"requests","description":"AnnotateImageRequest
or array of AnnotateImageRequest
s. See an AnnotateImageRequest
.AnnotateImageResponse
.Detect properties from an image (or images) of one or more types.
The raw API response will return some values in a range from VERY_UNLIKELY
to VERY_LIKELY
. For simplification, any value less than LIKELY
is converted to false
.
VERY_UNLIKELY
UNLIKELY
POSSIBLE
LIKELY
VERY_LIKELY
The API will also return many values represented in a [0,1]
range. We convert these to a [0,100]
value. E.g, 0.4
is represented as 40
.
For the response in the original format, review the apiResponse
argument your callback receives.
Run feature detection over a remote image.
","code":"var img = 'https://upload.wikimedia.org/wikipedia/commons/5/51/Google.png';\n\nvision.detect(img, types, function(err, detection, apiResponse) {});"},{"caption":"Run feature detection over a Buffer.
","code":"var level = require('level');\nvar db = level('./users-database');\n\ndb.get('user-image', { encoding: 'binary' }, function(err, image) {\n if (err) {\n // Error handling omitted.\n }\n\n vision.detect(image, types, function(err, detection, apiResponse) {});\n});"},{"caption":"If you have a base64 string, provide it in a Buffer.
","code":"var myBase64ImageRepresentation = '...';\n\nvar image = new Buffer(myBase64ImageRepresentation, 'base64');\n\nvision.detect(image, types, function(err, detection, apiResponse) {});"},{"caption":"Supply multiple images for feature detection.
","code":"var images = [\n 'image.jpg',\n 'image-two.jpg'\n];\n\nvar types = [\n 'face',\n 'label'\n];\n\nvision.detect(images, types, function(err, detections, apiResponse) {\n // detections = [\n // // Detections for image.jpg:\n // {\n // faces: [...],\n // labels: [...]\n // },\n //\n // // Detections for image-two.jpg:\n // {\n // faces: [...],\n // labels: [...]\n // }\n // ]\n});"},{"caption":"It's possible for part of your request to be completed successfully, while \na single feature request was not successful.
","code":"vision.detect('malformed-image.jpg', types, function(err, detections) {\n if (err) {\n // An API error or partial failure occurred.\n\n if (err.name === 'PartialFailureError') {\n // err.errors = [\n // {\n // image: 'malformed-image.jpg',\n // errors: [\n // {\n // code: 400,\n // message: 'Bad image data',\n // type: 'faces'\n // },\n // {\n // code: 400,\n // message: 'Bad image data',\n // type: 'labels'\n // }\n // ]\n // }\n // ]\n }\n }\n\n // `detections` will still be populated with all of the results that could\n // be annotated.\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"vision.detect('image.jpg', types).then(function(data) {\n var detections = data[0];\n var apiResponse = data[1];\n});"}],"params":[{"name":"images","description":"ImageContext
resource.crops
, document
, faces
, landmarks
, labels
, logos
, properties
, safeSearch
, similar
, text
.false
).config.types
). Additionally, if multiple images were provided, you will receive an array of detection objects, each representing an image. See the examples below for more information.Detect the crop hints within an image.
See vision#detect.
","source":"packages/vision/src/index.js#L707","resources":[{"title":"CropHintsAnnotation JSON respresentation","link":"https://cloud.google.com/vision/reference/rest/v1/images/annotate#CropHintsAnnotation"}],"examples":[{"code":"vision.detectCrops('image.jpg', function(err, crops, apiResponse) {\n // crops = [\n // [\n // {\n // x: 1\n // },\n // {\n // x: 295\n // },\n // {\n // x: 295,\n // y: 301\n // },\n // {\n // x: 1,\n // y: 301\n // }\n // ],\n // // ...\n // ]\n});"},{"caption":"Activate verbose
mode for a more detailed response.
If the callback is omitted, we'll return a Promise.
","code":"vision.detectCrops('image.jpg').then(function(data) {\n var crops = data[0];\n var apiResponse = data[1];\n});"}],"params":[],"exceptions":[],"returns":[]},{"id":"detectFaces","name":"detectFaces","type":"instance","description":"Run face detection against an image.
See vision#detect.
","source":"packages/vision/src/index.js#L1070","resources":[{"title":"FaceAnnotation JSON respresentation","link":"https://cloud.google.com/vision/reference/rest/v1/images/annotate#FaceAnnotation"}],"examples":[{"code":"vision.detectFaces('image.jpg', function(err, faces, apiResponse) {\n // faces = [\n // {\n // angles: {\n // pan: -8.1090336,\n // roll: -5.0002542,\n // tilt: 18.012161\n // },\n // bounds: {\n // head: [\n // {\n // x: 1\n // },\n // {\n // x: 295\n // },\n // {\n // x: 295,\n // y: 301\n // },\n // {\n // x: 1,\n // y: 301\n // }\n // ],\n // face: [\n // {\n // x: 28,\n // y: 40\n // },\n // {\n // x: 250,\n // y: 40\n // },\n // {\n // x: 250,\n // y: 262\n // },\n // {\n // x: 28,\n // y: 262\n // }\n // ]\n // },\n // features: {\n // confidence: 34.489909,\n // chin: {\n // center: {\n // x: 143.34183,\n // y: 262.22998,\n // z: -57.388493\n // },\n // left: {\n // x: 63.102425,\n // y: 248.99081,\n // z: 44.207638\n // },\n // right: {\n // x: 241.72728,\n // y: 225.53488,\n // z: 19.758242\n // }\n // },\n // ears: {\n // left: {\n // x: 54.872219,\n // y: 207.23712,\n // z: 97.030685\n // },\n // right: {\n // x: 252.67567,\n // y: 180.43124,\n // z: 70.15992\n // }\n // },\n // eyebrows: {\n // left: {\n // left: {\n // x: 58.790176,\n // y: 113.28249,\n // z: 17.89735\n // },\n // right: {\n // x: 106.14151,\n // y: 98.593758,\n // z: -13.116687\n // },\n // top: {\n // x: 80.248711,\n // y: 94.04303,\n // z: 0.21131183\n // }\n // },\n // right: {\n // left: {\n // x: 148.61565,\n // y: 92.294594,\n // z: -18.804882\n // },\n // right: {\n // x: 204.40808,\n // y: 94.300117,\n // z: -2.0009689\n // },\n // top: {\n // x: 174.70135,\n // y: 81.580917,\n // z: -12.702137\n // }\n // }\n // },\n // eyes: {\n // left: {\n // bottom: {\n // x: 84.883934,\n // y: 134.59479,\n // z: -2.8677137\n // },\n // center: {\n // x: 83.707092,\n // y: 128.34,\n // z: -0.00013388535\n // },\n // left: {\n // x: 72.213913,\n // y: 132.04138,\n // z: 9.6985674\n // },\n // pupil: {\n // x: 86.531624,\n // y: 126.49807,\n // z: -2.2496929\n // },\n // right: {\n // x: 105.28892,\n // y: 125.57655,\n // z: -2.51554\n // },\n // top: {\n // x: 86.706947,\n // y: 119.47144,\n // z: -4.1606765\n // }\n // },\n // right: {\n // bottom: {\n // x: 179.30353,\n // y: 121.03307,\n // z: -14.843414\n // },\n // center: {\n // x: 181.17694,\n // y: 115.16437,\n // z: -12.82961\n // },\n // left: {\n // x: 158.2863,\n // y: 118.491,\n // z: -9.723031\n // },\n // pupil: {\n // x: 175.99976,\n // y: 114.64407,\n // z: -14.53744\n // },\n // right: {\n // x: 194.59413,\n // y: 115.91954,\n // z: -6.952745\n // },\n // top: {\n // x: 173.99446,\n // y: 107.94287,\n // z: -16.050705\n // }\n // }\n // },\n // forehead: {\n // x: 126.53813,\n // y: 93.812057,\n // z: -18.863352\n // },\n // lips: {\n // bottom: {\n // x: 137.28528,\n // y: 219.23564,\n // z: -56.663128\n // },\n // top: {\n // x: 134.74164,\n // y: 192.50438,\n // z: -53.876408\n // }\n // },\n // mouth: {\n // center: {\n // x: 136.43481,\n // y: 204.37952,\n // z: -51.620205\n // },\n // left: {\n // x: 104.53558,\n // y: 214.05037,\n // z: -30.056231\n // },\n // right: {\n // x: 173.79134,\n // y: 204.99333,\n // z: -39.725758\n // }\n // },\n // nose: {\n // bottom: {\n // center: {\n // x: 133.81947,\n // y: 173.16437,\n // z: -48.287724\n // },\n // left: {\n // x: 110.98372,\n // y: 173.61331,\n // z: -29.7784\n // },\n // right: {\n // x: 161.31354,\n // y: 168.24527,\n // z: -36.1628\n // }\n // },\n // tip: {\n // x: 128.14919,\n // y: 153.68129,\n // z: -63.198204\n // },\n // top: {\n // x: 127.83745,\n // y: 110.17557,\n // z: -22.650913\n // }\n // }\n // },\n // confidence: 56.748849,\n // anger: false,\n // angerLikelihood: 1,\n // blurred: false,\n // blurredLikelihood: 1,\n // headwear: false,\n // headwearLikelihood: 1,\n // joy: false,\n // joyLikelihood: 1,\n // sorrow: false,\n // sorrowLikelihood: 1,\n // surprise: false,\n // surpriseLikelihood: 1,\n // underExposed: false,\n // underExposedLikelihood: 1\n // }\n // ]\n});"},{"caption":"Our library simplifies the response from the API. Use the map below to see \neach response name's original name.
","code":"var shortNameToLongNameMap = {\n chin: {\n center: 'CHIN_GNATHION',\n left: 'CHIN_LEFT_GONION',\n right: 'CHIN_RIGHT_GONION'\n },\n\n ears: {\n left: 'LEFT_EAR_TRAGION',\n right: 'RIGHT_EAR_TRAGION'\n },\n\n eyebrows: {\n left: {\n left: 'LEFT_OF_LEFT_EYEBROW',\n right: 'RIGHT_OF_LEFT_EYEBROW',\n top: 'LEFT_EYEBROW_UPPER_MIDPOINT'\n },\n right: {\n left: 'LEFT_OF_RIGHT_EYEBROW',\n right: 'RIGHT_OF_RIGHT_EYEBROW',\n top: 'RIGHT_EYEBROW_UPPER_MIDPOINT'\n }\n },\n\n eyes: {\n left: {\n bottom: 'LEFT_EYE_BOTTOM_BOUNDARY',\n center: 'LEFT_EYE',\n left: 'LEFT_EYE_LEFT_CORNER',\n pupil: 'LEFT_EYE_PUPIL',\n right: 'LEFT_EYE_RIGHT_CORNER',\n top: 'LEFT_EYE_TOP_BOUNDARY'\n },\n right: {\n bottom: 'RIGHT_EYE_BOTTOM_BOUNDARY',\n center: 'RIGHT_EYE',\n left: 'RIGHT_EYE_LEFT_CORNER',\n pupil: 'RIGHT_EYE_PUPIL',\n right: 'RIGHT_EYE_RIGHT_CORNER',\n top: 'RIGHT_EYE_TOP_BOUNDARY'\n }\n },\n\n forehead: 'FOREHEAD_GLABELLA',\n\n lips: {\n bottom: 'LOWER_LIP',\n top: 'UPPER_LIP'\n },\n\n mouth: {\n center: 'MOUTH_CENTER',\n left: 'MOUTH_LEFT',\n right: 'MOUTH_RIGHT'\n },\n\n nose: {\n bottom: {\n center: 'NOSE_BOTTOM_CENTER',\n left: 'NOSE_BOTTOM_LEFT',\n right: 'NOSE_BOTTOM_RIGHT'\n },\n tip: 'NOSE_TIP',\n top: 'MIDPOINT_BETWEEN_EYES'\n }\n};"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"vision.detectFaces('image.jpg').then(function(data) {\n var faces = data[0];\n var apiResponse = data[1];\n});"}],"params":[],"exceptions":[],"returns":[]},{"id":"detectLabels","name":"detectLabels","type":"instance","description":"Annotate an image with descriptive labels.
See vision#detect.
","source":"packages/vision/src/index.js#L1134","resources":[{"title":"EntityAnnotation JSON representation","link":"https://cloud.google.com/vision/reference/rest/v1/images/annotate#EntityAnnotation"}],"examples":[{"code":"vision.detectLabels('image.jpg', function(err, labels, apiResponse) {\n // labels = [\n // 'classical sculpture',\n // 'statue',\n // 'landmark',\n // 'ancient history',\n // 'artwork'\n // ]\n});"},{"caption":"Activate verbose
mode for a more detailed response.
If the callback is omitted, we'll return a Promise.
","code":"vision.detectLabels('image.jpg').then(function(data) {\n var labels = data[0];\n var apiResponse = data[1];\n});"}],"params":[],"exceptions":[],"returns":[]},{"id":"detectLandmarks","name":"detectLandmarks","type":"instance","description":"Detect the landmarks from an image.
See vision#detect.
","source":"packages/vision/src/index.js#L1214","resources":[{"title":"EntityAnnotation JSON representation","link":"https://cloud.google.com/vision/reference/rest/v1/images/annotate#EntityAnnotation"}],"examples":[{"code":"vision.detectLandmarks('image.jpg', function(err, landmarks, apiResponse) {\n // landmarks = [\n // 'Mount Rushmore'\n // ]\n});"},{"caption":"Activate verbose
mode for a more detailed response.
If the callback is omitted, we'll return a Promise.
","code":"vision.detectLandmarks('image.jpg').then(function(data) {\n var landmarks = data[0];\n var apiResponse = data[1];\n});"}],"params":[],"exceptions":[],"returns":[]},{"id":"detectLogos","name":"detectLogos","type":"instance","description":"Detect the logos from an image.
See vision#detect.
","source":"packages/vision/src/index.js#L1286","resources":[{"title":"EntityAnnotation JSON representation","link":"https://cloud.google.com/vision/reference/rest/v1/images/annotate#EntityAnnotation"}],"examples":[{"code":"vision.detectLogos('image.jpg', function(err, logos, apiResponse) {\n // logos = [\n // 'Google'\n // ]\n});"},{"caption":"Activate verbose
mode for a more detailed response.
If the callback is omitted, we'll return a Promise.
","code":"vision.detectLogos('image.jpg').then(function(data) {\n var logos = data[0];\n var apiResponse = data[1];\n});"}],"params":[],"exceptions":[],"returns":[]},{"id":"detectProperties","name":"detectProperties","type":"instance","description":"Get a set of properties about an image, such as its dominant colors.
See vision#detect.
","source":"packages/vision/src/index.js#L1367","resources":[{"title":"ImageProperties JSON representation","link":"https://cloud.google.com/vision/reference/rest/v1/images/annotate#ImageProperties"}],"examples":[{"code":"vision.detectProperties('image.jpg', function(err, props, apiResponse) {\n // props = {\n // colors: [\n // '3b3027',\n // '727d81',\n // '3f2f22',\n // '838e92',\n // '482a16',\n // '5f4f3c',\n // '261b14',\n // 'b39b7f',\n // '51473f',\n // '2c1e12'\n // ]\n // }\n});"},{"caption":"Activate verbose
mode for a more detailed response.
If the callback is omitted, we'll return a Promise.
","code":"vision.detectProperties('image.jpg').then(function(data) {\n var props = data[0];\n var apiResponse = data[1];\n});"}],"params":[],"exceptions":[],"returns":[]},{"id":"detectSafeSearch","name":"detectSafeSearch","type":"instance","description":"Detect the SafeSearch flags from an image.
See vision#detect.
","source":"packages/vision/src/index.js#L1407","resources":[{"title":"SafeSearch JSON representation","link":"https://cloud.google.com/vision/reference/rest/v1/images/annotate#SafeSearchAnnotation"}],"examples":[{"code":"vision.detectSafeSearch('image.jpg', function(err, safeSearch, apiResponse) {\n // safeSearch = {\n // adult: false,\n // medical: false,\n // spoof: false,\n // violence: true\n // }\n});"},{"caption":"If the callback is omitted, we'll return a Promise.
","code":"vision.detectSafeSearch('image.jpg').then(function(data) {\n var safeSearch = data[0];\n var apiResponse = data[1];\n});"}],"params":[],"exceptions":[],"returns":[]},{"id":"detectSimilar","name":"detectSimilar","type":"instance","description":"Detect similar images from the internet.
See vision#detect.
","source":"packages/vision/src/index.js#L1477","resources":[{"title":"WebAnnotation JSON representation","link":"https://cloud.google.com/vision/docs/reference/rest/v1/images/annotate#WebAnnotation"}],"examples":[{"code":"vision.detectSimilar('image.jpg', function(err, images, apiResponse) {\n // images = [\n // 'http://www.example.com/most-similar-image',\n // // ...\n // 'http://www.example.com/least-similar-image'\n // ]\n});"},{"caption":"Activate verbose
mode for a more detailed response.
If the callback is omitted, we'll return a Promise.
","code":"vision.detectSimilar('image.jpg').then(function(data) {\n var images = data[0];\n var apiResponse = data[1];\n});"}],"params":[],"exceptions":[],"returns":[]},{"id":"detectText","name":"detectText","type":"instance","description":"Detect the text within an image.
See vision#detect.
","source":"packages/vision/src/index.js#L1545","resources":[],"examples":[{"code":"vision.detectText('image.jpg', function(err, text, apiResponse) {\n // text = [\n // 'This was text found in the image'\n // ]\n});"},{"caption":"Activate verbose
mode for a more detailed response.
If the callback is omitted, we'll return a Promise.
","code":"vision.detectText('image.jpg').then(function(data) {\n var text = data[0];\n var apiResponse = data[1];\n});"}],"params":[],"exceptions":[],"returns":[]},{"id":"readDocument","name":"readDocument","type":"instance","description":"Annotate a document.
See vision#detect.
","source":"packages/vision/src/index.js#L1693","resources":[{"title":"FullTextAnnotation JSON representation","link":"https://cloud.google.com/vision/reference/rest/v1/images/annotate#FullTextAnnotation"}],"examples":[{"code":"vision.readDocument('image.jpg', function(err, text, apiResponse) {\n // text = 'This paragraph was extracted from image.jpg';\n});"},{"caption":"Activate verbose
mode for a more detailed response.
If the callback is omitted, we'll return a Promise.
","code":"vision.readDocument('image.jpg').then(function(data) {\n var pages = data[0];\n var apiResponse = data[1];\n});"}],"params":[],"exceptions":[],"returns":[]}],"path":"index.json"} \ No newline at end of file diff --git a/manifest.json b/manifest.json index 4a746901096..598bca772cf 100644 --- a/manifest.json +++ b/manifest.json @@ -13,6 +13,8 @@ "name": "google-cloud", "defaultService": "google-cloud", "versions": [ + "v0.51.1", + "v0.51.0", "0.50.0", "0.49.0", "0.48.0", @@ -287,6 +289,7 @@ "name": "@google-cloud/speech", "defaultService": "speech", "versions": [ + "0.9.0", "0.8.0", "0.7.0", "0.6.0",