awspec 1.4.2 → 1.4.3
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 +4 -4
 - data/README.md +9 -0
 - data/doc/_resource_types/s3_bucket.md +12 -1
 - data/doc/resource_types.md +15 -4
 - data/lib/awspec/stub/s3_bucket.rb +41 -0
 - data/lib/awspec/type/s3_bucket.rb +14 -2
 - data/lib/awspec/version.rb +1 -1
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: a25dc9ad7bb00c00fe9f75c60fb65a3bb7d2b657
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 1250c5a36bc0f938e7cd66d7c24edaa9c514942f
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: f13db27a3fadd0865336cb3b3a8c1e53bb8edc1128c57a503b3042a5b44ac30e832ba9c9589fe58e93d1c55a2728a866089ccd4b888438475f7e3a37c2619efd
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 012cc4516ecafde2171abdef407ec9172be2f350c82ef477af2223eaaabbcbc1f60669e25473bf78a1dec9642e85686523d77c38c9c9e033c83a6a5db299cd71
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -28,7 +28,16 @@ Or install it yourself as: 
     | 
|
| 
       28 
28 
     | 
    
         | 
| 
       29 
29 
     | 
    
         
             
            ### STEP 1. Generate awspec init files
         
     | 
| 
       30 
30 
     | 
    
         | 
| 
      
 31 
     | 
    
         
            +
            If you're starting on a fresh RSpec project, you can use awspec to generate your init files:
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
       31 
33 
     | 
    
         
             
                $ awspec init
         
     | 
| 
      
 34 
     | 
    
         
            +
                
         
     | 
| 
      
 35 
     | 
    
         
            +
            If you're working on an exisitng RSpec project, you will need to add the following lines to your `spec_helper.rb` file:
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 38 
     | 
    
         
            +
            require 'awspec'
         
     | 
| 
      
 39 
     | 
    
         
            +
            Awsecrets.load(secrets_path: File.expand_path('./secrets.yml', File.dirname(__FILE__)))
         
     | 
| 
      
 40 
     | 
    
         
            +
            ```
         
     | 
| 
       32 
41 
     | 
    
         | 
| 
       33 
42 
     | 
    
         
             
            ### STEP 2. Set AWS config
         
     | 
| 
       34 
43 
     | 
    
         | 
| 
         @@ -80,7 +80,18 @@ describe s3_bucket('my-bucket') do 
     | 
|
| 
       80 
80 
     | 
    
         
             
                  id: 'MyRuleName',
         
     | 
| 
       81 
81 
     | 
    
         
             
                  noncurrent_version_expiration: { noncurrent_days: 1 },
         
     | 
| 
       82 
82 
     | 
    
         
             
                  expiration: { days: 2 },
         
     | 
| 
       83 
     | 
    
         
            -
                  transitions: { days: 3, storage_class: 'GLACIER' },
         
     | 
| 
      
 83 
     | 
    
         
            +
                  transitions: [{ days: 3, storage_class: 'GLACIER' }],
         
     | 
| 
      
 84 
     | 
    
         
            +
                  status: 'Enabled'
         
     | 
| 
      
 85 
     | 
    
         
            +
                )
         
     | 
| 
      
 86 
     | 
    
         
            +
              end
         
     | 
| 
      
 87 
     | 
    
         
            +
             
     | 
| 
      
 88 
     | 
    
         
            +
              it do
         
     | 
| 
      
 89 
     | 
    
         
            +
                should have_lifecycle_rule(
         
     | 
| 
      
 90 
     | 
    
         
            +
                  id: 'MyRuleName2',
         
     | 
| 
      
 91 
     | 
    
         
            +
                  prefix: '123/',
         
     | 
| 
      
 92 
     | 
    
         
            +
                  noncurrent_version_expiration: { noncurrent_days: 2 },
         
     | 
| 
      
 93 
     | 
    
         
            +
                  expiration: { days: 3 },
         
     | 
| 
      
 94 
     | 
    
         
            +
                  transitions: [{ days: 5, storage_class: 'STANDARD_IA' }, { days: 10, storage_class: 'GLACIER' }],
         
     | 
| 
       84 
95 
     | 
    
         
             
                  status: 'Enabled'
         
     | 
| 
       85 
96 
     | 
    
         
             
                )
         
     | 
| 
       86 
97 
     | 
    
         
             
              end
         
     | 
    
        data/doc/resource_types.md
    CHANGED
    
    | 
         @@ -294,7 +294,7 @@ describe autoscaling_group('my-auto-scaling-group') do 
     | 
|
| 
       294 
294 
     | 
    
         
             
            end
         
     | 
| 
       295 
295 
     | 
    
         
             
            ```
         
     | 
| 
       296 
296 
     | 
    
         | 
| 
       297 
     | 
    
         
            -
            ### its(:auto_scaling_group_name), its(:auto_scaling_group_arn), its(:launch_configuration_name), its(:launch_template), its(:min_size), its(:max_size), its(:desired_capacity), its(:default_cooldown), its(:availability_zones), its(:load_balancer_names), its(:target_group_arns), its(:health_check_type), its(:health_check_grace_period), its(:created_time), its(:placement_group), its(:vpc_zone_identifier), its(:enabled_metrics), its(:status), its(:termination_policies), its(:new_instances_protected_from_scale_in)
         
     | 
| 
      
 297 
     | 
    
         
            +
            ### its(:auto_scaling_group_name), its(:auto_scaling_group_arn), its(:launch_configuration_name), its(:launch_template), its(:min_size), its(:max_size), its(:desired_capacity), its(:default_cooldown), its(:availability_zones), its(:load_balancer_names), its(:target_group_arns), its(:health_check_type), its(:health_check_grace_period), its(:created_time), its(:placement_group), its(:vpc_zone_identifier), its(:enabled_metrics), its(:status), its(:termination_policies), its(:new_instances_protected_from_scale_in), its(:service_linked_role_arn)
         
     | 
| 
       298 
298 
     | 
    
         
             
            ## <a name="cloudformation_stack">cloudformation_stack</a>
         
     | 
| 
       299 
299 
     | 
    
         | 
| 
       300 
300 
     | 
    
         
             
            CloudformationStack resource type.
         
     | 
| 
         @@ -648,7 +648,7 @@ end 
     | 
|
| 
       648 
648 
     | 
    
         
             
            ```
         
     | 
| 
       649 
649 
     | 
    
         | 
| 
       650 
650 
     | 
    
         | 
| 
       651 
     | 
    
         
            -
            ### its(:table_name), its(:table_status), its(:creation_date_time), its(:table_size_bytes), its(:item_count), its(:table_arn), its(:table_id), its(:local_secondary_indexes), its(:global_secondary_indexes), its(:stream_specification), its(:latest_stream_label), its(:latest_stream_arn), its(:restore_summary)
         
     | 
| 
      
 651 
     | 
    
         
            +
            ### its(:table_name), its(:table_status), its(:creation_date_time), its(:table_size_bytes), its(:item_count), its(:table_arn), its(:table_id), its(:local_secondary_indexes), its(:global_secondary_indexes), its(:stream_specification), its(:latest_stream_label), its(:latest_stream_arn), its(:restore_summary), its(:sse_description)
         
     | 
| 
       652 
652 
     | 
    
         
             
            ### :unlock: Advanced use
         
     | 
| 
       653 
653 
     | 
    
         | 
| 
       654 
654 
     | 
    
         
             
            `dynamodb_table` can use `Aws::DynamoDB::Table` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/DynamoDB/Table.html).
         
     | 
| 
         @@ -986,7 +986,7 @@ describe ecs_service('my-ecs-service') do 
     | 
|
| 
       986 
986 
     | 
    
         
             
            end
         
     | 
| 
       987 
987 
     | 
    
         
             
            ```
         
     | 
| 
       988 
988 
     | 
    
         | 
| 
       989 
     | 
    
         
            -
            ### its(:service_arn), its(:service_name), its(:cluster_arn), its(:load_balancers), its(:status), its(:desired_count), its(:running_count), its(:pending_count), its(:launch_type), its(:platform_version), its(:task_definition), its(:role_arn), its(:created_at), its(:placement_constraints), its(:placement_strategy), its(:network_configuration), its(:health_check_grace_period_seconds)
         
     | 
| 
      
 989 
     | 
    
         
            +
            ### its(:service_arn), its(:service_name), its(:cluster_arn), its(:load_balancers), its(:service_registries), its(:status), its(:desired_count), its(:running_count), its(:pending_count), its(:launch_type), its(:platform_version), its(:task_definition), its(:role_arn), its(:created_at), its(:placement_constraints), its(:placement_strategy), its(:network_configuration), its(:health_check_grace_period_seconds)
         
     | 
| 
       990 
990 
     | 
    
         
             
            ## <a name="ecs_task_definition">ecs_task_definition</a>
         
     | 
| 
       991 
991 
     | 
    
         | 
| 
       992 
992 
     | 
    
         
             
            ECS Task Definition resource type.
         
     | 
| 
         @@ -2357,7 +2357,18 @@ describe s3_bucket('my-bucket') do 
     | 
|
| 
       2357 
2357 
     | 
    
         
             
                  id: 'MyRuleName',
         
     | 
| 
       2358 
2358 
     | 
    
         
             
                  noncurrent_version_expiration: { noncurrent_days: 1 },
         
     | 
| 
       2359 
2359 
     | 
    
         
             
                  expiration: { days: 2 },
         
     | 
| 
       2360 
     | 
    
         
            -
                  transitions: { days: 3, storage_class: 'GLACIER' },
         
     | 
| 
      
 2360 
     | 
    
         
            +
                  transitions: [{ days: 3, storage_class: 'GLACIER' }],
         
     | 
| 
      
 2361 
     | 
    
         
            +
                  status: 'Enabled'
         
     | 
| 
      
 2362 
     | 
    
         
            +
                )
         
     | 
| 
      
 2363 
     | 
    
         
            +
              end
         
     | 
| 
      
 2364 
     | 
    
         
            +
             
     | 
| 
      
 2365 
     | 
    
         
            +
              it do
         
     | 
| 
      
 2366 
     | 
    
         
            +
                should have_lifecycle_rule(
         
     | 
| 
      
 2367 
     | 
    
         
            +
                  id: 'MyRuleName2',
         
     | 
| 
      
 2368 
     | 
    
         
            +
                  prefix: '123/',
         
     | 
| 
      
 2369 
     | 
    
         
            +
                  noncurrent_version_expiration: { noncurrent_days: 2 },
         
     | 
| 
      
 2370 
     | 
    
         
            +
                  expiration: { days: 3 },
         
     | 
| 
      
 2371 
     | 
    
         
            +
                  transitions: [{ days: 5, storage_class: 'STANDARD_IA' }, { days: 10, storage_class: 'GLACIER' }],
         
     | 
| 
       2361 
2372 
     | 
    
         
             
                  status: 'Enabled'
         
     | 
| 
       2362 
2373 
     | 
    
         
             
                )
         
     | 
| 
       2363 
2374 
     | 
    
         
             
              end
         
     | 
| 
         @@ -75,6 +75,47 @@ Aws.config[:s3] = { 
     | 
|
| 
       75 
75 
     | 
    
         
             
                      value: 'dev'
         
     | 
| 
       76 
76 
     | 
    
         
             
                    }
         
     | 
| 
       77 
77 
     | 
    
         
             
                  ]
         
     | 
| 
      
 78 
     | 
    
         
            +
                },
         
     | 
| 
      
 79 
     | 
    
         
            +
                get_bucket_lifecycle_configuration: {
         
     | 
| 
      
 80 
     | 
    
         
            +
                  rules: [
         
     | 
| 
      
 81 
     | 
    
         
            +
                    {
         
     | 
| 
      
 82 
     | 
    
         
            +
                      id: 'MyRuleName',
         
     | 
| 
      
 83 
     | 
    
         
            +
                      status: 'Enabled',
         
     | 
| 
      
 84 
     | 
    
         
            +
                      transitions: [
         
     | 
| 
      
 85 
     | 
    
         
            +
                        {
         
     | 
| 
      
 86 
     | 
    
         
            +
                          days: 3,
         
     | 
| 
      
 87 
     | 
    
         
            +
                          storage_class: 'GLACIER'
         
     | 
| 
      
 88 
     | 
    
         
            +
                        }
         
     | 
| 
      
 89 
     | 
    
         
            +
                      ],
         
     | 
| 
      
 90 
     | 
    
         
            +
                      expiration: {
         
     | 
| 
      
 91 
     | 
    
         
            +
                        days: 2
         
     | 
| 
      
 92 
     | 
    
         
            +
                      },
         
     | 
| 
      
 93 
     | 
    
         
            +
                      noncurrent_version_expiration: {
         
     | 
| 
      
 94 
     | 
    
         
            +
                        noncurrent_days: 1
         
     | 
| 
      
 95 
     | 
    
         
            +
                      }
         
     | 
| 
      
 96 
     | 
    
         
            +
                    },
         
     | 
| 
      
 97 
     | 
    
         
            +
                    {
         
     | 
| 
      
 98 
     | 
    
         
            +
                      id: 'MyRuleName2',
         
     | 
| 
      
 99 
     | 
    
         
            +
                      prefix: '123/',
         
     | 
| 
      
 100 
     | 
    
         
            +
                      status: 'Enabled',
         
     | 
| 
      
 101 
     | 
    
         
            +
                      transitions: [
         
     | 
| 
      
 102 
     | 
    
         
            +
                        {
         
     | 
| 
      
 103 
     | 
    
         
            +
                          days: 5,
         
     | 
| 
      
 104 
     | 
    
         
            +
                          storage_class: 'STANDARD_IA'
         
     | 
| 
      
 105 
     | 
    
         
            +
                        },
         
     | 
| 
      
 106 
     | 
    
         
            +
                        {
         
     | 
| 
      
 107 
     | 
    
         
            +
                          days: 10,
         
     | 
| 
      
 108 
     | 
    
         
            +
                          storage_class: 'GLACIER'
         
     | 
| 
      
 109 
     | 
    
         
            +
                        }
         
     | 
| 
      
 110 
     | 
    
         
            +
                      ],
         
     | 
| 
      
 111 
     | 
    
         
            +
                      expiration: {
         
     | 
| 
      
 112 
     | 
    
         
            +
                        days: 3
         
     | 
| 
      
 113 
     | 
    
         
            +
                      },
         
     | 
| 
      
 114 
     | 
    
         
            +
                      noncurrent_version_expiration: {
         
     | 
| 
      
 115 
     | 
    
         
            +
                        noncurrent_days: 2
         
     | 
| 
      
 116 
     | 
    
         
            +
                      }
         
     | 
| 
      
 117 
     | 
    
         
            +
                    }
         
     | 
| 
      
 118 
     | 
    
         
            +
                  ]
         
     | 
| 
       78 
119 
     | 
    
         
             
                }
         
     | 
| 
       79 
120 
     | 
    
         
             
              }
         
     | 
| 
       80 
121 
     | 
    
         
             
            }
         
     | 
| 
         @@ -87,8 +87,20 @@ module Awspec::Type 
     | 
|
| 
       87 
87 
     | 
    
         
             
                end
         
     | 
| 
       88 
88 
     | 
    
         | 
| 
       89 
89 
     | 
    
         
             
                def has_lifecycle_rule?(rule)
         
     | 
| 
       90 
     | 
    
         
            -
                  lifecycle_configuration_rules. 
     | 
| 
       91 
     | 
    
         
            -
             
     | 
| 
      
 90 
     | 
    
         
            +
                  lc_rule = lifecycle_configuration_rules.select { |r| r[:id] == rule[:id] }
         
     | 
| 
      
 91 
     | 
    
         
            +
                  return false if lc_rule == []
         
     | 
| 
      
 92 
     | 
    
         
            +
             
     | 
| 
      
 93 
     | 
    
         
            +
                  rule.all? do |key, value|
         
     | 
| 
      
 94 
     | 
    
         
            +
                    lc_rule.each do |r|
         
     | 
| 
      
 95 
     | 
    
         
            +
                      return false if value.is_a?(String) && r[key] != value
         
     | 
| 
      
 96 
     | 
    
         
            +
                      if value.is_a?(Hash)
         
     | 
| 
      
 97 
     | 
    
         
            +
                        return false if r[key].to_h != value
         
     | 
| 
      
 98 
     | 
    
         
            +
                      end
         
     | 
| 
      
 99 
     | 
    
         
            +
                      if value.is_a?(Array)
         
     | 
| 
      
 100 
     | 
    
         
            +
                        return false if r[key].map(&:to_h) != value
         
     | 
| 
      
 101 
     | 
    
         
            +
                      end
         
     | 
| 
      
 102 
     | 
    
         
            +
                      true
         
     | 
| 
      
 103 
     | 
    
         
            +
                    end
         
     | 
| 
       92 
104 
     | 
    
         
             
                  end
         
     | 
| 
       93 
105 
     | 
    
         
             
                end
         
     | 
| 
       94 
106 
     | 
    
         | 
    
        data/lib/awspec/version.rb
    CHANGED
    
    
    
        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.4. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.4.3
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - k1LoW
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2018- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2018-03-24 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: aws-sdk
         
     |