summaryrefslogtreecommitdiffabout
path: root/src/lsimg-cl.opt
blob: 2164238a8603b170f04ac0a7eb6e34a737470fff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/* This file is part of Eclat.
   Copyright (C) 2013-2014 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;

ECLAT_CL_BEGIN([<describe Amazon images>],
	       [<[FILTER...] [AMI...]>])

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

ECLAT_CL_END

ECLAT_CL_PARSER(parse_options,[<int argc, char *argv[], int *idx>], [<
{
	struct ec2_query *q = env->query;
	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.