From 858fef585e97f210378ca40b2287a78ced74c0de Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Thu, 19 Nov 2015 13:26:52 +0200 Subject: New commands: assocrtab, mkrtab, rmrtab, lsrtab, disasrtab, route These implement the following EC2 actions: AssociateRouteTable, CreateRoute, CreateRouteTable, DeleteRoute, DeleteRouteTable, DescribeRouteTables, DisassociateRouteTable, ReplaceRoute. * TODO: Update. * etc/Makefile.am: Add new formats. * etc/associate-route-table.fln: New file. * etc/create-route-table.fln: New file. * etc/create-route.fln: New file. * etc/delete-route-table.fln: New file. * etc/delete-route.fln: New file. * etc/describe-route-tables.fln: New file. * etc/disassociate-route-table.fln: New file. * etc/replace-route.fln: New file. * etc/route.fln: New file. * src/Makefile.am: Add routetable.c * src/routetable.c: New file. * src/eclat.c (cmdtab): Register new subcommands. * src/eclat.h (ECLAT_DEBCAT_DUMP): New category. Add new protos. * src/io.c (write_callback): Enable XML dump if dump debug category is set. --- etc/Makefile.am | 9 +++++++++ etc/associate-route-table.fln | 19 +++++++++++++++++++ etc/create-route-table.fln | 28 +++++++++++++++++++++++++++ etc/create-route.fln | 22 +++++++++++++++++++++ etc/delete-route-table.fln | 22 +++++++++++++++++++++ etc/delete-route.fln | 22 +++++++++++++++++++++ etc/describe-route-tables.fln | 41 ++++++++++++++++++++++++++++++++++++++++ etc/disassociate-route-table.fln | 20 ++++++++++++++++++++ etc/replace-route.fln | 22 +++++++++++++++++++++ etc/route.fln | 33 ++++++++++++++++++++++++++++++++ 10 files changed, 238 insertions(+) create mode 100644 etc/associate-route-table.fln create mode 100644 etc/create-route-table.fln create mode 100644 etc/create-route.fln create mode 100644 etc/delete-route-table.fln create mode 100644 etc/delete-route.fln create mode 100644 etc/describe-route-tables.fln create mode 100644 etc/disassociate-route-table.fln create mode 100644 etc/replace-route.fln create mode 100644 etc/route.fln (limited to 'etc') diff --git a/etc/Makefile.am b/etc/Makefile.am index dfb87cc..07e1d5b 100644 --- a/etc/Makefile.am +++ b/etc/Makefile.am @@ -21,10 +21,13 @@ FLNFILES=\ attach-internet-gateway.fln\ attach-volume.fln\ associate-address.fln\ + associate-route-table.fln\ copy-image.fln\ copy-snapshot.fln\ create-image.fln\ create-internet-gateway.fln\ + create-route.fln\ + create-route-table.fln\ create-security-group.fln\ create-snapshot.fln\ create-subnet.fln\ @@ -32,6 +35,8 @@ FLNFILES=\ create-volume.fln\ create-vpc.fln\ delete-internet-gateway.fln\ + delete-route.fln\ + delete-route-table.fln\ delete-security-group.fln\ delete-subnet.fln\ delete-snapshot.fln\ @@ -48,6 +53,7 @@ FLNFILES=\ describe-instance-status.fln\ describe-instances.fln\ describe-regions.fln\ + describe-route-tables.fln\ describe-security-groups.fln\ describe-snapshot-attribute.fln\ describe-snapshots.fln\ @@ -59,6 +65,7 @@ FLNFILES=\ detach-internet-gateway.fln\ detach-volume.fln\ disassociate-address.fln\ + disassociate-route-table.fln\ get-console-output.fln\ lsattr.fln\ modify-image-attribute.fln\ @@ -68,6 +75,8 @@ FLNFILES=\ modify-vpc-attribute.fln\ reboot-instances.fln\ release-address.fln\ + replace-route.fln\ + route.fln\ reset-snapshot-attribute.fln\ run-instances.fln\ sg.fln\ diff --git a/etc/associate-route-table.fln b/etc/associate-route-table.fln new file mode 100644 index 0000000..2bb2557 --- /dev/null +++ b/etc/associate-route-table.fln @@ -0,0 +1,19 @@ +/* This file is part of Eclat. + Copyright (C) 2012-2015 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 . */ + +if (.AssociateRouteTableResponse.associationId) { + print(last, "\n"); +} diff --git a/etc/create-route-table.fln b/etc/create-route-table.fln new file mode 100644 index 0000000..a669c0d --- /dev/null +++ b/etc/create-route-table.fln @@ -0,0 +1,28 @@ +/* This file is part of Eclat. + Copyright (C) 2012-2015 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 . */ + +if (.CreateRouteTableResponse.routeTable) { + let tab = .CreateRouteTableResponse.routeTable; + if (empty(tab.routeSet)) { + print(tab.routeTableId, "\t", tab.vpcId, "\n"); + } else { + for (rs in tab.routeSet.item) { + print(tab.routeTableId, "\t", tab.vpcId, "\t", + rs.destinationCidrBlock, "\t", rs.gatewayId, "\t", + rs.state, "\n"); + } + } +} diff --git a/etc/create-route.fln b/etc/create-route.fln new file mode 100644 index 0000000..70e8bed --- /dev/null +++ b/etc/create-route.fln @@ -0,0 +1,22 @@ +/* This file is part of Eclat. + Copyright (C) 2012-2015 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 . */ + +if (.CreateRouteResponse.return) { + if (!.CreateRouteResponse.return[true]) { + error("Return: ",.CreateRouteResponse.return,"\n"); + exit(1); + } +} diff --git a/etc/delete-route-table.fln b/etc/delete-route-table.fln new file mode 100644 index 0000000..4b20b7d --- /dev/null +++ b/etc/delete-route-table.fln @@ -0,0 +1,22 @@ +/* This file is part of Eclat. + Copyright (C) 2012-2015 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 . */ + +if (.DeleteRouteTableResponse.return) { + if (!.DeleteRouteTableResponse.return[true]) { + error("Return: ",.DeleteRouteTableResponse.return,"\n"); + exit(1); + } +} diff --git a/etc/delete-route.fln b/etc/delete-route.fln new file mode 100644 index 0000000..666b425 --- /dev/null +++ b/etc/delete-route.fln @@ -0,0 +1,22 @@ +/* This file is part of Eclat. + Copyright (C) 2012-2015 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 . */ + +if (.DeleteRouteResponse.return) { + if (!.DeleteRouteResponse.return[true]) { + error("Return: ",.DeleteRouteResponse.return,"\n"); + exit(1); + } +} diff --git a/etc/describe-route-tables.fln b/etc/describe-route-tables.fln new file mode 100644 index 0000000..5004416 --- /dev/null +++ b/etc/describe-route-tables.fln @@ -0,0 +1,41 @@ +/* This file is part of Eclat. + Copyright (C) 2012-2015 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 . */ + +if (.DescribeRouteTablesResponse.routeTableSet) { + let rts = .DescribeRouteTablesResponse.routeTableSet; + for (routetab in rts.item) { + for (route in routetab.routeSet.item) { + print(routetab.routeTableId, "\t", routetab.vpcId, "\t", + "R", "\t", + route.destinationCidrBlock, "\t", + route.gatewayId, "\t", + route.state, "\t", + route.origin, "\n"); + } + } + for (routetab in rts.item) { + for (assoc in routetab.associationSet.item) { + if (assoc.subnetId) { + print(routetab.routeTableId, "\t", routetab.vpcId, "\t", + "A", "\t", + assoc.routeTableAssociationId, "\t", + assoc.routeTableId, "\t", + assoc.subnetId, "\t", + assoc.main, "\n"); + } + } + } +} diff --git a/etc/disassociate-route-table.fln b/etc/disassociate-route-table.fln new file mode 100644 index 0000000..bab6087 --- /dev/null +++ b/etc/disassociate-route-table.fln @@ -0,0 +1,20 @@ +/* This file is part of Eclat. + Copyright (C) 2012-2015 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 . */ + +if (.DisassociateRouteTableResponse.return) { + if (!.DisassociateRouteTableResponse.return[true]) + error("Return: ",.DisassociateRouteTableResponse.return,"\n"); +} diff --git a/etc/replace-route.fln b/etc/replace-route.fln new file mode 100644 index 0000000..95aea1e --- /dev/null +++ b/etc/replace-route.fln @@ -0,0 +1,22 @@ +/* This file is part of Eclat. + Copyright (C) 2012-2015 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 . */ + +if (.ReplaceRouteResponse.return) { + if (!.ReplaceRouteResponse.return[true]) { + error("Return: ",.ReplaceRouteResponse.return,"\n"); + exit(1); + } +} diff --git a/etc/route.fln b/etc/route.fln new file mode 100644 index 0000000..e5f0983 --- /dev/null +++ b/etc/route.fln @@ -0,0 +1,33 @@ +/* This file is part of Eclat. + Copyright (C) 2012-2015 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 . */ + +if (.CreateRouteResponse.return) { + if (!.CreateRouteResponse.return[true]) { + error("Return: ",.CreateRouteResponse.return,"\n"); + exit(1); + } +} else if (.DeleteRouteResponse.return) { + if (!.DeleteRouteResponse.return[true]) { + error("Return: ",.DeleteRouteResponse.return,"\n"); + exit(1); + } +} else if (.ReplaceRouteResponse.return) { + if (!.ReplaceRouteResponse.return[true]) { + error("Return: ",.ReplaceRouteResponse.return,"\n"); + exit(1); + } +} + -- cgit v1.2.1