diff options
Diffstat (limited to 'src/delvol.c')
-rw-r--r-- | src/delvol.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/delvol.c b/src/delvol.c new file mode 100644 index 0000000..e3a17f2 --- /dev/null +++ b/src/delvol.c @@ -0,0 +1,43 @@ +/* This file is part of Eclat. + Copyright (C) 2012 Sergey Poznyakoff. + + Eclat is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + Eclat is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Eclat. If not, see <http://www.gnu.org/licenses/>. */ + +#include "eclat.h" + +int +eclat_delete_volume(CURL *curl, int argc, char **argv) +{ + int i; + struct ec2_query *q; + + generic_proginfo->args_doc = "VOL-ID"; + generic_parse_options("eclat delete-volume", + "delete a EC2 volume", + argc, argv, &i); + argc -= i; + argv += i; + + if (argc != 1) + die(EX_USAGE, "bad number of arguments"); + translate_ids(argc, argv, "VolumeId"); + if (!eclat_confirm("Really release volume %s", argv[0])) + exit(EX_CANCELLED); + q = eclat_query_create(use_ssl ? EC2_QF_HTTPS : 0, endpoint, "/"); + eclat_query_add_param(q, "Action", "DeleteVolume"); + eclat_query_add_param(q, "VolumeId", argv[0]); + return eclat_send_query(curl, q); +} + + |