adilbaig/pagerduty

Support for EU Endpoint

Closed this issue · 1 comments

paavo commented

Looks like the API Endpoint is hardcoded.
Like this I can't use this to contact the EU Endpoint available at https://events.eu.pagerduty.com/v2/enqueue

Thanks for asking. Yes, the fact that *Event()->send() is hardcoded is not ideal to me. A proper solution would combine the *Event classes and PagerDutyHttpConnection into one. That refactor is not on my timeline atm, even though I think it's fully justified.

Atm, it's possible is to use the PagerDutyHttpConnection()->send() method. See method here. Here's a sample for your use-case:

use \PagerDuty\TriggerEvent;
use \PagerDuty\Http\PagerDutyHttpConnection;

    $event = new TriggerEvent(...);

    // create a custom proxy connection
    $url = 'https://events.eu.pagerduty.com/v2/enqueue';
    $connection = new PagerDutyHttpConnection($url);
    
    // send event through proxy
    $connection->send($event);