-
Notifications
You must be signed in to change notification settings - Fork 592
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
9 changed files
with
177 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
/** | ||
* Copyright 2016 Google Inc. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
var fs = require('fs'); | ||
var join = require('path').join; | ||
var template = require('lodash.template'); | ||
|
||
var TEMPLATE_FILE = fs.readFileSync(join(__dirname, 'overview.template.html')); | ||
|
||
var CONFIG = { | ||
bigquery: { | ||
title: 'Google BigQuery' | ||
}, | ||
|
||
bigtable: { | ||
title: 'Google Cloud Bigtable' | ||
}, | ||
|
||
compute: { | ||
title: 'Google Compute Engine', | ||
instanceName: 'gce' | ||
}, | ||
|
||
datastore: { | ||
title: 'Google Cloud Datastore' | ||
}, | ||
|
||
dns: { | ||
title: 'Google Cloud DNS' | ||
}, | ||
|
||
language: { | ||
title: 'Google Cloud Natural Language' | ||
}, | ||
|
||
logging: { | ||
title: 'Google Cloud Logging' | ||
}, | ||
|
||
prediction: { | ||
title: 'Google Prediction API' | ||
}, | ||
|
||
pubsub: { | ||
title: 'Google Cloud Pub/Sub' | ||
}, | ||
|
||
resource: { | ||
title: 'Google Cloud Resource Manager' | ||
}, | ||
|
||
storage: { | ||
title: 'Google Cloud Storage', | ||
instanceName: 'gcs' | ||
}, | ||
|
||
translate: { | ||
title: 'Google Translate API' | ||
}, | ||
|
||
vision: { | ||
title: 'Google Cloud Vision' | ||
} | ||
}; | ||
|
||
module.exports = function(className) { | ||
var config = CONFIG[className]; | ||
|
||
return template(TEMPLATE_FILE)({ | ||
pkgJson: require(join('..', 'packages', className, 'package.json')), | ||
title: config.title, | ||
instanceName: config.instanceName, | ||
className: className, | ||
umbrellaView: true | ||
}); | ||
}; | ||
|
||
module.exports.CONFIG = CONFIG; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
This class allows you interact with <%= title %>. | ||
|
||
First, install `<%= pkgJson.name %>` with npm: | ||
|
||
<div hljs language="bash"> | ||
$ npm install --save <%= pkgJson.name %> | ||
</div> | ||
|
||
If you are running your app on Google Compute Engine, you won't need to worry | ||
about supplying connection configuration options to `<%= pkgJson.name %>`— we | ||
figure that out for you. | ||
|
||
However, if you're running your app elsewhere, you will need to provide project | ||
details to authenticate API requests. | ||
|
||
<h4>Compute Engine</h4> | ||
<div hljs language="javascript"> | ||
<% if (umbrellaView) { %> | ||
var <%= instanceName || className %> = require('<%= pkgJson.name %>')(); | ||
<% } else { %> | ||
var gcloud = require('google-cloud'); | ||
var <%= instanceName || className %> = gcloud.<%= className %>(); | ||
<% } %> | ||
</div> | ||
|
||
<h4>Elsewhere</h4> | ||
<div hljs language="javascript"> | ||
<% if (umbrellaView) { %> | ||
var <%= instanceName || className %> = require('<%= pkgJson.name %>')({ | ||
projectId: 'grape-spaceship-123', | ||
keyFilename: '/path/to/keyfile.json' | ||
}); | ||
<% } else { %> | ||
var gcloud = require('google-cloud'); | ||
var <%= instanceName || className %> = gcloud.<%= className %>({ | ||
projectId: 'grape-spaceship-123', | ||
keyFilename: '/path/to/keyfile.json' | ||
}); | ||
<% } %> | ||
</div> | ||
|
||
The full set of options which can be passed to `<%= pkgJson.name %>` are | ||
outlined in our | ||
[Authentication guide](#/docs/<%= className %>/<%= pkgJson.version %>/guides/authentication). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters