awspec 1.6.1 → 1.7.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eed077890929747791c651ec850e49bb86cc01c5
4
- data.tar.gz: 98cbb2b15a87e15a045ed7fa58928024cf6a0312
3
+ metadata.gz: e556799c2201a9daccf7462ad8f9ca83d59bbe10
4
+ data.tar.gz: 650f89151631592d2d5b4adaf07e1d4f2968624e
5
5
  SHA512:
6
- metadata.gz: f15bb29d18d6864d69318705aea35c1042271a81cc90db9e8a1ffe6e46a1bc4e52639308bb5bd1e138e19386dceaca1353a785eb60a199edf702845566637c41
7
- data.tar.gz: 76c60ab1bbf7615dee36645d27608c6019644492dc3701b3cd9d48061208e82531ae213a95762ad7740dc0802454377cc3fd95c1779cdd21f3cfa56567405c41
6
+ metadata.gz: 7d4c5c36524c93a129ab2fcf110c210121759f49e953f5ff547b2bec6ae6d3a6849fd8348fda7129b0420c9ece46df56fcaf9cb2e2934de5b5257bbb168dc0ee
7
+ data.tar.gz: d6c628e4ca7ddf3baf3a24facb92dd528afdf96d184520ae5ff6600e26e3fe4b49fdb47870041d6dfb08c52075f58dd92bf6bbdef7162086080b49cc3ea68605
@@ -73,7 +73,7 @@ end
73
73
 
74
74
  ```ruby
75
75
  describe iam_group('my-iam-group') do
76
- its('users.count) { should eq 5 }
76
+ its('users.count') { should eq 5 }
77
77
  end
78
78
  ```
79
79
 
@@ -0,0 +1,33 @@
1
+ ### exist
2
+
3
+ ```ruby
4
+ describe ssm_parameter('my-parameter') do
5
+ it { should exist }
6
+ end
7
+ ```
8
+
9
+ ### be_encrypted
10
+
11
+ ```ruby
12
+ describe ssm_parameter('my-parameter') do
13
+ it { should be_encrypted }
14
+ end
15
+ ```
16
+
17
+ ### have_tag
18
+
19
+ ```ruby
20
+ describe ssm_parameter('my-parameter') do
21
+ it { should have_tag('my-key').value('my-value') }
22
+ end
23
+ ```
24
+
25
+ ### advanced
26
+
27
+ ```ruby
28
+ describe ssm_parameter('my-parameter') do
29
+ its(:key_id) { should be_eql('6a81f446-27b0-4d51-a04f-af7ddeea2e22') }
30
+ its(:description) { should be_eql('Some string description') }
31
+ its(:version) { should be_eql(1) }
32
+ end
33
+ ```
@@ -53,6 +53,7 @@
53
53
  | [security_group](#security_group)
54
54
  | [ses_identity](#ses_identity)
55
55
  | [sqs](#sqs)
56
+ | [ssm_parameter](#ssm_parameter)
56
57
  | [subnet](#subnet)
57
58
  | [vpc](#vpc)
58
59
  | [vpn_connection](#vpn_connection)
@@ -1390,7 +1391,7 @@ end
1390
1391
 
1391
1392
  ```ruby
1392
1393
  describe iam_group('my-iam-group') do
1393
- its('users.count) { should eq 5 }
1394
+ its('users.count') { should eq 5 }
1394
1395
  end
1395
1396
  ```
1396
1397
 
@@ -2197,7 +2198,7 @@ end
2197
2198
  ```
2198
2199
 
2199
2200
 
2200
- ### its(:vpc_id), its(:db_instance_identifier), its(:db_instance_class), its(:engine), its(:db_instance_status), its(:master_username), its(:db_name), its(:endpoint), its(:allocated_storage), its(:instance_create_time), its(:preferred_backup_window), its(:backup_retention_period), its(:db_security_groups), its(:availability_zone), its(:preferred_maintenance_window), its(:pending_modified_values), its(:latest_restorable_time), its(:multi_az), its(:engine_version), its(:auto_minor_version_upgrade), its(:read_replica_source_db_instance_identifier), its(:read_replica_db_instance_identifiers), its(:read_replica_db_cluster_identifiers), its(:license_model), its(:iops), its(:character_set_name), its(:secondary_availability_zone), its(:publicly_accessible), its(:status_infos), its(:storage_type), its(:tde_credential_arn), its(:db_instance_port), its(:db_cluster_identifier), its(:storage_encrypted), its(:kms_key_id), its(:dbi_resource_id), its(:ca_certificate_identifier), its(:domain_memberships), its(:copy_tags_to_snapshot), its(:monitoring_interval), its(:enhanced_monitoring_resource_arn), its(:monitoring_role_arn), its(:promotion_tier), its(:db_instance_arn), its(:timezone), its(:iam_database_authentication_enabled), its(:performance_insights_enabled), its(:performance_insights_kms_key_id), its(:enabled_cloudwatch_logs_exports), its(:processor_features)
2201
+ ### its(:vpc_id), its(:db_instance_identifier), its(:db_instance_class), its(:engine), its(:db_instance_status), its(:master_username), its(:db_name), its(:endpoint), its(:allocated_storage), its(:instance_create_time), its(:preferred_backup_window), its(:backup_retention_period), its(:db_security_groups), its(:availability_zone), its(:preferred_maintenance_window), its(:pending_modified_values), its(:latest_restorable_time), its(:multi_az), its(:engine_version), its(:auto_minor_version_upgrade), its(:read_replica_source_db_instance_identifier), its(:read_replica_db_instance_identifiers), its(:read_replica_db_cluster_identifiers), its(:license_model), its(:iops), its(:character_set_name), its(:secondary_availability_zone), its(:publicly_accessible), its(:status_infos), its(:storage_type), its(:tde_credential_arn), its(:db_instance_port), its(:db_cluster_identifier), its(:storage_encrypted), its(:kms_key_id), its(:dbi_resource_id), its(:ca_certificate_identifier), its(:domain_memberships), its(:copy_tags_to_snapshot), its(:monitoring_interval), its(:enhanced_monitoring_resource_arn), its(:monitoring_role_arn), its(:promotion_tier), its(:db_instance_arn), its(:timezone), its(:iam_database_authentication_enabled), its(:performance_insights_enabled), its(:performance_insights_kms_key_id), its(:performance_insights_retention_period), its(:enabled_cloudwatch_logs_exports), its(:processor_features)
2201
2202
  ### :unlock: Advanced use
2202
2203
 
2203
2204
  `rds` can use `Aws::RDS::DBInstance` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/RDS/DBInstance.html).
@@ -2614,6 +2615,48 @@ end
2614
2615
  ```
2615
2616
 
2616
2617
  ### its(:queue_arn), its(:approximate_number_of_messages), its(:approximate_number_of_messages_not_visible), its(:approximate_number_of_messages_delayed), its(:created_timestamp), its(:last_modified_timestamp), its(:visibility_timeout), its(:maximum_message_size), its(:message_retention_period), its(:delay_seconds), its(:receive_message_wait_time_seconds), its(:queue_url)
2618
+ ## <a name="ssm_parameter">ssm_parameter</a>
2619
+
2620
+ SsmParameter resource type.
2621
+
2622
+ ### exist
2623
+
2624
+ ```ruby
2625
+ describe ssm_parameter('my-parameter') do
2626
+ it { should exist }
2627
+ end
2628
+ ```
2629
+
2630
+
2631
+ ### be_encrypted
2632
+
2633
+ ```ruby
2634
+ describe ssm_parameter('my-parameter') do
2635
+ it { should be_encrypted }
2636
+ end
2637
+ ```
2638
+
2639
+
2640
+ ### have_tag
2641
+
2642
+ ```ruby
2643
+ describe ssm_parameter('my-parameter') do
2644
+ it { should have_tag('my-key').value('my-value') }
2645
+ end
2646
+ ```
2647
+
2648
+
2649
+ ### its(:name), its(:type), its(:key_id), its(:last_modified_date), its(:last_modified_user), its(:description), its(:allowed_pattern), its(:version)
2650
+ ### :unlock: Advanced use
2651
+
2652
+ ```ruby
2653
+ describe ssm_parameter('my-parameter') do
2654
+ its(:key_id) { should be_eql('6a81f446-27b0-4d51-a04f-af7ddeea2e22') }
2655
+ its(:description) { should be_eql('Some string description') }
2656
+ its(:version) { should be_eql(1) }
2657
+ end
2658
+ ```
2659
+
2617
2660
  ## <a name="subnet">subnet</a>
2618
2661
 
2619
2662
  Subnet resource type.
@@ -0,0 +1,17 @@
1
+ module Awspec::Generator
2
+ module Doc
3
+ module Type
4
+ class SsmParameter < Base
5
+ def initialize
6
+ super
7
+ @type_name = 'SsmParameter'
8
+ @type = Awspec::Type::SsmParameter.new('my-ssm')
9
+ @ret = @type.resource_via_client
10
+ @matchers = []
11
+ @ignore_matchers = []
12
+ @describes = []
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -34,6 +34,7 @@ require 'awspec/helper/finder/cloudwatch_logs'
34
34
  require 'awspec/helper/finder/dynamodb'
35
35
  require 'awspec/helper/finder/sqs'
36
36
  require 'awspec/helper/finder/cloudformation'
37
+ require 'awspec/helper/finder/ssm_parameter'
37
38
 
38
39
  require 'awspec/helper/finder/account_attributes'
39
40
 
@@ -76,6 +77,7 @@ module Awspec::Helper
76
77
  include Awspec::Helper::Finder::CloudwatchLogs
77
78
  include Awspec::Helper::Finder::Dynamodb
78
79
  include Awspec::Helper::Finder::Sqs
80
+ include Awspec::Helper::Finder::SsmParameter
79
81
  include Awspec::Helper::Finder::Cloudformation
80
82
 
81
83
  CLIENTS = {
@@ -108,6 +110,7 @@ module Awspec::Helper
108
110
  cloudwatch_logs_client: Aws::CloudWatchLogs::Client,
109
111
  dynamodb_client: Aws::DynamoDB::Client,
110
112
  sqs_client: Aws::SQS::Client,
113
+ ssm_client: Aws::SSM::Client,
111
114
  cloudformation_client: Aws::CloudFormation::Client
112
115
  }
113
116
 
@@ -0,0 +1,32 @@
1
+ module Awspec::Helper
2
+ module Finder
3
+ module SsmParameter
4
+ def find_ssm_parameter(name)
5
+ ssm_client.describe_parameters(
6
+ {
7
+ filters: [
8
+ {
9
+ key: 'Name',
10
+ values: [name]
11
+ }
12
+ ]
13
+ }).parameters[0]
14
+ end
15
+
16
+ def find_parameter_tag(id, tag_key)
17
+ tag = nil
18
+ begin
19
+ response = ssm_client.list_tags_for_resource(
20
+ resource_type: 'Parameter',
21
+ resource_id: id
22
+ )
23
+ tag_set = response.tag_list
24
+ tag = tag_set.find { |tag_obj| tag_obj.key == tag_key }
25
+ rescue Aws::SSM::Errors::ServiceError
26
+ nil
27
+ end
28
+ return tag if tag
29
+ end
30
+ end
31
+ end
32
+ end
@@ -17,7 +17,7 @@ module Awspec
17
17
  rds rds_db_cluster_parameter_group rds_db_parameter_group route53_hosted_zone
18
18
  route_table s3_bucket security_group ses_identity subnet vpc cloudfront_distribution
19
19
  elastictranscoder_pipeline waf_web_acl customer_gateway vpn_gateway vpn_connection internet_gateway acm
20
- cloudwatch_logs dynamodb_table eip sqs cloudformation_stack
20
+ cloudwatch_logs dynamodb_table eip sqs ssm_parameter cloudformation_stack
21
21
  )
22
22
 
23
23
  ACCOUNT_ATTRIBUTES = %w(
@@ -0,0 +1,16 @@
1
+ Aws.config[:ssm] = {
2
+ stub_responses: {
3
+ describe_parameters: {
4
+ parameters: [
5
+ {
6
+ name: 'my-parameter',
7
+ type: 'SecureString',
8
+ key_id: 'alias/aws/ssm',
9
+ description: 'Some description',
10
+ version: 1,
11
+ next_token: nil
12
+ }
13
+ ]
14
+ }
15
+ }
16
+ }
@@ -0,0 +1,26 @@
1
+ module Awspec::Type
2
+ class SsmParameter < ResourceBase
3
+ def initialize(name)
4
+ super
5
+ @display_name = name
6
+ end
7
+
8
+ def resource_via_client
9
+ @resource_via_client ||= find_ssm_parameter(@display_name)
10
+ end
11
+
12
+ def id
13
+ @id ||= @display_name if resource_via_client
14
+ end
15
+
16
+ def encrypted?
17
+ resource_via_client.type.eql? 'SecureString'
18
+ end
19
+
20
+ def has_tag?(key, value)
21
+ tag = find_parameter_tag(id, key)
22
+ return nil if tag.value != value
23
+ tag
24
+ end
25
+ end
26
+ end
@@ -1,3 +1,3 @@
1
1
  module Awspec
2
- VERSION = '1.6.1'
2
+ VERSION = '1.7.0'
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: 1.6.1
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - k1LoW
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-06-18 00:00:00.000000000 Z
11
+ date: 2018-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -269,6 +269,7 @@ files:
269
269
  - doc/_resource_types/ses_identity.md
270
270
  - doc/_resource_types/ses_send_quota.md
271
271
  - doc/_resource_types/sqs.md
272
+ - doc/_resource_types/ssm_parameter.md
272
273
  - doc/_resource_types/subnet.md
273
274
  - doc/_resource_types/vpc.md
274
275
  - doc/_resource_types/vpn_connection.md
@@ -349,6 +350,7 @@ files:
349
350
  - lib/awspec/generator/doc/type/ses_identity.rb
350
351
  - lib/awspec/generator/doc/type/ses_send_quota.rb
351
352
  - lib/awspec/generator/doc/type/sqs.rb
353
+ - lib/awspec/generator/doc/type/ssm_parameter.rb
352
354
  - lib/awspec/generator/doc/type/subnet.rb
353
355
  - lib/awspec/generator/doc/type/vpc.rb
354
356
  - lib/awspec/generator/doc/type/vpn_connection.rb
@@ -424,6 +426,7 @@ files:
424
426
  - lib/awspec/helper/finder/security_group.rb
425
427
  - lib/awspec/helper/finder/ses.rb
426
428
  - lib/awspec/helper/finder/sqs.rb
429
+ - lib/awspec/helper/finder/ssm_parameter.rb
427
430
  - lib/awspec/helper/finder/subnet.rb
428
431
  - lib/awspec/helper/finder/vpc.rb
429
432
  - lib/awspec/helper/finder/waf.rb
@@ -523,6 +526,7 @@ files:
523
526
  - lib/awspec/stub/security_group.rb
524
527
  - lib/awspec/stub/ses_identity.rb
525
528
  - lib/awspec/stub/sqs.rb
529
+ - lib/awspec/stub/ssm_parameter.rb
526
530
  - lib/awspec/stub/subnet.rb
527
531
  - lib/awspec/stub/vpc.rb
528
532
  - lib/awspec/stub/vpn_connection.rb
@@ -591,6 +595,7 @@ files:
591
595
  - lib/awspec/type/ses_identity.rb
592
596
  - lib/awspec/type/ses_send_quota.rb
593
597
  - lib/awspec/type/sqs.rb
598
+ - lib/awspec/type/ssm_parameter.rb
594
599
  - lib/awspec/type/subnet.rb
595
600
  - lib/awspec/type/vpc.rb
596
601
  - lib/awspec/type/vpn_connection.rb
@@ -617,7 +622,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
617
622
  version: '0'
618
623
  requirements: []
619
624
  rubyforge_project:
620
- rubygems_version: 2.6.14
625
+ rubygems_version: 2.5.2
621
626
  signing_key:
622
627
  specification_version: 4
623
628
  summary: RSpec tests for your AWS resources.