Created
May 2, 2018 00:45
-
-
Save zhangyuan/aa0c5f086299c39950891ca305848548 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const container = require('@google-cloud/container'); | |
const clusterClient = new container.v1.ClusterManagerClient({ | |
credentials: { | |
"private_key": "", | |
"client_email": "", | |
} | |
}); | |
const projectId = 'projectId'; | |
const zone = 'europe-west1-c'; | |
const clusterName = 'clusterName'; | |
async function createCluster() { | |
return await clusterClient.createCluster({ | |
projectId: projectId, | |
zone: zone, | |
cluster: { | |
name: clusterName, | |
initialNodeCount: 1 | |
} | |
}); | |
} | |
async function deleteCluster() { | |
return await clusterClient.deleteCluster({ | |
projectId: projectId, | |
zone: zone, | |
clusterId: clusterName | |
}); | |
} | |
async function getCluster() { | |
const responses = await clusterClient.getCluster({ | |
projectId: projectId, | |
zone: zone, | |
clusterId: clusterName, | |
}) | |
return responses; | |
} | |
const main = async () => { | |
const createClusterRes = await createCluster(); | |
console.log(createClusterRes); | |
const deleteClusterRes = await deleteCluster(); | |
console.log(deleteClusterRes); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment