Google kubernetes engine 如何使用api运行gcloud容器命令

Google kubernetes engine 如何使用api运行gcloud容器命令,google-kubernetes-engine,gcloud,Google Kubernetes Engine,Gcloud,我正在使用这个gcloud命令调整GKE集群的大小 gcloud container clusters resize $CLUSTER_NAME --num-nodes=0 如何使用api实现同样的功能 我找到了库,我应该使用什么函数 const container = require('@google-cloud/container'); const client = new container.v1.ClusterManagerClient(); const request = {

我正在使用这个gcloud命令调整GKE集群的大小

   gcloud container clusters resize $CLUSTER_NAME --num-nodes=0
如何使用api实现同样的功能

我找到了库,我应该使用什么函数

const container = require('@google-cloud/container');
const client = new container.v1.ClusterManagerClient();

const request = {
    projectId: 'my-project-id',
    zone: 'us-central1-f',
    clusterId: 'my-cluster-id',
    nodePoolId: 'default-pool',
    nodeCount: 0
};

client.setNodePoolSize(request, (err, res) => {
    console.log(err);
    console.log(res);
});
另见