MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/nodejs-docs-samples / _listStoppedInstances

Function _listStoppedInstances

functions/billing/index.js:195–202  ·  view source on GitHub ↗
(projectId, zone)

Source from the content-addressed store, hash-verified

193 * @return {Promise} Array of names of running instances
194 */
195const _listStoppedInstances = async (projectId, zone) => {
196 const [instances] = await instancesClient.list({
197 project: projectId,
198 zone: zone,
199 });
200 const stoppedInstances = instances.filter(item => item.status !== 'RUNNING');
201 return stoppedInstances.map(item => item.name);
202};
203
204/**
205 * @param {Array} instanceNames Names of instance to stop

Callers 1

index.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected