Class: ServerGuard24::V3

Inherits:
Integration
  • Object
show all
Defined in:
app/models/pager_tree/integrations/server_guard24/v3.rb

Constant Summary collapse

OPTIONS =
[
  {key: :resolve_warn, type: :boolean, default: false}
]

Instance Method Summary collapse

Instance Method Details

#adapter_actionObject



30
31
32
33
34
35
36
37
38
39
40
# File 'app/models/pager_tree/integrations/server_guard24/v3.rb', line 30

def adapter_action
  check_result = adapter_incoming_request_params.dig("check_result")

  if check_result == "CRITICAL"
    :create
  elsif check_result == "OK" || (check_result == "WARNING" && self.option_resolve_warn == true)
    :resolve
  else
    :other
  end
end

#adapter_incoming_can_defer?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'app/models/pager_tree/integrations/server_guard24/v3.rb', line 22

def adapter_incoming_can_defer?
  true
end

#adapter_process_createObject



42
43
44
45
46
47
48
49
50
# File 'app/models/pager_tree/integrations/server_guard24/v3.rb', line 42

def adapter_process_create
  Alert.new(
    title: _title,
    description: _description,
    thirdparty_id: adapter_thirdparty_id,
    dedup_keys: [],
    additional_data: _additional_datums
  )
end

#adapter_supports_incoming?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'app/models/pager_tree/integrations/server_guard24/v3.rb', line 14

def adapter_supports_incoming?
  true
end

#adapter_supports_outgoing?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'app/models/pager_tree/integrations/server_guard24/v3.rb', line 18

def adapter_supports_outgoing?
  false
end

#adapter_thirdparty_idObject



26
27
28
# File 'app/models/pager_tree/integrations/server_guard24/v3.rb', line 26

def adapter_thirdparty_id
  [adapter_incoming_request_params.dig("server_name"), adapter_incoming_request_params.dig("service_shortname")].compact_blank.join("_")
end