summaryrefslogtreecommitdiffabout
path: root/src
authorSergey Poznyakoff <gray@gnu.org.ua>2019-11-26 12:09:09 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2019-11-26 12:09:09 (GMT)
commit0f78a1684e0119adceba8e9fd99a8bc33fa826b1 (patch) (side-by-side diff)
tree8ad56bbc1d748f4fa2fc8af6a0b7522ee3723735 /src
parentce1af46af7a84d061676ede08dab2a0be3fadbaf (diff)
downloadeclat-0f78a1684e0119adceba8e9fd99a8bc33fa826b1.tar.gz
eclat-0f78a1684e0119adceba8e9fd99a8bc33fa826b1.tar.bz2
Implement MoveAddressToVpc (addr2vpc) and RestoreAddressToClassic (addr2ec2)
* TODO: Document changes. * doc/Makefile.inc: Add new files. * doc/eclat-addr2ec2.1: New file. * doc/eclat-addr2vpc.1: New file. * etc/Makefile.am: Add new files. * etc/move-address-to-vpc.fln: New file. * etc/restore-address-to-classic.fln: New file. * src/Makefile.am: Add new file. * src/mvaddr.c: New file. * src/eclat.c (cmdtab): New commands: addr2vpc and addr2ec2. * src/eclat.h (eclat_move_address): New proto. * etc/describe-images.fln: List creation date.
Diffstat (limited to 'src') (more/less context) (ignore whitespace changes)
-rw-r--r--src/Makefile.am1
-rw-r--r--src/eclat.c6
-rw-r--r--src/eclat.h1
-rw-r--r--src/mvaddr.c39
4 files changed, 46 insertions, 1 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index c4fc211..637beb2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -60,6 +60,7 @@ eclat_SOURCES=\
mktags.c\
mkvol.c\
mkvpc.c\
+ mvaddr.c\
rmaddr.c\
rmsg.c\
rmsnap.c\
diff --git a/src/eclat.c b/src/eclat.c
index 43387be..1c87314 100644
--- a/src/eclat.c
+++ b/src/eclat.c
@@ -211,7 +211,11 @@ struct eclat_command cmdtab[] = {
{ "chvol", "modify-volume", "ModifyVolume",
eclat_modify_volume },
{ "lschvol", "describe-volumes-modifications", "DescribeVolumesModifications",
- eclat_describe_volumes_modifications }
+ eclat_describe_volumes_modifications },
+ { "addr2vpc", "move-address-to-vpc", "MoveAddressToVpc",
+ eclat_move_address },
+ { "addr2ec2", "restore-address-to-classic", "RestoreAddressToClassic",
+ eclat_move_address },
};
size_t cmdcnt = sizeof(cmdtab) / sizeof(cmdtab[0]);
diff --git a/src/eclat.h b/src/eclat.h
index f314476..d0f47a1 100644
--- a/src/eclat.h
+++ b/src/eclat.h
@@ -135,6 +135,7 @@ int eclat_release_address(eclat_command_env_t *env, int argc, char **argv);
int eclat_associate_address(eclat_command_env_t *env, int argc, char **argv);
int eclat_disassociate_address(eclat_command_env_t *env, int argc, char **argv);
int eclat_describe_addresses(eclat_command_env_t *env, int argc, char **argv);
+int eclat_move_address(eclat_command_env_t *env, int argc, char **argv);
int eclat_describe_volumes(eclat_command_env_t *env, int argc, char **argv);
int eclat_get_console_output(eclat_command_env_t *env, int argc, char **argv);
int eclat_describe_instance_attribute(eclat_command_env_t *env, int argc, char **argv);
diff --git a/src/mvaddr.c b/src/mvaddr.c
new file mode 100644
index 0000000..dbe9986
--- a/dev/null
+++ b/src/mvaddr.c
@@ -0,0 +1,39 @@
+/* This file is part of Eclat.
+ Copyright (C) 2019 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_move_address(eclat_command_env_t *env, int argc, char **argv)
+{
+ int i;
+
+ generic_proginfo->args_doc = "IP";
+ generic_parse_options(env->cmd,
+ strcmp(env->cmd->tag, "MoveAddressToVpc") == 0
+ ? "Move IP address from EC2-Classic to EC2-VPC"
+ : "Restore a VPC address back to EC2-Classic",
+ argc, argv, &i);
+ argc -= i;
+ argv += i;
+
+ if (argc != 1)
+ die(EX_USAGE, "wrong number of arguments to move-address-to-vpc");
+
+ eclat_request_add_param(env->request, "PublicIp", argv[0]);
+
+ return 0;
+}

Return to:

Send suggestions and report system problems to the System administrator.