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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
/* 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 <config.h>
#include <sysexits.h>
#include <ctype.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <curl/curl.h>
#include <expat.h>
#include "grecs.h"
#include "grecsopt.h"
#include "wordsplit.h"
#include "libeclat.h"
#include "forlan.h"
#define ECLAT_DEBCAT_MAIN 0
#define ECLAT_DEBCAT_CFGRAM 1
#define ECLAT_DEBCAT_CFLEX 2
#define ECLAT_DEBCAT_CONF 3
#define ECLAT_DEBCAT_CURL 4
#define ECLAT_DEBCAT_FORLAN 5
extern char *endpoint;
extern int use_ssl;
extern int dry_run_mode;
extern char *region_name;
extern char *access_file_name;
extern char *access_key;
extern char *secret_key;
extern char *format_file;
extern int translate_option;
extern char *custom_map;
typedef int (*config_finish_hook_t) (void*);
void add_config_finish_hook(config_finish_hook_t fun, void *data);
void config_help(void);
void config_init(void);
void config_finish(struct grecs_node *tree);
int run_config_finish_hooks(void);
typedef int (*eclat_command_handler_t) (CURL *curl, int argc, char **argv);
int eclat_start_instance(CURL *curl, int argc, char **argv);
int eclat_stop_instance(CURL *curl, int argc, char **argv);
int eclat_reboot_instance(CURL *curl, int argc, char **argv);
int eclat_describe_tags(CURL *curl, int argc, char **argv);
int eclat_describe_instance_status(CURL *curl, int argc, char **argv);
int eclat_describe_instances(CURL *curl, int argc, char **argv);
int eclat_associate_address(CURL *curl, int argc, char **argv);
int eclat_disassociate_address(CURL *curl, int argc, char **argv);
int eclat_describe_addresses(CURL *curl, int argc, char **argv);
int eclat_describe_volumes(CURL *curl, int argc, char **argv);
int eclat_get_console_output(CURL *curl, int argc, char **argv);
int eclat_describe_instance_attribute(CURL *curl, int argc, char **argv);
int eclat_create_tags(CURL *curl, int argc, char **argv);
int eclat_delete_tags(CURL *curl, int argc, char **argv);
int eclat_describe_security_groups(CURL *curl, int argc, char **argv);
char *region_to_endpoint(const char *region);
void define_format(const char *name, const char *format, grecs_locus_t *locus);
void set_command_format(const char *name, const char *format,
grecs_locus_t *locus);
struct ec2_query *describe_query_create(CURL *curl, const char *verb,
int argc, char **argv,
const char *uparm);
int eclat_send_query(CURL *curl, struct ec2_query *q);
#define XML_DUMP_FILE_NAME "eclat.dump.xml"
#define FILTER_STRING 0
#define FILTER_DATE 1
#define FILTER_BOOL 2
#define FILTER_INT 3
#define FILTER_ENUM 4
struct filter_descr {
char *name;
int type;
char **avail;
};
struct filter_descr *available_filters;
void list_filters(FILE *fp);
int get_scr_cols(void);
void translate_ids(int argc, char **argv, const char *mapname);
void translate_resource_ids(int argc, char **argv);
int get_access_creds(const char *id, char **access_key_ptr,
char **secret_key_ptr);
void define_format(const char *name, const char *fmt, grecs_locus_t *loc);
forlan_eval_env_t find_format(const char *name);
void generic_parse_options(const char *pname, const char *docstring,
int argc, char *argv[], int *index);
extern struct grecs_proginfo *generic_proginfo;
|