public void GetEmailAliasFromOnCallUser() { var response = "{\"users\":[" + "{\"id\":\"ABCDEF1\",\"name\":\"On-call User\",\"email\":\"[email protected]\", \"on_call\":" + "[" + "{\"level\":1,\"start\":null,\"end\":null,\"escalation_policy\":{ \"id\":\"sampleId\",\"name\":\"Support Requests\"}}" + "]" + "}," + "{\"id\":\"ABCDEF2\",\"name\":\"NuGet Core Team\",\"email\":\"[email protected]\", \"on_call\":" + "[" + "{\"level\":1,\"start\":null,\"end\":null,\"escalation_policy\":{ \"id\":\"sampleId\",\"name\":\"Support Requests\"}}" + "]" + "}," + "{\"id\":\"ABCDEF3\",\"name\":\"Off-call User\",\"email\":\"[email protected]\",\"on_call\":" + "[" + "{\"level\":1,\"start\":null,\"end\":null,\"escalation_policy\":{ \"id\":\"sampleId2\",\"name\":\"Sev1 - Service Interruption\"}}," + "{\"level\":3,\"start\":null,\"end\":null,\"escalation_policy\":{ \"id\":\"sampleId\",\"name\":\"Support Requests\"}}" + "]" + "}," + "{\"id\":\"ABCDEF4\",\"name\":\"Off-call User 2\",\"email\":\"[email protected]\",\"on_call\":" + "[" + "{\"level\":3,\"start\":null,\"end\":null,\"escalation_policy\":{ \"id\":\"sampleId2\",\"name\":\"Sev1 - Service Interruption\"}}" + "]" + "}], " + "\"active_account_users\":11,\"limit\":25,\"offset\":0,\"total\":4}"; var username = PagerDutyClient.GetEmailAliasFromOnCallUser(response, "sampleId"); Assert.Equal("on-call", username); }
public OnCallDailyNotificationTask( IDictionary <string, string> jobArgsDictionary, ILoggerFactory loggerFactory) : base(jobArgsDictionary, loggerFactory) { var pagerDutyConfiguration = new PagerDutyConfiguration( jobArgsDictionary[_argumentNamePagerDutyAccountName], jobArgsDictionary[_argumentNamePagerDutyApiKey] ); _pagerDutyClient = new PagerDutyClient(pagerDutyConfiguration); }
public OnCallDailyNotificationTask( InitializationConfiguration configuration, Func <Task <SqlConnection> > openSupportRequestSqlConnectionAsync, ILoggerFactory loggerFactory) : base(configuration, openSupportRequestSqlConnectionAsync, loggerFactory) { var pagerDutyConfiguration = new PagerDutyConfiguration( configuration.PagerDutyAccountName, configuration.PagerDutyApiKey ); _pagerDutyClient = new PagerDutyClient(pagerDutyConfiguration); }