/* This file is part of Eclat. Copyright (C) 2013-2018 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 . */ static int owner_n; static int xby_n; ECLAT_CL_BEGIN([], [<[FILTER...] [AMI...]>]) OPTION(all,a,, []) BEGIN grecs_asprintf(&bufptr, &bufsize, "Owner.%d", ++owner_n); eclat_request_add_param(q, bufptr, "all"); END OPTION(owner,u,[], []) BEGIN grecs_asprintf(&bufptr, &bufsize, "ExecutableBy.%d", ++xby_n); eclat_request_add_param(q, bufptr, optarg); END ECLAT_CL_END ECLAT_CL_PARSER(parse_options,[], [< { struct ec2_request *q = env->request; 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:", 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); } >] )