Struct pagerduty::integration::TriggerEvent [] [src]

pub struct TriggerEvent<'a> {
    // some fields omitted
}

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.

Methods

impl<'a> TriggerEvent<'a>

fn new<S>(service_key: S, description: S) -> Self where S: Into<Cow<'a, str>>

Create a new trigger event payload

service_key: The GUID of one of your "Generic API" services. This is the "service key" listed on a Generic API's service detail page.

description: A short description of the problem that led to this trigger. This field (or a truncated version) will be used when generating phone calls, SMS messages and alert emails. It will also appear on the incidents tables in the PagerDuty UI. The maximum length is 1024 characters.

fn set_incident_key<S>(self, incident_key: S) -> Self where S: Into<Cow<'a, str>>

Set incident_key

Identifies the incident to which this trigger event should be applied. If there's no open (i.e. unresolved) incident with this key, a new one will be created. If there's already an open incident with a matching key, this event will be appended to that incident's log. The event key provides an easy way to "de-dup" problem reports.

fn set_client<S>(self, client: S) -> Self where S: Into<Cow<'a, str>>

Set event's client

The name of the monitoring client that is triggering this event.

fn set_client_url<S>(self, client_url: S) -> Self where S: Into<Cow<'a, str>>

Set event's client_url

The URL of the monitoring client that is triggering this event.

fn set_details<T: ?Sized>(self, details: &T) -> Self where T: Serialize

Set event details

An arbitrary JSON object containing any data you'd like included in the incident log.

Examples

// Extra data to be included with the event. Anything that implements
// Serialize can be passed to `set_details`.
#[derive(Serialize)]
struct Details {
    what: &'static str,
    count: i32,
}

// Create a trigger event and include custom data
TriggerEvent::new("service_key", "event description")
    .set_details(&Details {
         what: "Server fire",
         count: 1,
    });

fn add_context(self, context: Context<'a>) -> Self

Add a Context to this event

Contexts to be included with the incident trigger such as links to graphs or images. A "type" is required for each context submitted. For type "link", an "href" is required. You may optionally specify "text" with more information about the link. For type "image", "src" must be specified with the image src. You may optionally specify an "href" or an "alt" with this image.

Trait Implementations

impl<'a> Serialize for TriggerEvent<'a>

fn serialize<__S>(&self, serializer: &mut __S) -> Result<(), __S::Error> where __S: Serializer

Derived Implementations

impl<'a> Debug for TriggerEvent<'a>

fn fmt(&self, arg_0: &mut Formatter) -> Result