@Override public Optional<Monitor> getByName(String monitorName) { Invocation.Builder builder = client .target(MONITORS_URL) .request(); return getPageable(builder, MonitorList.class) .filter(monitor -> monitor.getName().equals(monitorName)) .getSingle(); }
/** * NewRelic API constructor. * * @param restApiUrl NewRelic REST API URL, for example https://api.newrelic.com * @param syntheticsApiUrl NewRelic Synthetics API URL * @param apiKey API Key for given NewRelic account */ public NewRelicInternalApi(String restApiUrl, String syntheticsApiUrl, String apiKey) { NewRelicClient client = new NewRelicClient(restApiUrl, apiKey); applicationsApi = new DefaultApplicationsApi(client); alertsChannelsApi = new DefaultAlertsChannelsApi(client); alertsPoliciesApi = new DefaultAlertsPoliciesApi(client); alertsConditionsApi = new DefaultAlertsConditionsApi(client); alertsExternalServiceConditionsApi = new DefaultAlertsExternalServiceConditionsApi(client); alertsNrqlConditionsApi = new DefaultAlertsNrqlConditionsApi(client); alertsSyntheticsConditionApi = new DefaultAlertsSyntheticsConditionsApi(client); keyTransactionsApi = new DefaultKeyTransactionsApi(client); deploymentsApi = new DefaultDeploymentsApi(client); serversApi = new DefaultServersApi(client); usersApi = new DefaultUsersApi(client); NewRelicClient syntheticsClient = new NewRelicClient(syntheticsApiUrl, apiKey); syntheticsMonitorsApi = new DefaultSyntheticsMonitorsApi(syntheticsClient); } }