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); +});