From ae194ce922bff039e9003f1e84d44132aab63c3e Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Thu, 19 Nov 2015 22:39:11 +0200 Subject: Restore missing translation maps --- doc/eclat.1man | 10 +++++----- doc/eclat.conf.5 | 16 ++++++++++++++-- src/eclat.h | 22 ++++++++++++---------- src/routetable.c | 8 ++++---- src/subnet.c | 6 +++--- 5 files changed, 38 insertions(+), 24 deletions(-) diff --git a/doc/eclat.1man b/doc/eclat.1man index 829bec6..7d416c4 100644 --- a/doc/eclat.1man +++ b/doc/eclat.1man @@ -13,7 +13,7 @@ .\" .\" You should have received a copy of the GNU General Public License .\" along with Eclat. If not, see . -.TH ECLAT 1 "February 2, 2015" "ECLAT" "Eclat User Reference" +.TH ECLAT 1 "November 19, 2015" "ECLAT" "Eclat User Reference" .SH NAME eclat \- EC2 Command Line Administrator Tool .SH SYNOPSIS @@ -120,7 +120,7 @@ separated by dots. Requests are authenticated using a pair of strings: access key and secret key. Their function is similar to that of username/password in traditional authentication schemes. These values are obtained from -.IR authentication provider . +.IR "authentication provider" . There are three types of authentication providers: .IR immediate , .IR file , @@ -136,16 +136,16 @@ be seen by other users (e.g. in the .BR ps (1) output). .SS File Provider -The \Ifile\fR provider is requested by the following statement in +The \fIfile\fR provider is requested by the following statement in the configuration file: .PP .EX authentication\-provider file \fIFILENAME\fR; .EE .PP -The credentials are stored them in a file protected by appropriate +The credentials are stored in a file protected by appropriate permissions. Each line in such a file (named for short -\fBaccess\-file\fR) lists access key and the corresponding secret key, +\fBaccess\-file\fR) lists the access key and the corresponding secret key, separated by a colon. Empty lines are ignored, as well as lines starting with a \fB#\fR sign, except as immediately followed by a colon. In the latter case, such a line introduces a tag, which diff --git a/doc/eclat.conf.5 b/doc/eclat.conf.5 index 3597309..c896dba 100644 --- a/doc/eclat.conf.5 +++ b/doc/eclat.conf.5 @@ -13,7 +13,7 @@ .\" .\" You should have received a copy of the GNU General Public License .\" along with Eclat. If not, see . -.TH ECLAT.CONF 5 "February 26, 2015" "ECLAT" "Eclat User Reference" +.TH ECLAT.CONF 5 "November 19, 2015" "ECLAT" "Eclat User Reference" .SH NAME eclat.conf \- configuration file for .BR eclat (1). @@ -719,6 +719,18 @@ Translates snapshot names to IDs. .B VolumeId Translates volume names to IDs. .TP +.B VpcId +Translates VPC names to IDs. +.TP +.B InternetGatewayId +Translates internet gateway names to IDs. +.TP +.B SubnetId +Translates subnet names to IDs. +.TP +.B RouteTableId +Translates route table names to IDs. +.TP .B AZ Translates availability region names to Amazon names. .TP @@ -817,7 +829,7 @@ last map in sequence. This statement defines the sequence of maps to query. Its argument is a list of map names. The maps it references must be declared elsewhere in the configuration file (not necessarily before the -sequence map that references them. +sequence map that references them). .PP For example: .PP diff --git a/src/eclat.h b/src/eclat.h index fcd9f13..5a067f4 100644 --- a/src/eclat.h +++ b/src/eclat.h @@ -255,16 +255,18 @@ char *read_file(const char *file); int get_scr_cols(void); -#define MAP_IMAGE "ImageId" -#define MAP_INSTANCE "InstanceId" -#define MAP_GROUPID "GroupId" -#define MAP_GROUPNAME "GroupName" -#define MAP_SNAPSHOT "SnapshotId" -#define MAP_VOLUME "VolumeId" -#define MAP_AZ "AZ" -#define MAP_REG "reg" -#define MAP_VPC "VpcId" -#define MAP_IGW "InternetGatewayId" +#define MAP_IMAGE "ImageId" +#define MAP_INSTANCE "InstanceId" +#define MAP_GROUPID "GroupId" +#define MAP_GROUPNAME "GroupName" +#define MAP_SNAPSHOT "SnapshotId" +#define MAP_VOLUME "VolumeId" +#define MAP_AZ "AZ" +#define MAP_REG "reg" +#define MAP_VPC "VpcId" +#define MAP_IGW "InternetGatewayId" +#define MAP_SUBNET "SubnetId" +#define MAP_ROUTE_TABLE "RouteTableId" void translate_ids(int argc, char **argv, const char *map); void translate_resource_ids(int argc, char **argv); diff --git a/src/routetable.c b/src/routetable.c index 05d4be3..9b0c577 100644 --- a/src/routetable.c +++ b/src/routetable.c @@ -90,7 +90,7 @@ eclat_describe_route_tables(eclat_command_env_t *env, argc, argv, &i); argv += i; argc -= i; - //FIXME: translate_ids(argc, argv, MAP_ROUTE_TABLE); + translate_ids(argc, argv, MAP_ROUTE_TABLE); describe_request_create(env, argc, argv, "RouteTableId"); return 0; @@ -112,10 +112,8 @@ eclat_associate_route_table(eclat_command_env_t *env, if (argc != 2) die(EX_USAGE, "wrong number of arguments"); -/*FIXME: translate_ids(1, argv, MAP_ROUTE_TABLE); translate_ids(1, argv+1, MAP_SUBNET); -*/ eclat_request_add_param(q, "RouteTableId", argv[0]); eclat_request_add_param(q, "SubnetId", argv[1]); @@ -168,6 +166,7 @@ route_create_request(struct ec2_request *req, int argc, char **argv) break; } + translate_ids(1, argv+1, id); eclat_request_add_param(req, id, argv[1]); } @@ -190,7 +189,8 @@ eclat_route(eclat_command_env_t *env, int argc, char **argv) if (argc < 3) die(EX_USAGE, "wrong number of arguments"); - //FIXME: translate_ids(1, argv, MAP_ROUTE_TABLE); + + translate_ids(1, argv, MAP_ROUTE_TABLE); rtb_id = argv[0]; op = argv[1]; diff --git a/src/subnet.c b/src/subnet.c index 2e56c79..382f62b 100644 --- a/src/subnet.c +++ b/src/subnet.c @@ -72,7 +72,7 @@ eclat_describe_subnets(eclat_command_env_t *env, argc, argv, &i); argv += i; argc -= i; - //FIXME: translate_ids(argc, argv, MAP_SUBNET); + translate_ids(argc, argv, MAP_SUBNET); describe_request_create(env, argc, argv, "SubnetId"); return 0; @@ -106,7 +106,7 @@ eclat_modify_subnet_attribute(eclat_command_env_t *env, int argc, char **argv) if (!attrname) die(EX_USAGE, "unrecognized attribute name"); - //FIXME: translate_ids(1, argv, MAP_SUBNET); + translate_ids(1, argv, MAP_SUBNET); eclat_request_add_param(q, "SubnetId", argv[0]); grecs_asprintf(&bufptr, &bufsize, "%s.Value", attrname); eclat_request_add_param(q, bufptr, argv[2]); @@ -130,7 +130,7 @@ eclat_delete_subnet(eclat_command_env_t *env, int argc, char **argv) if (argc != 1) die(EX_USAGE, "wrong number of arguments"); - //FIXME: translate_ids(1, argv, MAP_SUBNET); + translate_ids(1, argv, MAP_SUBNET); eclat_request_add_param(q, "SubnetId", argv[0]); return 0; -- cgit v1.2.1