Class: CFnDK::KeyPairs

Inherits:
Object
  • Object
show all
Defined in:
lib/cfndk/key_pairs.rb

Instance Method Summary collapse

Constructor Details

#initialize(data, option, credentials) ⇒ KeyPairs

Returns a new instance of KeyPairs.



3
4
5
6
7
8
# 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

Instance Method Details

#createObject



10
11
12
13
14
15
# 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

#destroyObject



17
18
19
20
21
22
# 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_executeObject



30
31
32
33
34
# 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_executeObject



24
25
26
27
28
# File 'lib/cfndk/key_pairs.rb', line 24

def pre_command_execute
  @keypairs.each_value do |keypair|
    keypair.pre_command_execute
  end
end