-
Notifications
You must be signed in to change notification settings - Fork 598
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add .repo-metadata.json, quickstart, and generate README (#177)
- Loading branch information
1 parent
45e8630
commit ac0248d
Showing
6 changed files
with
158 additions
and
39 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "redis", | ||
"name_pretty": "Cloud Redis", | ||
"product_documentation": "https://cloud.google.com/memorystore/docs/redis/", | ||
"client_documentation": "https://cloud.google.com/nodejs/docs/reference/redis/latest/", | ||
"issue_tracker": "https://issuetracker.google.com/savedsearches/5169231", | ||
"release_level": "alpha", | ||
"language": "nodejs", | ||
"repo": "googleapis/nodejs-redis", | ||
"distribution_name": "@google-cloud/redis", | ||
"api_id": "redis.googleapis.com", | ||
"requires_billing": true | ||
} | ||
|
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,44 @@ | ||
[//]: # "This README.md file is auto-generated, all changes to this file will be lost." | ||
[//]: # "To regenerate it, use `python -m synthtool`." | ||
<img src="https://avatars2.githubusercontent.com/u/2810941?v=3&s=96" alt="Google Cloud Platform logo" title="Google Cloud Platform" align="right" height="96" width="96"/> | ||
|
||
# [Cloud Redis: Node.js Samples](https://github.com/googleapis/nodejs-redis) | ||
|
||
[![Open in Cloud Shell][shell_img]][shell_link] | ||
|
||
|
||
|
||
## Table of Contents | ||
|
||
* [Before you begin](#before-you-begin) | ||
* [Samples](#samples) | ||
* [Quickstart](#quickstart) | ||
|
||
## Before you begin | ||
|
||
Before running the samples, make sure you've followed the steps outlined in | ||
[Using the client library](https://github.com/googleapis/nodejs-redis#using-the-client-library). | ||
|
||
## Samples | ||
|
||
|
||
|
||
### Quickstart | ||
|
||
View the [source code](https://github.com/googleapis/nodejs-redis/blob/master/samples/quickstart.js). | ||
|
||
[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-redis&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) | ||
|
||
__Usage:__ | ||
|
||
|
||
`node quickstart.js` | ||
|
||
|
||
|
||
|
||
|
||
|
||
[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png | ||
[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-redis&page=editor&open_in_editor=samples/README.md | ||
[product-docs]: https://cloud.google.com/memorystore/docs/redis/ |
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 |
---|---|---|
@@ -1,15 +1,39 @@ | ||
// Copyright 2018 Google LLC | ||
// | ||
// 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 | ||
// | ||
// https://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. | ||
/** | ||
* Copyright 2019, Google, Inc. | ||
* 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. | ||
*/ | ||
|
||
console.warn('no samples available 😐'); | ||
'use strict'; | ||
|
||
// [START redis_quickstart] | ||
/** | ||
* List instances in a given location. | ||
* @param {string} project. | ||
* @param {string} location, e.g., us-east-1. | ||
*/ | ||
async function main(projectId, location) { | ||
const {CloudRedisClient} = require('@google-cloud/redis'); | ||
const client = new CloudRedisClient(); | ||
const formattedParent = client.locationPath(projectId, location); | ||
const request = { | ||
parent: formattedParent, | ||
}; | ||
const resp = (await client.listInstances(request))[0]; | ||
console.info(resp); | ||
} | ||
// [END redis_quickstart] | ||
|
||
main(...process.argv.slice(2)).catch(err => { | ||
console.error(err); | ||
process.exitCode = 1; | ||
}); |
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