MCPcopy Index your code
hub / github.com/linuxkit/linuxkit / DeleteInstance

Method DeleteInstance

src/cmd/linuxkit/gcp.go:340–360  ·  view source on GitHub ↗

DeleteInstance removes an instance

(instance, zone string, wait bool)

Source from the content-addressed store, hash-verified

338
339// DeleteInstance removes an instance
340func (g GCPClient) DeleteInstance(instance, zone string, wait bool) error {
341 var notFound bool
342 op, err := g.compute.Instances.Delete(g.projectName, zone, instance).Do()
343 if err != nil {
344 if _, ok := err.(*googleapi.Error); !ok {
345 return err
346 }
347 if err.(*googleapi.Error).Code != 404 {
348 return err
349 }
350 notFound = true
351 }
352 if !notFound && wait {
353 log.Infof("Deleting existing instance...")
354 if err := g.pollZoneOperationStatus(op.Name, zone); err != nil {
355 return err
356 }
357 log.Infof("Instance %s deleted", instance)
358 }
359 return nil
360}
361
362// GetInstanceSerialOutput streams the serial output of an instance
363func (g GCPClient) GetInstanceSerialOutput(instance, zone string) error {

Callers 2

CreateInstanceMethod · 0.95
runGCPCmdFunction · 0.95

Calls 3

DoMethod · 0.80
DeleteMethod · 0.80

Tested by

no test coverage detected