From 47b82ebd5cc0d2b2551297475f825ab2a11e6d5b Mon Sep 17 00:00:00 2001 From: Alexander Fenster Date: Fri, 15 Dec 2017 15:22:19 -0800 Subject: [PATCH] Better readme and quickstart (#4) added quickstart.js and a better README --- container/snippets/quickstart.js | 42 ++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 container/snippets/quickstart.js diff --git a/container/snippets/quickstart.js b/container/snippets/quickstart.js new file mode 100644 index 0000000000..157e72344d --- /dev/null +++ b/container/snippets/quickstart.js @@ -0,0 +1,42 @@ +// Copyright 2017, Google LLC 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'; + +const container = require('../src'); + +if ( + !process.env.GCLOUD_PROJECT || + !process.env.GOOGLE_APPLICATION_CREDENTIALS +) { + throw new Error( + 'Usage: GCLOUD_PROJECT= GOOGLE_APPLICATION_CREDENTIALS= node #{$0}' + ); +} +var projectId = process.env.GCLOUD_PROJECT; + +var client = new container.v1.ClusterManagerClient({ + // optional auth parameters. +}); + +var projectId2 = projectId; +var zone = 'us-central1-a'; +var request = { + projectId: projectId2, + zone: zone, +}; +client.listClusters(request).then(responses => { + var response = responses[0]; + console.log(response); +});