Class: ForemanNetbox::NetboxParameters

Inherits:
Object
  • Object
show all
Defined in:
app/services/foreman_netbox/netbox_parameters.rb

Overview

rubocop:disable Metrics/ClassLength

Constant Summary collapse

UNKNOWN =
'Unknown'
DEFAULT_INTERFACE_TYPE =
'virtual'
CLUSTER_TYPES =
{
  'Foreman::Model::Vmware': {
    name: 'VMware ESXi',
    slug: 'vmware-esxi',
  },
}.freeze
DEVICE_ROLE =
{
  name: 'SERVER',
  color: '9e9e9e',
  slug: 'server',
}.freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host) ⇒ NetboxParameters

Returns a new instance of NetboxParameters.



24
25
26
# File 'app/services/foreman_netbox/netbox_parameters.rb', line 24

def initialize(host)
  @host = host
end

Class Method Details

.call(host) ⇒ Object



20
21
22
# File 'app/services/foreman_netbox/netbox_parameters.rb', line 20

def self.call(host)
  new(host).call
end

Instance Method Details

#callObject



28
29
30
31
32
33
34
# File 'app/services/foreman_netbox/netbox_parameters.rb', line 28

def call
  additional_params = host.compute? ? ForemanNetbox::NetboxFacet::VIRTUAL_MACHINE_PARAMS : ForemanNetbox::NetboxFacet::DEVICE_PARAMS

  (ForemanNetbox::NetboxFacet::COMMON_PARAMS + additional_params).map do |param|
    send(param)
  end.reduce({}, :merge)
end