Class: ForemanOpentofu::KeyPairs
- Inherits:
-
Array
- Object
- Array
- ForemanOpentofu::KeyPairs
- Defined in:
- app/services/foreman_opentofu/key_pairs.rb
Instance Attribute Summary collapse
-
#opentofu_executer ⇒ Object
Returns the value of attribute opentofu_executer.
Instance Method Summary collapse
- #create(opts = {}) ⇒ Object
- #get(name) ⇒ Object
-
#initialize(exec, init_value = []) ⇒ KeyPairs
constructor
A new instance of KeyPairs.
Constructor Details
#initialize(exec, init_value = []) ⇒ KeyPairs
Returns a new instance of KeyPairs.
5 6 7 8 |
# File 'app/services/foreman_opentofu/key_pairs.rb', line 5 def initialize(exec, init_value = []) self.opentofu_executer = exec super init_value unless init_value.nil? end |
Instance Attribute Details
#opentofu_executer ⇒ Object
Returns the value of attribute opentofu_executer.
3 4 5 |
# File 'app/services/foreman_opentofu/key_pairs.rb', line 3 def opentofu_executer @opentofu_executer end |
Instance Method Details
#create(opts = {}) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'app/services/foreman_opentofu/key_pairs.rb', line 10 def create(opts = {}) # client.key_pairs.create :name => "foreman-#{id}#{Foreman.uuid}" key_pair = TofuKeyPair.new opts[:name] key_pair.generate opentofu_executer.run_create_key(key_pair) key_pair end |
#get(name) ⇒ Object
20 21 22 23 24 |
# File 'app/services/foreman_opentofu/key_pairs.rb', line 20 def get(name) kp = TofuKeyPair.new name kp.opentofu_executer = opentofu_executer kp end |