summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--TODO2
-rw-r--r--doc/Makefile.inc1
-rw-r--r--doc/eclat-mkinst.15
-rw-r--r--doc/eclat-reboot.14
-rw-r--r--doc/eclat-terminate.158
-rw-r--r--etc/Makefile.am3
-rw-r--r--etc/terminate-instances.fln23
-rw-r--r--src/eclat.c4
-rw-r--r--src/eclat.h1
-rw-r--r--src/startstop.c14
-rw-r--r--tests/Makefile.am1
-rw-r--r--tests/terminate-instances.at39
-rw-r--r--tests/testsuite.at1
13 files changed, 149 insertions, 7 deletions
diff --git a/TODO b/TODO
index 4fa62d9..3e45bda 100644
--- a/TODO
+++ b/TODO
@@ -151,7 +151,7 @@ RevokeSecurityGroupIngress sg [X] [X]
151RunInstances mkinst [X] [X] 151RunInstances mkinst [X] [X]
152StartInstances start [X] [X] 152StartInstances start [X] [X]
153StopInstances stop [X] [X] 153StopInstances stop [X] [X]
154TerminateInstances killinst [ ] [ ] 154TerminateInstances terminate [X] [X]
155UnassignPrivateIpAddresses - [ ] [ ] 155UnassignPrivateIpAddresses - [ ] [ ]
156UnmonitorInstances - [ ] [ ] 156UnmonitorInstances - [ ] [ ]
157 157
diff --git a/doc/Makefile.inc b/doc/Makefile.inc
index 143f579..43b62b3 100644
--- a/doc/Makefile.inc
+++ b/doc/Makefile.inc
@@ -61,6 +61,7 @@ MANPAGES1=\
61 eclat-sg.1\ 61 eclat-sg.1\
62 eclat-start.1\ 62 eclat-start.1\
63 eclat-stop.1\ 63 eclat-stop.1\
64 eclat-terminate.1\
64 ispeek.1 65 ispeek.1
65 66
66MANPAGES5=\ 67MANPAGES5=\
diff --git a/doc/eclat-mkinst.1 b/doc/eclat-mkinst.1
index f934484..4db3c7e 100644
--- a/doc/eclat-mkinst.1
+++ b/doc/eclat-mkinst.1
@@ -13,7 +13,7 @@
13.\" 13.\"
14.\" You should have received a copy of the GNU General Public License 14.\" You should have received a copy of the GNU General Public License
15.\" along with Eclat. If not, see <http://www.gnu.org/licenses/>. 15.\" along with Eclat. If not, see <http://www.gnu.org/licenses/>.
16.TH ECLAT-MKINST 1 "January 26, 2015" "ECLAT" "Eclat User Reference" 16.TH ECLAT-MKINST 1 "November 17, 2018" "ECLAT" "Eclat User Reference"
17.SH NAME 17.SH NAME
18eclat-mkinst, eclat-run-instances \- launch new EC2 instances 18eclat-mkinst, eclat-run-instances \- launch new EC2 instances
19.SH SYNOPSIS 19.SH SYNOPSIS
@@ -166,6 +166,7 @@ instance in the same format as the
166command 166command
167.SH "SEE ALSO" 167.SH "SEE ALSO"
168.BR eclat (1), 168.BR eclat (1),
169.BR eclat\-terminate (1),
169.BR eclat\-lsiattr (1), 170.BR eclat\-lsiattr (1),
170.BR eclat\-lsinst (1), 171.BR eclat\-lsinst (1),
171.BR eclat\-lsistat (1), 172.BR eclat\-lsistat (1),
@@ -178,7 +179,7 @@ Sergey Poznyakoff
178.SH "BUG REPORTS" 179.SH "BUG REPORTS"
179Report bugs to <bug\-eclat@gnu.org.ua>. 180Report bugs to <bug\-eclat@gnu.org.ua>.
180.SH COPYRIGHT 181.SH COPYRIGHT
181Copyright \(co 2012-2015 Sergey Poznyakoff 182Copyright \(co 2012-2018 Sergey Poznyakoff
182.br 183.br
183.na 184.na
184License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> 185License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
diff --git a/doc/eclat-reboot.1 b/doc/eclat-reboot.1
index 1addd87..d234808 100644
--- a/doc/eclat-reboot.1
+++ b/doc/eclat-reboot.1
@@ -13,7 +13,7 @@
13.\" 13.\"
14.\" You should have received a copy of the GNU General Public License 14.\" You should have received a copy of the GNU General Public License
15.\" along with Eclat. If not, see <http://www.gnu.org/licenses/>. 15.\" along with Eclat. If not, see <http://www.gnu.org/licenses/>.
16.TH ECLAT-REBOOT 1 "January 26, 2015" "ECLAT" "Eclat User Reference" 16.TH ECLAT-REBOOT 1 "November 17, 2018" "ECLAT" "Eclat User Reference"
17.SH NAME 17.SH NAME
18eclat-reboot, eclat-reboot-instances \- reboot EC2 instances 18eclat-reboot, eclat-reboot-instances \- reboot EC2 instances
19.SH SYNOPSIS 19.SH SYNOPSIS
@@ -29,7 +29,7 @@ The command
29.B reboot 29.B reboot
30reboots running Amazon EBS-backed instances. 30reboots running Amazon EBS-backed instances.
31.SH OUTPUT 31.SH OUTPUT
32The default output format lists o each line the instance ID, its 32The default output format lists on each line the instance ID, its
33previous and current states, separated by single horizontal tab 33previous and current states, separated by single horizontal tab
34characters. 34characters.
35.SH "SEE ALSO" 35.SH "SEE ALSO"
diff --git a/doc/eclat-terminate.1 b/doc/eclat-terminate.1
new file mode 100644
index 0000000..a70a1ee
--- a/dev/null
+++ b/doc/eclat-terminate.1
@@ -0,0 +1,58 @@
1.\" This file is part of Eclat -*- nroff -*-
2.\" Copyright (C) 2012-2018 Sergey Poznyakoff
3.\"
4.\" Eclat is free software; you can redistribute it and/or modify
5.\" it under the terms of the GNU General Public License as published by
6.\" the Free Software Foundation; either version 3, or (at your option)
7.\" any later version.
8.\"
9.\" Eclat is distributed in the hope that it will be useful,
10.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
11.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12.\" GNU General Public License for more details.
13.\"
14.\" You should have received a copy of the GNU General Public License
15.\" along with Eclat. If not, see <http://www.gnu.org/licenses/>.
16.TH ECLAT-TERMINATE 1 "November 17, 2018" "ECLAT" "Eclat User Reference"
17.SH NAME
18eclat-terminate, eclat-terminate-instances \- terminate EC2 instances
19.SH SYNOPSIS
20.nh
21.na
22\fBeclat terminate\fR \fIID\fR [\fIID\fR...]
23.PP
24\fBeclat terminate\fR \fB\-\-help\fR
25.ad
26.hy
27.SH DESCRIPTION
28Terminates the listed Amazon EBS-backed instances.
29.SH OUTPUT
30The default output format lists on each line the instance ID, its
31previous and current states, separated by single horizontal tab
32characters.
33.SH "SEE ALSO"
34.BR eclat (1),
35.BR eclat\-mkinst (1),
36.BR eclat\-start (1),
37.BR eclat\-stop (1).
38.SH AUTHORS
39Sergey Poznyakoff
40.SH "BUG REPORTS"
41Report bugs to <bug\-eclat@gnu.org.ua>.
42.SH COPYRIGHT
43Copyright \(co 2012-2018 Sergey Poznyakoff
44.br
45.na
46License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
47.br
48.ad
49This is free software: you are free to change and redistribute it.
50There is NO WARRANTY, to the extent permitted by law.
51.\" Local variables:
52.\" eval: (add-hook 'write-file-hooks 'time-stamp)
53.\" time-stamp-start: ".TH [A-Z_][A-Z0-9_.\\-]* [0-9] \""
54.\" time-stamp-format: "%:B %:d, %:y"
55.\" time-stamp-end: "\""
56.\" time-stamp-line-limit: 20
57.\" end:
58
diff --git a/etc/Makefile.am b/etc/Makefile.am
index 21b958b..2376583 100644
--- a/etc/Makefile.am
+++ b/etc/Makefile.am
@@ -81,7 +81,8 @@ FLNFILES=\
81 run-instances.fln\ 81 run-instances.fln\
82 sg.fln\ 82 sg.fln\
83 start-instances.fln\ 83 start-instances.fln\
84 stop-instances.fln 84 stop-instances.fln\
85 terminate-instances.fln
85 86
86EXTRA_DIST=$(FLNFILES) default.fln eclat.cfin 87EXTRA_DIST=$(FLNFILES) default.fln eclat.cfin
87 88
diff --git a/etc/terminate-instances.fln b/etc/terminate-instances.fln
new file mode 100644
index 0000000..12995c3
--- a/dev/null
+++ b/etc/terminate-instances.fln
@@ -0,0 +1,23 @@
1/* This file is part of Eclat.
2 Copyright (C) 2012-2018 Sergey Poznyakoff.
3
4 Eclat is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3, or (at your option)
7 any later version.
8
9 Eclat is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with Eclat. If not, see <http://www.gnu.org/licenses/>. */
16
17if (.TerminateInstancesResponse) {
18 for (var in .TerminateInstancesResponse.instancesSet.item) {
19 print(var.instanceId,": ",
20 var.previousState.name," => ",
21 var.currentState.name,"\n");
22 }
23}
diff --git a/src/eclat.c b/src/eclat.c
index 12b4dd1..26a8f9f 100644
--- a/src/eclat.c
+++ b/src/eclat.c
@@ -90,6 +90,9 @@ struct eclat_command cmdtab[] = {
90 CMD_MOD }, 90 CMD_MOD },
91 { "reboot", "reboot-instances", "RebootInstances", eclat_reboot_instance, 91 { "reboot", "reboot-instances", "RebootInstances", eclat_reboot_instance,
92 CMD_MOD }, 92 CMD_MOD },
93 { "terminate", "terminate-instances", "TerminateInstances",
94 eclat_terminate_instances, CMD_MOD|CMD_DESTR },
95
93 { "lsaddr", "describe-addresses", "DescribeAddresses", 96 { "lsaddr", "describe-addresses", "DescribeAddresses",
94 eclat_describe_addresses }, 97 eclat_describe_addresses },
95 { "lstag", "describe-tags", "DescribeTags", eclat_describe_tags }, 98 { "lstag", "describe-tags", "DescribeTags", eclat_describe_tags },
@@ -205,6 +208,7 @@ struct eclat_command cmdtab[] = {
205 { "disasrtab", "disassociate-route-table", "DisassociateRouteTable", 208 { "disasrtab", "disassociate-route-table", "DisassociateRouteTable",
206 eclat_disassociate_route_table, CMD_MOD }, 209 eclat_disassociate_route_table, CMD_MOD },
207 { "route", NULL, NULL, eclat_route }, 210 { "route", NULL, NULL, eclat_route },
211
208}; 212};
209size_t cmdcnt = sizeof(cmdtab) / sizeof(cmdtab[0]); 213size_t cmdcnt = sizeof(cmdtab) / sizeof(cmdtab[0]);
210 214
diff --git a/src/eclat.h b/src/eclat.h
index 21e89e1..1948234 100644
--- a/src/eclat.h
+++ b/src/eclat.h
@@ -126,6 +126,7 @@ int eclat_trace_fun(CURL *handle, curl_infotype type,
126int eclat_start_instance(eclat_command_env_t *env, int argc, char **argv); 126int eclat_start_instance(eclat_command_env_t *env, int argc, char **argv);
127int eclat_stop_instance(eclat_command_env_t *env, int argc, char **argv); 127int eclat_stop_instance(eclat_command_env_t *env, int argc, char **argv);
128int eclat_reboot_instance(eclat_command_env_t *env, int argc, char **argv); 128int eclat_reboot_instance(eclat_command_env_t *env, int argc, char **argv);
129int eclat_terminate_instances(eclat_command_env_t *env, int argc, char **argv);
129int eclat_describe_tags(eclat_command_env_t *env, int argc, char **argv); 130int eclat_describe_tags(eclat_command_env_t *env, int argc, char **argv);
130int eclat_describe_instance_status(eclat_command_env_t *env, int argc, char **argv); 131int eclat_describe_instance_status(eclat_command_env_t *env, int argc, char **argv);
131int eclat_describe_instances(eclat_command_env_t *env, int argc, char **argv); 132int eclat_describe_instances(eclat_command_env_t *env, int argc, char **argv);
diff --git a/src/startstop.c b/src/startstop.c
index 2460682..78c581c 100644
--- a/src/startstop.c
+++ b/src/startstop.c
@@ -44,7 +44,6 @@ start_stop_instance(eclat_command_env_t *env, int argc, char **argv)
44 snprintf(bend, bs, "%lu", (unsigned long)(i + 1)); 44 snprintf(bend, bs, "%lu", (unsigned long)(i + 1));
45 eclat_request_add_param(q, buf, argv[i]); 45 eclat_request_add_param(q, buf, argv[i]);
46 } 46 }
47
48 return 0; 47 return 0;
49} 48}
50 49
@@ -90,3 +89,16 @@ eclat_reboot_instance(eclat_command_env_t *env, int argc, char **argv)
90 debug(ECLAT_DEBCAT_MAIN, 1, ("rebooting instances")); 89 debug(ECLAT_DEBCAT_MAIN, 1, ("rebooting instances"));
91 return start_stop_instance(env, argc - i, argv + i); 90 return start_stop_instance(env, argc - i, argv + i);
92} 91}
92
93int
94eclat_terminate_instances(eclat_command_env_t *env, int argc, char **argv)
95{
96 int i;
97
98 parse_options(env->cmd,
99 "Terminate named instances",
100 argc, argv, &i);
101
102 debug(ECLAT_DEBCAT_MAIN, 1, ("terminate instances"));
103 return start_stop_instance(env, argc - i, argv + i);
104}
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 61046ba..36927c7 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -84,6 +84,7 @@ TESTSUITE_AT = \
84 sortts.at\ 84 sortts.at\
85 start-instances.at\ 85 start-instances.at\
86 stop-instances.at\ 86 stop-instances.at\
87 terminate-instances.at\
87 tagshairy.at\ 88 tagshairy.at\
88 testsuite.at\ 89 testsuite.at\
89 urlenc01.at\ 90 urlenc01.at\
diff --git a/tests/terminate-instances.at b/tests/terminate-instances.at
new file mode 100644
index 0000000..7242986
--- a/dev/null
+++ b/tests/terminate-instances.at
@@ -0,0 +1,39 @@
1# This file is part of Eclat -*- Autotest -*-
2# Copyright (C) 2012-2018 Sergey Poznyakoff
3#
4# Eclat is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation; either version 3, or (at your option)
7# any later version.
8#
9# Eclat is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with Eclat. If not, see <http://www.gnu.org/licenses/>.
16
17ECLAT_TEST_FORMAT([TerminateInstances],
18[TerminateInstances],
19[terminate-instances.fln],
20[<TerminateInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2016-11-15/">
21 <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
22 <instancesSet>
23 <item>
24 <instanceId>i-1234567890abcdef0</instanceId>
25 <currentState>
26 <code>32</code>
27 <name>shutting-down</name>
28 </currentState>
29 <previousState>
30 <code>16</code>
31 <name>running</name>
32 </previousState>
33 </item>
34 </instancesSet>
35</TerminateInstancesResponse>
36],
37[i-1234567890abcdef0: running => shutting-down
38])
39
diff --git a/tests/testsuite.at b/tests/testsuite.at
index 6583b89..0d25b97 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -78,6 +78,7 @@ m4_include([describe-volumes.at])
78m4_include([get-console-output.at]) 78m4_include([get-console-output.at])
79m4_include([start-instances.at]) 79m4_include([start-instances.at])
80m4_include([stop-instances.at]) 80m4_include([stop-instances.at])
81m4_include([terminate-instances.at])
81 82
82AT_BANNER([Sort]) 83AT_BANNER([Sort])
83m4_include([sortstring.at]) 84m4_include([sortstring.at])

Return to:

Send suggestions and report system problems to the System administrator.