Class: Pagerduty::EventsApiV1::Incident
- Inherits:
-
Object
- Object
- Pagerduty::EventsApiV1::Incident
- Defined in:
- lib/pagerduty/events_api_v1.rb
Instance Attribute Summary collapse
-
#incident_key ⇒ Object
readonly
Returns the value of attribute incident_key.
Instance Method Summary collapse
-
#acknowledge(description = nil, details = nil) ⇒ Pagerduty::EventsApiV1::Incident
Acknowledge the referenced incident.
-
#initialize(config) ⇒ Incident
constructor
A new instance of Incident.
-
#resolve(description = nil, details = nil) ⇒ Pagerduty::EventsApiV1::Incident
Resolve the referenced incident.
-
#trigger(description, options = {}) ⇒ Object
Send PagerDuty a trigger event to report a new or ongoing problem.
Constructor Details
#initialize(config) ⇒ Incident
Returns a new instance of Incident.
133 134 135 136 137 138 139 140 141 142 |
# File 'lib/pagerduty/events_api_v1.rb', line 133 def initialize(config) @integration_key = config.fetch(:integration_key) do raise ArgumentError "integration_key not provided" end @incident_key = config[:incident_key] @transport = Pagerduty::HttpTransport.new( path: "/generic/2010-04-15/create_event.json", proxy: config[:http_proxy], ) end |
Instance Attribute Details
#incident_key ⇒ Object (readonly)
Returns the value of attribute incident_key.
120 121 122 |
# File 'lib/pagerduty/events_api_v1.rb', line 120 def incident_key @incident_key end |
Instance Method Details
#acknowledge(description = nil, details = nil) ⇒ Pagerduty::EventsApiV1::Incident
Acknowledge the referenced incident. While an incident is acknowledged, it won’t generate any additional notifications, even if it receives new trigger events. Send PagerDuty an acknowledge event when you know someone is presently working on the problem.
218 219 220 |
# File 'lib/pagerduty/events_api_v1.rb', line 218 def acknowledge(description = nil, details = nil) modify_incident("acknowledge", description, details) end |
#resolve(description = nil, details = nil) ⇒ Pagerduty::EventsApiV1::Incident
Resolve the referenced incident. Once an incident is resolved, it won’t generate any additional notifications. New trigger events with the same incident_key as a resolved incident won’t re-open the incident. Instead, a new incident will be created. Send PagerDuty a resolve event when the problem that caused the initial trigger event has been fixed.
251 252 253 |
# File 'lib/pagerduty/events_api_v1.rb', line 251 def resolve(description = nil, details = nil) modify_incident("resolve", description, details) end |
#trigger(description, options = {}) ⇒ Object
Send PagerDuty a trigger event to report a new or ongoing problem. When PagerDuty receives a trigger event, it will either open a new incident, or add a new trigger log entry to an existing incident, depending on the provided incident_key.
178 179 180 181 182 183 184 185 186 187 188 |
# File 'lib/pagerduty/events_api_v1.rb', line 178 def trigger(description, = {}) if .key?(:incident_key) raise ArgumentError, "incident_key provided" end = .merge(description: description) [:incident_key] = @incident_key unless @incident_key.nil? response = api_call("trigger", ) @incident_key = response["incident_key"] self end |