Module: Awspec::Helper::Finder::Redshift

Included in:
Awspec::Helper::Finder
Defined in:
lib/awspec/helper/finder/redshift.rb

Instance Method Summary collapse

Instance Method Details

#find_redshift_cluster_identifier(id) ⇒ Object



4
5
6
7
8
9
# File 'lib/awspec/helper/finder/redshift.rb', line 4

def find_redshift_cluster_identifier(id)
  res = redshift_client.describe_clusters(cluster_identifier: id)
  res.clusters.single_resource(id)
rescue
  nil
end

#select_all_redshift_cluster_parameters(parameter_group) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/awspec/helper/finder/redshift.rb', line 18

def select_all_redshift_cluster_parameters(parameter_group)
  parameters = {}
  res = redshift_client.describe_cluster_parameters({
                                                      parameter_group_name: parameter_group
                                                    })
  loop do
    res.parameters.each do |param|
      parameters[param.parameter_name] = param.parameter_value
    end
    break if res.marker.nil?
    res = redshift_client.describe_cluster_parameters({
                                                        parameter_group_name: parameter_group,
                                                        marker: res.marker
                                                      })
  end
  parameters
end

#select_redshift_by_vpc_id(vpc_id) ⇒ Object



11
12
13
14
15
16
# File 'lib/awspec/helper/finder/redshift.rb', line 11

def select_redshift_by_vpc_id(vpc_id)
  res = redshift_client.describe_clusters
  res.clusters.select do |clusters|
    clusters.vpc_id == vpc_id
  end
end