Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const container = require('@google-cloud/container');
require('babel-polyfill');
const GOOGLE_APPLICATION_CREDENTIALS = require('./creds.json');
const client: any = new container.v1.ClusterManagerClient(GOOGLE_APPLICATION_CREDENTIALS);
// console.log(client)
console.log('-------------------------------------');
async function quickstart() {
const zone = 'us-west2-a';
const projectId = await client.getProjectId();
const request = {
projectId: projectId,
zone: zone,
};
const [response] = await client.listClusters(request);
const [listOperation] = await client.listOperations(request);
console.log('Clusters:');
console.log(response);
console.log('-------------------------------------');
console.log(response.clusters[0].nodePools.length)
async function main() {
// [START container_quickstart]
const container = require('@google-cloud/container');
// Create the Cluster Manager Client
const client = new container.v1.ClusterManagerClient();
async function quickstart() {
const zone = 'us-central1-a';
const projectId = await client.getProjectId();
const request = {
projectId: projectId,
zone: zone,
};
const [response] = await client.listClusters(request);
console.log('Clusters:');
console.log(response);
}
quickstart();
// [END container_quickstart]
}
function main() {
const clusterManagerClient = new container.ClusterManagerClient();
}
function main() {
const clusterManagerClient = new ClusterManagerClient();
}
async function create(GOOGLE_APPLICATION_CREDENTIALS:any, zone:string ='us-central1-a', input:object = {'clusterType':'affordable', 'name':'deployCluster', 'zone':'us-central1-a'}){
const client:any = new container.v1.ClusterManagerClient(GOOGLE_APPLICATION_CREDENTIALS);
GOOGLE_APPLICATION_CREDENTIALS = JSON.parse(GOOGLE_APPLICATION_CREDENTIALS);
const projectId:string = GOOGLE_APPLICATION_CREDENTIALS["project_id"];
let cluster:object ={};
console.log(`we're invoking create input is:` , input)
console.log('gcptype: ', GOOGLE_APPLICATION_CREDENTIALS["project_id"])
if(input['clusterType'] == 'affordable'){
cluster = {
"name": input['name'],
"masterAuth": {
"clientCertificateConfig": {}
},
"loggingService": "none",
"monitoringService": "none",
"network": `projects/${projectId}/global/networks/default`,
"addonsConfig": {