Sha256: 21b6b5747cb6225ec52463de0cb741f3aef46f1fbd75f41da7c17d6f63ef3059
Contents?: true
Size: 1.04 KB
Versions: 10
Compression:
Stored size: 1.04 KB
Contents
# frozen_string_literal: true module Awspec::Generator module Spec class RdsProxy include Awspec::Helper::Finder def generate_by_vpc_id(vpc_id) vpc = find_vpc(vpc_id) raise 'Not Found VPC' unless vpc @vpc_id = vpc[:vpc_id] db_proxies = select_rds_proxy_by_vpc_id(@vpc_id) specs = db_proxies.map do |db_proxy| content = ERB.new(rds_proxy_spec_template, nil, '-').result(binding).gsub(/^\n/, '') end specs.join("\n") end # rubocop:disable all def rds_proxy_spec_template template = <<-'EOF' describe rds_proxy('<%= db_proxy.db_proxy_name %>') do it { should exist } it { should be_<%= db_proxy.status %> } it { should belong_to_vpc('<%= @vpc_id %>') } <% db_proxy.vpc_security_group_ids.each do |sg_group_id| %> it { should have_security_group('<%= sg_group_id %>') } <% end %> <% db_proxy.vpc_subnet_ids.each do |subnet_id| %> it { should belong_to_subnet('<%= subnet_id %>') } <% end %> end EOF template end end end end
Version data entries
10 entries across 10 versions & 1 rubygems