Skip to content

Commit

Permalink
Better readme and quickstart (#4)
Browse files Browse the repository at this point in the history
added quickstart.js and a better README
  • Loading branch information
alexander-fenster authored Dec 15, 2017
1 parent 66a83c5 commit 47b82eb
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions container/snippets/quickstart.js
Original file line number Diff line number Diff line change
@@ -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=<project_id> GOOGLE_APPLICATION_CREDENTIALS=<path to key json file> 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);
});

0 comments on commit 47b82eb

Please sign in to comment.