zaws 0.0.5 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/.travis.yml +9 -18
- data/Gemfile +0 -0
- data/Gemfile.lock +26 -35
- data/Gemfile.lock.linux +69 -0
- data/Gemfile.lock.mac +81 -0
- data/Gemfile.lock.windows +77 -0
- data/LICENSE +0 -0
- data/README.md +11 -0
- data/Rakefile +1 -7
- data/archive/cloud_trail/cloud_trail.feature +124 -0
- data/bin/win_zaws.bat +2 -0
- data/lib/zaws.rb +54 -41
- data/lib/zaws/command/ai.rb +34 -0
- data/lib/zaws/command/bucket.rb +35 -0
- data/lib/zaws/command/cloud_trail.rb +43 -0
- data/lib/zaws/command/compute.rb +152 -87
- data/lib/zaws/command/config.rb +42 -0
- data/lib/zaws/command/elasticip.rb +19 -9
- data/lib/zaws/command/hosted_zone.rb +31 -18
- data/lib/zaws/command/iam.rb +37 -0
- data/lib/zaws/command/load_balancer.rb +54 -51
- data/lib/zaws/command/nessus.rb +41 -0
- data/lib/zaws/command/newrelic.rb +30 -0
- data/lib/zaws/command/route_table.rb +135 -122
- data/lib/zaws/command/security_group.rb +95 -82
- data/lib/zaws/command/subnet.rb +58 -46
- data/lib/zaws/command/sumo.rb +34 -0
- data/lib/zaws/command/vpc.rb +53 -0
- data/lib/zaws/external/awscli/awscli.rb +65 -0
- data/lib/zaws/external/awscli/commands.rb +10 -0
- data/lib/zaws/external/awscli/commands/aws.rb +40 -0
- data/lib/zaws/external/awscli/commands/ec2.rb +74 -0
- data/lib/zaws/external/awscli/commands/ec2/allocate_address.rb +42 -0
- data/lib/zaws/external/awscli/commands/ec2/assign_private_ip_addresses.rb +49 -0
- data/lib/zaws/external/awscli/commands/ec2/associate_address.rb +48 -0
- data/lib/zaws/external/awscli/commands/ec2/associate_route_table.rb +48 -0
- data/lib/zaws/external/awscli/commands/ec2/authorize_security_group_ingress.rb +70 -0
- data/lib/zaws/external/awscli/commands/ec2/create_route.rb +60 -0
- data/lib/zaws/external/awscli/commands/ec2/create_route_table.rb +40 -0
- data/lib/zaws/external/awscli/commands/ec2/create_security_group.rb +58 -0
- data/lib/zaws/external/awscli/commands/ec2/create_subnet.rb +62 -0
- data/lib/zaws/external/awscli/commands/ec2/create_tags.rb +53 -0
- data/lib/zaws/external/awscli/commands/ec2/create_vpc.rb +21 -0
- data/lib/zaws/external/awscli/commands/ec2/delete_route.rb +54 -0
- data/lib/zaws/external/awscli/commands/ec2/delete_route_table.rb +46 -0
- data/lib/zaws/external/awscli/commands/ec2/delete_security_group.rb +46 -0
- data/lib/zaws/external/awscli/commands/ec2/delete_subnet.rb +46 -0
- data/lib/zaws/external/awscli/commands/ec2/describe_addresses.rb +41 -0
- data/lib/zaws/external/awscli/commands/ec2/describe_images.rb +58 -0
- data/lib/zaws/external/awscli/commands/ec2/describe_instances.rb +56 -0
- data/lib/zaws/external/awscli/commands/ec2/describe_route_tables.rb +44 -0
- data/lib/zaws/external/awscli/commands/ec2/describe_security_groups.rb +50 -0
- data/lib/zaws/external/awscli/commands/ec2/describe_subnets.rb +48 -0
- data/lib/zaws/external/awscli/commands/ec2/describe_vpc_peering_connections.rb +23 -0
- data/lib/zaws/external/awscli/commands/ec2/describe_vpcs.rb +26 -0
- data/lib/zaws/external/awscli/commands/ec2/disable_vgw_route_propagation.rb +48 -0
- data/lib/zaws/external/awscli/commands/ec2/disassociate-address.rb +42 -0
- data/lib/zaws/external/awscli/commands/ec2/disassociate_route_table.rb +41 -0
- data/lib/zaws/external/awscli/commands/ec2/enable_vgw_route_propagation.rb +48 -0
- data/lib/zaws/external/awscli/commands/ec2/filter.rb +115 -0
- data/lib/zaws/external/awscli/commands/ec2/modify_instance_attribute.rb +62 -0
- data/lib/zaws/external/awscli/commands/ec2/network_interfaces.rb +63 -0
- data/lib/zaws/external/awscli/commands/ec2/release_address.rb +42 -0
- data/lib/zaws/external/awscli/commands/ec2/revoke_security_group_ingress.rb +70 -0
- data/lib/zaws/external/awscli/commands/ec2/run_instances.rb +21 -0
- data/lib/zaws/external/awscli/commands/ec2/stop_instances.rb +21 -0
- data/lib/zaws/external/awscli/commands/ec2/terminate_instances.rb +40 -0
- data/lib/zaws/external/awscli/commands/ec2/unassign_private_ip_addresses.rb +49 -0
- data/lib/zaws/external/awscli/commands/elb.rb +19 -0
- data/lib/zaws/external/awscli/commands/elb/create_load_balancer.rb +64 -0
- data/lib/zaws/external/awscli/commands/elb/create_load_balancer_listeners.rb +47 -0
- data/lib/zaws/external/awscli/commands/elb/delete_load_balancer.rb +40 -0
- data/lib/zaws/external/awscli/commands/elb/delete_load_balancer_listeners.rb +49 -0
- data/lib/zaws/external/awscli/commands/elb/deregister_instances_with_load_balancer.rb +49 -0
- data/lib/zaws/external/awscli/commands/elb/describe_load_balancers.rb +30 -0
- data/lib/zaws/external/awscli/commands/elb/register_instances_with_load_balancer.rb +49 -0
- data/lib/zaws/external/awscli/commands/iam.rb +31 -0
- data/lib/zaws/external/awscli/commands/iam/GetPolicy.rb +21 -0
- data/lib/zaws/external/awscli/commands/iam/GetPolicyVersion.rb +21 -0
- data/lib/zaws/external/awscli/commands/iam/GetRolePolicy.rb +21 -0
- data/lib/zaws/external/awscli/commands/route53.rb +19 -0
- data/lib/zaws/external/awscli/commands/route53/list_hosted_zones.rb +30 -0
- data/lib/zaws/external/awscli/commands/route53/list_resource_record_sets.rb +41 -0
- data/lib/zaws/external/awscli/commands/s3/ls.rb +34 -0
- data/lib/zaws/external/awscli/commands/s3/mb.rb +41 -0
- data/lib/zaws/external/awscli/commands/s3/sync.rb +48 -0
- data/lib/zaws/external/awscli/credentials.rb +22 -0
- data/lib/zaws/external/awscli/data.rb +10 -0
- data/lib/zaws/external/awscli/data/ec2.rb +33 -0
- data/lib/zaws/external/awscli/data/ec2/instance.rb +162 -0
- data/lib/zaws/external/awscli/data/ec2/security_group.rb +51 -0
- data/lib/zaws/external/awscli/data/ec2/subnet.rb +59 -0
- data/lib/zaws/external/awscli/data/ec2/vpc.rb +85 -0
- data/lib/zaws/external/awscli/data/iam.rb +34 -0
- data/lib/zaws/external/awscli/data/iam/policy.rb +42 -0
- data/lib/zaws/external/awscli/data/iam/policy_document.rb +52 -0
- data/lib/zaws/external/awscli/data/iam/policy_version.rb +42 -0
- data/lib/zaws/external/awscli/data/iam/role_policy.rb +52 -0
- data/lib/zaws/external/awscli/generators/result/ec2/addresses.rb +70 -0
- data/lib/zaws/external/awscli/generators/result/ec2/allocation_id.rb +39 -0
- data/lib/zaws/external/awscli/generators/result/ec2/association_id.rb +29 -0
- data/lib/zaws/external/awscli/generators/result/ec2/images.rb +46 -0
- data/lib/zaws/external/awscli/generators/result/ec2/instances.rb +57 -0
- data/lib/zaws/external/awscli/generators/result/ec2/ip_permissions.rb +70 -0
- data/lib/zaws/external/awscli/generators/result/ec2/network_interfaces.rb +53 -0
- data/lib/zaws/external/awscli/generators/result/ec2/private_ip_addresses.rb +41 -0
- data/lib/zaws/external/awscli/generators/result/ec2/route_tables.rb +80 -0
- data/lib/zaws/external/awscli/generators/result/ec2/routes.rb +58 -0
- data/lib/zaws/external/awscli/generators/result/ec2/security_groups.rb +73 -0
- data/lib/zaws/external/awscli/generators/result/ec2/subnets.rb +88 -0
- data/lib/zaws/external/awscli/generators/result/ec2/tags.rb +34 -0
- data/lib/zaws/external/awscli/generators/result/ec2/virtual_gateway.rb +32 -0
- data/lib/zaws/external/awscli/generators/result/elb/listeners.rb +65 -0
- data/lib/zaws/external/awscli/generators/result/elb/load_balancers.rb +61 -0
- data/lib/zaws/external/awscli/generators/result/route53/hosted_zones.rb +52 -0
- data/lib/zaws/external/awscli/regions.rb +13 -0
- data/lib/zaws/external/nessusapi/data/agents.rb +36 -0
- data/lib/zaws/external/nessusapi/data/scanners.rb +35 -0
- data/lib/zaws/external/nessusapi/nessusapi.rb +57 -0
- data/lib/zaws/external/nessusapi/reources.rb +10 -0
- data/lib/zaws/external/nessusapi/resources/agents.rb +18 -0
- data/lib/zaws/external/nessusapi/resources/agents/list.rb +20 -0
- data/lib/zaws/external/nessusapi/resources/scanners.rb +18 -0
- data/lib/zaws/external/nessusapi/resources/scanners/list.rb +20 -0
- data/lib/zaws/external/newrelicapi/data/servers.rb +36 -0
- data/lib/zaws/external/newrelicapi/newrelic_client.rb +64 -0
- data/lib/zaws/external/newrelicapi/newrelic_creds.rb +60 -0
- data/lib/zaws/external/newrelicapi/newrelicapi.rb +46 -0
- data/lib/zaws/external/newrelicapi/resources/servers.rb +18 -0
- data/lib/zaws/external/newrelicapi/resources/servers/list.rb +20 -0
- data/lib/zaws/external/sumoapi/data/collectors.rb +35 -0
- data/lib/zaws/external/sumoapi/data/sources.rb +35 -0
- data/lib/zaws/external/sumoapi/resources/collectors.rb +18 -0
- data/lib/zaws/external/sumoapi/resources/collectors/list.rb +20 -0
- data/lib/zaws/external/sumoapi/resources/sources.rb +18 -0
- data/lib/zaws/external/sumoapi/resources/sources/list.rb +20 -0
- data/lib/zaws/external/sumoapi/sumo_client.rb +63 -0
- data/lib/zaws/external/sumoapi/sumo_creds.rb +67 -0
- data/lib/zaws/external/sumoapi/sumoapi.rb +56 -0
- data/lib/zaws/helper/data_lattice.rb +22 -0
- data/lib/zaws/helper/filestore.rb +48 -0
- data/lib/zaws/helper/filter.rb +15 -0
- data/lib/zaws/helper/inifile.rb +632 -0
- data/lib/zaws/helper/nessus_client.rb +143 -0
- data/lib/zaws/helper/nessus_creds.rb +67 -0
- data/lib/zaws/helper/option.rb +14 -15
- data/lib/zaws/helper/output.rb +81 -29
- data/lib/zaws/helper/process_hash.rb +47 -0
- data/lib/zaws/helper/shell.rb +0 -0
- data/lib/zaws/helper/verbose.rb +15 -0
- data/lib/zaws/helper/zfile.rb +8 -8
- data/lib/zaws/services/ai.rb +35 -0
- data/lib/zaws/services/ai/query.rb +135 -0
- data/lib/zaws/services/aws.rb +41 -0
- data/lib/zaws/services/chef.rb +0 -0
- data/lib/zaws/services/cloud_trail.rb +76 -0
- data/lib/zaws/services/config.rb +31 -0
- data/lib/zaws/services/ec2.rb +47 -0
- data/lib/zaws/services/ec2/compute.rb +352 -0
- data/lib/zaws/services/ec2/elasticip.rb +82 -0
- data/lib/zaws/services/ec2/route_table.rb +210 -0
- data/lib/zaws/services/ec2/security_group.rb +186 -0
- data/lib/zaws/services/ec2/subnet.rb +111 -0
- data/lib/zaws/services/ec2/vpc.rb +69 -0
- data/lib/zaws/{elb.rb → services/elb.rb} +3 -2
- data/lib/zaws/services/elb/load_balancer.rb +160 -0
- data/lib/zaws/services/iam.rb +25 -0
- data/lib/zaws/services/iam/policy.rb +25 -0
- data/lib/zaws/services/iam/role.rb +23 -0
- data/lib/zaws/services/nessus.rb +24 -0
- data/lib/zaws/services/nessus/agents.rb +19 -0
- data/lib/zaws/services/nessus/scanners.rb +19 -0
- data/lib/zaws/services/newrelic.rb +21 -0
- data/lib/zaws/services/newrelic/servers.rb +19 -0
- data/lib/zaws/{route53.rb → services/route53.rb} +1 -1
- data/lib/zaws/services/route53/hosted_zone.rb +36 -0
- data/lib/zaws/services/s3.rb +15 -0
- data/lib/zaws/services/s3/bucket.rb +42 -0
- data/lib/zaws/services/sumo.rb +21 -0
- data/lib/zaws/services/sumo/collectors.rb +19 -0
- data/lib/zaws/services/vmware.rb +0 -0
- data/lib/zaws/version.rb +1 -1
- data/shove_all.sh +6 -0
- data/shove_all_mac.sh +6 -0
- data/shove_all_windows.sh +6 -0
- data/spec/spec_helper.rb +0 -0
- data/spec/zaws/command/ec2/compute/assoc_security_group_spec.rb +135 -0
- data/spec/zaws/command/ec2/compute/compute_spec.rb +321 -0
- data/spec/zaws/command/ec2/compute/images_spec.rb +69 -0
- data/spec/zaws/command/ec2/compute/management_spec.rb +364 -0
- data/spec/zaws/command/ec2/compute/network_spec.rb +93 -0
- data/spec/zaws/command/ec2/compute/node_spec.rb +70 -0
- data/spec/zaws/command/ec2/compute/secondary_ip_spec.rb +212 -0
- data/spec/zaws/command/ec2/compute/storage_spec.rb +63 -0
- data/spec/zaws/command/ec2/elasticip_spec.rb +271 -0
- data/spec/zaws/command/ec2/route_table_spec.rb +844 -0
- data/spec/zaws/command/ec2/security_group_spec.rb +710 -0
- data/spec/zaws/command/ec2/subnet_spec.rb +273 -0
- data/spec/zaws/command/ec2/vpc_spec.rb +180 -0
- data/spec/zaws/command/elb/load_balancer_spec.rb +633 -0
- data/spec/zaws/command/iam/policy_spec.rb +101 -0
- data/spec/zaws/command/iam/role_policy_spec.rb +35 -0
- data/spec/zaws/command/route53/hosted_zone_spec.rb +100 -0
- data/spec/zaws/command/s3/bucket_spec.rb +70 -0
- data/spec/zaws/external/awscli/data/ec2/instance_spec.rb +90 -0
- data/spec/zaws/external/awscli/data/iam/policy_document_spec.rb +56 -0
- data/spec/zaws/external/awscli/data/iam/role_policy_spec.rb +54 -0
- data/spec/zaws/external/awscli/get_aws_version_spec.rb +18 -0
- data/spec/zaws/helper/option_spec.rb +54 -0
- data/spec/zaws/helper/output_spec.rb +144 -0
- data/spec/zaws/helper/process_hash_spec.rb +48 -0
- data/spec/zaws/helper/shell_spec.rb +56 -0
- data/spec/zaws/nessus/scanners.json +0 -0
- data/spec/zaws/version_spec.rb +18 -0
- data/zaws.gemspec +1 -3
- metadata +260 -189
- data/feature/compute/assoc_security_group.feature +0 -55
- data/feature/compute/compute.feature +0 -138
- data/feature/compute/secondary_ip.feature +0 -107
- data/feature/compute/view.feature +0 -23
- data/feature/compute/view_images.feature +0 -24
- data/feature/elasticip/elasticip.feature +0 -138
- data/feature/elasticip/view.feature +0 -18
- data/feature/hosted_zone/view.feature +0 -17
- data/feature/hosted_zone/view_record.feature +0 -29
- data/feature/load_balancer/instance_registration.feature +0 -120
- data/feature/load_balancer/listener.feature +0 -86
- data/feature/load_balancer/load_balancer.feature +0 -101
- data/feature/load_balancer/view.feature +0 -18
- data/feature/route_table/assoc_subnet.feature +0 -128
- data/feature/route_table/route_propagation.feature +0 -93
- data/feature/route_table/route_table.feature +0 -91
- data/feature/route_table/route_to_gateway.feature +0 -69
- data/feature/route_table/route_to_instance.feature +0 -115
- data/feature/route_table/view.feature +0 -25
- data/feature/security_group/ingress_cidr.feature +0 -144
- data/feature/security_group/ingress_group.feature +0 -184
- data/feature/security_group/security_group.feature +0 -107
- data/feature/security_group/view.feature +0 -23
- data/feature/subnet/subnet.feature +0 -94
- data/feature/subnet/view.feature +0 -24
- data/feature/support/env.rb +0 -14
- data/feature/version.feature +0 -6
- data/lib/zaws/aws.rb +0 -26
- data/lib/zaws/ec2.rb +0 -40
- data/lib/zaws/ec2/compute.rb +0 -247
- data/lib/zaws/ec2/elasticip.rb +0 -79
- data/lib/zaws/ec2/route_table.rb +0 -207
- data/lib/zaws/ec2/security_group.rb +0 -154
- data/lib/zaws/ec2/subnet.rb +0 -109
- data/lib/zaws/elb/load_balancer.rb +0 -157
- data/lib/zaws/route53/hosted_zone.rb +0 -36
- data/spec/zaws/ec2/compute/add_volume_spec.rb +0 -39
- data/spec/zaws/ec2/compute/block_device_mapping_spec.rb +0 -31
- data/spec/zaws/ec2/compute/instance_id_by_external_id_spec.rb +0 -23
- data/spec/zaws/ec2/compute/instance_ping_spec.rb +0 -34
- data/spec/zaws/ec2/compute/instance_running_spec.rb +0 -47
- data/spec/zaws/ec2/compute/network_interface_json_spec.rb +0 -57
- data/spec/zaws/ec2/compute/nosdcheck_spec.rb +0 -17
- data/spec/zaws/ec2/compute/tag_instance_spec.rb +0 -21
- data/spec/zaws/ec2/security_group/id_by_name_spec.rb +0 -32
- data/spec/zaws/ec2/subnet/available_spec.rb +0 -22
- data/spec/zaws/ec2/subnet/declare_spec.rb +0 -31
- data/spec/zaws/ec2/subnet/exists_spec.rb +0 -33
- data/spec/zaws/ec2/subnet/id_array_by_cidrblock_array_spec.rb +0 -48
- data/spec/zaws/ec2/subnet/id_by_cidrblock_spec.rb +0 -35
- data/spec/zaws/ec2/subnet/id_by_ip_spec.rb +0 -42
- data/spec/zaws/ec2/subnet/view_spec.rb +0 -34
- data/spec/zaws/elb/load_balancer/calculated_listener_spec.rb +0 -18
- data/spec/zaws/helper/option/absent_spec.rb +0 -14
- data/spec/zaws/helper/option/exclusive_spec.rb +0 -14
- data/spec/zaws/helper/option/exists_spec.rb +0 -18
- data/spec/zaws/helper/option/minimum_spec.rb +0 -14
- data/spec/zaws/helper/output/binary_nagios_check_spec.rb +0 -19
- data/spec/zaws/helper/output/colorize_spec.rb +0 -30
- data/spec/zaws/helper/output/opt_exclusive_spec.rb +0 -14
- data/spec/zaws/helper/output/opt_minimum_spec.rb +0 -15
- data/spec/zaws/helper/output/opt_required_spec.rb +0 -12
- data/spec/zaws/helper/shell/cli_spec.rb +0 -33
- data/spec/zaws/helper/shell/if_then_spec.rb +0 -24
@@ -0,0 +1,39 @@
|
|
1
|
+
module ZAWS
|
2
|
+
class External
|
3
|
+
class AWSCLI
|
4
|
+
class Generators
|
5
|
+
class Result
|
6
|
+
class EC2
|
7
|
+
class AllocationId
|
8
|
+
def initialize
|
9
|
+
@addresses= {}
|
10
|
+
self
|
11
|
+
end
|
12
|
+
|
13
|
+
def public_ip(ip)
|
14
|
+
@addresses["PublicIp"]=ip
|
15
|
+
self
|
16
|
+
end
|
17
|
+
|
18
|
+
def domain(domain)
|
19
|
+
@addresses["Domain"]=domain
|
20
|
+
self
|
21
|
+
end
|
22
|
+
|
23
|
+
def allocation_id(id)
|
24
|
+
@addresses["AllocationId"]=id
|
25
|
+
self
|
26
|
+
end
|
27
|
+
|
28
|
+
def get_json
|
29
|
+
@addresses.to_json
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module ZAWS
|
2
|
+
class External
|
3
|
+
class AWSCLI
|
4
|
+
class Generators
|
5
|
+
class Result
|
6
|
+
class EC2
|
7
|
+
class AssociationId
|
8
|
+
def initialize
|
9
|
+
@addresses= {}
|
10
|
+
self
|
11
|
+
end
|
12
|
+
|
13
|
+
def association_id(id)
|
14
|
+
@addresses["AssociationId"]=id
|
15
|
+
self
|
16
|
+
end
|
17
|
+
|
18
|
+
def get_json
|
19
|
+
@addresses.to_json
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module ZAWS
|
2
|
+
class External
|
3
|
+
class AWSCLI
|
4
|
+
class Generators
|
5
|
+
class Result
|
6
|
+
class EC2
|
7
|
+
class Images
|
8
|
+
def initialize
|
9
|
+
@res= {}
|
10
|
+
@res["Images"]= []
|
11
|
+
self
|
12
|
+
end
|
13
|
+
|
14
|
+
def root_device_name(image_number, name)
|
15
|
+
resize_images_array(image_number)
|
16
|
+
@res["Images"][image_number]["RootDeviceNmae"]=name
|
17
|
+
self
|
18
|
+
end
|
19
|
+
|
20
|
+
def block_device_mappings(image_number,block)
|
21
|
+
@res["Images"][image_number]["BlockDeviceMappings"]=block
|
22
|
+
self
|
23
|
+
end
|
24
|
+
|
25
|
+
def resize_images_array(index)
|
26
|
+
while index > @res["Images"].length-1
|
27
|
+
@res["Images"].push({})
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def get_json
|
32
|
+
@res.to_json
|
33
|
+
end
|
34
|
+
|
35
|
+
def get_images_array
|
36
|
+
@res["Images"]
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
@@ -0,0 +1,57 @@
|
|
1
|
+
module ZAWS
|
2
|
+
class External
|
3
|
+
class AWSCLI
|
4
|
+
class Generators
|
5
|
+
class Result
|
6
|
+
class EC2
|
7
|
+
class Instances
|
8
|
+
def initialize
|
9
|
+
@res= {}
|
10
|
+
@res["Reservations"]= []
|
11
|
+
@res["Reservations"] << { "Instances" => [] }
|
12
|
+
self
|
13
|
+
end
|
14
|
+
|
15
|
+
def instance_id(instance_number, id)
|
16
|
+
resize_instances_array(instance_number)
|
17
|
+
@res["Reservations"][0]["Instances"][instance_number]["InstanceId"]=id
|
18
|
+
self
|
19
|
+
end
|
20
|
+
|
21
|
+
def security_groups(instance_number,groups)
|
22
|
+
@res["Reservations"][0]["Instances"][instance_number]["SecurityGroups"]=groups.get_security_groups_array
|
23
|
+
self
|
24
|
+
end
|
25
|
+
|
26
|
+
def network_interfaces(instance_number,interfaces)
|
27
|
+
@res["Reservations"][0]["Instances"][instance_number]["NetworkInterfaces"]=interfaces.get_network_interfaces_array
|
28
|
+
self
|
29
|
+
end
|
30
|
+
|
31
|
+
def tags(instance_number,tags)
|
32
|
+
@res["Reservations"][0]["Instances"][instance_number]["Tags"]=tags.get_tags_array
|
33
|
+
self
|
34
|
+
end
|
35
|
+
|
36
|
+
def resize_instances_array(index)
|
37
|
+
while index > @res["Reservations"][0]["Instances"].length-1
|
38
|
+
@res["Reservations"][0]["Instances"].push({})
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def get_json
|
43
|
+
@res.to_json
|
44
|
+
end
|
45
|
+
|
46
|
+
def get_instances_array
|
47
|
+
@res["Reservations"][0]["Instances"]
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
@@ -0,0 +1,70 @@
|
|
1
|
+
module ZAWS
|
2
|
+
class External
|
3
|
+
class AWSCLI
|
4
|
+
class Generators
|
5
|
+
class Result
|
6
|
+
class EC2
|
7
|
+
class IpPermissions
|
8
|
+
def initialize
|
9
|
+
@ip_perms= {}
|
10
|
+
@ip_perms["IpPermissions"]= []
|
11
|
+
self
|
12
|
+
end
|
13
|
+
|
14
|
+
def to_port(security_group_number, port)
|
15
|
+
resize_ip_permissions_array(security_group_number)
|
16
|
+
@ip_perms["IpPermissions"][security_group_number]["ToPort"]=port
|
17
|
+
self
|
18
|
+
end
|
19
|
+
|
20
|
+
def ip_protocol(security_group_number, proto)
|
21
|
+
resize_ip_permissions_array(security_group_number)
|
22
|
+
@ip_perms["IpPermissions"][security_group_number]["IpProtocol"]=proto
|
23
|
+
self
|
24
|
+
end
|
25
|
+
|
26
|
+
def from_port(security_group_number, port)
|
27
|
+
resize_ip_permissions_array(security_group_number)
|
28
|
+
@ip_perms["IpPermissions"][security_group_number]["FromPort"]=port
|
29
|
+
self
|
30
|
+
end
|
31
|
+
|
32
|
+
def resize_ip_permissions_array(index)
|
33
|
+
while index > @ip_perms["IpPermissions"].length-1
|
34
|
+
@ip_perms["IpPermissions"].push({})
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def ip_ranges(security_group_number, cidr)
|
39
|
+
resize_ip_permissions_array(security_group_number)
|
40
|
+
@ip_perms["IpPermissions"][security_group_number]["IpRanges"] ||= []
|
41
|
+
@ip_perms["IpPermissions"][security_group_number]["IpRanges"] << {'CidrIp' => cidr }
|
42
|
+
self
|
43
|
+
end
|
44
|
+
|
45
|
+
def user_id_group_pairs(security_group_number, user_id, group_id)
|
46
|
+
resize_ip_permissions_array(security_group_number)
|
47
|
+
@ip_perms["IpPermissions"][security_group_number]["UserIdGroupPairs"] ||= []
|
48
|
+
@ip_perms["IpPermissions"][security_group_number]["UserIdGroupPairs"] << {
|
49
|
+
'UserId' => user_id,
|
50
|
+
'GroupId' => group_id}
|
51
|
+
self
|
52
|
+
end
|
53
|
+
|
54
|
+
def get_json
|
55
|
+
@ip_perms.to_json
|
56
|
+
end
|
57
|
+
|
58
|
+
def get_ip_permissions_array
|
59
|
+
@ip_perms["IpPermissions"]
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
|
@@ -0,0 +1,53 @@
|
|
1
|
+
module ZAWS
|
2
|
+
class External
|
3
|
+
class AWSCLI
|
4
|
+
class Generators
|
5
|
+
class Result
|
6
|
+
class EC2
|
7
|
+
class NetworkInterfaces
|
8
|
+
def initialize
|
9
|
+
@net= {}
|
10
|
+
@net["NetworkInterfaces"]= []
|
11
|
+
self
|
12
|
+
end
|
13
|
+
|
14
|
+
def network_interface_id(network_interface_number, id)
|
15
|
+
resize_network_interface_array(network_interface_number)
|
16
|
+
@net["NetworkInterfaces"][network_interface_number]["NetworkInterfaceId"]=id
|
17
|
+
self
|
18
|
+
end
|
19
|
+
|
20
|
+
def groups(network_interface_number, groups)
|
21
|
+
resize_network_interface_array(network_interface_number)
|
22
|
+
@net["NetworkInterfaces"][network_interface_number]["Groups"]=groups.get_security_groups_array
|
23
|
+
self
|
24
|
+
end
|
25
|
+
|
26
|
+
def private_ip_addresses(network_interface_number, ips)
|
27
|
+
resize_network_interface_array(network_interface_number)
|
28
|
+
@net["NetworkInterfaces"][network_interface_number]["PrivateIpAddresses"]=ips.get_private_ip_addresses_array
|
29
|
+
self
|
30
|
+
end
|
31
|
+
|
32
|
+
def resize_network_interface_array(index)
|
33
|
+
while index > @net["NetworkInterfaces"].length-1
|
34
|
+
@net["NetworkInterfaces"].push({})
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def get_json
|
39
|
+
@net.to_json
|
40
|
+
end
|
41
|
+
|
42
|
+
def get_network_interfaces_array
|
43
|
+
@net["NetworkInterfaces"]
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module ZAWS
|
2
|
+
class External
|
3
|
+
class AWSCLI
|
4
|
+
class Generators
|
5
|
+
class Result
|
6
|
+
class EC2
|
7
|
+
class PrivateIpAddresses
|
8
|
+
def initialize
|
9
|
+
@ips= {}
|
10
|
+
@ips["PrivateIpAddresses"]= []
|
11
|
+
self
|
12
|
+
end
|
13
|
+
|
14
|
+
def private_ip_address(ip_number, ip)
|
15
|
+
resize_ip_array(ip_number)
|
16
|
+
@ips["PrivateIpAddresses"][ip_number]["PrivateIpAddress"]=ip
|
17
|
+
self
|
18
|
+
end
|
19
|
+
|
20
|
+
def resize_ip_array(index)
|
21
|
+
while index > @ips["PrivateIpAddresses"].length-1
|
22
|
+
@ips["PrivateIpAddresses"].push({})
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def get_json
|
27
|
+
@ips.to_json
|
28
|
+
end
|
29
|
+
|
30
|
+
def get_private_ip_addresses_array
|
31
|
+
@ips["PrivateIpAddresses"]
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
@@ -0,0 +1,80 @@
|
|
1
|
+
module ZAWS
|
2
|
+
class External
|
3
|
+
class AWSCLI
|
4
|
+
class Generators
|
5
|
+
class Result
|
6
|
+
class EC2
|
7
|
+
class RouteTables
|
8
|
+
def initialize
|
9
|
+
@route_tables= {}
|
10
|
+
@route_tables["RouteTables"]= []
|
11
|
+
@route_tables["Associations"]= []
|
12
|
+
self
|
13
|
+
end
|
14
|
+
|
15
|
+
def vpc_id(route_table_number, vpc_id)
|
16
|
+
resize_route_tables_array(route_table_number)
|
17
|
+
@route_tables["RouteTables"][route_table_number]["VpcId"]=vpc_id
|
18
|
+
self
|
19
|
+
end
|
20
|
+
|
21
|
+
def route_table_id(route_table_number, id)
|
22
|
+
resize_route_tables_array(route_table_number)
|
23
|
+
@route_tables["RouteTables"][route_table_number]["RouteTableId"]=id
|
24
|
+
self
|
25
|
+
end
|
26
|
+
|
27
|
+
def resize_route_tables_array(index)
|
28
|
+
while index > @route_tables["RouteTables"].length-1
|
29
|
+
@route_tables["RouteTables"].push({})
|
30
|
+
end
|
31
|
+
@route_tables["RouteTables"][index]["Associations"] ||= []
|
32
|
+
@route_tables["RouteTables"][index]["PropagatingVgws"] ||= []
|
33
|
+
@route_tables["RouteTables"][index]["Routes"] ||= []
|
34
|
+
end
|
35
|
+
|
36
|
+
def add(route_tables)
|
37
|
+
@route_tables["RouteTables"].concat(route_tables.get_route_tables_array)
|
38
|
+
self
|
39
|
+
end
|
40
|
+
|
41
|
+
def routes(route_table_number, routes)
|
42
|
+
resize_route_tables_array(route_table_number)
|
43
|
+
@route_tables["RouteTables"][route_table_number]["Routes"].concat(routes.get_route_array)
|
44
|
+
self
|
45
|
+
end
|
46
|
+
|
47
|
+
def associate_subnets(route_table_number, subnets)
|
48
|
+
resize_route_tables_array(route_table_number)
|
49
|
+
@route_tables["RouteTables"][route_table_number]["Associations"].concat(subnets.get_subnets_array)
|
50
|
+
self
|
51
|
+
end
|
52
|
+
|
53
|
+
def propagate_to_virtual_gateway(route_table_number, gateway)
|
54
|
+
resize_route_tables_array(route_table_number)
|
55
|
+
@route_tables["RouteTables"][route_table_number]["PropagatingVgws"] << gateway.get_hash
|
56
|
+
self
|
57
|
+
end
|
58
|
+
|
59
|
+
def get_json
|
60
|
+
@route_tables.to_json
|
61
|
+
end
|
62
|
+
|
63
|
+
def get_json_single_route_table(index)
|
64
|
+
single={"RouteTable" => @route_tables["RouteTables"][index]}
|
65
|
+
single.to_json
|
66
|
+
end
|
67
|
+
|
68
|
+
def get_route_tables_array
|
69
|
+
@route_tables["RouteTables"]
|
70
|
+
end
|
71
|
+
|
72
|
+
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
@@ -0,0 +1,58 @@
|
|
1
|
+
module ZAWS
|
2
|
+
class External
|
3
|
+
class AWSCLI
|
4
|
+
class Generators
|
5
|
+
class Result
|
6
|
+
class EC2
|
7
|
+
class Routes
|
8
|
+
def initialize
|
9
|
+
@route= {}
|
10
|
+
@route["Routes"]= []
|
11
|
+
self
|
12
|
+
end
|
13
|
+
|
14
|
+
def instance_id(route_number, id)
|
15
|
+
resize_route_array(route_number)
|
16
|
+
@route["Routes"][route_number]["InstanceId"]=id
|
17
|
+
self
|
18
|
+
end
|
19
|
+
|
20
|
+
def gateway_id(route_number, id)
|
21
|
+
resize_route_array(route_number)
|
22
|
+
@route["Routes"][route_number]["GatewayId"]=id
|
23
|
+
self
|
24
|
+
end
|
25
|
+
|
26
|
+
def destination_cidr_block(route_number, cidr)
|
27
|
+
resize_route_array(route_number)
|
28
|
+
@route["Routes"][route_number]["DestinationCidrBlock"]=cidr
|
29
|
+
self
|
30
|
+
end
|
31
|
+
|
32
|
+
def resize_route_array(index)
|
33
|
+
while index > @route["Routes"].length-1
|
34
|
+
@route["Routes"].push({})
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def add(route)
|
39
|
+
@route["Routes"].concat(route.get_route_array)
|
40
|
+
self
|
41
|
+
end
|
42
|
+
|
43
|
+
def get_json
|
44
|
+
@route.to_json
|
45
|
+
end
|
46
|
+
|
47
|
+
def get_route_array
|
48
|
+
@route["Routes"]
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|