Remove   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 26
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A apply() 0 11 1
A initialize() 0 5 1
1
# frozen_string_literal: true
2
3
require_relative '../../../../action'
4
5
module AMA
6
  module Chef
7
    module User
8
      class Action
9
        module Account
10
          module PrivateKey
11
            module Remote
12
              class Remove < Action
13
                attr_accessor :account
14
                attr_accessor :private_key
15
                attr_accessor :remote
16
17
                # @param [AMA::Chef::User::Model::Account] account
18
                # @param [AMA::Chef::User::Model::PrivateKey] private_key
19
                # @param [AMA::Chef::User::Model::PrivateKey::Remote] remote
20
                def initialize(account, private_key, remote)
21
                  @account = account
22
                  @private_key = private_key
23
                  @remote = remote
24
                end
25
26
                def apply(resource_factory)
27
                  account = @account
28
                  key = @private_key
29
                  remote = @remote
30
                  name = "#{account.id}:#{key.owner}:#{key.id}:#{remote.id}"
31
                  resource_factory.ssh_config name do
32
                    host remote.id.to_s
33
                    user account.id.to_s
34
                    action :remove
35
                  end
36
                end
37
              end
38
            end
39
          end
40
        end
41
      end
42
    end
43
  end
44
end
45