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

Function _stopInstances

functions/billing/index.js:164–178  ·  view source on GitHub ↗
(projectId, zone, instanceNames)

Source from the content-addressed store, hash-verified

162 * @return {Promise} Response from stopping instances
163 */
164const _stopInstances = async (projectId, zone, instanceNames) => {
165 await Promise.all(
166 instanceNames.map(instanceName => {
167 return instancesClient
168 .stop({
169 project: projectId,
170 zone: zone,
171 instance: instanceName,
172 })
173 .then(() => {
174 console.log(`Instance stopped successfully: ${instanceName}`);
175 });
176 })
177 );
178};
179// [END functions_billing_limit]
180
181// Helper function to restart instances (used in tests)

Callers 1

index.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected