class CFnDK::KeyPairs

Public Class Methods

new(data, option, credentials) click to toggle source
# File lib/cfndk/key_pairs.rb, line 3
def initialize(data, option, credentials)
  @option = option
  @credentials = credentials
  @global_config = CFnDK::GlobalConfig.new(data, option)
  prepare_keypairs(data)
end

Public Instance Methods

create() click to toggle source
# File lib/cfndk/key_pairs.rb, line 10
def create
  @keypairs.each_value do |keypair|
    next if @option[:keypair_names].instance_of?(Array) && !@option[:keypair_names].include?(keypair.original_name)
    keypair.create
  end
end
destroy() click to toggle source
# File lib/cfndk/key_pairs.rb, line 17
def destroy
  @keypairs.each_value do |keypair|
    next if @option[:keypair_names].instance_of?(Array) && !@option[:keypair_names].include?(keypair.original_name)
    keypair.destroy
  end
end
post_command_execute() click to toggle source
# File lib/cfndk/key_pairs.rb, line 30
def post_command_execute
  @keypairs.each_value do |keypair|
    keypair.post_command_execute
  end
end
pre_command_execute() click to toggle source
# File lib/cfndk/key_pairs.rb, line 24
def pre_command_execute
  @keypairs.each_value do |keypair|
    keypair.pre_command_execute
  end
end

Private Instance Methods

prepare_keypairs(data) click to toggle source
# File lib/cfndk/key_pairs.rb, line 38
def prepare_keypairs(data)
  @keypairs = {}
  return unless data['keypairs']
  data['keypairs'].each do |name, properties|
    @keypairs[name] = KeyPair.new(name, properties, @option, @global_config, @credentials)
  end
end