awspec 1.29.3 → 1.31.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 +4 -4
- data/.github/workflows/ci.yml +2 -5
- data/Rakefile +0 -1
- data/awspec.gemspec +3 -1
- data/doc/_resource_types/codebuild.md +14 -0
- data/doc/_resource_types/managed_prefix_list.md +32 -0
- data/doc/_resource_types/transit_gateway.md +22 -0
- data/doc/resource_types.md +117 -39
- data/lib/awspec/command/generate.rb +1 -1
- data/lib/awspec/generator/doc/type/managed_prefix_list.rb +19 -0
- data/lib/awspec/generator/doc/type/rds_db_cluster.rb +5 -5
- data/lib/awspec/generator/doc/type/rds_db_cluster_parameter_group.rb +2 -2
- data/lib/awspec/generator/doc/type/rds_db_parameter_group.rb +2 -2
- data/lib/awspec/generator/doc/type/rds_db_subnet_group.rb +3 -3
- data/lib/awspec/generator/spec/iam_group.rb +1 -1
- data/lib/awspec/generator/spec/iam_policy.rb +1 -1
- data/lib/awspec/generator/spec/iam_role.rb +1 -1
- data/lib/awspec/generator/spec/iam_user.rb +1 -1
- data/lib/awspec/generator/spec/managed_prefix_list.rb +54 -0
- data/lib/awspec/generator/spec/rds_db_cluster.rb +1 -1
- data/lib/awspec/generator/spec/rds_db_cluster_parameter_group.rb +1 -1
- data/lib/awspec/generator/spec/rds_db_parameter_group.rb +1 -1
- data/lib/awspec/generator.rb +1 -0
- data/lib/awspec/helper/finder/codebuild.rb +2 -4
- data/lib/awspec/helper/finder/ec2.rb +12 -0
- data/lib/awspec/helper/finder/vpc_endpoints.rb +1 -3
- data/lib/awspec/helper/type.rb +1 -1
- data/lib/awspec/matcher/belong_to_subnet.rb +1 -1
- data/lib/awspec/matcher/have_cidr.rb +11 -0
- data/lib/awspec/matcher.rb +3 -0
- data/lib/awspec/stub/codebuild.rb +56 -0
- data/lib/awspec/stub/managed_prefix_list.rb +41 -0
- data/lib/awspec/type/codebuild.rb +3 -0
- data/lib/awspec/type/managed_prefix_list.rb +34 -0
- data/lib/awspec/type/rds_db_cluster.rb +1 -1
- data/lib/awspec/type/rds_db_cluster_parameter_group.rb +1 -1
- data/lib/awspec/type/rds_db_parameter_group.rb +4 -4
- data/lib/awspec/type/rds_db_subnet_group.rb +1 -1
- data/lib/awspec/type/transit_gateway.rb +15 -3
- data/lib/awspec/version.rb +2 -2
- metadata +38 -7
| @@ -3,16 +3,16 @@ | |
| 3 3 | 
             
            module Awspec::Generator
         | 
| 4 4 | 
             
              module Doc
         | 
| 5 5 | 
             
                module Type
         | 
| 6 | 
            -
                  class  | 
| 6 | 
            +
                  class RdsDBCluster < Base
         | 
| 7 7 | 
             
                    def initialize
         | 
| 8 8 | 
             
                      super
         | 
| 9 | 
            -
                      @type_name = ' | 
| 10 | 
            -
                      @type = Awspec::Type:: | 
| 9 | 
            +
                      @type_name = 'RdsDBCluster'
         | 
| 10 | 
            +
                      @type = Awspec::Type::RdsDBCluster.new('my-rds-db-cluster')
         | 
| 11 11 | 
             
                      @ret = @type.resource_via_client
         | 
| 12 12 | 
             
                      @matchers = [
         | 
| 13 | 
            -
                        Awspec::Type:: | 
| 13 | 
            +
                        Awspec::Type::RdsDBCluster::STATES.map { |state| "be_#{state.tr('-', '_')}" }.join(', ')
         | 
| 14 14 | 
             
                      ]
         | 
| 15 | 
            -
                      @ignore_matchers = Awspec::Type:: | 
| 15 | 
            +
                      @ignore_matchers = Awspec::Type::RdsDBCluster::STATES.map { |state| "be_#{state.tr('-', '_')}" }
         | 
| 16 16 | 
             
                      @describes = []
         | 
| 17 17 | 
             
                    end
         | 
| 18 18 | 
             
                  end
         | 
| @@ -3,10 +3,10 @@ | |
| 3 3 | 
             
            module Awspec::Generator
         | 
| 4 4 | 
             
              module Doc
         | 
| 5 5 | 
             
                module Type
         | 
| 6 | 
            -
                  class  | 
| 6 | 
            +
                  class RdsDBClusterParameterGroup < Base
         | 
| 7 7 | 
             
                    def initialize
         | 
| 8 8 | 
             
                      super
         | 
| 9 | 
            -
                      @type = Awspec::Type:: | 
| 9 | 
            +
                      @type = Awspec::Type::RdsDBClusterParameterGroup.new('my-rds-db-cluster-parameter-group')
         | 
| 10 10 | 
             
                      @matchers = []
         | 
| 11 11 | 
             
                      @ignore_matchers = []
         | 
| 12 12 | 
             
                      @describes = []
         | 
| @@ -3,10 +3,10 @@ | |
| 3 3 | 
             
            module Awspec::Generator
         | 
| 4 4 | 
             
              module Doc
         | 
| 5 5 | 
             
                module Type
         | 
| 6 | 
            -
                  class  | 
| 6 | 
            +
                  class RdsDBParameterGroup < Base
         | 
| 7 7 | 
             
                    def initialize
         | 
| 8 8 | 
             
                      super
         | 
| 9 | 
            -
                      @type = Awspec::Type:: | 
| 9 | 
            +
                      @type = Awspec::Type::RdsDBParameterGroup.new('my-rds-db-parameter-group')
         | 
| 10 10 | 
             
                      @matchers = []
         | 
| 11 11 | 
             
                      @ignore_matchers = []
         | 
| 12 12 | 
             
                      @describes = []
         | 
| @@ -3,11 +3,11 @@ | |
| 3 3 | 
             
            module Awspec::Generator
         | 
| 4 4 | 
             
              module Doc
         | 
| 5 5 | 
             
                module Type
         | 
| 6 | 
            -
                  class  | 
| 6 | 
            +
                  class RdsDBSubnetGroup < Base
         | 
| 7 7 | 
             
                    def initialize
         | 
| 8 8 | 
             
                      super
         | 
| 9 | 
            -
                      @type_name = ' | 
| 10 | 
            -
                      @type = Awspec::Type:: | 
| 9 | 
            +
                      @type_name = 'RdsDBSubnetGroup'
         | 
| 10 | 
            +
                      @type = Awspec::Type::RdsDBSubnetGroup.new('my-rds-db-subnet-group')
         | 
| 11 11 | 
             
                      @ret = @type.resource_via_client
         | 
| 12 12 | 
             
                      @matchers = %w[belong_to_vpc belong_to_subnet]
         | 
| 13 13 | 
             
                      @ignore_matchers = []
         | 
| @@ -27,7 +27,7 @@ module Awspec::Generator | |
| 27 27 | 
             
            describe iam_group('<%= group.group_name %>') do
         | 
| 28 28 | 
             
              it { should exist }
         | 
| 29 29 | 
             
              its(:arn) { should eq '<%= group.arn %>' }
         | 
| 30 | 
            -
              its(:create_date) { should eq Time.parse('<%= group.create_date %>') }
         | 
| 30 | 
            +
              its(:create_date) { should eq Time.parse('<%= group.create_date.utc %>') }
         | 
| 31 31 | 
             
            <% select_iam_policy_by_group_name(group.group_name).each do |policy| %>  it { should have_iam_policy('<%= policy.policy_name %>') }
         | 
| 32 32 | 
             
            <% end %>
         | 
| 33 33 | 
             
            <%- inline_policies.each do |line| -%>
         | 
| @@ -23,7 +23,7 @@ describe iam_policy('<%= policy.policy_name %>') do | |
| 23 23 | 
             
              it { should_not be_attachable }
         | 
| 24 24 | 
             
            <%- end -%>
         | 
| 25 25 | 
             
              its(:arn) { should eq '<%= policy.arn %>' }
         | 
| 26 | 
            -
              its(:update_date) { should eq Time.parse('<%= policy.update_date %>') }
         | 
| 26 | 
            +
              its(:update_date) { should eq Time.parse('<%= policy.update_date.utc %>') }
         | 
| 27 27 | 
             
              its(:attachment_count) { should eq <%= policy.attachment_count %> }
         | 
| 28 28 | 
             
            <%- users = select_attached_users(policy.arn) -%>
         | 
| 29 29 | 
             
            <%- if users.empty? -%>
         | 
| @@ -27,7 +27,7 @@ module Awspec::Generator | |
| 27 27 | 
             
            describe iam_role('<%= role.role_name %>') do
         | 
| 28 28 | 
             
              it { should exist }
         | 
| 29 29 | 
             
              its(:arn) { should eq '<%= role.arn %>' }
         | 
| 30 | 
            -
              its(:create_date) { should eq Time.parse('<%= role.create_date %>') }
         | 
| 30 | 
            +
              its(:create_date) { should eq Time.parse('<%= role.create_date.utc %>') }
         | 
| 31 31 | 
             
            <% select_iam_policy_by_role_name(role.role_name).each do |policy| %>  it { should have_iam_policy('<%= policy.policy_name %>') }
         | 
| 32 32 | 
             
            <% end %>
         | 
| 33 33 | 
             
            <%- inline_policies.each do |line| -%>
         | 
| @@ -27,7 +27,7 @@ module Awspec::Generator | |
| 27 27 | 
             
            describe iam_user('<%= user.user_name %>') do
         | 
| 28 28 | 
             
              it { should exist }
         | 
| 29 29 | 
             
              its(:arn) { should eq '<%= user.arn %>' }
         | 
| 30 | 
            -
              its(:create_date) { should eq Time.parse('<%= user.create_date %>') }
         | 
| 30 | 
            +
              its(:create_date) { should eq Time.parse('<%= user.create_date.utc %>') }
         | 
| 31 31 | 
             
            <% select_iam_policy_by_user_name(user.user_name).each do |policy| %>  it { should have_iam_policy('<%= policy.policy_name %>') }
         | 
| 32 32 | 
             
            <% end %>
         | 
| 33 33 | 
             
            <%- inline_policies.each do |line| -%>
         | 
| @@ -0,0 +1,54 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module Awspec::Generator
         | 
| 4 | 
            +
              module Spec
         | 
| 5 | 
            +
                class ManagedPrefixList
         | 
| 6 | 
            +
                  include Awspec::Helper::Finder
         | 
| 7 | 
            +
                  def select_all_managed_prefix_lists
         | 
| 8 | 
            +
                    res = ec2_client.describe_managed_prefix_lists
         | 
| 9 | 
            +
                    res.prefix_lists
         | 
| 10 | 
            +
                  end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
                  def generate_all
         | 
| 13 | 
            +
                    prefix_lists = select_all_managed_prefix_lists
         | 
| 14 | 
            +
                    raise 'Not Found Managed Prefix List.' if prefix_lists.empty?
         | 
| 15 | 
            +
             | 
| 16 | 
            +
                    specs = prefix_lists.map do |prefix_list|
         | 
| 17 | 
            +
                      entries = select_managed_prefix_list_entries(prefix_list.prefix_list_id)
         | 
| 18 | 
            +
                      content = ERB.new(managed_prefix_list_spec_template, nil, '-').result(binding).gsub(/^\n/, '')
         | 
| 19 | 
            +
                    end
         | 
| 20 | 
            +
                    specs.join("\n")
         | 
| 21 | 
            +
                  end
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                  def managed_prefix_list_spec_template
         | 
| 24 | 
            +
                    <<-'EOF'
         | 
| 25 | 
            +
            describe managed_prefix_list('<%= prefix_list.prefix_list_name %>') do
         | 
| 26 | 
            +
              it { should exist }
         | 
| 27 | 
            +
            <% entries.each do |entry| %>
         | 
| 28 | 
            +
            <% if entry.description.nil? %>
         | 
| 29 | 
            +
              it { should have_cidr('<%= entry.cidr %>') }
         | 
| 30 | 
            +
            <% else %>
         | 
| 31 | 
            +
              it { should have_cidr('<%= entry.cidr %>').desc('<%= entry.description %>') }
         | 
| 32 | 
            +
            <% end %>
         | 
| 33 | 
            +
            <% end %>
         | 
| 34 | 
            +
              its(:entries_count) { should eq <%= entries.length %> }
         | 
| 35 | 
            +
              its(:prefix_list_id) { should eq '<%= prefix_list.prefix_list_id %>' }
         | 
| 36 | 
            +
              its(:address_family) { should eq '<%= prefix_list.address_family %>' }
         | 
| 37 | 
            +
              its(:state) { should eq '<%= prefix_list.state %>' }
         | 
| 38 | 
            +
              its(:prefix_list_arn) { should eq '<%= prefix_list.prefix_list_arn %>' }
         | 
| 39 | 
            +
            <% if prefix_list.max_entries %>
         | 
| 40 | 
            +
              its(:max_entries) { should eq <%= prefix_list.max_entries %> }
         | 
| 41 | 
            +
            <% end %>
         | 
| 42 | 
            +
            <% if prefix_list.version %>
         | 
| 43 | 
            +
              its(:version) { should eq <%= prefix_list.version %> }
         | 
| 44 | 
            +
            <% end %>
         | 
| 45 | 
            +
              its(:owner_id) { should eq '<%= prefix_list.owner_id %>' }
         | 
| 46 | 
            +
            <% prefix_list.tags.each do |tag| %>
         | 
| 47 | 
            +
              it { should have_tag('<%= tag.key %>').value('<%= tag.value %>') }
         | 
| 48 | 
            +
            <% end %>
         | 
| 49 | 
            +
            end
         | 
| 50 | 
            +
            EOF
         | 
| 51 | 
            +
                  end
         | 
| 52 | 
            +
                end
         | 
| 53 | 
            +
              end
         | 
| 54 | 
            +
            end
         | 
    
        data/lib/awspec/generator.rb
    CHANGED
    
    | @@ -43,6 +43,7 @@ require 'awspec/generator/spec/redshift_cluster_parameter_group' | |
| 43 43 | 
             
            require 'awspec/generator/spec/rds_proxy'
         | 
| 44 44 | 
             
            require 'awspec/generator/spec/rds_db_cluster'
         | 
| 45 45 | 
             
            require 'awspec/generator/spec/rds_global_cluster'
         | 
| 46 | 
            +
            require 'awspec/generator/spec/managed_prefix_list'
         | 
| 46 47 |  | 
| 47 48 | 
             
            # Doc
         | 
| 48 49 | 
             
            require 'awspec/generator/doc/type'
         | 
| @@ -4,10 +4,8 @@ module Awspec::Helper | |
| 4 4 | 
             
              module Finder
         | 
| 5 5 | 
             
                module Codebuild
         | 
| 6 6 | 
             
                  def find_codebuild_project(id)
         | 
| 7 | 
            -
                     | 
| 8 | 
            -
             | 
| 9 | 
            -
                    end
         | 
| 10 | 
            -
                    projects.single_resource(id)
         | 
| 7 | 
            +
                    res = codebuild_client.batch_get_projects({ names: [id] })
         | 
| 8 | 
            +
                    res.projects.single_resource(id)
         | 
| 11 9 | 
             
                  end
         | 
| 12 10 |  | 
| 13 11 | 
             
                  def select_all_codebuild_projects
         | 
| @@ -228,6 +228,18 @@ module Awspec::Helper | |
| 228 228 | 
             
                                                                          })
         | 
| 229 229 | 
             
                    res.transit_gateway_attachments
         | 
| 230 230 | 
             
                  end
         | 
| 231 | 
            +
             | 
| 232 | 
            +
                  def find_managed_prefix_list(prefix_list_name)
         | 
| 233 | 
            +
                    res = ec2_client.describe_managed_prefix_lists({
         | 
| 234 | 
            +
                                                                     filters: [{ name: 'prefix-list-name',
         | 
| 235 | 
            +
                                                                                 values: [prefix_list_name] }]
         | 
| 236 | 
            +
                                                                   })
         | 
| 237 | 
            +
                    res.prefix_lists.single_resource(prefix_list_name)
         | 
| 238 | 
            +
                  end
         | 
| 239 | 
            +
             | 
| 240 | 
            +
                  def select_managed_prefix_list_entries(prefix_list_id)
         | 
| 241 | 
            +
                    ec2_client.get_managed_prefix_list_entries({ prefix_list_id: prefix_list_id }).data.entries
         | 
| 242 | 
            +
                  end
         | 
| 231 243 | 
             
                end
         | 
| 232 244 | 
             
              end
         | 
| 233 245 | 
             
            end
         | 
| @@ -4,9 +4,7 @@ module Awspec::Helper | |
| 4 4 | 
             
              module Finder
         | 
| 5 5 | 
             
                module VpcEndpoints
         | 
| 6 6 | 
             
                  def find_vpc_endpoint(id)
         | 
| 7 | 
            -
                    res = ec2_client.describe_vpc_endpoints({
         | 
| 8 | 
            -
                                                              filters: [{ name: 'vpc-endpoint-id', values: [id] }]
         | 
| 9 | 
            -
                                                            })
         | 
| 7 | 
            +
                    res = ec2_client.describe_vpc_endpoints({ vpc_endpoint_ids: [id] })
         | 
| 10 8 |  | 
| 11 9 | 
             
                    ret = res.vpc_endpoints.select do |vpce|
         | 
| 12 10 | 
             
                      vpce.vpc_endpoint_id == id
         | 
    
        data/lib/awspec/helper/type.rb
    CHANGED
    
    | @@ -24,7 +24,7 @@ module Awspec | |
| 24 24 | 
             
                    internet_gateway acm cloudwatch_logs dynamodb_table eip sqs ssm_parameter cloudformation_stack
         | 
| 25 25 | 
             
                    codebuild sns_topic redshift redshift_cluster_parameter_group codedeploy codedeploy_deployment_group
         | 
| 26 26 | 
             
                    secretsmanager msk transit_gateway cognito_identity_pool cognito_user_pool vpc_endpoints
         | 
| 27 | 
            -
                    transfer_server
         | 
| 27 | 
            +
                    transfer_server managed_prefix_list
         | 
| 28 28 | 
             
                  ]
         | 
| 29 29 |  | 
| 30 30 | 
             
                  ACCOUNT_ATTRIBUTES = %w[
         | 
| @@ -34,7 +34,7 @@ RSpec::Matchers.define :belong_to_subnet do |subnet_id| | |
| 34 34 | 
             
                end
         | 
| 35 35 |  | 
| 36 36 | 
             
                # RDS DB Subnet Group
         | 
| 37 | 
            -
                if type.instance_of?(Awspec::Type:: | 
| 37 | 
            +
                if type.instance_of?(Awspec::Type::RdsDBSubnetGroup)
         | 
| 38 38 | 
             
                  subnets = type.resource_via_client[:subnets]
         | 
| 39 39 | 
             
                  ret = subnets.find do |s|
         | 
| 40 40 | 
             
                    s[:subnet_identifier] == subnet_id
         | 
    
        data/lib/awspec/matcher.rb
    CHANGED
    
    
| @@ -2,6 +2,62 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            Aws.config[:codebuild] = {
         | 
| 4 4 | 
             
              stub_responses: {
         | 
| 5 | 
            +
                batch_get_projects: {
         | 
| 6 | 
            +
                  projects: [
         | 
| 7 | 
            +
                    {
         | 
| 8 | 
            +
                      name: 'my-codebuild1',
         | 
| 9 | 
            +
                      arn: 'arn:aws:codebuild:ap-northeast-1:123456789012:project/my-codebuild1',
         | 
| 10 | 
            +
                      source: {
         | 
| 11 | 
            +
                        type: 'S3',
         | 
| 12 | 
            +
                        location: 'example-bucket/test.zip',
         | 
| 13 | 
            +
                        insecure_ssl: false
         | 
| 14 | 
            +
                      },
         | 
| 15 | 
            +
                      secondary_sources: [],
         | 
| 16 | 
            +
                      secondary_source_versions: [],
         | 
| 17 | 
            +
                      artifacts: {
         | 
| 18 | 
            +
                        type: 'NO_ARTIFACTS'
         | 
| 19 | 
            +
                      },
         | 
| 20 | 
            +
                      secondary_artifacts: [],
         | 
| 21 | 
            +
                      cache: {
         | 
| 22 | 
            +
                        type: 'NO_CACHE'
         | 
| 23 | 
            +
                      },
         | 
| 24 | 
            +
                      environment: {
         | 
| 25 | 
            +
                        type: 'LINUX_CONTAINER',
         | 
| 26 | 
            +
                        image: 'aws/codebuild/amazonlinux2-x86_64-standard:5.0',
         | 
| 27 | 
            +
                        compute_type: 'BUILD_GENERAL1_SMALL',
         | 
| 28 | 
            +
                        environment_variables: [],
         | 
| 29 | 
            +
                        privileged_mode: false,
         | 
| 30 | 
            +
                        image_pull_credentials_type: 'CODEBUILD'
         | 
| 31 | 
            +
                      },
         | 
| 32 | 
            +
                      service_role: 'arn:aws:iam::123456789012:role/service-role/codebuild-my-codebuild1-service-role',
         | 
| 33 | 
            +
                      timeout_in_minutes: 60,
         | 
| 34 | 
            +
                      queued_timeout_in_minutes: 480,
         | 
| 35 | 
            +
                      encryption_key: 'arn:aws:kms:ap-northeast-1:123456789012:alias/aws/s3',
         | 
| 36 | 
            +
                      tags: [
         | 
| 37 | 
            +
                        {
         | 
| 38 | 
            +
                          key: 'env',
         | 
| 39 | 
            +
                          value: 'dev'
         | 
| 40 | 
            +
                        }
         | 
| 41 | 
            +
                      ],
         | 
| 42 | 
            +
                      created: Time.local(2024),
         | 
| 43 | 
            +
                      last_modified: Time.local(2024),
         | 
| 44 | 
            +
                      badge: {
         | 
| 45 | 
            +
                        badge_enabled: false
         | 
| 46 | 
            +
                      },
         | 
| 47 | 
            +
                      logs_config: {
         | 
| 48 | 
            +
                        cloud_watch_logs: {
         | 
| 49 | 
            +
                          status: 'ENABLED'
         | 
| 50 | 
            +
                        },
         | 
| 51 | 
            +
                        s3_logs: {
         | 
| 52 | 
            +
                          status: 'DISABLED',
         | 
| 53 | 
            +
                          encryption_disabled: false
         | 
| 54 | 
            +
                        }
         | 
| 55 | 
            +
                      },
         | 
| 56 | 
            +
                      project_visibility: 'PRIVATE'
         | 
| 57 | 
            +
                    }
         | 
| 58 | 
            +
                  ],
         | 
| 59 | 
            +
                  projects_not_found: []
         | 
| 60 | 
            +
                },
         | 
| 5 61 | 
             
                list_projects: {
         | 
| 6 62 | 
             
                  projects: %w[
         | 
| 7 63 | 
             
                    my-codebuild1
         | 
| @@ -0,0 +1,41 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            Aws.config[:ec2] = {
         | 
| 4 | 
            +
              stub_responses: {
         | 
| 5 | 
            +
                describe_managed_prefix_lists: {
         | 
| 6 | 
            +
                  next_token: nil,
         | 
| 7 | 
            +
                  prefix_lists: [
         | 
| 8 | 
            +
                    {
         | 
| 9 | 
            +
                      prefix_list_id: 'pl-12345678',
         | 
| 10 | 
            +
                      address_family: 'IPv4',
         | 
| 11 | 
            +
                      state: 'create-complete',
         | 
| 12 | 
            +
                      state_message: nil,
         | 
| 13 | 
            +
                      prefix_list_arn: 'arn:aws:ec2:ap-northeast-1:aws:prefix-list/pl-12345678',
         | 
| 14 | 
            +
                      prefix_list_name: 'my-managed-prefix-list',
         | 
| 15 | 
            +
                      max_entries: 2,
         | 
| 16 | 
            +
                      version: 1,
         | 
| 17 | 
            +
                      tags: [
         | 
| 18 | 
            +
                        {
         | 
| 19 | 
            +
                          key: 'env',
         | 
| 20 | 
            +
                          value: 'dev'
         | 
| 21 | 
            +
                        }
         | 
| 22 | 
            +
                      ],
         | 
| 23 | 
            +
                      owner_id: '123456789012'
         | 
| 24 | 
            +
                    }
         | 
| 25 | 
            +
                  ]
         | 
| 26 | 
            +
                },
         | 
| 27 | 
            +
                get_managed_prefix_list_entries: {
         | 
| 28 | 
            +
                  next_toke: nil,
         | 
| 29 | 
            +
                  entries: [
         | 
| 30 | 
            +
                    {
         | 
| 31 | 
            +
                      cidr: '10.0.0.0/16',
         | 
| 32 | 
            +
                      description: 'test'
         | 
| 33 | 
            +
                    },
         | 
| 34 | 
            +
                    {
         | 
| 35 | 
            +
                      cidr: '192.168.0.0/24',
         | 
| 36 | 
            +
                      description: 'dev'
         | 
| 37 | 
            +
                    }
         | 
| 38 | 
            +
                  ]
         | 
| 39 | 
            +
                }
         | 
| 40 | 
            +
              }
         | 
| 41 | 
            +
            }
         | 
| @@ -0,0 +1,34 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module Awspec::Type
         | 
| 4 | 
            +
              class ManagedPrefixList < ResourceBase
         | 
| 5 | 
            +
                aws_resource Aws::EC2::Types::ManagedPrefixList
         | 
| 6 | 
            +
                tags_allowed
         | 
| 7 | 
            +
             | 
| 8 | 
            +
                def resource_via_client
         | 
| 9 | 
            +
                  @resource_via_client ||= find_managed_prefix_list(@display_name)
         | 
| 10 | 
            +
                end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
                def id
         | 
| 13 | 
            +
                  @id ||= resource_via_client.prefix_list_id if resource_via_client
         | 
| 14 | 
            +
                end
         | 
| 15 | 
            +
             | 
| 16 | 
            +
                def entries
         | 
| 17 | 
            +
                  @entries ||= select_managed_prefix_list_entries(id)
         | 
| 18 | 
            +
                end
         | 
| 19 | 
            +
             | 
| 20 | 
            +
                def has_cidr?(cidr, description = nil)
         | 
| 21 | 
            +
                  entries.find do |entry|
         | 
| 22 | 
            +
                    if description.nil?
         | 
| 23 | 
            +
                      entry.cidr == cidr
         | 
| 24 | 
            +
                    else
         | 
| 25 | 
            +
                      entry.cidr == cidr && entry.description == description
         | 
| 26 | 
            +
                    end
         | 
| 27 | 
            +
                  end
         | 
| 28 | 
            +
                end
         | 
| 29 | 
            +
             | 
| 30 | 
            +
                def entries_count
         | 
| 31 | 
            +
                  entries.length
         | 
| 32 | 
            +
                end
         | 
| 33 | 
            +
              end
         | 
| 34 | 
            +
            end
         | 
| @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 3 | 
             
            module Awspec::Type
         | 
| 4 | 
            -
              class  | 
| 4 | 
            +
              class InvalidRdsDBParameter < StandardError
         | 
| 5 5 | 
             
                ##
         | 
| 6 6 | 
             
                # Overrides the superclass initialize method to include more information
         | 
| 7 7 | 
             
                # and default error message.
         | 
| @@ -19,7 +19,7 @@ module Awspec::Type | |
| 19 19 | 
             
                ##
         | 
| 20 20 | 
             
                # Thanks to AWS for creating parameters names like
         | 
| 21 21 | 
             
                # 'rds.accepted_password_auth_method', which would be caught as method 'rds'
         | 
| 22 | 
            -
                # by method_missing in  | 
| 22 | 
            +
                # by method_missing in RdsDBParameterGroup class, this class was created
         | 
| 23 23 | 
             
                # See https://github.com/k1LoW/awspec/issues/527 for more details
         | 
| 24 24 | 
             
                def initialize(params)
         | 
| 25 25 | 
             
                  @params = params
         | 
| @@ -33,11 +33,11 @@ module Awspec::Type | |
| 33 33 | 
             
                  param_name = name.to_sym
         | 
| 34 34 | 
             
                  return @params[param_name] if @params.include?(param_name)
         | 
| 35 35 |  | 
| 36 | 
            -
                  raise  | 
| 36 | 
            +
                  raise InvalidRdsDBParameter, name
         | 
| 37 37 | 
             
                end
         | 
| 38 38 | 
             
              end
         | 
| 39 39 |  | 
| 40 | 
            -
              class  | 
| 40 | 
            +
              class RdsDBParameterGroup < ResourceBase
         | 
| 41 41 | 
             
                def resource_via_client
         | 
| 42 42 | 
             
                  return @resource_via_client if @resource_via_client
         | 
| 43 43 |  | 
| @@ -18,9 +18,21 @@ module Awspec::Type | |
| 18 18 | 
             
                end
         | 
| 19 19 |  | 
| 20 20 | 
             
                def has_attachment?(att_id)
         | 
| 21 | 
            -
                  atts = find_tgw_attachments_by_tgw_id( | 
| 22 | 
            -
             | 
| 23 | 
            -
                   | 
| 21 | 
            +
                  atts = find_tgw_attachments_by_tgw_id(id)
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                  atts.any? do |att|
         | 
| 24 | 
            +
                    att.transit_gateway_attachment_id == att_id || attachment_has_name?(att, att_id)
         | 
| 25 | 
            +
                  end
         | 
| 26 | 
            +
                end
         | 
| 27 | 
            +
             | 
| 28 | 
            +
                private
         | 
| 29 | 
            +
             | 
| 30 | 
            +
                def attachment_has_name?(attachment, name)
         | 
| 31 | 
            +
                  if name.is_a?(Regexp)
         | 
| 32 | 
            +
                    attachment.tags.any? { |tag| tag.key == 'Name' && (name =~ tag.value) }
         | 
| 33 | 
            +
                  else
         | 
| 34 | 
            +
                    attachment.tags.any? { |tag| tag.key == 'Name' && tag.value == name }
         | 
| 35 | 
            +
                  end
         | 
| 24 36 | 
             
                end
         | 
| 25 37 | 
             
              end
         | 
| 26 38 | 
             
            end
         | 
    
        data/lib/awspec/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,13 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: awspec
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1. | 
| 4 | 
            +
              version: 1.31.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - k1LoW
         | 
| 8 | 
            -
            autorequire:
         | 
| 9 8 | 
             
            bindir: exe
         | 
| 10 9 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 10 | 
            +
            date: 2025-01-22 00:00:00.000000000 Z
         | 
| 12 11 | 
             
            dependencies:
         | 
| 13 12 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 13 | 
             
              name: addressable
         | 
| @@ -52,6 +51,20 @@ dependencies: | |
| 52 51 | 
             
                - - "~>"
         | 
| 53 52 | 
             
                  - !ruby/object:Gem::Version
         | 
| 54 53 | 
             
                    version: '3'
         | 
| 54 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 55 | 
            +
              name: base64
         | 
| 56 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 57 | 
            +
                requirements:
         | 
| 58 | 
            +
                - - "~>"
         | 
| 59 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 60 | 
            +
                    version: 0.1.0
         | 
| 61 | 
            +
              type: :runtime
         | 
| 62 | 
            +
              prerelease: false
         | 
| 63 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 64 | 
            +
                requirements:
         | 
| 65 | 
            +
                - - "~>"
         | 
| 66 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 67 | 
            +
                    version: 0.1.0
         | 
| 55 68 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 56 69 | 
             
              name: dry-inflector
         | 
| 57 70 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -80,6 +93,20 @@ dependencies: | |
| 80 93 | 
             
                - - ">="
         | 
| 81 94 | 
             
                  - !ruby/object:Gem::Version
         | 
| 82 95 | 
             
                    version: '0'
         | 
| 96 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 97 | 
            +
              name: ostruct
         | 
| 98 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 99 | 
            +
                requirements:
         | 
| 100 | 
            +
                - - "~>"
         | 
| 101 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 102 | 
            +
                    version: 0.6.1
         | 
| 103 | 
            +
              type: :runtime
         | 
| 104 | 
            +
              prerelease: false
         | 
| 105 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 106 | 
            +
                requirements:
         | 
| 107 | 
            +
                - - "~>"
         | 
| 108 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 109 | 
            +
                    version: 0.6.1
         | 
| 83 110 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 84 111 | 
             
              name: rspec
         | 
| 85 112 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -300,6 +327,7 @@ files: | |
| 300 327 | 
             
            - doc/_resource_types/lambda_account_settings.md
         | 
| 301 328 | 
             
            - doc/_resource_types/launch_configuration.md
         | 
| 302 329 | 
             
            - doc/_resource_types/launch_template.md
         | 
| 330 | 
            +
            - doc/_resource_types/managed_prefix_list.md
         | 
| 303 331 | 
             
            - doc/_resource_types/mq.md
         | 
| 304 332 | 
             
            - doc/_resource_types/msk.md
         | 
| 305 333 | 
             
            - doc/_resource_types/nat_gateway.md
         | 
| @@ -410,6 +438,7 @@ files: | |
| 410 438 | 
             
            - lib/awspec/generator/doc/type/lambda_account_settings.rb
         | 
| 411 439 | 
             
            - lib/awspec/generator/doc/type/launch_configuration.rb
         | 
| 412 440 | 
             
            - lib/awspec/generator/doc/type/launch_template.rb
         | 
| 441 | 
            +
            - lib/awspec/generator/doc/type/managed_prefix_list.rb
         | 
| 413 442 | 
             
            - lib/awspec/generator/doc/type/mq.rb
         | 
| 414 443 | 
             
            - lib/awspec/generator/doc/type/msk.rb
         | 
| 415 444 | 
             
            - lib/awspec/generator/doc/type/nat_gateway.rb
         | 
| @@ -470,6 +499,7 @@ files: | |
| 470 499 | 
             
            - lib/awspec/generator/spec/internet_gateway.rb
         | 
| 471 500 | 
             
            - lib/awspec/generator/spec/kms.rb
         | 
| 472 501 | 
             
            - lib/awspec/generator/spec/lambda.rb
         | 
| 502 | 
            +
            - lib/awspec/generator/spec/managed_prefix_list.rb
         | 
| 473 503 | 
             
            - lib/awspec/generator/spec/nat_gateway.rb
         | 
| 474 504 | 
             
            - lib/awspec/generator/spec/network_acl.rb
         | 
| 475 505 | 
             
            - lib/awspec/generator/spec/network_interface.rb
         | 
| @@ -572,6 +602,7 @@ files: | |
| 572 602 | 
             
            - lib/awspec/matcher/belong_to_subnets.rb
         | 
| 573 603 | 
             
            - lib/awspec/matcher/belong_to_vpc.rb
         | 
| 574 604 | 
             
            - lib/awspec/matcher/have_attribute_definition.rb
         | 
| 605 | 
            +
            - lib/awspec/matcher/have_cidr.rb
         | 
| 575 606 | 
             
            - lib/awspec/matcher/have_cluster_member.rb
         | 
| 576 607 | 
             
            - lib/awspec/matcher/have_cluster_parameter_group.rb
         | 
| 577 608 | 
             
            - lib/awspec/matcher/have_custom_response_error_code.rb
         | 
| @@ -656,6 +687,7 @@ files: | |
| 656 687 | 
             
            - lib/awspec/stub/lambda.rb
         | 
| 657 688 | 
             
            - lib/awspec/stub/launch_configuration.rb
         | 
| 658 689 | 
             
            - lib/awspec/stub/launch_template.rb
         | 
| 690 | 
            +
            - lib/awspec/stub/managed_prefix_list.rb
         | 
| 659 691 | 
             
            - lib/awspec/stub/mq.rb
         | 
| 660 692 | 
             
            - lib/awspec/stub/msk.rb
         | 
| 661 693 | 
             
            - lib/awspec/stub/nat_gateway.rb
         | 
| @@ -751,6 +783,7 @@ files: | |
| 751 783 | 
             
            - lib/awspec/type/lambda_account_settings.rb
         | 
| 752 784 | 
             
            - lib/awspec/type/launch_configuration.rb
         | 
| 753 785 | 
             
            - lib/awspec/type/launch_template.rb
         | 
| 786 | 
            +
            - lib/awspec/type/managed_prefix_list.rb
         | 
| 754 787 | 
             
            - lib/awspec/type/mq.rb
         | 
| 755 788 | 
             
            - lib/awspec/type/msk.rb
         | 
| 756 789 | 
             
            - lib/awspec/type/nat_gateway.rb
         | 
| @@ -794,7 +827,6 @@ homepage: https://github.com/k1LoW/awspec | |
| 794 827 | 
             
            licenses:
         | 
| 795 828 | 
             
            - MIT
         | 
| 796 829 | 
             
            metadata: {}
         | 
| 797 | 
            -
            post_install_message:
         | 
| 798 830 | 
             
            rdoc_options: []
         | 
| 799 831 | 
             
            require_paths:
         | 
| 800 832 | 
             
            - lib
         | 
| @@ -802,15 +834,14 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 802 834 | 
             
              requirements:
         | 
| 803 835 | 
             
              - - ">="
         | 
| 804 836 | 
             
                - !ruby/object:Gem::Version
         | 
| 805 | 
            -
                  version: ' | 
| 837 | 
            +
                  version: '3.0'
         | 
| 806 838 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 807 839 | 
             
              requirements:
         | 
| 808 840 | 
             
              - - ">="
         | 
| 809 841 | 
             
                - !ruby/object:Gem::Version
         | 
| 810 842 | 
             
                  version: '0'
         | 
| 811 843 | 
             
            requirements: []
         | 
| 812 | 
            -
            rubygems_version: 3. | 
| 813 | 
            -
            signing_key:
         | 
| 844 | 
            +
            rubygems_version: 3.6.2
         | 
| 814 845 | 
             
            specification_version: 4
         | 
| 815 846 | 
             
            summary: RSpec tests for your AWS resources.
         | 
| 816 847 | 
             
            test_files: []
         |