diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2019-11-26 14:09:09 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2019-11-26 14:09:09 +0200 |
commit | 0f78a1684e0119adceba8e9fd99a8bc33fa826b1 (patch) | |
tree | 8ad56bbc1d748f4fa2fc8af6a0b7522ee3723735 | |
parent | ce1af46af7a84d061676ede08dab2a0be3fadbaf (diff) | |
download | eclat-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.
-rw-r--r-- | TODO | 2 | ||||
-rw-r--r-- | doc/Makefile.inc | 4 | ||||
-rw-r--r-- | doc/eclat-addr2ec2.1 | 66 | ||||
-rw-r--r-- | doc/eclat-addr2vpc.1 | 59 | ||||
-rw-r--r-- | etc/Makefile.am | 2 | ||||
-rw-r--r-- | etc/describe-images.fln | 1 | ||||
-rw-r--r-- | etc/move-address-to-vpc.fln | 23 | ||||
-rw-r--r-- | etc/restore-address-to-classic.fln | 22 | ||||
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/eclat.c | 6 | ||||
-rw-r--r-- | src/eclat.h | 1 | ||||
-rw-r--r-- | src/mvaddr.c | 39 |
12 files changed, 224 insertions, 2 deletions
@@ -136,2 +136,3 @@ ModifyVpcAttribute setvpcattr [X] [ ] MonitorInstances - [ ] [ ] +MoveAddressToVpc addr2vpc [X] [X] PurchaseReservedInstancesOffering - [ ] [ ] @@ -150,2 +151,3 @@ ResetNetworkInterfaceAttribute - [ ] [ ] ResetSnapshotAttribute clrsattr [X] [X] +RestoreAddressToClassic addr2ec2 [X] [X] RevokeSecurityGroupEgress sg [X] [X] diff --git a/doc/Makefile.inc b/doc/Makefile.inc index e55c607..ab6c2a7 100644 --- a/doc/Makefile.inc +++ b/doc/Makefile.inc @@ -1,3 +1,3 @@ # This file is part of Eclat -*- Makefile -*- -# Copyright (C) 2012-2018 Sergey Poznyakoff +# Copyright (C) 2012-2019 Sergey Poznyakoff # @@ -22,2 +22,4 @@ MANPAGES1=\ eclat.1\ + eclat-addr2ec2.1\ + eclat-addr2vpc.1\ eclat-assocaddr.1\ diff --git a/doc/eclat-addr2ec2.1 b/doc/eclat-addr2ec2.1 new file mode 100644 index 0000000..983fc8f --- /dev/null +++ b/doc/eclat-addr2ec2.1 @@ -0,0 +1,66 @@ +.\" This file is part of Eclat -*- nroff -*- +.\" Copyright (C) 2012-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/>. +.TH ECLAT-ADDR2EC2 1 "November 26, 2019" "ECLAT" "Eclat User Reference" +.SH NAME +eclat-addr2ec2 \- Move VPC IP address back to EC2 Classic +.SH SYNOPSIS +.nh +.na +\fBeclat addr2ec2\fR \fIIP\fR +.PP +\fBeclat restore-address-to-classic\fR \fIIP\fR +.PP +\fBeclat addr2ec2\fR \fB\-\-help\fR +.ad +.hy +.SH DESCRIPTION +Restores an Elastic IP address that was previously moved to the +EC2-VPC platform back to the EC2-Classic platform (addresses are +moved to EC2-VPC using the +.BR eclat\-addr2vpc (1) +command). +You cannot move an +Elastic IP address that was originally allocated for use in +EC2-VPC. The Elastic IP address must not be associated with an +instance or network interface. +.PP +.PP +To move the address back to EC2 classic, use +.BR "eclat addr2ec2". +.SH "SEE ALSO" +.BR eclat (1), +.BR eclat\-addr2vpc (1). +.SH AUTHORS +Sergey Poznyakoff +.SH "BUG REPORTS" +Report bugs to <bug\-eclat@gnu.org.ua>. +.SH COPYRIGHT +Copyright \(co 2012-2019 Sergey Poznyakoff +.br +.na +License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> +.br +.ad +This is free software: you are free to change and redistribute it. +There is NO WARRANTY, to the extent permitted by law. +.\" Local variables: +.\" eval: (add-hook 'write-file-hooks 'time-stamp) +.\" time-stamp-start: ".TH [A-Z_][A-Z0-9_.\\-]* [0-9] \"" +.\" time-stamp-format: "%:B %:d, %:y" +.\" time-stamp-end: "\"" +.\" time-stamp-line-limit: 20 +.\" end: + diff --git a/doc/eclat-addr2vpc.1 b/doc/eclat-addr2vpc.1 new file mode 100644 index 0000000..dec6bda --- /dev/null +++ b/doc/eclat-addr2vpc.1 @@ -0,0 +1,59 @@ +.\" This file is part of Eclat -*- nroff -*- +.\" Copyright (C) 2012-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/>. +.TH ECLAT-ADDR2VPC 1 "November 26, 2019" "ECLAT" "Eclat User Reference" +.SH NAME +eclat-addr2vpc \- Move IP address from EC2 to EC2-VPC +.SH SYNOPSIS +.nh +.na +\fBeclat addr2vpc\fR \fIIP\fR +.PP +\fBeclat move-address-to-vpc\fR \fIIP\fR +.PP +\fBeclat addr2vpc\fR \fB\-\-help\fR +.ad +.hy +.SH DESCRIPTION +Moves the Elastic IP address \fIIP\fR from the EC2-Classic platform to +the EC2-VPC platform. \fIIP\fR must be allocated to your account for +more than 24 hours, and it must not be associated with an instance. +.PP +To move the address back to EC2 classic, use +.BR "eclat addr2ec2". +.SH "SEE ALSO" +.BR eclat (1), +.BR eclat\-addr2ec2 (1). +.SH AUTHORS +Sergey Poznyakoff +.SH "BUG REPORTS" +Report bugs to <bug\-eclat@gnu.org.ua>. +.SH COPYRIGHT +Copyright \(co 2012-2019 Sergey Poznyakoff +.br +.na +License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> +.br +.ad +This is free software: you are free to change and redistribute it. +There is NO WARRANTY, to the extent permitted by law. +.\" Local variables: +.\" eval: (add-hook 'write-file-hooks 'time-stamp) +.\" time-stamp-start: ".TH [A-Z_][A-Z0-9_.\\-]* [0-9] \"" +.\" time-stamp-format: "%:B %:d, %:y" +.\" time-stamp-end: "\"" +.\" time-stamp-line-limit: 20 +.\" end: + diff --git a/etc/Makefile.am b/etc/Makefile.am index 7d0b355..d508fbf 100644 --- a/etc/Makefile.am +++ b/etc/Makefile.am @@ -77,2 +77,3 @@ FLNFILES=\ modify-vpc-attribute.fln\ + move-address-to-vpc.fln\ reboot-instances.fln\ @@ -80,2 +81,3 @@ FLNFILES=\ replace-route.fln\ + restore-address-to-classic.fln\ route.fln\ diff --git a/etc/describe-images.fln b/etc/describe-images.fln index ac2fc79..01ebd5f 100644 --- a/etc/describe-images.fln +++ b/etc/describe-images.fln @@ -19,2 +19,3 @@ if (.DescribeImagesResponse.imagesSet) { print("\nImage ID: ", var.imageId, "\n"); + print("\tCreated on: ", var.creationDate, "\n"); print("\tName: ", var.name, "\n"); diff --git a/etc/move-address-to-vpc.fln b/etc/move-address-to-vpc.fln new file mode 100644 index 0000000..24dab40 --- /dev/null +++ b/etc/move-address-to-vpc.fln @@ -0,0 +1,23 @@ +/* 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/>. */ + +if (.MoveAddressToVpcResponse.status) { + print(.MoveAddressToVpcResponse.status); + if (.MoveAddressToVpcResponse.allocationId) + print("\t", .MoveAddressToVpcResponse.allocationId); + print("\n"); +} + diff --git a/etc/restore-address-to-classic.fln b/etc/restore-address-to-classic.fln new file mode 100644 index 0000000..4750d63 --- /dev/null +++ b/etc/restore-address-to-classic.fln @@ -0,0 +1,22 @@ +/* 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/>. */ + +if (.RestoreAddressToClassicResponse.status) { + print(.RestoreAddressToClassicResponse.status); + if (.RestoreAddressToClassicResponse.publicIp) + print("\t", .RestoreAddressToClassicResponse.publicIp); + print("\n"); +} diff --git a/src/Makefile.am b/src/Makefile.am index c4fc211..637beb2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -62,2 +62,3 @@ eclat_SOURCES=\ mkvpc.c\ + mvaddr.c\ rmaddr.c\ diff --git a/src/eclat.c b/src/eclat.c index 43387be..1c87314 100644 --- a/src/eclat.c +++ b/src/eclat.c @@ -213,3 +213,7 @@ struct eclat_command cmdtab[] = { { "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 }, }; diff --git a/src/eclat.h b/src/eclat.h index f314476..d0f47a1 100644 --- a/src/eclat.h +++ b/src/eclat.h @@ -137,2 +137,3 @@ 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); diff --git a/src/mvaddr.c b/src/mvaddr.c new file mode 100644 index 0000000..dbe9986 --- /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; +} |