aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO18
-rw-r--r--doc/Makefile.inc1
-rw-r--r--etc/Makefile.am2
-rw-r--r--etc/describe-vpc-attribute.fln20
-rw-r--r--etc/describe-vpcs.fln22
-rw-r--r--src/Makefile.am8
-rw-r--r--src/eclat.c20
-rw-r--r--src/eclat.h19
-rw-r--r--src/igw.c133
-rw-r--r--src/lsinst.c1
-rw-r--r--src/lsreg.c6
-rw-r--r--src/lstag-cl.opt9
-rw-r--r--src/lsvpc.c59
-rw-r--r--src/mksg-cl.opt2
-rw-r--r--src/mktags-cl.opt10
-rw-r--r--src/mkvpc-cl.opt36
-rw-r--r--src/mkvpc.c38
-rw-r--r--src/rmvpc.c40
-rw-r--r--src/util.c2
-rw-r--r--src/vpcattr.c96
20 files changed, 528 insertions, 14 deletions
diff --git a/TODO b/TODO
index 8953a65..400c91d 100644
--- a/TODO
+++ b/TODO
@@ -13,7 +13,7 @@ AssignPrivateIpAddresses - [ ] [ ]
AssociateAddress assocaddr [X] [X]
AssociateDhcpOptions - [ ] [ ]
AssociateRouteTable - [ ] [ ]
-AttachInternetGateway - [ ] [ ]
+AttachInternetGateway atigw [X] [ ]
AttachNetworkInterface - [ ] [ ]
AttachVolume atvol [X] [X]
AttachVpnGateway - [ ] [ ]
@@ -32,7 +32,7 @@ CreateCustomerGateway - [ ] [ ]
CreateDhcpOptions - [ ] [ ]
CreateImage mkimg [X] [X]
CreateInstanceExportTask - [ ] [ ]
-CreateInternetGateway - [ ] [ ]
+CreateInternetGateway mkigw [X] [ ]
CreateKeyPair - [ ] [ ]
CreateNetworkAcl - [ ] [ ]
CreateNetworkAclEntry - [ ] [ ]
@@ -47,13 +47,13 @@ CreateSpotDatafeedSubscription - [ ] [ ]
CreateSubnet - [ ] [ ]
CreateTags mktag [X] [X]
CreateVolume mkvol [X] [X]
-CreateVpc - [ ] [ ]
+CreateVpc mkvpc [X] [X]
CreateVpnConnection - [ ] [ ]
CreateVpnConnectionRoute - [ ] [ ]
CreateVpnGateway - [ ] [ ]
DeleteCustomerGateway - [ ] [ ]
DeleteDhcpOptions - [ ] [ ]
-DeleteInternetGateway - [ ] [ ]
+DeleteInternetGateway rmigw [X] [ ]
DeleteKeyPair - [ ] [ ]
DeleteNetworkAcl - [ ] [ ]
DeleteNetworkAclEntry - [ ] [ ]
@@ -67,7 +67,7 @@ DeleteSpotDatafeedSubscription - [ ] [ ]
DeleteSubnet - [ ] [ ]
DeleteTags rmtag [X] [X]
DeleteVolume rmvol [X] [X]
-DeleteVpc - [ ] [ ]
+DeleteVpc rmvpc [X] [ ]
DeleteVpnConnection - [ ] [ ]
DeleteVpnConnectionRoute - [ ] [ ]
DeleteVpnGateway - [ ] [ ]
@@ -84,7 +84,7 @@ DescribeImages lsimg [X] [X]
DescribeInstanceAttribute lsiattr [X] [X]
DescribeInstances lsinst [X] [X]
DescribeInstanceStatus lsistat [X] [X]
-DescribeInternetGateways - [ ] [ ]
+DescribeInternetGateways lsigw [X] [ ]
DescribeKeyPairs - [ ] [ ]
DescribeNetworkAcls - [ ] [ ]
DescribeNetworkInterfaceAttribute - [ ] [ ]
@@ -106,10 +106,11 @@ DescribeTags lstag [X] [X]
DescribeVolumes lsvol [X] [X]
DescribeVolumeAttribute - [ ] [ ]
DescribeVolumeStatus - [ ] [ ]
-DescribeVpcs - [ ] [ ]
+DescribeVpcAttribute lsvpcattr [X] [ ]
+DescribeVpcs lsvpc [X] [ ]
DescribeVpnConnections - [ ] [ ]
DescribeVpnGateways - [ ] [ ]
-DetachInternetGateway - [ ] [ ]
+DetachInternetGateway deigw [X] [ ]
DetachNetworkInterface - [ ] [ ]
DetachVolume devol [X] [X]
DetachVpnGateway - [ ] [ ]
@@ -128,6 +129,7 @@ ModifyInstanceAttribute setiattr [X] [X]
ModifyNetworkInterfaceAttribute - [ ] [ ]
ModifySnapshotAttribute setsattr [X] [X]
ModifyVolumeAttribute - [ ] [ ]
+ModifyVpcAttribute setvpcattr [X] [ ]
MonitorInstances - [ ] [ ]
PurchaseReservedInstancesOffering - [ ] [ ]
RebootInstances reboot [X] [X]
diff --git a/doc/Makefile.inc b/doc/Makefile.inc
index 5885e21..9997bca 100644
--- a/doc/Makefile.inc
+++ b/doc/Makefile.inc
@@ -49,6 +49,7 @@ MANPAGES1=\
eclat-mksnap.1\
eclat-mktag.1\
eclat-mkvol.1\
+ eclat-mkvpc.1\
eclat-reboot.1\
eclat-rmaddr.1\
eclat-rmsg.1\
diff --git a/etc/Makefile.am b/etc/Makefile.am
index 29ae900..10de3fd 100644
--- a/etc/Makefile.am
+++ b/etc/Makefile.am
@@ -27,6 +27,7 @@ FLNFILES=\
create-snapshot.fln\
create-tags.fln\
create-volume.fln\
+ create-vpc.fln\
delete-security-group.fln\
delete-snapshot.fln\
delete-tags.fln\
@@ -45,6 +46,7 @@ FLNFILES=\
describe-snapshots.fln\
describe-tags.fln\
describe-volumes.fln\
+ describe-vpcs.fln\
detach-volume.fln\
disassociate-address.fln\
get-console-output.fln\
diff --git a/etc/describe-vpc-attribute.fln b/etc/describe-vpc-attribute.fln
new file mode 100644
index 0000000..c96f624
--- /dev/null
+++ b/etc/describe-vpc-attribute.fln
@@ -0,0 +1,20 @@
+/* This file is part of Eclat.
+ Copyright (C) 2012-2015 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/>. */
+
+if (.DescribeVpcAttributeResponse.enableDnsHostnames ||
+ .DescribeVpcAttributeResponse.enableDnsSupport) {
+ print(last.value,"\n");
+} \ No newline at end of file
diff --git a/etc/describe-vpcs.fln b/etc/describe-vpcs.fln
new file mode 100644
index 0000000..e53e2fc
--- /dev/null
+++ b/etc/describe-vpcs.fln
@@ -0,0 +1,22 @@
+/* This file is part of Eclat.
+ Copyright (C) 2012-2015 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/>. */
+
+if (.DescribeVpcsResponse.vpcSet) {
+ for (var in .DescribeVpcsResponse.vpcSet.item) {
+ print(var.vpcId, "\t", var.cidrBlock, "\t", var.dhcpOptionsId, "\t",
+ var.state, "\t", var.isDefault, "\n");
+ }
+}
diff --git a/src/Makefile.am b/src/Makefile.am
index 7ec7c66..d46ad42 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -34,6 +34,7 @@ eclat_SOURCES=\
eclat.h\
genericcl.c\
getconout.c\
+ igw.c\
io.c\
lsaddr.c\
lsattr.c\
@@ -48,6 +49,7 @@ eclat_SOURCES=\
lssnap.c\
lstag.c\
lsvol.c\
+ lsvpc.c\
lszon.c\
mkimg.c\
mkinst.c\
@@ -55,16 +57,19 @@ eclat_SOURCES=\
mksnap.c\
mktags.c\
mkvol.c\
+ mkvpc.c\
rmaddr.c\
rmsg.c\
rmsnap.c\
rmvol.c\
+ rmvpc.c\
setiattr.c\
sg.c\
sg.h\
setaattr.c\
startstop.c\
- util.c
+ util.c\
+ vpcattr.c
ispeek_SOURCES = \
ispeek.c\
@@ -98,6 +103,7 @@ OPTFILES=\
mksg-cl.opt\
mktags-cl.opt\
mkvol-cl.opt\
+ mkvpc-cl.opt\
rmaddr-cl.opt\
rmsg-cl.opt\
sg-cl.opt\
diff --git a/src/eclat.c b/src/eclat.c
index 69efa8e..faba64a 100644
--- a/src/eclat.c
+++ b/src/eclat.c
@@ -164,6 +164,26 @@ struct eclat_command cmdtab[] = {
eclat_describe_image_attribute },
{ "setaattr", "modify-image-attribute", "ModifyImageAttribute",
eclat_modify_image_attribute, CMD_MOD },
+ { "lsvpc", "describe-vpcs", "DescribeVpcs",
+ eclat_describe_vpcs },
+ { "lsvpcattr", "describe-vpc-attribute", "DescribeVpcAttribute",
+ eclat_describe_vpc_attribute },
+ { "mkvpc", "create-vpc", "CreateVpc",
+ eclat_create_vpc, CMD_MOD },
+ { "setvpcattr", "modify-vpc-attribute", "ModifyVpcAttribute",
+ eclat_modify_vpc_attribute, CMD_MOD },
+ { "rmvpc", "delete-vpc", "DeleteVpc",
+ eclat_delete_vpc, CMD_MOD|CMD_DESTR },
+ { "lsigw", "describe-internet-gateways", "DescribeInternetGateways",
+ eclat_describe_internet_gateways },
+ { "mkigw", "create-internet-gateway", "CreateInternetGateway",
+ eclat_create_internet_gateway, CMD_MOD },
+ { "rmigw", "delete-internet-gateway", "DeleteInternetGateway",
+ eclat_delete_internet_gateway, CMD_MOD|CMD_DESTR },
+ { "atigw", "attach-internet-gateway", "AttachInternetGateway",
+ eclat_attach_internet_gateway, CMD_MOD },
+ { "deigw", "detach-internet-gateway", "DetachInternetGateway",
+ eclat_detach_internet_gateway, CMD_MOD|CMD_DESTR },
};
size_t cmdcnt = sizeof(cmdtab) / sizeof(cmdtab[0]);
diff --git a/src/eclat.h b/src/eclat.h
index 604ffdc..6897c15 100644
--- a/src/eclat.h
+++ b/src/eclat.h
@@ -163,6 +163,22 @@ int eclat_copy_image(eclat_command_env_t *env, int argc, char **argv);
int eclat_copy_snapshot(eclat_command_env_t *env, int argc, char **argv);
int eclat_sg(eclat_command_env_t *env, int argc, char **argv);
+int eclat_describe_vpcs(eclat_command_env_t *env, int argc, char **argv);
+int eclat_describe_vpc_attribute(eclat_command_env_t *env, int argc, char **argv);
+int eclat_modify_vpc_attribute(eclat_command_env_t *env, int argc, char **argv);
+int eclat_delete_vpc(eclat_command_env_t *env, int argc, char **argv);
+
+int eclat_create_internet_gateway(eclat_command_env_t *env,
+ int argc, char **argv);
+int eclat_delete_internet_gateway(eclat_command_env_t *env,
+ int argc, char **argv);
+int eclat_describe_internet_gateways(eclat_command_env_t *env,
+ int argc, char **argv);
+int eclat_attach_internet_gateway(eclat_command_env_t *env,
+ int argc, char **argv);
+int eclat_detach_internet_gateway(eclat_command_env_t *env,
+ int argc, char **argv);
+
int eclat_create_security_group(eclat_command_env_t *env,
int argc, char **argv);
int eclat_delete_security_group(eclat_command_env_t *env,
@@ -174,6 +190,7 @@ int eclat_modify_image_attribute(eclat_command_env_t *env,
int argc, char **argv);
int eclat_lsattr(eclat_command_env_t *env, int argc, char **argv);
+int eclat_create_vpc(eclat_command_env_t *env, int argc, char **argv);
char *region_to_endpoint(const char *region);
@@ -228,6 +245,8 @@ int get_scr_cols(void);
#define MAP_VOLUME "VolumeId"
#define MAP_AZ "AZ"
#define MAP_REG "reg"
+#define MAP_VPC "VpcId"
+#define MAP_IGW "InternetGatewayId"
void translate_ids(int argc, char **argv, const char *map);
void translate_resource_ids(int argc, char **argv);
diff --git a/src/igw.c b/src/igw.c
new file mode 100644
index 0000000..a0f6f48
--- /dev/null
+++ b/src/igw.c
@@ -0,0 +1,133 @@
+/* This file is part of Eclat.
+ Copyright (C) 2012-2015 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 "eclat.h"
+
+int
+eclat_create_internet_gateway(eclat_command_env_t *env, int argc, char **argv)
+{
+ int i;
+ struct ec2_request *q = env->request;
+ generic_proginfo->args_doc = NULL;
+ generic_parse_options(env->cmd,
+ "create internet gateway",
+ argc, argv, &i);
+ if (argc > i)
+ die(EX_USAGE, "wrong number of arguments");
+ return 0;
+}
+
+int
+eclat_delete_internet_gateway(eclat_command_env_t *env, int argc, char **argv)
+{
+ int i;
+ struct ec2_request *q = env->request;
+
+ generic_proginfo->args_doc = "IGW-ID";
+ generic_parse_options(env->cmd,
+ "delete internet gateway",
+ argc, argv, &i);
+ argv += i;
+ argc -= i;
+
+ if (argc != 1)
+ die(EX_USAGE, "wrong number of arguments");
+
+ translate_ids(1, argv, MAP_IGW);
+ eclat_request_add_param(q, "InternetGatewayId", argv[0]);
+
+ return 0;
+}
+
+static struct filter_descr filters[] = {
+ { "attachment.state", FILTER_STRING },
+ { "attachment.vpc-id", FILTER_STRING },
+ { "internet-gateway-id", FILTER_STRING },
+ { "tag-key", FILTER_STRING },
+ { "tag-value", FILTER_STRING },
+ { "tag:<KEY>", FILTER_STRING },
+ { NULL }
+};
+
+int
+eclat_describe_internet_gateways(eclat_command_env_t *env,
+ int argc, char **argv)
+{
+ int i;
+
+ available_filters = filters;
+ generic_proginfo->print_help_hook = list_filters;
+ generic_proginfo->args_doc = "[FILTER...] [ID...]";
+ generic_parse_options(env->cmd,
+ "describe internet gateways",
+ argc, argv, &i);
+ argv += i;
+ argc -= i;
+ translate_ids(argc, argv, MAP_IGW);
+
+ describe_request_create(env, argc, argv, "InternetGatewayId");
+ return 0;
+}
+
+int
+eclat_attach_internet_gateway(eclat_command_env_t *env,
+ int argc, char **argv)
+{
+ int i;
+ struct ec2_request *q = env->request;
+
+ generic_proginfo->args_doc = "IGW-ID VPC-ID";
+ generic_parse_options(env->cmd,
+ "attach internet gateway to a VPC",
+ argc, argv, &i);
+ argv += i;
+ argc -= i;
+ if (argc != 2)
+ die(EX_USAGE, "wrong number of arguments");
+
+ translate_ids(1, argv, MAP_IGW);
+ translate_ids(1, argv+1, MAP_VPC);
+
+ eclat_request_add_param(q, "InternetGatewayId", argv[0]);
+ eclat_request_add_param(q, "VpcId", argv[1]);
+
+ return 0;
+}
+
+int
+eclat_detach_internet_gateway(eclat_command_env_t *env,
+ int argc, char **argv)
+{
+ int i;
+ struct ec2_request *q = env->request;
+
+ generic_proginfo->args_doc = "IGW-ID VPC-ID";
+ generic_parse_options(env->cmd,
+ "detach internet gateway from VPC",
+ argc, argv, &i);
+ argv += i;
+ argc -= i;
+ if (argc != 2)
+ die(EX_USAGE, "wrong number of arguments");
+
+ translate_ids(1, argv, MAP_IGW);
+ translate_ids(1, argv+1, MAP_VPC);
+
+ eclat_request_add_param(q, "InternetGatewayId", argv[0]);
+ eclat_request_add_param(q, "VpcId", argv[1]);
+
+ return 0;
+}
diff --git a/src/lsinst.c b/src/lsinst.c
index 7c65495..79cc4ec 100644
--- a/src/lsinst.c
+++ b/src/lsinst.c
@@ -132,6 +132,7 @@ parse_options(struct eclat_command const *cmd, int argc, char *argv[],
available_filters = filters;
generic_proginfo->print_help_hook = list_filters;
+ generic_proginfo->args_doc = _("[FILTER...] [INST-ID...]");
return generic_parse_options(cmd,
"List instances",
argc, argv, index);
diff --git a/src/lsreg.c b/src/lsreg.c
index 11c8203..78d3862 100644
--- a/src/lsreg.c
+++ b/src/lsreg.c
@@ -29,9 +29,9 @@ parse_options(struct eclat_command const *cmd,
available_filters = filters;
generic_proginfo->print_help_hook = list_filters;
generic_proginfo->args_doc = "[REGION [REGION...]]";
- return generic_parse_options(cmd,
- "List available regions",
- argc, argv, index);
+ generic_parse_options(cmd,
+ "List available regions",
+ argc, argv, index);
}
int
diff --git a/src/lstag-cl.opt b/src/lstag-cl.opt
index 1c0c1af..15cd6f3 100644
--- a/src/lstag-cl.opt
+++ b/src/lstag-cl.opt
@@ -76,6 +76,15 @@ BEGIN
grecs_list_append(reslist, res);
END
+OPTION(internet-gateway,g,[<ID>],
+ [<internet gateway ID>])
+BEGIN
+ struct resource *res = grecs_malloc(sizeof(*res));
+ res->map = MAP_IGW;
+ res->resid = optarg;
+ grecs_list_append(reslist, res);
+END
+
ECLAT_CL_END
ECLAT_CL_PARSER(parse_options, [<int argc, char *argv[], int *index>],[<
diff --git a/src/lsvpc.c b/src/lsvpc.c
new file mode 100644
index 0000000..edd8a13
--- /dev/null
+++ b/src/lsvpc.c
@@ -0,0 +1,59 @@
+/* This file is part of Eclat.
+ Copyright (C) 2015 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 "eclat.h"
+
+static void
+parse_options(struct eclat_command const *cmd, int argc, char *argv[],
+ int *index)
+{
+ static char *state_enum[] = { "pending", "available", NULL };
+ static struct filter_descr filters[] = {
+ { "cidr", FILTER_STRING }, //FIXME: FILTER_CIDR
+ { "dhcp-options-id", FILTER_STRING },
+ { "isDefault", FILTER_BOOL },
+ { "state", FILTER_ENUM, state_enum },
+ { "tag-key", FILTER_STRING },
+ { "tag-value", FILTER_STRING },
+ { "tag:<KEY>", FILTER_STRING },
+ { "vpc-id", FILTER_STRING },
+ { NULL }
+ };
+
+ available_filters = filters;
+ generic_proginfo->print_help_hook = list_filters;
+ generic_proginfo->args_doc = _("[FILTER...] [VPC-ID...]");
+ return generic_parse_options(cmd,
+ "List VPCs",
+ argc, argv, index);
+}
+
+int
+eclat_describe_vpcs(eclat_command_env_t *env, int argc, char **argv)
+{
+ int i;
+
+ parse_options(env->cmd, argc, argv, &i);
+ argv += i;
+ argc -= i;
+ translate_ids(argc, argv, MAP_VPC);
+
+ describe_request_create(env, argc, argv, "VpcId");
+ return 0;
+}
+
+
+
diff --git a/src/mksg-cl.opt b/src/mksg-cl.opt
index 474b2ae..6b09ca6 100644
--- a/src/mksg-cl.opt
+++ b/src/mksg-cl.opt
@@ -21,7 +21,7 @@ ECLAT_CL_BEGIN([<create EC2 security group>],
OPTION(vpc-id,i,[<ID>],
[<VPC ID>])
-BEGINb
+BEGIN
vpcid = optarg;
END
diff --git a/src/mktags-cl.opt b/src/mktags-cl.opt
index 8cb0033..510835b 100644
--- a/src/mktags-cl.opt
+++ b/src/mktags-cl.opt
@@ -77,6 +77,16 @@ BEGIN
grecs_list_append(reslist, res);
END
+OPTION(internet-gateway,g,[<ID>],
+ [<internet gateway ID>])
+BEGIN
+ struct resource *res = grecs_malloc(sizeof(*res));
+ res->map = MAP_IGW;
+ res->resid = optarg;
+ grecs_list_append(reslist, res);
+END
+
+
OPTION(from-file,T,[<FILE>],
[<read tags from FILE>])
BEGIN
diff --git a/src/mkvpc-cl.opt b/src/mkvpc-cl.opt
new file mode 100644
index 0000000..03611f0
--- /dev/null
+++ b/src/mkvpc-cl.opt
@@ -0,0 +1,36 @@
+/* This file is part of Eclat.
+ Copyright (C) 2013-2015 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 vpc_dry_run;
+static char *vpc_tenancy;
+
+ECLAT_CL_BEGIN([<create VPC>],
+ [<CIDR>])
+
+OPTION(tenancy,t,
+ [<default|dedicated>],
+ [<instance tenancy>])
+BEGIN
+ vpc_tenancy = optarg;
+END
+
+ECLAT_CL_END
+
+ECLAT_CL_PARSER(parse_options, [<int argc, char *argv[], int *index>],[<
+{
+ GETOPT(argc, argv, *index, exit(EX_USAGE))
+}
+>])
diff --git a/src/mkvpc.c b/src/mkvpc.c
new file mode 100644
index 0000000..1c837ba
--- /dev/null
+++ b/src/mkvpc.c
@@ -0,0 +1,38 @@
+/* This file is part of Eclat.
+ Copyright (C) 2015 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 "eclat.h"
+#include "mkvpc-cl.h"
+
+int
+eclat_create_vpc(eclat_command_env_t *env, int argc, char **argv)
+{
+ int i;
+ struct ec2_request *q = env->request;
+
+ parse_options(env, argc, argv, &i);
+ argc -= i;
+ argv += i;
+ if (argc != 1)
+ die(EX_USAGE, "wrong number of arguments");
+
+ if (vpc_tenancy)
+ eclat_request_add_param(q, "InstanceTenancy", "true");
+ eclat_request_add_param(q, "CidrBlock", argv[0]);
+ return 0;
+}
+
+
diff --git a/src/rmvpc.c b/src/rmvpc.c
new file mode 100644
index 0000000..d1c0026
--- /dev/null
+++ b/src/rmvpc.c
@@ -0,0 +1,40 @@
+/* This file is part of Eclat.
+ Copyright (C) 2012-2015 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 "eclat.h"
+
+int
+eclat_delete_vpc(eclat_command_env_t *env, int argc, char **argv)
+{
+ int i;
+ struct ec2_request *q = env->request;
+
+ generic_proginfo->args_doc = "VPC-ID";
+ generic_parse_options(env->cmd,
+ "delete the VPC",
+ argc, argv, &i);
+ argv += i;
+ argc -= i;
+
+ if (argc != 1)
+ die(EX_USAGE, "wrong number of arguments");
+
+ translate_ids(1, argv, MAP_VPC);
+ eclat_request_add_param(q, "VpcId", argv[0]);
+
+ return 0;
+}
+
diff --git a/src/util.c b/src/util.c
index 79a78ff..7bf13ac 100644
--- a/src/util.c
+++ b/src/util.c
@@ -165,7 +165,7 @@ get_scr_cols()
void
describe_request_update(eclat_command_env_t *env, int argc, char **argv,
- const char *uparm, int n_in, int *n_out)
+ const char *uparm, int n_in, int *n_out)
{
int i, j, k;
struct ec2_request *q = env->request;
diff --git a/src/vpcattr.c b/src/vpcattr.c
new file mode 100644
index 0000000..1896ee1
--- /dev/null
+++ b/src/vpcattr.c
@@ -0,0 +1,96 @@
+/* This file is part of Eclat.
+ Copyright (C) 2015 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 "eclat.h"
+
+int
+eclat_describe_vpc_attribute(eclat_command_env_t *env, int argc, char **argv)
+{
+ int i;
+ struct ec2_request *q = env->request;
+ const char *attrname;
+ static char *attrs[] = {
+ "enableDnsSupport",
+ "enableDnsHostnames",
+ NULL
+ };
+
+ generic_proginfo->args_doc = "VPC-ID [ATTR]";
+ available_attrs = attrs;
+ generic_proginfo->print_help_hook = list_attrs;
+ generic_parse_options(env->cmd,
+ "describe VPC attributes",
+ argc, argv, &i);
+ argv += i;
+ argc -= i;
+
+ switch (argc) {
+ default:
+ die(EX_USAGE, "wrong number of arguments");
+ case 2:
+ attrname = canonattrname(attrs, argv[1], NULL, NULL);
+ if (!attrname)
+ die(EX_USAGE, "unrecognized attribute name");
+ break;
+ case 1:
+ attrname = attrs[0];
+ }
+
+ translate_ids(1, argv, MAP_VPC);
+ eclat_request_add_param(q, "VpcId", argv[0]);
+ if (attrname)
+ eclat_request_add_param(q, "Attribute", attrname);
+ return 0;
+}
+
+int
+eclat_modify_vpc_attribute(eclat_command_env_t *env, int argc, char **argv)
+{
+ int i;
+ struct ec2_request *q = env->request;
+ const char *attrname;
+ char *bufptr = NULL;
+ size_t bufsize = 0;
+ static char *attrs[] = {
+ "EnableDnsSupport",
+ "EnableDnsHostnames",
+ NULL
+ };
+
+
+ generic_proginfo->args_doc = "VPC-ID ATTR VALUE";
+ available_attrs = attrs;
+ generic_proginfo->print_help_hook = list_attrs;
+ generic_parse_options(env->cmd,
+ "modify VPC attribute",
+ argc, argv, &i);
+ argv += i;
+ argc -= i;
+
+ if (argc != 3)
+ die(EX_USAGE, "wrong number of arguments");
+ attrname = canonattrname(attrs, argv[1], NULL, NULL);
+ if (!attrname)
+ die(EX_USAGE, "unrecognized attribute name");
+
+ translate_ids(1, argv, MAP_VPC);
+ eclat_request_add_param(q, "VpcId", argv[0]);
+ grecs_asprintf(&bufptr, &bufsize, "%s.Value", attrname);
+ eclat_request_add_param(q, bufptr, argv[2]);
+ free(bufptr);
+ return 0;
+}
+

Return to:

Send suggestions and report system problems to the System administrator.