diff options
-rw-r--r-- | TODO | 2 | ||||
-rw-r--r-- | doc/Makefile.am | 2 | ||||
-rw-r--r-- | doc/eclat-describe-availability-zones.1 | 87 | ||||
-rw-r--r-- | doc/eclat.1 | 4 | ||||
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/dscrazs.c | 56 | ||||
-rw-r--r-- | src/eclat.c | 4 | ||||
-rw-r--r-- | src/eclat.h | 1 | ||||
-rw-r--r-- | tests/Makefile.am | 1 | ||||
-rw-r--r-- | tests/describe-availability-zones.at | 57 | ||||
-rw-r--r-- | tests/testsuite.at | 1 |
11 files changed, 213 insertions, 3 deletions
@@ -70,7 +70,7 @@ DeleteVpnConnectionRoute DELVPNCNCTROUT [ ] [ ] DeleteVpnGateway DELVPNGW [ ] [ ] DeregisterImage DRGIMG [ ] [ ] DescribeAddresses DSCRADRS [X] [X] -DescribeAvailabilityZones DSCRAVAIZONS [ ] [ ] +DescribeAvailabilityZones DSCRAZS [X] [X] DescribeBundleTasks DSCRBUNTSKS [ ] [ ] DescribeConversionTasks DSCRCVRSTSKS [ ] [ ] DescribeCustomerGateways DSCRCUSTGWS [ ] [ ] diff --git a/doc/Makefile.am b/doc/Makefile.am index cf20541..eb56d02 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -16,12 +16,14 @@ MANPAGES1=\ eclat.1\ + eclat-allocate-address.1\ eclat-associate-address.1\ eclat-create-snapshot.1\ eclat-create-tags.1\ eclat-delete-snapshot.1\ eclat-delete-tags.1\ eclat-describe-addresses.1\ + eclat-describe-availability-zones.1\ eclat-describe-instance-attribute.1\ eclat-describe-instance-status.1\ eclat-describe-instances.1\ diff --git a/doc/eclat-describe-availability-zones.1 b/doc/eclat-describe-availability-zones.1 new file mode 100644 index 0000000..6e719ea --- /dev/null +++ b/doc/eclat-describe-availability-zones.1 @@ -0,0 +1,87 @@ +.\" This file is part of Eclat -*- nroff -*- +.\" 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/>. +.TH DESCRIBE\-AVAILABILITY\-ZONES 1 "December 6, 2012" "ECLAT" "Eclat User Reference" +.SH NAME +eclat describe\-availability\-zones \- describe availability zones +.SH SYNOPSIS +eclat describe\-availability\-zones [\fBFILTER\fR...] [\fBZONE\fR...] + +eclat describe\-availability\-zones \fB\-\-help\fR +.SH DESCRIPTION +This command lists availability zones accessible to your account. The +results include zones only for the region you're currently using, as +set by the +.B default-region +configuration file statement or the +.B \-\-region +command line option. +.SH FILTERS +Filters allow you to select only zones matching particular +criteria. The following filters are defined: +.TP +\fBmessage\fR=\fIstring\fR +Information about the Availability Zone. +.TP +\fBregion\-name\fR=\fIstring\fR +The region the Availablity Zone is in. The purpose of this filter +is highly questionable, because you can describe only zones in the +currently selected region anyway. It is, however, included in the AWS +API, so we list it here for completeness sake. +.TP +\fBstate\fR=\fBavailable\fR +Show only available zones. +.TP +\fBzone\-name\fR=\fBstring\fR +Select zone with the given name. It is the same as giving +\fBstring\fR as a command line argument. +.SH OUTPUT +The default output shows at least one line for each zone. Each such +line contains zone name and its status, separated by a single tab +character. +.PP +If there are any messages associated with the zone, these are printed +in subsequent lines. Each message is indented one tab stop. +.SH EXAMPLE +.nf +.sp 2 +$ \fBeclat describe\-availability\-zones\fR +eu-west-1a available +eu-west-1b available +eu-west-1c available +.fi +.SH "SEE ALSO" +.BR eclat (1). +.SH AUTHORS +Sergey Poznyakoff +.SH "BUG REPORTS" +Report bugs to <bug\-eclat@gnu.org.ua>. +.SH COPYRIGHT +Copyright \(co 2012 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.1 b/doc/eclat.1 index 58a67e7..ee04c7a 100644 --- a/doc/eclat.1 +++ b/doc/eclat.1 @@ -13,7 +13,7 @@ .\" .\" 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 1 "December 5, 2012" "ECLAT" "Eclat User Reference" +.TH ECLAT 1 "December 6, 2012" "ECLAT" "Eclat User Reference" .SH NAME eclat \- EC2 Command Line Administrator Tool .SH SYNOPSIS @@ -215,6 +215,7 @@ commands are implemented: .BR delete\-tags , .BR delete\-snapshot , .BR describe\-addresses , +.BR describe\-availability\-zones , .BR describe\-instance\-attribute , .BR describe\-instance\-status , .BR describe\-instances , @@ -432,6 +433,7 @@ from the format file. .BR eclat\-delete\-tags (1), .BR eclat\-delete\-snapshot (1), .BR eclat\-describe\-addresses (1), +.BR eclat\-describe\-availability\-zones (1), .BR eclat\-describe\-instance\-attribute (1), .BR eclat\-describe\-instance\-status (1), .BR eclat\-describe\-instances (1), diff --git a/src/Makefile.am b/src/Makefile.am index 715af98..7f20ba4 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -27,6 +27,7 @@ eclat_SOURCES=\ delsnap.c\ disassaddr.c\ dscraddrs.c\ + dscrazs.c\ dscrsnap.c\ dscrtags.c\ dscrinstattr.c\ diff --git a/src/dscrazs.c b/src/dscrazs.c new file mode 100644 index 0000000..9ddfaaf --- /dev/null +++ b/src/dscrazs.c @@ -0,0 +1,56 @@ +/* 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 void +parse_options(int argc, char *argv[], int *index) +{ + static char *states[] = { + "available", NULL + }; + + static struct filter_descr filters[] = { + { "message", FILTER_STRING }, + { "region-name", FILTER_STRING }, + { "state", FILTER_ENUM, states }, + { "zone-name", FILTER_STRING }, + { NULL } + }; + + available_filters = filters; + generic_proginfo->print_help_hook = list_filters; + generic_proginfo->args_doc = "[ZONE [ZONE...]]"; + return generic_parse_options("eclat describe-availability-zones", + "List availability zones", + argc, argv, index); +} + +int +eclat_describe_avaialbility_zones(CURL *curl, int argc, char **argv) +{ + int i; + struct ec2_query *q; + + parse_options(argc, argv, &i); + argv += i; + argc -= i; + translate_ids(argc, argv, "AZ"); + + q = describe_query_create(curl, "DescribeAvailabilityZones", + argc, argv, "ZoneName"); + return eclat_send_query(curl, q); +} diff --git a/src/eclat.c b/src/eclat.c index e5ea2c1..c6a1fa4 100644 --- a/src/eclat.c +++ b/src/eclat.c @@ -241,7 +241,9 @@ struct command cmdtab[] = { { "describe-snapshots", "DescribeSnapshots", eclat_describe_snapshots }, { "delete-snapshot", "DeleteSnapshot", - eclat_delete_snapshot } + eclat_delete_snapshot }, + { "describe-avaialbility-zones", "DescribeAvaialbilityZones", + eclat_describe_avaialbility_zones }, }; size_t cmdcnt = sizeof(cmdtab) / sizeof(cmdtab[0]); diff --git a/src/eclat.h b/src/eclat.h index 57c624f..94140bb 100644 --- a/src/eclat.h +++ b/src/eclat.h @@ -84,6 +84,7 @@ int eclat_describe_security_groups(CURL *curl, int argc, char **argv); int eclat_create_snapshot(CURL *curl, int argc, char **argv); int eclat_describe_snapshots(CURL *curl, int argc, char **argv); int eclat_delete_snapshot(CURL *curl, int argc, char **argv); +int eclat_describe_avaialbility_zones(CURL *curl, int argc, char **argv); char *region_to_endpoint(const char *region); diff --git a/tests/Makefile.am b/tests/Makefile.am index 816c395..8d12342 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -46,6 +46,7 @@ TESTSUITE_AT = \ decode.at\ delete-snapshot.at\ describe-addresses.at\ + describe-availability-zones.at\ describe-instance-attribute.at\ describe-instance-status.at\ describe-instances.at\ diff --git a/tests/describe-availability-zones.at b/tests/describe-availability-zones.at new file mode 100644 index 0000000..d9c18fc --- /dev/null +++ b/tests/describe-availability-zones.at @@ -0,0 +1,57 @@ +# This file is part of Eclat -*- Autotest -*- +# 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/>. + +ECLAT_TEST_FORMAT([DescribeAvailabilityZones], +[DescribeAvailabilityZones], +[describe-availability-zones.fln], +[<?xml version="1.0" encoding="UTF-8"?> +<DescribeAvailabilityZonesResponse xmlns="http://ec2.amazonaws.com/doc/2012-08-15/"> + <requestId>5f309b29-fbbe-4c56-a319-2e68e0138dcb</requestId> + <availabilityZoneInfo> + <item> + <zoneName>eu-west-1a</zoneName> + <zoneState>available</zoneState> + <regionName>eu-west-1</regionName> + <messageSet/> + </item> + <item> + <zoneName>eu-west-1b</zoneName> + <zoneState>available</zoneState> + <regionName>eu-west-1</regionName> + <messageSet> + <item> + <message>Message text 1</message> + </item> + <item> + <message>Message text 2</message> + </item> + </messageSet> + </item> + <item> + <zoneName>eu-west-1c</zoneName> + <zoneState>available</zoneState> + <regionName>eu-west-1</regionName> + <messageSet/> + </item> + </availabilityZoneInfo> +</DescribeAvailabilityZonesResponse> +], +[eu-west-1a available +eu-west-1b available + "Message text 1" + "Message text 2" +eu-west-1c available +])
\ No newline at end of file diff --git a/tests/testsuite.at b/tests/testsuite.at index 79d370e..65e1d99 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -60,6 +60,7 @@ m4_include([associate-address.at]) m4_include([create-snapshot.at]) m4_include([delete-snapshot.at]) m4_include([describe-addresses.at]) +m4_include([describe-availability-zones.at]) m4_include([describe-instance-attribute.at]) m4_include([describe-instance-status.at]) m4_include([describe-instances.at]) |