-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switch to individual API packages. #169
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,11 +16,11 @@ | |
var async = require('async'); | ||
|
||
// [START auth] | ||
// By default, gcloud will authenticate using the service account file specified | ||
// by the GOOGLE_APPLICATION_CREDENTIALS environment variable and use the | ||
// project specified by the GCLOUD_PROJECT environment variable. See | ||
// https://googlecloudplatform.github.io/gcloud-node/#/docs/guides/authentication | ||
var gcloud = require('gcloud'); | ||
// By default, the client will authenticate using the service account file | ||
// specified by the GOOGLE_APPLICATION_CREDENTIALS environment variable and use | ||
// the project specified by the GCLOUD_PROJECT environment variable. See | ||
// https://googlecloudplatform.github.io/gcloud-node/#/docs/google-cloud/latest/guides/authentication | ||
var BigQuery = require('@google-cloud/bigquery'); | ||
// [END auth] | ||
|
||
// [START list_tables] | ||
|
@@ -84,7 +84,8 @@ function getSizeExample (projectId, datasetId, callback) { | |
return callback(new Error('datasetId is require!')); | ||
} | ||
|
||
var bigquery = gcloud.bigquery({ | ||
// Instantiate a bigquery client | ||
var bigquery = BigQuery({ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this all be on one line? |
||
projectId: projectId | ||
}); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,11 +23,16 @@ | |
|
||
// [START all] | ||
// [START auth] | ||
// By default, gcloud will authenticate using the service account file specified | ||
// by the GOOGLE_APPLICATION_CREDENTIALS environment variable and use the | ||
// project specified by the GCLOUD_PROJECT environment variable. See | ||
// https://googlecloudplatform.github.io/gcloud-node/#/docs/guides/authentication | ||
var gcloud = require('gcloud'); | ||
// By default, the client will authenticate using the service account file | ||
// specified by the GOOGLE_APPLICATION_CREDENTIALS environment variable and use | ||
// the project specified by the GCLOUD_PROJECT environment variable. See | ||
// https://googlecloudplatform.github.io/gcloud-node/#/docs/google-cloud/latest/guides/authentication | ||
var BigQuery = require('@google-cloud/bigquery'); | ||
|
||
var Resource = require('@google-cloud/resource'); | ||
|
||
// Instantiate a resource client | ||
var resource = Resource(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we put this closer to where it's used? (I can see the merit of leaving it at the top too...) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All samples put it at the top, except for those samples that specifically need to instantiate a client with a custom option before making a request, like a |
||
// [END auth] | ||
|
||
// [START list_tables] | ||
|
@@ -41,7 +46,9 @@ function listDatasets (projectId, callback) { | |
if (!projectId) { | ||
return callback(new Error('projectId is required!')); | ||
} | ||
var bigquery = gcloud.bigquery({ | ||
|
||
// Instantiate a bigquery client | ||
var bigquery = BigQuery({ | ||
projectId: projectId | ||
}); | ||
|
||
|
@@ -63,8 +70,6 @@ function listDatasets (projectId, callback) { | |
* @param {Function} callback Callback function. | ||
*/ | ||
function listProjects (callback) { | ||
var resource = gcloud.resource(); | ||
|
||
resource.getProjects(function (err, projects) { | ||
if (err) { | ||
return callback(err); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm assuming this is supposed to be commented out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's randomly failing on Circle, I'll figure it out later.