Skip to content

Commit

Permalink
feat: add .repo-metadata.json, quickstart, and generate README (#177)
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoe authored and JustinBeckwith committed Jun 1, 2019
1 parent 45e8630 commit ac0248d
Show file tree
Hide file tree
Showing 6 changed files with 158 additions and 39 deletions.
1 change: 1 addition & 0 deletions packages/google-cloud-redis/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ system-test/*key.json
google-cloud-logging-winston-*.tgz
google-cloud-logging-bunyan-*.tgz
package-lock.json
__pycache__
14 changes: 14 additions & 0 deletions packages/google-cloud-redis/.repo-metadata.json
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
}

74 changes: 55 additions & 19 deletions packages/google-cloud-redis/README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
[//]: # "This README.md file is auto-generated, all changes to this file will be lost."
[//]: # "To regenerate it, use `npm run generate-scaffolding`."
[//]: # "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 Client](https://github.com/googleapis/nodejs-redis)

[![release level](https://img.shields.io/badge/release%20level-alpha-orange.svg?style&#x3D;flat)](https://cloud.google.com/terms/launch-stages)
[![release level](https://img.shields.io/badge/release%20level-alpha-orange.svg?style=flat)](https://cloud.google.com/terms/launch-stages)
[![npm version](https://img.shields.io/npm/v/@google-cloud/redis.svg)](https://www.npmjs.org/package/@google-cloud/redis)
[![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-redis/master.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-redis)

> Node.js idiomatic client for [Cloud Redis][product-docs].

Client for Google Cloud Redis


Google Cloud Memorystore for Redis API client for Node.js


* [Cloud Redis Node.js Client API Reference][client-docs]
* [github.com/googleapis/nodejs-redis](https://github.com/googleapis/nodejs-redis)
* [Cloud Redis Documentation][product-docs]
* [github.com/googleapis/nodejs-redis](https://github.com/googleapis/nodejs-redis)

Read more about the client libraries for Cloud APIs, including the older
Google APIs Client Libraries, in [Client Libraries Explained][explained].
Expand All @@ -24,10 +25,12 @@ Google APIs Client Libraries, in [Client Libraries Explained][explained].

**Table of contents:**


* [Quickstart](#quickstart)
* [Before you begin](#before-you-begin)
* [Installing the client library](#installing-the-client-library)
* [Using the client library](#using-the-client-library)
* [Samples](#samples)
* [Versioning](#versioning)
* [Contributing](#contributing)
* [License](#license)
Expand All @@ -36,25 +39,50 @@ Google APIs Client Libraries, in [Client Libraries Explained][explained].

### Before you begin

1. Select or create a Cloud Platform project.
1. [Select or create a Cloud Platform project][projects].
1. [Enable billing for your project][billing].
1. [Enable the Cloud Redis API][enable_api].
1. [Set up authentication with a service account][auth] so you can access the
API from your local workstation.

[Go to the projects page][projects]
### Installing the client library

1. Enable billing for your project.
```bash
npm install @google-cloud/redis
```

[Enable billing][billing]

1. [Set up authentication with a service account][auth] so you can access the
API from your local workstation.
### Using the client library

[projects]: https://console.cloud.google.com/project
[billing]: https://support.google.com/cloud/answer/6293499#enable-billing
[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=
[auth]: https://cloud.google.com/docs/authentication/getting-started
```javascript
/**
* 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);
}

### Installing the client library
```

npm install --save @google-cloud/redis


## Samples

Samples are in the [`samples/`](https://github.com/googleapis/nodejs-redis/tree/master/samples) directory. The samples' `README.md`
has instructions for running the samples.

| Sample | Source Code | Try it |
| --------------------------- | --------------------------------- | ------ |
| Quickstart | [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) |



Expand All @@ -65,10 +93,15 @@ also contains samples.

This library follows [Semantic Versioning](http://semver.org/).




This library is considered to be in **alpha**. This means it is still a
work-in-progress and under active development. Any release is subject to
backwards-incompatible changes at any time.



More Information: [Google Cloud Platform Launch Stages][launch_stages]

[launch_stages]: https://cloud.google.com/terms/launch-stages
Expand All @@ -84,6 +117,9 @@ Apache Version 2.0
See [LICENSE](https://github.com/googleapis/nodejs-redis/blob/master/LICENSE)

[client-docs]: https://cloud.google.com/nodejs/docs/reference/redis/latest/
[product-docs]: https://cloud.google.com/memorystore/docs
[product-docs]: https://cloud.google.com/memorystore/docs/redis/
[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png

[projects]: https://console.cloud.google.com/project
[billing]: https://support.google.com/cloud/answer/6293499#enable-billing
[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=redis.googleapis.com
[auth]: https://cloud.google.com/docs/authentication/getting-started
44 changes: 44 additions & 0 deletions packages/google-cloud-redis/samples/README.md
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/
52 changes: 38 additions & 14 deletions packages/google-cloud-redis/samples/quickstart.js
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;
});
12 changes: 6 additions & 6 deletions packages/google-cloud-redis/synth.metadata
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
{
"updateTime": "2019-05-21T11:22:45.313794Z",
"updateTime": "2019-06-01T09:03:35.220606Z",
"sources": [
{
"generator": {
"name": "artman",
"version": "0.20.0",
"dockerImage": "googleapis/artman@sha256:3246adac900f4bdbd62920e80de2e5877380e44036b3feae13667ec255ebf5ec"
"version": "0.22.0",
"dockerImage": "googleapis/artman@sha256:72f6287a42490bfe1609aed491f29411af21df3f744199fe8bb8d276c1fdf419"
}
},
{
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
"sha": "32a10f69e2c9ce15bba13ab1ff928bacebb25160",
"internalRef": "249058354"
"sha": "a8ee1416f4c588f2ab92da72e7c1f588c784d3e6",
"internalRef": "250996044"
}
},
{
"template": {
"name": "node_library",
"origin": "synthtool.gcp",
"version": "2019.5.2"
"version": "2019.4.10"
}
}
],
Expand Down

0 comments on commit ac0248d

Please sign in to comment.