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.
Files changed (282) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +2 -0
  3. data/.travis.yml +9 -18
  4. data/Gemfile +0 -0
  5. data/Gemfile.lock +26 -35
  6. data/Gemfile.lock.linux +69 -0
  7. data/Gemfile.lock.mac +81 -0
  8. data/Gemfile.lock.windows +77 -0
  9. data/LICENSE +0 -0
  10. data/README.md +11 -0
  11. data/Rakefile +1 -7
  12. data/archive/cloud_trail/cloud_trail.feature +124 -0
  13. data/bin/win_zaws.bat +2 -0
  14. data/lib/zaws.rb +54 -41
  15. data/lib/zaws/command/ai.rb +34 -0
  16. data/lib/zaws/command/bucket.rb +35 -0
  17. data/lib/zaws/command/cloud_trail.rb +43 -0
  18. data/lib/zaws/command/compute.rb +152 -87
  19. data/lib/zaws/command/config.rb +42 -0
  20. data/lib/zaws/command/elasticip.rb +19 -9
  21. data/lib/zaws/command/hosted_zone.rb +31 -18
  22. data/lib/zaws/command/iam.rb +37 -0
  23. data/lib/zaws/command/load_balancer.rb +54 -51
  24. data/lib/zaws/command/nessus.rb +41 -0
  25. data/lib/zaws/command/newrelic.rb +30 -0
  26. data/lib/zaws/command/route_table.rb +135 -122
  27. data/lib/zaws/command/security_group.rb +95 -82
  28. data/lib/zaws/command/subnet.rb +58 -46
  29. data/lib/zaws/command/sumo.rb +34 -0
  30. data/lib/zaws/command/vpc.rb +53 -0
  31. data/lib/zaws/external/awscli/awscli.rb +65 -0
  32. data/lib/zaws/external/awscli/commands.rb +10 -0
  33. data/lib/zaws/external/awscli/commands/aws.rb +40 -0
  34. data/lib/zaws/external/awscli/commands/ec2.rb +74 -0
  35. data/lib/zaws/external/awscli/commands/ec2/allocate_address.rb +42 -0
  36. data/lib/zaws/external/awscli/commands/ec2/assign_private_ip_addresses.rb +49 -0
  37. data/lib/zaws/external/awscli/commands/ec2/associate_address.rb +48 -0
  38. data/lib/zaws/external/awscli/commands/ec2/associate_route_table.rb +48 -0
  39. data/lib/zaws/external/awscli/commands/ec2/authorize_security_group_ingress.rb +70 -0
  40. data/lib/zaws/external/awscli/commands/ec2/create_route.rb +60 -0
  41. data/lib/zaws/external/awscli/commands/ec2/create_route_table.rb +40 -0
  42. data/lib/zaws/external/awscli/commands/ec2/create_security_group.rb +58 -0
  43. data/lib/zaws/external/awscli/commands/ec2/create_subnet.rb +62 -0
  44. data/lib/zaws/external/awscli/commands/ec2/create_tags.rb +53 -0
  45. data/lib/zaws/external/awscli/commands/ec2/create_vpc.rb +21 -0
  46. data/lib/zaws/external/awscli/commands/ec2/delete_route.rb +54 -0
  47. data/lib/zaws/external/awscli/commands/ec2/delete_route_table.rb +46 -0
  48. data/lib/zaws/external/awscli/commands/ec2/delete_security_group.rb +46 -0
  49. data/lib/zaws/external/awscli/commands/ec2/delete_subnet.rb +46 -0
  50. data/lib/zaws/external/awscli/commands/ec2/describe_addresses.rb +41 -0
  51. data/lib/zaws/external/awscli/commands/ec2/describe_images.rb +58 -0
  52. data/lib/zaws/external/awscli/commands/ec2/describe_instances.rb +56 -0
  53. data/lib/zaws/external/awscli/commands/ec2/describe_route_tables.rb +44 -0
  54. data/lib/zaws/external/awscli/commands/ec2/describe_security_groups.rb +50 -0
  55. data/lib/zaws/external/awscli/commands/ec2/describe_subnets.rb +48 -0
  56. data/lib/zaws/external/awscli/commands/ec2/describe_vpc_peering_connections.rb +23 -0
  57. data/lib/zaws/external/awscli/commands/ec2/describe_vpcs.rb +26 -0
  58. data/lib/zaws/external/awscli/commands/ec2/disable_vgw_route_propagation.rb +48 -0
  59. data/lib/zaws/external/awscli/commands/ec2/disassociate-address.rb +42 -0
  60. data/lib/zaws/external/awscli/commands/ec2/disassociate_route_table.rb +41 -0
  61. data/lib/zaws/external/awscli/commands/ec2/enable_vgw_route_propagation.rb +48 -0
  62. data/lib/zaws/external/awscli/commands/ec2/filter.rb +115 -0
  63. data/lib/zaws/external/awscli/commands/ec2/modify_instance_attribute.rb +62 -0
  64. data/lib/zaws/external/awscli/commands/ec2/network_interfaces.rb +63 -0
  65. data/lib/zaws/external/awscli/commands/ec2/release_address.rb +42 -0
  66. data/lib/zaws/external/awscli/commands/ec2/revoke_security_group_ingress.rb +70 -0
  67. data/lib/zaws/external/awscli/commands/ec2/run_instances.rb +21 -0
  68. data/lib/zaws/external/awscli/commands/ec2/stop_instances.rb +21 -0
  69. data/lib/zaws/external/awscli/commands/ec2/terminate_instances.rb +40 -0
  70. data/lib/zaws/external/awscli/commands/ec2/unassign_private_ip_addresses.rb +49 -0
  71. data/lib/zaws/external/awscli/commands/elb.rb +19 -0
  72. data/lib/zaws/external/awscli/commands/elb/create_load_balancer.rb +64 -0
  73. data/lib/zaws/external/awscli/commands/elb/create_load_balancer_listeners.rb +47 -0
  74. data/lib/zaws/external/awscli/commands/elb/delete_load_balancer.rb +40 -0
  75. data/lib/zaws/external/awscli/commands/elb/delete_load_balancer_listeners.rb +49 -0
  76. data/lib/zaws/external/awscli/commands/elb/deregister_instances_with_load_balancer.rb +49 -0
  77. data/lib/zaws/external/awscli/commands/elb/describe_load_balancers.rb +30 -0
  78. data/lib/zaws/external/awscli/commands/elb/register_instances_with_load_balancer.rb +49 -0
  79. data/lib/zaws/external/awscli/commands/iam.rb +31 -0
  80. data/lib/zaws/external/awscli/commands/iam/GetPolicy.rb +21 -0
  81. data/lib/zaws/external/awscli/commands/iam/GetPolicyVersion.rb +21 -0
  82. data/lib/zaws/external/awscli/commands/iam/GetRolePolicy.rb +21 -0
  83. data/lib/zaws/external/awscli/commands/route53.rb +19 -0
  84. data/lib/zaws/external/awscli/commands/route53/list_hosted_zones.rb +30 -0
  85. data/lib/zaws/external/awscli/commands/route53/list_resource_record_sets.rb +41 -0
  86. data/lib/zaws/external/awscli/commands/s3/ls.rb +34 -0
  87. data/lib/zaws/external/awscli/commands/s3/mb.rb +41 -0
  88. data/lib/zaws/external/awscli/commands/s3/sync.rb +48 -0
  89. data/lib/zaws/external/awscli/credentials.rb +22 -0
  90. data/lib/zaws/external/awscli/data.rb +10 -0
  91. data/lib/zaws/external/awscli/data/ec2.rb +33 -0
  92. data/lib/zaws/external/awscli/data/ec2/instance.rb +162 -0
  93. data/lib/zaws/external/awscli/data/ec2/security_group.rb +51 -0
  94. data/lib/zaws/external/awscli/data/ec2/subnet.rb +59 -0
  95. data/lib/zaws/external/awscli/data/ec2/vpc.rb +85 -0
  96. data/lib/zaws/external/awscli/data/iam.rb +34 -0
  97. data/lib/zaws/external/awscli/data/iam/policy.rb +42 -0
  98. data/lib/zaws/external/awscli/data/iam/policy_document.rb +52 -0
  99. data/lib/zaws/external/awscli/data/iam/policy_version.rb +42 -0
  100. data/lib/zaws/external/awscli/data/iam/role_policy.rb +52 -0
  101. data/lib/zaws/external/awscli/generators/result/ec2/addresses.rb +70 -0
  102. data/lib/zaws/external/awscli/generators/result/ec2/allocation_id.rb +39 -0
  103. data/lib/zaws/external/awscli/generators/result/ec2/association_id.rb +29 -0
  104. data/lib/zaws/external/awscli/generators/result/ec2/images.rb +46 -0
  105. data/lib/zaws/external/awscli/generators/result/ec2/instances.rb +57 -0
  106. data/lib/zaws/external/awscli/generators/result/ec2/ip_permissions.rb +70 -0
  107. data/lib/zaws/external/awscli/generators/result/ec2/network_interfaces.rb +53 -0
  108. data/lib/zaws/external/awscli/generators/result/ec2/private_ip_addresses.rb +41 -0
  109. data/lib/zaws/external/awscli/generators/result/ec2/route_tables.rb +80 -0
  110. data/lib/zaws/external/awscli/generators/result/ec2/routes.rb +58 -0
  111. data/lib/zaws/external/awscli/generators/result/ec2/security_groups.rb +73 -0
  112. data/lib/zaws/external/awscli/generators/result/ec2/subnets.rb +88 -0
  113. data/lib/zaws/external/awscli/generators/result/ec2/tags.rb +34 -0
  114. data/lib/zaws/external/awscli/generators/result/ec2/virtual_gateway.rb +32 -0
  115. data/lib/zaws/external/awscli/generators/result/elb/listeners.rb +65 -0
  116. data/lib/zaws/external/awscli/generators/result/elb/load_balancers.rb +61 -0
  117. data/lib/zaws/external/awscli/generators/result/route53/hosted_zones.rb +52 -0
  118. data/lib/zaws/external/awscli/regions.rb +13 -0
  119. data/lib/zaws/external/nessusapi/data/agents.rb +36 -0
  120. data/lib/zaws/external/nessusapi/data/scanners.rb +35 -0
  121. data/lib/zaws/external/nessusapi/nessusapi.rb +57 -0
  122. data/lib/zaws/external/nessusapi/reources.rb +10 -0
  123. data/lib/zaws/external/nessusapi/resources/agents.rb +18 -0
  124. data/lib/zaws/external/nessusapi/resources/agents/list.rb +20 -0
  125. data/lib/zaws/external/nessusapi/resources/scanners.rb +18 -0
  126. data/lib/zaws/external/nessusapi/resources/scanners/list.rb +20 -0
  127. data/lib/zaws/external/newrelicapi/data/servers.rb +36 -0
  128. data/lib/zaws/external/newrelicapi/newrelic_client.rb +64 -0
  129. data/lib/zaws/external/newrelicapi/newrelic_creds.rb +60 -0
  130. data/lib/zaws/external/newrelicapi/newrelicapi.rb +46 -0
  131. data/lib/zaws/external/newrelicapi/resources/servers.rb +18 -0
  132. data/lib/zaws/external/newrelicapi/resources/servers/list.rb +20 -0
  133. data/lib/zaws/external/sumoapi/data/collectors.rb +35 -0
  134. data/lib/zaws/external/sumoapi/data/sources.rb +35 -0
  135. data/lib/zaws/external/sumoapi/resources/collectors.rb +18 -0
  136. data/lib/zaws/external/sumoapi/resources/collectors/list.rb +20 -0
  137. data/lib/zaws/external/sumoapi/resources/sources.rb +18 -0
  138. data/lib/zaws/external/sumoapi/resources/sources/list.rb +20 -0
  139. data/lib/zaws/external/sumoapi/sumo_client.rb +63 -0
  140. data/lib/zaws/external/sumoapi/sumo_creds.rb +67 -0
  141. data/lib/zaws/external/sumoapi/sumoapi.rb +56 -0
  142. data/lib/zaws/helper/data_lattice.rb +22 -0
  143. data/lib/zaws/helper/filestore.rb +48 -0
  144. data/lib/zaws/helper/filter.rb +15 -0
  145. data/lib/zaws/helper/inifile.rb +632 -0
  146. data/lib/zaws/helper/nessus_client.rb +143 -0
  147. data/lib/zaws/helper/nessus_creds.rb +67 -0
  148. data/lib/zaws/helper/option.rb +14 -15
  149. data/lib/zaws/helper/output.rb +81 -29
  150. data/lib/zaws/helper/process_hash.rb +47 -0
  151. data/lib/zaws/helper/shell.rb +0 -0
  152. data/lib/zaws/helper/verbose.rb +15 -0
  153. data/lib/zaws/helper/zfile.rb +8 -8
  154. data/lib/zaws/services/ai.rb +35 -0
  155. data/lib/zaws/services/ai/query.rb +135 -0
  156. data/lib/zaws/services/aws.rb +41 -0
  157. data/lib/zaws/services/chef.rb +0 -0
  158. data/lib/zaws/services/cloud_trail.rb +76 -0
  159. data/lib/zaws/services/config.rb +31 -0
  160. data/lib/zaws/services/ec2.rb +47 -0
  161. data/lib/zaws/services/ec2/compute.rb +352 -0
  162. data/lib/zaws/services/ec2/elasticip.rb +82 -0
  163. data/lib/zaws/services/ec2/route_table.rb +210 -0
  164. data/lib/zaws/services/ec2/security_group.rb +186 -0
  165. data/lib/zaws/services/ec2/subnet.rb +111 -0
  166. data/lib/zaws/services/ec2/vpc.rb +69 -0
  167. data/lib/zaws/{elb.rb → services/elb.rb} +3 -2
  168. data/lib/zaws/services/elb/load_balancer.rb +160 -0
  169. data/lib/zaws/services/iam.rb +25 -0
  170. data/lib/zaws/services/iam/policy.rb +25 -0
  171. data/lib/zaws/services/iam/role.rb +23 -0
  172. data/lib/zaws/services/nessus.rb +24 -0
  173. data/lib/zaws/services/nessus/agents.rb +19 -0
  174. data/lib/zaws/services/nessus/scanners.rb +19 -0
  175. data/lib/zaws/services/newrelic.rb +21 -0
  176. data/lib/zaws/services/newrelic/servers.rb +19 -0
  177. data/lib/zaws/{route53.rb → services/route53.rb} +1 -1
  178. data/lib/zaws/services/route53/hosted_zone.rb +36 -0
  179. data/lib/zaws/services/s3.rb +15 -0
  180. data/lib/zaws/services/s3/bucket.rb +42 -0
  181. data/lib/zaws/services/sumo.rb +21 -0
  182. data/lib/zaws/services/sumo/collectors.rb +19 -0
  183. data/lib/zaws/services/vmware.rb +0 -0
  184. data/lib/zaws/version.rb +1 -1
  185. data/shove_all.sh +6 -0
  186. data/shove_all_mac.sh +6 -0
  187. data/shove_all_windows.sh +6 -0
  188. data/spec/spec_helper.rb +0 -0
  189. data/spec/zaws/command/ec2/compute/assoc_security_group_spec.rb +135 -0
  190. data/spec/zaws/command/ec2/compute/compute_spec.rb +321 -0
  191. data/spec/zaws/command/ec2/compute/images_spec.rb +69 -0
  192. data/spec/zaws/command/ec2/compute/management_spec.rb +364 -0
  193. data/spec/zaws/command/ec2/compute/network_spec.rb +93 -0
  194. data/spec/zaws/command/ec2/compute/node_spec.rb +70 -0
  195. data/spec/zaws/command/ec2/compute/secondary_ip_spec.rb +212 -0
  196. data/spec/zaws/command/ec2/compute/storage_spec.rb +63 -0
  197. data/spec/zaws/command/ec2/elasticip_spec.rb +271 -0
  198. data/spec/zaws/command/ec2/route_table_spec.rb +844 -0
  199. data/spec/zaws/command/ec2/security_group_spec.rb +710 -0
  200. data/spec/zaws/command/ec2/subnet_spec.rb +273 -0
  201. data/spec/zaws/command/ec2/vpc_spec.rb +180 -0
  202. data/spec/zaws/command/elb/load_balancer_spec.rb +633 -0
  203. data/spec/zaws/command/iam/policy_spec.rb +101 -0
  204. data/spec/zaws/command/iam/role_policy_spec.rb +35 -0
  205. data/spec/zaws/command/route53/hosted_zone_spec.rb +100 -0
  206. data/spec/zaws/command/s3/bucket_spec.rb +70 -0
  207. data/spec/zaws/external/awscli/data/ec2/instance_spec.rb +90 -0
  208. data/spec/zaws/external/awscli/data/iam/policy_document_spec.rb +56 -0
  209. data/spec/zaws/external/awscli/data/iam/role_policy_spec.rb +54 -0
  210. data/spec/zaws/external/awscli/get_aws_version_spec.rb +18 -0
  211. data/spec/zaws/helper/option_spec.rb +54 -0
  212. data/spec/zaws/helper/output_spec.rb +144 -0
  213. data/spec/zaws/helper/process_hash_spec.rb +48 -0
  214. data/spec/zaws/helper/shell_spec.rb +56 -0
  215. data/spec/zaws/nessus/scanners.json +0 -0
  216. data/spec/zaws/version_spec.rb +18 -0
  217. data/zaws.gemspec +1 -3
  218. metadata +260 -189
  219. data/feature/compute/assoc_security_group.feature +0 -55
  220. data/feature/compute/compute.feature +0 -138
  221. data/feature/compute/secondary_ip.feature +0 -107
  222. data/feature/compute/view.feature +0 -23
  223. data/feature/compute/view_images.feature +0 -24
  224. data/feature/elasticip/elasticip.feature +0 -138
  225. data/feature/elasticip/view.feature +0 -18
  226. data/feature/hosted_zone/view.feature +0 -17
  227. data/feature/hosted_zone/view_record.feature +0 -29
  228. data/feature/load_balancer/instance_registration.feature +0 -120
  229. data/feature/load_balancer/listener.feature +0 -86
  230. data/feature/load_balancer/load_balancer.feature +0 -101
  231. data/feature/load_balancer/view.feature +0 -18
  232. data/feature/route_table/assoc_subnet.feature +0 -128
  233. data/feature/route_table/route_propagation.feature +0 -93
  234. data/feature/route_table/route_table.feature +0 -91
  235. data/feature/route_table/route_to_gateway.feature +0 -69
  236. data/feature/route_table/route_to_instance.feature +0 -115
  237. data/feature/route_table/view.feature +0 -25
  238. data/feature/security_group/ingress_cidr.feature +0 -144
  239. data/feature/security_group/ingress_group.feature +0 -184
  240. data/feature/security_group/security_group.feature +0 -107
  241. data/feature/security_group/view.feature +0 -23
  242. data/feature/subnet/subnet.feature +0 -94
  243. data/feature/subnet/view.feature +0 -24
  244. data/feature/support/env.rb +0 -14
  245. data/feature/version.feature +0 -6
  246. data/lib/zaws/aws.rb +0 -26
  247. data/lib/zaws/ec2.rb +0 -40
  248. data/lib/zaws/ec2/compute.rb +0 -247
  249. data/lib/zaws/ec2/elasticip.rb +0 -79
  250. data/lib/zaws/ec2/route_table.rb +0 -207
  251. data/lib/zaws/ec2/security_group.rb +0 -154
  252. data/lib/zaws/ec2/subnet.rb +0 -109
  253. data/lib/zaws/elb/load_balancer.rb +0 -157
  254. data/lib/zaws/route53/hosted_zone.rb +0 -36
  255. data/spec/zaws/ec2/compute/add_volume_spec.rb +0 -39
  256. data/spec/zaws/ec2/compute/block_device_mapping_spec.rb +0 -31
  257. data/spec/zaws/ec2/compute/instance_id_by_external_id_spec.rb +0 -23
  258. data/spec/zaws/ec2/compute/instance_ping_spec.rb +0 -34
  259. data/spec/zaws/ec2/compute/instance_running_spec.rb +0 -47
  260. data/spec/zaws/ec2/compute/network_interface_json_spec.rb +0 -57
  261. data/spec/zaws/ec2/compute/nosdcheck_spec.rb +0 -17
  262. data/spec/zaws/ec2/compute/tag_instance_spec.rb +0 -21
  263. data/spec/zaws/ec2/security_group/id_by_name_spec.rb +0 -32
  264. data/spec/zaws/ec2/subnet/available_spec.rb +0 -22
  265. data/spec/zaws/ec2/subnet/declare_spec.rb +0 -31
  266. data/spec/zaws/ec2/subnet/exists_spec.rb +0 -33
  267. data/spec/zaws/ec2/subnet/id_array_by_cidrblock_array_spec.rb +0 -48
  268. data/spec/zaws/ec2/subnet/id_by_cidrblock_spec.rb +0 -35
  269. data/spec/zaws/ec2/subnet/id_by_ip_spec.rb +0 -42
  270. data/spec/zaws/ec2/subnet/view_spec.rb +0 -34
  271. data/spec/zaws/elb/load_balancer/calculated_listener_spec.rb +0 -18
  272. data/spec/zaws/helper/option/absent_spec.rb +0 -14
  273. data/spec/zaws/helper/option/exclusive_spec.rb +0 -14
  274. data/spec/zaws/helper/option/exists_spec.rb +0 -18
  275. data/spec/zaws/helper/option/minimum_spec.rb +0 -14
  276. data/spec/zaws/helper/output/binary_nagios_check_spec.rb +0 -19
  277. data/spec/zaws/helper/output/colorize_spec.rb +0 -30
  278. data/spec/zaws/helper/output/opt_exclusive_spec.rb +0 -14
  279. data/spec/zaws/helper/output/opt_minimum_spec.rb +0 -15
  280. data/spec/zaws/helper/output/opt_required_spec.rb +0 -12
  281. data/spec/zaws/helper/shell/cli_spec.rb +0 -33
  282. data/spec/zaws/helper/shell/if_then_spec.rb +0 -24
@@ -1,18 +0,0 @@
1
- Feature: Elasticip
2
-
3
- Scenario: Get elasticip in a human readable table.
4
- Given I double `aws --output table --region us-west-1 ec2 describe-addresses` with "AWS Elasticip Output"
5
- When I run `bundle exec zaws elasticip view --region us-west-1 --viewtype table`
6
- Then the stdout should contain "AWS Elasticip Output\n"
7
-
8
- Scenario: Get elasticip in a human readable table form by default
9
- Given I double `aws --output table --region us-west-1 ec2 describe-addresses` with "AWS Elasticip Output"
10
- When I run `bundle exec zaws elasticip view --region us-west-1`
11
- Then the stdout should contain "AWS Elasticip Output\n"
12
-
13
- Scenario: Get elasticip in JSON form
14
- Given I double `aws --output json --region us-west-1 ec2 describe-addresses` with "AWS Elasticip JSON Output"
15
- When I run `bundle exec zaws elasticip view --region us-west-1 --viewtype json`
16
- Then the stdout should contain "AWS Elasticip JSON Output\n"
17
-
18
-
@@ -1,17 +0,0 @@
1
- Feature: Hosted Zone
2
-
3
- Scenario: Get hosted zone in a human readable table.
4
- Given I double `aws --output table route53 list-hosted-zones` with "AWS Hosted Zone Output"
5
- When I run `bundle exec zaws hosted_zone view --viewtype table`
6
- Then the stdout should contain "AWS Hosted Zone Output\n"
7
-
8
- Scenario: Get hosted zone in a human readable table form by default
9
- Given I double `aws --output table route53 list-hosted-zones` with "AWS Hosted Zone Output"
10
- When I run `bundle exec zaws hosted_zone view`
11
- Then the stdout should contain "AWS Hosted Zone Output\n"
12
-
13
- Scenario: Get hosted zone in JSON form
14
- Given I double `aws --output json route53 list-hosted-zones` with "AWS Hosted Zone JSON Output"
15
- When I run `bundle exec zaws hosted_zone view --viewtype json`
16
- Then the stdout should contain "AWS Hosted Zone JSON Output\n"
17
-
@@ -1,29 +0,0 @@
1
- Feature: View Record
2
-
3
- Scenario: Get records for hosted zone in a human readable table.
4
- Given I double `aws --output json route53 list-hosted-zones` with stdout:
5
- """
6
- { "HostedZones": [ { "Id": "id-???", "Name": "abc.com." } ] }
7
- """
8
- And I double `aws --output table route53 list-resource-record-sets --hosted-zone-id id-???` with "AWS Resource Record Sets Output"
9
- When I run `bundle exec zaws hosted_zone view_records abc.com. --viewtype table`
10
- Then the stdout should contain "AWS Resource Record Sets Output\n"
11
-
12
- Scenario: Get records for hosted zone in a human readable table form by default
13
- Given I double `aws --output json route53 list-hosted-zones` with stdout:
14
- """
15
- { "HostedZones": [ { "Id": "id-???", "Name": "abc.com." } ] }
16
- """
17
- And I double `aws --output table route53 list-resource-record-sets --hosted-zone-id id-???` with "AWS Resource Record Sets Output"
18
- When I run `bundle exec zaws hosted_zone view_records abc.com.`
19
- Then the stdout should contain "AWS Resource Record Sets Output\n"
20
-
21
- Scenario: Get records for hosted zone in a JSON form.
22
- Given I double `aws --output json route53 list-hosted-zones` with stdout:
23
- """
24
- { "HostedZones": [ { "Id": "id-???", "Name": "abc.com." } ] }
25
- """
26
- And I double `aws --output json route53 list-resource-record-sets --hosted-zone-id id-???` with "AWS Resource Record Sets Output"
27
- When I run `bundle exec zaws hosted_zone view_records abc.com. --viewtype json`
28
- Then the stdout should contain "AWS Resource Record Sets Output\n"
29
-
@@ -1,120 +0,0 @@
1
- Feature: Instance Registration
2
-
3
- Scenario: Determine instance is registered
4
- Given I double `aws --output json --region us-west-1 elb describe-load-balancers` with stdout:
5
- """
6
- { "LoadBalancerDescriptions": [ { "LoadBalancerName": "lbname", "Instances": [ { "InstanceId": "i-X" } ]} ] }
7
- """
8
- And I double `aws --output json --region us-west-1 ec2 describe-instances --filter 'Name=vpc-id,Values=my_vpc_id' 'Name=tag:externalid,Values=my_instance'` with stdout:
9
- """
10
- { "Reservations": [ { "Instances" : [ {"InstanceId": "i-X","Tags": [ { "Value": "my_instance","Key": "externalid" } ] } ] } ] }
11
- """
12
- When I run `bundle exec zaws load_balancer exists_instance lbname my_instance --region us-west-1 --vpcid my_vpc_id`
13
- Then the stdout should contain "true\n"
14
-
15
- Scenario: Determine instance is NOT registered
16
- Given I double `aws --output json --region us-west-1 elb describe-load-balancers` with stdout:
17
- """
18
- { "LoadBalancerDescriptions": [ { "LoadBalancerName": "lbname", "Instances": [ { "InstanceId": "i-Y" } ]} ] }
19
- """
20
- And I double `aws --output json --region us-west-1 ec2 describe-instances --filter 'Name=vpc-id,Values=my_vpc_id' 'Name=tag:externalid,Values=my_instance'` with stdout:
21
- """
22
- { "Reservations": [ { "Instances" : [ {"InstanceId": "i-X","Tags": [ { "Value": "my_instance","Key": "externalid" } ] } ] } ] }
23
- """
24
- When I run `bundle exec zaws load_balancer exists_instance lbname my_instance --region us-west-1 --vpcid my_vpc_id`
25
- Then the stdout should contain "false\n"
26
-
27
- Scenario: Declare instance registration
28
- Given I double `aws --output json --region us-west-1 elb describe-load-balancers` with stdout:
29
- """
30
- { "LoadBalancerDescriptions": [ { "LoadBalancerName": "lbname", "Instances": [ ] } ] }
31
- """
32
- And I double `aws --output json --region us-west-1 ec2 describe-instances --filter 'Name=vpc-id,Values=my_vpc_id' 'Name=tag:externalid,Values=my_instance'` with stdout:
33
- """
34
- { "Reservations": [ { "Instances" : [ {"InstanceId": "i-X","Tags": [ { "Value": "my_instance","Key": "externalid" } ] } ] } ] }
35
- """
36
- And I double `aws --region us-west-1 elb register-instances-with-load-balancer --load-balancer-name lbname --instances i-X` with stdout:
37
- """
38
- { "return" : "true" }
39
- """
40
- When I run `bundle exec zaws load_balancer register_instance lbname my_instance --region us-west-1 --vpcid my_vpc_id`
41
- Then the stdout should contain "New instance registered.\n"
42
-
43
- Scenario: Declare instance registration, Skip creation
44
- Given I double `aws --output json --region us-west-1 elb describe-load-balancers` with stdout:
45
- """
46
- { "LoadBalancerDescriptions": [ { "LoadBalancerName": "lbname", "Instances": [ { "InstanceId": "i-X" } ]} ] }
47
- """
48
- And I double `aws --output json --region us-west-1 ec2 describe-instances --filter 'Name=vpc-id,Values=my_vpc_id' 'Name=tag:externalid,Values=my_instance'` with stdout:
49
- """
50
- { "Reservations": [ { "Instances" : [ {"InstanceId": "i-X","Tags": [ { "Value": "my_instance","Key": "externalid" } ] } ] } ] }
51
- """
52
- When I run `bundle exec zaws load_balancer register_instance lbname my_instance --region us-west-1 --vpcid my_vpc_id`
53
- Then the stdout should contain "Instance already registered. Skipping registration.\n"
54
-
55
- Scenario: Delete
56
- Given I double `aws --output json --region us-west-1 elb describe-load-balancers` with stdout:
57
- """
58
- { "LoadBalancerDescriptions": [ { "LoadBalancerName": "lbname", "Instances": [ { "InstanceId": "i-X" } ]} ] }
59
- """
60
- And I double `aws --output json --region us-west-1 ec2 describe-instances --filter 'Name=vpc-id,Values=my_vpc_id' 'Name=tag:externalid,Values=my_instance'` with stdout:
61
- """
62
- { "Reservations": [ { "Instances" : [ {"InstanceId": "i-X","Tags": [ { "Value": "my_instance","Key": "externalid" } ] } ] } ] }
63
- """
64
- And I double `aws --region us-west-1 elb deregister-instances-with-load-balancer --load-balancer-name lbname --instances i-X` with stdout:
65
- """
66
- { "return" : "true" }
67
- """
68
- When I run `bundle exec zaws load_balancer deregister_instance lbname my_instance --region us-west-1 --vpcid my_vpc_id`
69
- Then the stdout should contain "Instance deregistered.\n"
70
-
71
- Scenario: Delete, skip
72
- Given I double `aws --output json --region us-west-1 elb describe-load-balancers` with stdout:
73
- """
74
- { "LoadBalancerDescriptions": [ { "LoadBalancerName": "lbname", "Instances": [ ] } ] }
75
- """
76
- And I double `aws --output json --region us-west-1 ec2 describe-instances --filter 'Name=vpc-id,Values=my_vpc_id' 'Name=tag:externalid,Values=my_instance'` with stdout:
77
- """
78
- { "Reservations": [ { "Instances" : [ {"InstanceId": "i-X","Tags": [ { "Value": "my_instance","Key": "externalid" } ] } ] } ] }
79
- """
80
- When I run `bundle exec zaws load_balancer deregister_instance lbname my_instance --region us-west-1 --vpcid my_vpc_id`
81
- Then the stdout should contain "Instance not registered. Skipping deregistration.\n"
82
-
83
- Scenario: Nagios OK
84
- Given I double `aws --output json --region us-west-1 elb describe-load-balancers` with stdout:
85
- """
86
- { "LoadBalancerDescriptions": [ { "LoadBalancerName": "lbname", "Instances": [ { "InstanceId": "i-X" } ]} ] }
87
- """
88
- And I double `aws --output json --region us-west-1 ec2 describe-instances --filter 'Name=vpc-id,Values=my_vpc_id' 'Name=tag:externalid,Values=my_instance'` with stdout:
89
- """
90
- { "Reservations": [ { "Instances" : [ {"InstanceId": "i-X","Tags": [ { "Value": "my_instance","Key": "externalid" } ] } ] } ] }
91
- """
92
- When I run `bundle exec zaws load_balancer register_instance lbname my_instance --region us-west-1 --vpcid my_vpc_id --nagios`
93
- Then the stdout should contain "OK: Instance registerd.\n"
94
-
95
- Scenario: Nagios CRITICAL
96
- Given I double `aws --output json --region us-west-1 elb describe-load-balancers` with stdout:
97
- """
98
- { "LoadBalancerDescriptions": [ { "LoadBalancerName": "lbname", "Instances": [ ] } ] }
99
- """
100
- And I double `aws --output json --region us-west-1 ec2 describe-instances --filter 'Name=vpc-id,Values=my_vpc_id' 'Name=tag:externalid,Values=my_instance'` with stdout:
101
- """
102
- { "Reservations": [ { "Instances" : [ {"InstanceId": "i-X","Tags": [ { "Value": "my_instance","Key": "externalid" } ] } ] } ] }
103
- """
104
- When I run `bundle exec zaws load_balancer register_instance lbname my_instance --region us-west-1 --vpcid my_vpc_id --nagios`
105
- Then the stdout should contain "CRITICAL: Instance not registered.\n"
106
-
107
- Scenario: Undo file
108
- Given I double `aws --output json --region us-west-1 elb describe-load-balancers` with stdout:
109
- """
110
- { "LoadBalancerDescriptions": [ { "LoadBalancerName": "lbname", "Instances": [ { "InstanceId": "i-X" } ]} ] }
111
- """
112
- And I double `aws --output json --region us-west-1 ec2 describe-instances --filter 'Name=vpc-id,Values=my_vpc_id' 'Name=tag:externalid,Values=my_instance'` with stdout:
113
- """
114
- { "Reservations": [ { "Instances" : [ {"InstanceId": "i-X","Tags": [ { "Value": "my_instance","Key": "externalid" } ] } ] } ] }
115
- """
116
- Given an empty file named "undo.sh.1"
117
- When I run `bundle exec zaws load_balancer register_instance lbname my_instance --region us-west-1 --vpcid my_vpc_id --undofile undo.sh.1`
118
- Then the stdout should contain "Instance already registered. Skipping registration.\n"
119
- And the file "undo.sh.1" should contain "zaws load_balancer deregister_instance lbname my_instance --region us-west-1 --vpcid my_vpc_id $XTRA_OPTS"
120
-
@@ -1,86 +0,0 @@
1
- Feature: Listner
2
-
3
- Scenario: Determine listner exists
4
- Given I double `aws --output json --region us-west-1 elb describe-load-balancers` with stdout:
5
- """
6
- { "LoadBalancerDescriptions": [ { "LoadBalancerName": "lbname", "ListenerDescriptions": [ { "Listener": { "InstancePort": 80, "LoadBalancerPort": 80, "Protocol": "HTTP", "InstanceProtocol": "HTTP" }, "PolicyNames": [] } ] } ] }
7
- """
8
- When I run `bundle exec zaws load_balancer exists_listener lbname HTTP 80 HTTP 80 --region us-west-1`
9
- Then the stdout should contain "true\n"
10
-
11
- Scenario: Determine listner does not exist
12
- Given I double `aws --output json --region us-west-1 elb describe-load-balancers` with stdout:
13
- """
14
- { "LoadBalancerDescriptions": [ { "LoadBalancerName": "lbname", "ListenerDescriptions": [ { "Listener": { "InstancePort": 17080, "LoadBalancerPort": 80, "Protocol": "HTTP", "InstanceProtocol": "HTTP" }, "PolicyNames": [] } ] } ] }
15
- """
16
- When I run `bundle exec zaws load_balancer exists_listener lbname tcp 80 tcp 80 --region us-west-1`
17
- Then the stdout should contain "false\n"
18
-
19
- Scenario: Declare listner
20
- Given I double `aws --output json --region us-west-1 elb describe-load-balancers` with stdout:
21
- """
22
- { "LoadBalancerDescriptions": [ { "LoadBalancerName": "lbname", "ListenerDescriptions": [] } ] }
23
- """
24
- And I double `aws --region us-west-1 elb create-load-balancer-listeners --load-balancer-name lbname --listeners '[{"Protocol":"HTTP","LoadBalancerPort":80,"InstanceProtocol":"HTTP","InstancePort":80}]'` with stdout:
25
- """
26
- { "return": "true" }
27
- """
28
- When I run `bundle exec zaws load_balancer declare_listener lbname HTTP 80 HTTP 80 --region us-west-1`
29
- Then the stdout should contain "Listener created.\n"
30
-
31
- Scenario: Declare listner, Skip creation
32
- Given I double `aws --output json --region us-west-1 elb describe-load-balancers` with stdout:
33
- """
34
- { "LoadBalancerDescriptions": [ { "LoadBalancerName": "lbname", "ListenerDescriptions": [ { "Listener": { "InstancePort": 80, "LoadBalancerPort": 80, "Protocol": "HTTP", "InstanceProtocol": "HTTP" }, "PolicyNames": [] } ] } ] }
35
- """
36
- When I run `bundle exec zaws load_balancer declare_listener lbname HTTP 80 HTTP 80 --region us-west-1`
37
- Then the stdout should contain "Listerner exists. Skipping creation.\n"
38
-
39
- Scenario: Delete
40
- Given I double `aws --output json --region us-west-1 elb describe-load-balancers` with stdout:
41
- """
42
- { "LoadBalancerDescriptions": [ { "LoadBalancerName": "lbname", "ListenerDescriptions": [ { "Listener": { "InstancePort": 80, "LoadBalancerPort": 80, "Protocol": "HTTP", "InstanceProtocol": "HTTP" }, "PolicyNames": [] } ] } ] }
43
- """
44
- And I double `aws --region us-west-1 elb delete-load-balancer-listeners --load-balancer-name lbname --load-balancer-ports 80` with stdout:
45
- """
46
- { "return": "true" }
47
- """
48
- When I run `bundle exec zaws load_balancer delete_listener lbname HTTP 80 HTTP 80 --region us-west-1`
49
- Then the stdout should contain "Listerner deleted.\n"
50
-
51
- Scenario: Delete, skip
52
- Given I double `aws --output json --region us-west-1 elb describe-load-balancers` with stdout:
53
- """
54
- { "LoadBalancerDescriptions": [ { "LoadBalancerName": "lbname", "ListenerDescriptions": [] } ] }
55
- """
56
- When I run `bundle exec zaws load_balancer delete_listener lbname HTTP 80 HTTP 80 --region us-west-1`
57
- Then the stdout should contain "Listener does not exist. Skipping deletion.\n"
58
-
59
- Scenario: Nagios OK
60
- Given I double `aws --output json --region us-west-1 elb describe-load-balancers` with stdout:
61
- """
62
- { "LoadBalancerDescriptions": [ { "LoadBalancerName": "lbname", "ListenerDescriptions": [ { "Listener": { "InstancePort": 80, "LoadBalancerPort": 80, "Protocol": "HTTP", "InstanceProtocol": "HTTP" }, "PolicyNames": [] } ] } ] }
63
- """
64
- When I run `bundle exec zaws load_balancer declare_listener lbname HTTP 80 HTTP 80 --region us-west-1 --nagios`
65
- Then the stdout should contain "OK: Listerner exists.\n"
66
-
67
- Scenario: Nagios CRITICAL
68
- Given I double `aws --output json --region us-west-1 elb describe-load-balancers` with stdout:
69
- """
70
- { "LoadBalancerDescriptions": [ { "LoadBalancerName": "lbname", "ListenerDescriptions": [] } ] }
71
- """
72
- When I run `bundle exec zaws load_balancer declare_listener lbname HTTP 80 HTTP 80 --region us-west-1 --nagios`
73
- Then the stdout should contain "CRITICAL: Listener does not exist.\n"
74
-
75
- Scenario: Undo file
76
- Given I double `aws --output json --region us-west-1 elb describe-load-balancers` with stdout:
77
- """
78
- { "LoadBalancerDescriptions": [ { "LoadBalancerName": "lbname", "ListenerDescriptions": [ { "Listener": { "InstancePort": 80, "LoadBalancerPort": 80, "Protocol": "HTTP", "InstanceProtocol": "HTTP" }, "PolicyNames": [] } ] } ] }
79
- """
80
- Given an empty file named "undo.sh.1"
81
- When I run `bundle exec zaws load_balancer declare_listener lbname HTTP 80 HTTP 80 --region us-west-1 --undofile undo.sh.1`
82
- Then the stdout should contain "Listerner exists. Skipping creation.\n"
83
- And the file "undo.sh.1" should contain "zaws load_balancer delete_listener lbname HTTP 80 HTTP 80 --region us-west-1 $XTRA_OPTS"
84
-
85
-
86
-
@@ -1,101 +0,0 @@
1
- Feature: Load Balancer
2
-
3
- Scenario: Determine a load balancer exists in a vpc
4
- Given I double `aws --output json --region us-west-1 elb describe-load-balancers` with stdout:
5
- """
6
- { "LoadBalancerDescriptions": [ { "LoadBalancerName": "name-???" } ] }
7
- """
8
- When I run `bundle exec zaws load_balancer exists name-??? --region us-west-1`
9
- Then the stdout should contain "true\n"
10
-
11
- Scenario: Determine a load balancer does not exist in a vpc
12
- Given I double `aws --output json --region us-west-1 elb describe-load-balancers` with stdout:
13
- """
14
- { "LoadBalancerDescriptions": [ ] }
15
- """
16
- When I run `bundle exec zaws load_balancer exists name-??? --region us-west-1`
17
- Then the stdout should contain "false\n"
18
-
19
- Scenario: Declare load balancer in vpc
20
- Given I double `aws --output json --region us-west-1 elb describe-load-balancers` with stdout:
21
- """
22
- { "LoadBalancerDescriptions": [ ] }
23
- """
24
- And I double `aws --output json --region us-west-1 ec2 describe-subnets --filter 'Name=vpc-id,Values=my_vpc_id' 'Name=cidr,Values=10.0.0.0/28'` with stdout:
25
- """
26
- { "Subnets": [ { "SubnetId" : "subnet-A???","CidrBlock":"10.0.0.0/28" }] }
27
- """
28
- And I double `aws --output json --region us-west-1 ec2 describe-subnets --filter 'Name=vpc-id,Values=my_vpc_id' 'Name=cidr,Values=10.0.1.0/28'` with stdout:
29
- """
30
- { "Subnets": [ { "SubnetId" : "subnet-B???" ,"CidrBlock":"10.0.1.0/28"}] }
31
- """
32
- And I double `aws --output json --region us-west-1 ec2 describe-security-groups --filter 'Name=vpc-id,Values=my_vpc_id' 'Name=group-name,Values=my_security_group_name'` with stdout:
33
- """
34
- { "SecurityGroups": [ { "GroupName": "my_security_group_name","GroupId": "sg-???" } ] }
35
- """
36
- And I double `aws --region us-west-1 elb create-load-balancer --load-balancer-name newlb --listeners '[{"Protocol":"tcp","LoadBalancerPort":80,"InstanceProtocol":"tcp","InstancePort":80}]' --subnets subnet-A??? subnet-B??? --security-groups sg-???` with stdout:
37
- """
38
- { "DNSName": "???.us-west-1.elb.amazonaws.com" }
39
- """
40
- When I run `bundle exec zaws load_balancer create_in_subnet newlb tcp 80 tcp 80 my_security_group_name --cidrblocks="10.0.0.0/28" "10.0.1.0/28" --vpcid my_vpc_id --region us-west-1`
41
- Then the stdout should contain "Load balancer created.\n"
42
-
43
- Scenario: Declare load balancer in vpc, Skip creation
44
- Given I double `aws --output json --region us-west-1 elb describe-load-balancers` with stdout:
45
- """
46
- { "LoadBalancerDescriptions": [ { "LoadBalancerName": "name-???" } ] }
47
- """
48
- When I run `bundle exec zaws load_balancer create_in_subnet name-??? tcp 80 tcp 80 my_security_group_name --cidrblocks="10.0.0.0/28" "10.0.1.0/28" --vpcid my_vpc_id --region us-west-1`
49
- Then the stdout should contain "Load balancer already exists. Skipping creation.\n"
50
-
51
- Scenario: Delete
52
- Given I double `aws --output json --region us-west-1 elb describe-load-balancers` with stdout:
53
- """
54
- { "LoadBalancerDescriptions": [ { "LoadBalancerName": "name-???" }] }
55
- """
56
- And I double `aws --region us-west-1 elb delete-load-balancer --load-balancer-name name-???` with stdout:
57
- """
58
- { "return": "true" }
59
- """
60
- When I run `bundle exec zaws load_balancer delete "name-???" --region us-west-1`
61
- Then the stdout should contain "Load balancer deleted.\n"
62
-
63
- Scenario: Delete, skip
64
- Given I double `aws --output json --region us-west-1 elb describe-load-balancers` with stdout:
65
- """
66
- { "LoadBalancerDescriptions": [ ] }
67
- """
68
- When I run `bundle exec zaws load_balancer delete name-??? --region us-west-1`
69
- Then the stdout should contain "Load balancer does not exist. Skipping deletion.\n"
70
-
71
- Scenario: Nagios OK
72
- Given I double `aws --output json --region us-west-1 elb describe-load-balancers` with stdout:
73
- """
74
- { "LoadBalancerDescriptions": [ { "LoadBalancerName": "name-???" } ] }
75
- """
76
- When I run `bundle exec zaws load_balancer create_in_subnet name-??? tcp 80 tcp 80 my_security_group_name --cidrblocks="10.0.0.0/28" "10.0.1.0/28" --vpcid my_vpc_id --region us-west-1 --nagios`
77
- Then the output should contain "OK: Load Balancer Exists.\n"
78
- And the exit status should be 0
79
-
80
- Scenario: Nagios CRITICAL
81
- Given I double `aws --output json --region us-west-1 elb describe-load-balancers` with stdout:
82
- """
83
- { "LoadBalancerDescriptions": [ ] }
84
- """
85
- When I run `bundle exec zaws load_balancer create_in_subnet name-??? tcp 80 tcp 80 my_security_group_name --cidrblocks="10.0.0.0/28" "10.0.1.0/28" --vpcid my_vpc_id --region us-west-1 --nagios`
86
- Then the output should contain "CRITICAL: Load Balancer does not exist.\n"
87
- And the exit status should be 2
88
-
89
- Scenario: Undo file
90
- Given I double `aws --output json --region us-west-1 elb describe-load-balancers` with stdout:
91
- """
92
- { "LoadBalancerDescriptions": [ { "LoadBalancerName": "name-???" } ] }
93
- """
94
- Given an empty file named "undo.sh.1"
95
- When I run `bundle exec zaws load_balancer create_in_subnet name-??? tcp 80 tcp 80 my_security_group_name --cidrblocks="10.0.0.0/28" "10.0.1.0/28" --vpcid my_vpc_id --region us-west-1 --undofile undo.sh.1`
96
- Then the stdout should contain "Load balancer already exists. Skipping creation.\n"
97
- And the file "undo.sh.1" should contain "zaws load_balancer delete name-??? --region us-west-1 $XTRA_OPTS"
98
-
99
-
100
-
101
-
@@ -1,18 +0,0 @@
1
- Feature: Load Balancer
2
-
3
- Scenario: Get load balancer in a human readable table.
4
- Given I double `aws --output table --region us-west-1 elb describe-load-balancers` with "AWS Load Balancer Output"
5
- When I run `bundle exec zaws load_balancer view --region us-west-1 --viewtype table`
6
- Then the stdout should contain "AWS Load Balancer Output\n"
7
-
8
- Scenario: Get load balancer in a human readable table form by default
9
- Given I double `aws --output table --region us-west-1 elb describe-load-balancers` with "AWS Load Balancer Output"
10
- When I run `bundle exec zaws load_balancer view --region us-west-1`
11
- Then the stdout should contain "AWS Load Balancer Output\n"
12
-
13
- Scenario: Get load balancer in JSON form
14
- Given I double `aws --output json --region us-west-1 elb describe-load-balancers` with "AWS Load Balancer JSON Output"
15
- When I run `bundle exec zaws load_balancer view --region us-west-1 --viewtype json`
16
- Then the stdout should contain "AWS Load Balancer JSON Output\n"
17
-
18
-
@@ -1,128 +0,0 @@
1
- Feature: Route Table
2
-
3
- Scenario: Determine that a subnet is associated to a route table
4
- Given I double `aws --output json --region us-west-1 ec2 describe-subnets --filter 'Name=vpc-id,Values=my_vpc_id' 'Name=cidr,Values=my_cidr_block'` with stdout:
5
- """
6
- { "Subnets": [ { "SubnetId" : "X" } ] }
7
- """
8
- And I double `aws --output json --region us-west-1 ec2 describe-route-tables --filter 'Name=vpc-id,Values=my_vpc_id' 'Name=tag:externalid,Values=my_route_table'` with stdout:
9
- """
10
- { "RouteTables": [ { "VpcId":"my_vpc_id","RouteTableId":"rtb-XXXXXXX","Associations": [ { "SubnetId":"X" } ] } ] }
11
- """
12
- When I run `bundle exec zaws route_table subnet_assoc_exists my_route_table my_cidr_block --region us-west-1 --vpcid my_vpc_id`
13
- Then the output should contain "true\n"
14
-
15
- Scenario: Determine that a subnet is NOT associated to a route table
16
- Given I double `aws --output json --region us-west-1 ec2 describe-subnets --filter 'Name=vpc-id,Values=my_vpc_id' 'Name=cidr,Values=my_cidr_block'` with stdout:
17
- """
18
- { "Subnets": [ { "SubnetId" : "X" } ] }
19
- """
20
- And I double `aws --output json --region us-west-1 ec2 describe-route-tables --filter 'Name=vpc-id,Values=my_vpc_id' 'Name=tag:externalid,Values=my_route_table'` with stdout:
21
- """
22
- { "RouteTables": [ { "VpcId":"my_vpc_id","RouteTableId":"rtb-XXXXXXX","Associations": [ ] } ] }
23
- """
24
- When I run `bundle exec zaws route_table subnet_assoc_exists my_route_table my_cidr_block --region us-west-1 --vpcid my_vpc_id`
25
- Then the output should contain "false\n"
26
-
27
- Scenario: Associate a subnet to a route table
28
- Given I double `aws --output json --region us-west-1 ec2 describe-subnets --filter 'Name=vpc-id,Values=my_vpc_id' 'Name=cidr,Values=my_cidr_block'` with stdout:
29
- """
30
- { "Subnets": [ { "SubnetId" : "X" } ] }
31
- """
32
- And I double `aws --output json --region us-west-1 ec2 describe-route-tables --filter 'Name=vpc-id,Values=my_vpc_id' 'Name=tag:externalid,Values=my_route_table'` with stdout:
33
- """
34
- { "RouteTables": [ { "VpcId":"my_vpc_id","RouteTableId":"rtb-XXXXXXX","Associations": [ ] } ] }
35
- """
36
- And I double `aws --region us-west-1 ec2 associate-route-table --subnet-id X --route-table-id rtb-XXXXXXX` with stdout:
37
- """
38
- { "AssociationId": "rtbassoc-???????" }
39
- """
40
- When I run `bundle exec zaws route_table assoc_subnet my_route_table my_cidr_block --region us-west-1 --vpcid my_vpc_id`
41
- Then the output should contain "Route table associated to subnet.\n"
42
-
43
- Scenario: Associate a subnet to a route table, skip because it exists already
44
- Given I double `aws --output json --region us-west-1 ec2 describe-subnets --filter 'Name=vpc-id,Values=my_vpc_id' 'Name=cidr,Values=my_cidr_block'` with stdout:
45
- """
46
- { "Subnets": [ { "SubnetId" : "X" } ] }
47
- """
48
- And I double `aws --output json --region us-west-1 ec2 describe-route-tables --filter 'Name=vpc-id,Values=my_vpc_id' 'Name=tag:externalid,Values=my_route_table'` with stdout:
49
- """
50
- { "RouteTables": [ { "VpcId":"my_vpc_id","RouteTableId":"rtb-XXXXXXX","Associations": [ { "SubnetId":"X" } ] } ] }
51
- """
52
- When I run `bundle exec zaws route_table assoc_subnet my_route_table my_cidr_block --region us-west-1 --vpcid my_vpc_id`
53
- Then the output should contain "Route table already associated to subnet. Skipping association.\n"
54
-
55
- Scenario: Delete subnet association to route table
56
- Given I double `aws --output json --region us-west-1 ec2 describe-subnets --filter 'Name=vpc-id,Values=my_vpc_id' 'Name=cidr,Values=my_cidr_block'` with stdout:
57
- """
58
- { "Subnets": [ { "SubnetId" : "X" } ] }
59
- """
60
- And I double `aws --output json --region us-west-1 ec2 describe-route-tables --filter 'Name=vpc-id,Values=my_vpc_id' 'Name=tag:externalid,Values=my_route_table'` with stdout:
61
- """
62
- { "RouteTables": [ { "VpcId":"my_vpc_id","RouteTableId":"rtb-XXXXXXX","Associations": [ { "SubnetId":"X","RouteTableAssociationId":"rtbassoc-????????" } ] } ] }
63
- """
64
- And I double `aws --region us-west-1 ec2 disassociate-route-table --association-id rtbassoc-????????` with stdout:
65
- """
66
- { "return" : "true" }
67
- """
68
- When I run `bundle exec zaws route_table delete_assoc_subnet my_route_table my_cidr_block --region us-west-1 --vpcid my_vpc_id`
69
- Then the output should contain "Route table association to subnet deleted.\n"
70
-
71
- Scenario: Delete subnet association to route table that does not exists, skip it.
72
- Given I double `aws --output json --region us-west-1 ec2 describe-subnets --filter 'Name=vpc-id,Values=my_vpc_id' 'Name=cidr,Values=my_cidr_block'` with stdout:
73
- """
74
- { "Subnets": [ { "SubnetId" : "X" } ] }
75
- """
76
- And I double `aws --output json --region us-west-1 ec2 describe-route-tables --filter 'Name=vpc-id,Values=my_vpc_id' 'Name=tag:externalid,Values=my_route_table'` with stdout:
77
- """
78
- { "RouteTables": [ { "VpcId":"my_vpc_id","RouteTableId":"rtb-XXXXXXX","Associations": [ ] } ] }
79
- """
80
- When I run `bundle exec zaws route_table delete_assoc_subnet my_route_table my_cidr_block --region us-west-1 --vpcid my_vpc_id`
81
- Then the output should contain "Route table association to subnet not deleted because it does not exist.\n"
82
-
83
- Scenario: Nagios OK
84
- Given I double `aws --output json --region us-west-1 ec2 describe-subnets --filter 'Name=vpc-id,Values=my_vpc_id' 'Name=cidr,Values=my_cidr_block'` with stdout:
85
- """
86
- { "Subnets": [ { "SubnetId" : "X" } ] }
87
- """
88
- And I double `aws --output json --region us-west-1 ec2 describe-route-tables --filter 'Name=vpc-id,Values=my_vpc_id' 'Name=tag:externalid,Values=my_route_table'` with stdout:
89
- """
90
- { "RouteTables": [ { "VpcId":"my_vpc_id","RouteTableId":"rtb-XXXXXXX","Associations": [ { "SubnetId":"X" } ] } ] }
91
- """
92
- When I run `bundle exec zaws route_table assoc_subnet my_route_table my_cidr_block --region us-west-1 --vpcid my_vpc_id --nagios`
93
- Then the output should contain "OK: Route table association to subnet exists.\n"
94
- And the exit status should be 0
95
-
96
- Scenario: Nagios CRITICAL
97
- Given I double `aws --output json --region us-west-1 ec2 describe-subnets --filter 'Name=vpc-id,Values=my_vpc_id' 'Name=cidr,Values=my_cidr_block'` with stdout:
98
- """
99
- { "Subnets": [ { "SubnetId" : "X" } ] }
100
- """
101
- And I double `aws --output json --region us-west-1 ec2 describe-route-tables --filter 'Name=vpc-id,Values=my_vpc_id' 'Name=tag:externalid,Values=my_route_table'` with stdout:
102
- """
103
- { "RouteTables": [ { "VpcId":"my_vpc_id","RouteTableId":"rtb-XXXXXXX","Associations": [ ] } ] }
104
- """
105
- When I run `bundle exec zaws route_table assoc_subnet my_route_table my_cidr_block --region us-west-1 --vpcid my_vpc_id --nagios`
106
- Then the output should contain "CRITICAL: Route table association to subnet does not exist.\n"
107
- And the exit status should be 2
108
-
109
- Scenario: Undo file
110
- Given I double `aws --output json --region us-west-1 ec2 describe-subnets --filter 'Name=vpc-id,Values=my_vpc_id' 'Name=cidr,Values=my_cidr_block'` with stdout:
111
- """
112
- { "Subnets": [ { "SubnetId" : "X" } ] }
113
- """
114
- And I double `aws --output json --region us-west-1 ec2 describe-route-tables --filter 'Name=vpc-id,Values=my_vpc_id' 'Name=tag:externalid,Values=my_route_table'` with stdout:
115
- """
116
- { "RouteTables": [ { "VpcId":"my_vpc_id","RouteTableId":"rtb-XXXXXXX","Associations": [ ] } ] }
117
- """
118
- And I double `aws --region us-west-1 ec2 associate-route-table --subnet-id X --route-table-id rtb-XXXXXXX` with stdout:
119
- """
120
- { "AssociationId": "rtbassoc-???????" }
121
- """
122
- Given an empty file named "undo.sh.1"
123
- When I run `bundle exec zaws route_table assoc_subnet my_route_table my_cidr_block --region us-west-1 --vpcid my_vpc_id --undofile undo.sh.1`
124
- Then the output should contain "Route table associated to subnet.\n"
125
- And the file "undo.sh.1" should contain "zaws route_table delete_assoc_subnet my_route_table my_cidr_block --region us-west-1 --vpcid my_vpc_id"
126
-
127
-
128
-