aboutsummaryrefslogtreecommitdiff
path: root/src/lsimg-cl.opt
diff options
context:
space:
mode:
Diffstat (limited to 'src/lsimg-cl.opt')
-rw-r--r--src/lsimg-cl.opt104
1 files changed, 104 insertions, 0 deletions
diff --git a/src/lsimg-cl.opt b/src/lsimg-cl.opt
new file mode 100644
index 0000000..a176e60
--- /dev/null
+++ b/src/lsimg-cl.opt
@@ -0,0 +1,104 @@
+/* This file is part of Eclat.
+ Copyright (C) 2013 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/>. */
+
+static int owner_n;
+static int xby_n;
+
+OPTIONS_BEGIN("eclat describe-images",
+ [<describe Amazon images>],
+ [<[FILTER...] [AMI...]>],
+ [<gnu>],
+ [<nousage>],
+ [<noversion>])
+
+OPTION(all,a,,
+ [<describe all images>])
+BEGIN
+ grecs_asprintf(&bufptr, &bufsize, "Owner.%d", ++owner_n);
+ eclat_query_add_param(q, bufptr, "all");
+END
+
+OPTION(owner,u,[<ID|amazon|aws-marketplace|self|all>],
+ [<select AMIs with a particular owner>])
+BEGIN
+ grecs_asprintf(&bufptr, &bufsize, "Owner.%d", ++owner_n);
+ eclat_query_add_param(q, bufptr, optarg);
+END
+
+OPTION(executable-by, x, [<ID|all|self>],
+ [<select images executable by the given user>])
+BEGIN
+ grecs_asprintf(&bufptr, &bufsize, "ExecutableBy.%d", ++xby_n);
+ eclat_query_add_param(q, bufptr, optarg);
+END
+
+OPTIONS_END
+
+static void
+parse_options(struct ec2_query *q, int argc, char *argv[], int *idx)
+{
+ char *bufptr = NULL;
+ size_t bufsize = 0;
+ static char *arch[] = { "i386", "x86_64", NULL };
+ static char *voltype[] = { "standard", "io1", NULL };
+ static char *imgtype[] = { "machine", "kernel", "ramdisk", NULL };
+ static char *prodcode[] = { "devpay", "marketplace", NULL };
+ static char *rootdevtype[] = { "ebs", "instance-store", NULL };
+ static char *states[] = { "available", "pending", "failed", NULL };
+ static char *virttype[] = { "paravirtual", "hvm", NULL };
+ static char *hvstype[] = { "ovm", "xen", NULL };
+ static struct filter_descr filters[] = {
+ { "architecture", FILTER_ENUM, arch },
+ { "block-device-mapping.delete-on-termination", FILTER_BOOL },
+ { "block-device-mapping.device-name", FILTER_STRING },
+ { "block-device-mapping.snapshot-id", FILTER_STRING },
+ { "block-device-mapping.volume-size", FILTER_INT },
+ { "block-device-mapping.volume-type", FILTER_ENUM, voltype },
+ { "description", FILTER_STRING },
+ { "image-id", FILTER_STRING },
+ { "image-type", FILTER_ENUM, imgtype },
+ { "is-public", FILTER_BOOL },
+ { "kernel-id", FILTER_STRING },
+ { "manifest-location", FILTER_STRING },
+ { "name", FILTER_STRING },
+ { "owner-alias", FILTER_STRING },
+ { "owner-id", FILTER_STRING },
+ { "platform", FILTER_STRING },
+ { "product-code", FILTER_STRING },
+ { "product-code.type", FILTER_ENUM, prodcode },
+ { "ramdisk-id", FILTER_STRING },
+ { "root-device-name", FILTER_STRING },
+ { "root-device-type", FILTER_ENUM, rootdevtype },
+ { "state", FILTER_ENUM, states },
+ { "state-reason-code", FILTER_STRING },
+ { "state-reason-message", FILTER_STRING },
+ { "tag-key", FILTER_STRING },
+ { "tag-value", FILTER_STRING },
+ { "tag:<key>", FILTER_STRING },
+ { "virtualization-type", FILTER_ENUM, virttype },
+ { "hypervisor", FILTER_ENUM, hvstype },
+ { NULL }
+ };
+
+ available_filters = filters;
+ proginfo.print_help_hook = list_filters;
+ GETOPT(argc, argv, *idx, exit(EX_USAGE))
+ free(bufptr);
+}
+
+
+
+

Return to:

Send suggestions and report system problems to the System administrator.