Class: FlapjackConfigurator::FlapjackPagerduty
- Inherits:
-
FlapjackSubObjectBase
- Object
- FlapjackObjectBase
- FlapjackSubObjectBase
- FlapjackConfigurator::FlapjackPagerduty
- Defined in:
- lib/flapjack_configurator/flapjack_pagerduty.rb
Overview
Class representing Pagerduty credentials In Flapjack 1.x Pagerduty is somewhat duct-taped to the side of the thing and not handled as media. However, to make our lives easier, make this class look like FlapjackMedia so that it can be handled like a media entry
Instance Attribute Summary
Attributes inherited from FlapjackObjectBase
Instance Method Summary collapse
- #create(contact_id, config) ⇒ Object
-
#initialize(current_config, diner, logger) ⇒ FlapjackPagerduty
constructor
A new instance of FlapjackPagerduty.
-
#type ⇒ Object
Type helper to match FlapjackMedia.
Methods inherited from FlapjackSubObjectBase
#_create, #_filter_config, #update
Methods inherited from FlapjackObjectBase
#_load_from_api, #_reload_config, #_update, #delete, #id
Constructor Details
#initialize(current_config, diner, logger) ⇒ FlapjackPagerduty
Returns a new instance of FlapjackPagerduty.
10 11 12 13 14 15 16 17 |
# File 'lib/flapjack_configurator/flapjack_pagerduty.rb', line 10 def initialize(current_config, diner, logger) # The contact ID is essentially the pagerduty credentials ID; 1-1 # Pull the ID from the config. Contacts is an array but in practice it only appears to ever be single-element. conf_id = current_config.nil? ? nil : current_config[:links][:contacts][0] super(conf_id, current_config, diner.method(:pagerduty_credentials), diner.method(:create_contact_pagerduty_credentials), diner.method(:update_pagerduty_credentials), diner.method(:delete_pagerduty_credentials), logger, 'pagerduty') @allowed_config_keys = [:subdomain, :token, :service_key] end |
Instance Method Details
#create(contact_id, config) ⇒ Object
19 20 21 |
# File 'lib/flapjack_configurator/flapjack_pagerduty.rb', line 19 def create(contact_id, config) _create(contact_id, _filter_config(config)) end |
#type ⇒ Object
Type helper to match FlapjackMedia
24 25 26 |
# File 'lib/flapjack_configurator/flapjack_pagerduty.rb', line 24 def type return 'pagerduty' end |