awspec 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c7cdec523d2ed0c3f17c1fe819f9ec63907135d7
4
- data.tar.gz: 8a56f108f5fd80304b1c7f2d12cd14992cf0ebd7
3
+ metadata.gz: 8c81642a5b9b297d827bead3be1bf63946948cf8
4
+ data.tar.gz: ec37738f21f3047036e55876a6386406edd33220
5
5
  SHA512:
6
- metadata.gz: 5f22da57b3c932b9e98ab55e6a07db11346c45ba90e126e72a411a81d0d315eb424b49502e453b8a77b2d19cf639bac380b7eef610a91b7c095ff2beca1d2cc5
7
- data.tar.gz: 74de2a12f8a98ab7fc1f4409d86972e36611e781be22db161caddc0cf99becd3f3c195b1f7cc594b22167dc5302bd5e8e129521440f134c40fb6a63c87e92500
6
+ metadata.gz: 2af5ebabeece857dbf0eeb260b5541ef925448ddab272f382c74cd1234f0e3097062620ef3bac6bf71879f2f72e36e0a3fe80e3fb644193e4074b183daeb2965
7
+ data.tar.gz: 6011008a79a69fe3f8fd2184374ee03670f27e550d1162e5b4f64cd1f55f124ed9c0bb1ea657c623e30129d877d6c6f0737d3f18f7630a25b892bc8802f5f7da
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # awspec [![Build Status](https://travis-ci.org/k1LoW/awspec.svg?branch=master)](https://travis-ci.org/k1LoW/awspec)
1
+ # awspec [![Gem](https://img.shields.io/gem/v/awspec.svg)](https://rubygems.org/gems/awspec) [![Travis](https://img.shields.io/travis/k1LoW/awspec.svg)](https://travis-ci.org/k1LoW/awspec)
2
2
 
3
3
  RSpec tests for your AWS resources.
4
4
 
@@ -41,11 +41,11 @@ end
41
41
 
42
42
  ## Support AWS Resources
43
43
 
44
- - [X] EC2
45
- - [X] RDS
46
- - [ ] RDS DB Parameter
47
- - [X] Security Group
48
- - [X] VPC
44
+ - [X] EC2 (`ec2`)
45
+ - [X] RDS (`rds`)
46
+ - [X] RDS DB Parameter Group (`rds_db_parameter_group`)
47
+ - [X] Security Group (`security_group`)
48
+ - [X] VPC (`vpc`)
49
49
 
50
50
  ### Next..
51
51
 
@@ -2,7 +2,7 @@ module Awspec
2
2
  module Helper
3
3
  module Type
4
4
  types = %w(
5
- base ec2 rds security_group vpc
5
+ base ec2 rds rds_db_parameter_group security_group vpc
6
6
  )
7
7
 
8
8
  types.each { |type| require "awspec/type/#{type}" }
@@ -48,21 +48,12 @@ module Awspec::Type
48
48
  end
49
49
  end
50
50
 
51
- describes = %w(
52
- instance_id image_id state private_dns_name public_dns_name
53
- state_transition_reason key_name ami_launch_index product_codes
54
- instance_type launch_time placement kernel_id ramdisk_id platform
55
- monitoring subnet_id vpc_id private_ip_address public_ip_address
56
- state_reason architecture root_device_type root_device_name
57
- block_device_mappings virtualization_type instance_lifecycle
58
- spot_instance_request_id client_token tags security_groups
59
- source_dest_check hypervisor network_interfaces
60
- iam_instance_profile ebs_optimized sriov_net_support
61
- )
62
-
63
- describes.each do |describe|
64
- define_method describe do
51
+ def method_missing(name)
52
+ describe = name.to_s
53
+ if @instance.key?(describe)
65
54
  @instance[describe]
55
+ else
56
+ super
66
57
  end
67
58
  end
68
59
 
@@ -29,23 +29,12 @@ module Awspec::Type
29
29
  end
30
30
  end
31
31
 
32
- describes = %w(
33
- db_instance_identifier db_instance_class engine db_instance_status
34
- master_username db_name endpoint allocated_storage instance_create_time
35
- preferred_backup_window backup_retention_period db_security_groups
36
- vpc_security_groups db_parameter_groups availability_zone
37
- db_subnet_group preferred_maintenance_window pending_modified_values
38
- latest_restorable_time multi_az engine_version auto_minor_version_upgrade
39
- read_replica_source_db_instance_identifier
40
- read_replica_db_instance_identifiers license_model iops
41
- option_group_memberships character_set_name secondary_availability_zone
42
- publicly_accessible status_infos storage_type tde_credential_arn
43
- storage_encrypted kms_key_id dbi_resource_id ca_certificate_identifier
44
- )
45
-
46
- describes.each do |describe|
47
- define_method describe do
32
+ def method_missing(name)
33
+ describe = name.to_s
34
+ if @instance.key?(describe)
48
35
  @instance[describe]
36
+ else
37
+ super
49
38
  end
50
39
  end
51
40
 
@@ -0,0 +1,31 @@
1
+ module Awspec::Type
2
+ class RdsDbParameterGroup < Base
3
+ attr_reader :parameters
4
+
5
+ def initialize(name)
6
+ @client = Aws::RDS::Client.new
7
+ @parameters = {}
8
+
9
+ marker = nil
10
+ while @parameters.empty? || !marker.nil?
11
+ res = @client.describe_db_parameters(
12
+ db_parameter_group_name: name,
13
+ marker: marker)
14
+ marker = res.marker
15
+ break if res.parameters.empty?
16
+ res.parameters.each do |param|
17
+ @parameters[param.parameter_name] = param.parameter_value
18
+ end
19
+ end
20
+ end
21
+
22
+ def method_missing(name)
23
+ param_name = name.to_s
24
+ if @parameters.key?(param_name)
25
+ @parameters[param_name].to_s
26
+ else
27
+ super
28
+ end
29
+ end
30
+ end
31
+ end
@@ -10,14 +10,12 @@ module Awspec::Type
10
10
  @id = @sg[:group_id]
11
11
  end
12
12
 
13
- describes = %w(
14
- owner_id group_name group_id description
15
- ip_permissions ip_permissions_egress vpc_id tags
16
- )
17
-
18
- describes.each do |describe|
19
- define_method describe do
13
+ def method_missing(name)
14
+ describe = name.to_s
15
+ if @sg.key?(describe)
20
16
  @sg[describe]
17
+ else
18
+ super
21
19
  end
22
20
  end
23
21
 
@@ -19,14 +19,12 @@ module Awspec::Type
19
19
  end
20
20
  end
21
21
 
22
- describes = %w(
23
- vpc_id state cidr_block dhcp_options_id
24
- tags instance_tenancy is_default
25
- )
26
-
27
- describes.each do |describe|
28
- define_method describe do
22
+ def method_missing(name)
23
+ describe = name.to_s
24
+ if @vpc.key?(describe)
29
25
  @vpc[describe]
26
+ else
27
+ super
30
28
  end
31
29
  end
32
30
 
@@ -1,3 +1,3 @@
1
1
  module Awspec
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - k1LoW
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-07-28 00:00:00.000000000 Z
11
+ date: 2015-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -139,6 +139,7 @@ files:
139
139
  - lib/awspec/type/base.rb
140
140
  - lib/awspec/type/ec2.rb
141
141
  - lib/awspec/type/rds.rb
142
+ - lib/awspec/type/rds_db_parameter_group.rb
142
143
  - lib/awspec/type/security_group.rb
143
144
  - lib/awspec/type/vpc.rb
144
145
  - lib/awspec/version.rb