aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2012-10-01 22:36:54 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2012-10-01 22:36:54 +0300
commit9591095bbf09b6a1cbe084801bde49336d626dbe (patch)
treea2416f151d6ee51863092374cd20b2c87a4941e9 /src
parent179bf25f249a8ee7456e9f3e47f930014b0e5f90 (diff)
downloadeclat-9591095bbf09b6a1cbe084801bde49336d626dbe.tar.gz
eclat-9591095bbf09b6a1cbe084801bde49336d626dbe.tar.bz2
Fix disassociate-address to work with VPC addresses. Improve docs.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am2
-rw-r--r--src/asscaddr.c22
-rw-r--r--src/cmdline.opt2
-rw-r--r--src/disassaddr-cl.opt36
-rw-r--r--src/disassaddr.c39
5 files changed, 78 insertions, 23 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index c344b5b..1a1e1a5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -21,6 +21,7 @@ eclat_SOURCES=\
asscaddr.c\
cmdline.h\
config.c\
+ disassaddr.c\
dscraddrs.c\
dscrtags.c\
dscrinsts.c\
@@ -43,6 +44,7 @@ AM_CPPFLAGS= \
OPTFILES=\
asscaddr-cl.opt\
+ disassaddr-cl.opt\
dscraddrs-cl.opt\
dscrinststat-cl.opt\
generic-cl.opt
diff --git a/src/asscaddr.c b/src/asscaddr.c
index 7767664..a5ba86e 100644
--- a/src/asscaddr.c
+++ b/src/asscaddr.c
@@ -51,25 +51,3 @@ eclat_associate_address(CURL *curl, int argc, char **argv)
}
return eclat_send_query(curl, q);
}
-
-int
-eclat_disassociate_address(CURL *curl, int argc, char **argv)
-{
- int i;
- struct ec2_query *q;
-
- generic_parse_options("eclat disassociate-address",
- "IP",
- argc, argv, &i);
- argc -= i;
- argv += i;
-
- if (argc != 1)
- die(EX_USAGE, "wrong number of arguments to disassociate-address");
-
- q = eclat_query_create(use_ssl ? EC2_QF_HTTPS : 0, endpoint, "/");
- eclat_query_add_param(q, "Action", "DisassociateAddress");
- eclat_query_add_param(q, "PublicIp", argv[0]);
-
- return eclat_send_query(curl, q);
-}
diff --git a/src/cmdline.opt b/src/cmdline.opt
index 84b495f..c19f628 100644
--- a/src/cmdline.opt
+++ b/src/cmdline.opt
@@ -57,7 +57,7 @@ BEGIN
preprocess_only = 1;
END
-OPTION(match-command,m,,
+OPTION(match-commands,m,,
[<find matching command names>])
BEGIN
match_command_mode = 1;
diff --git a/src/disassaddr-cl.opt b/src/disassaddr-cl.opt
new file mode 100644
index 0000000..c676122
--- /dev/null
+++ b/src/disassaddr-cl.opt
@@ -0,0 +1,36 @@
+/* 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/>. */
+
+OPTIONS_BEGIN("eclat disassociate-address",
+ [<disassociate IP address from instance>],
+ [<IP-OR-ALLOC-ID>],
+ [<gnu>],
+ [<nousage>],
+ [<noversion>])
+
+OPTION(vpc,v,,
+ [<disassociate VPC address>])
+BEGIN
+ vpc = 1;
+END
+OPTIONS_END
+
+static void
+parse_options(int argc, char *argv[], int *index)
+{
+ GETOPT(argc, argv, *index, exit(EX_USAGE))
+}
+
diff --git a/src/disassaddr.c b/src/disassaddr.c
new file mode 100644
index 0000000..cfd9d70
--- /dev/null
+++ b/src/disassaddr.c
@@ -0,0 +1,39 @@
+/* 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"
+static int vpc;
+#include "disassaddr-cl.h"
+
+int
+eclat_disassociate_address(CURL *curl, int argc, char **argv)
+{
+ int i;
+ struct ec2_query *q;
+
+ parse_options(argc, argv, &i);
+ argc -= i;
+ argv += i;
+
+ if (argc != 1)
+ die(EX_USAGE, "wrong number of arguments to disassociate-address");
+
+ q = eclat_query_create(use_ssl ? EC2_QF_HTTPS : 0, endpoint, "/");
+ eclat_query_add_param(q, "Action", "DisassociateAddress");
+ eclat_query_add_param(q, vpc ? "AssociationId" : "PublicIp", argv[0]);
+
+ return eclat_send_query(curl, q);
+}

Return to:

Send suggestions and report system problems to the System administrator.