class FlapjackConfigurator::FlapjackPagerduty

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

Public Class Methods

new(current_config, diner, logger) click to toggle source
Calls superclass method
# 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

Public Instance Methods

create(contact_id, config) click to toggle source
# File lib/flapjack_configurator/flapjack_pagerduty.rb, line 19
def create(contact_id, config)
  _create(contact_id, _filter_config(config))
end
type() click to toggle source

Type helper to match FlapjackMedia

# File lib/flapjack_configurator/flapjack_pagerduty.rb, line 24
def type
  return 'pagerduty'
end