Description Usage Arguments Examples
View source: R/deletion-prevention.R
Toggle deletion protection for existing instances
1 2 3 4 5 6 | gce_vm_deletion_protection(
instance,
cmd = c("status", "true", "false"),
project = gce_get_global_project(),
zone = gce_get_global_zone()
)
|
instance |
The vm to work with its deletion protection |
cmd |
Whether to get the status, or toggle "true" or "false" on deletion protection for this VM |
project |
The projectId |
zone |
The zone |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ## Not run:
# a workflow for deleting lots of VMs across zones that have deletion protection
zones <- gce_list_zones()
instances <- lapply(zones$name, function(x) gce_list_instances(zone = x))
instances_e <- lapply(instances, function(x) x$items$name)
names(instances_e) <- zones$name
status <- lapply(zones$name, function(x){
lapply(instances_e[[x]], function(y) {
gce_vm_deletion_protection(y, cmd = "false", zone = x)))
}
}
deletes <- lapply(zones$name, function(x){
lapply(instances_e[[x]], function(y) {
gce_vm_delete(y, zone = x)))
}
}
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.