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