Creates the given external service alert condition.
@param policyId The id of the policy to add the alert condition to
@param condition The alert condition to create
@return The alert condition that was created
177040
public Optional<ExternalServiceAlertCondition> create(long policyId, ExternalServiceAlertCondition condition)
    {
        return HTTP.POST(String.format("/v2/alerts_external_service_conditions/policies/%d.json", policyId), condition, EXTERNAL_SERVICE_ALERT_CONDITION);
    }
529361
static void waitForCondition(final StartConditionCheck condition, int timeoutSeconds, final String containerDescription) throws TimeoutException {
        try {
            log.info("wait for {} started", condition.describe());
            new WaitForUnit(TimeUnit.SECONDS, timeoutSeconds, TimeUnit.SECONDS, 1, new WaitForUnit.WaitForCondition() {
                @Override
                public boolean isConditionMet() {
                    return condition.check();
                }
                @Override
                public String timeoutMessage() {
                    return String.format("timeout waiting for %s in container %s", condition.describe(), containerDescription);
                }
            }).startWaiting();
            log.info("wait for {} - condition met", condition.describe());
        } catch (InterruptedException e) {
            throw new IllegalStateException(String.format("Interrupted while waiting for %s", condition.describe()), e);
        }
    }
659932
public Collection<ExternalServiceAlertCondition> list(List<String> queryParams)
    {
        return HTTP.GET("/v2/alerts_external_service_conditions.json", null, queryParams, EXTERNAL_SERVICE_ALERT_CONDITIONS).get();
    }
366389
public OvhStreamAlertCondition serviceName_output_graylog_stream_streamId_alert_alertId_GET(String serviceName, String streamId, String alertId) throws IOException {
		String qPath = "/dbaas/logs/{serviceName}/output/graylog/stream/{streamId}/alert/{alertId}";
		StringBuilder sb = path(qPath, serviceName, streamId, alertId);
		String resp = exec(qPath, "GET", sb.toString(), null);
		return convertTo(resp, OvhStreamAlertCondition.class);
	}
1092745
public Collection<AlertCondition> list(long policyId, String name)
    {
        List<AlertCondition> ret = new ArrayList<AlertCondition>();
        Collection<AlertCondition> conditions = list(policyId);
        for(AlertCondition condition : conditions)
        {
            if(condition.getName().equals(name))
                ret.add(condition);
        }
        return ret;
    }
15065
public AlertPolicyFilter id(List<String> ids) {
        checkNotNull(ids, "List of ids must be not a null");

        this.ids.addAll(ids);

        return this;
    }
691434
@SuppressWarnings("unused")
    public static Query createWithTimeout(Service service, Domain domain, int timeout) {
        return new Query(service, domain, timeout);
    }
601746
public Collection<AlertCondition> list(long entityId, String entityType)
    {
        QueryParameterList queryParams = new QueryParameterList();
        queryParams.add("entity_type", entityType);
        return HTTP.GET(String.format("/v2/alerts_entity_conditions/%d.json", entityId), null, queryParams, ALERT_CONDITIONS).get();
    }
863160
public OperationFuture<List<AlertPolicy>> modify(AlertPolicyFilter filter,
        AlertPolicyConfig modifyConfig) {

        return modify(getRefsFromFilter(filter), modifyConfig);
    }
388843
public OperationFuture<List<AlertPolicy>> delete(AlertPolicyFilter filter) {
        List<AlertPolicy> policyRefs = getRefsFromFilter(filter);
        return delete(policyRefs.toArray(new AlertPolicy[policyRefs.size()]));
    }
181101
public Optional<InfraAlertCondition> update(InfraAlertCondition condition)
    {
        return HTTP.PUT(String.format("/v2/alerts/conditions/%d", condition.getId()), condition, INFRA_ALERT_CONDITION);
    }
803962
def create_alert_policy(self, policy_name):
    """"""
    policy_data = { 'policy': { 'incident_preference': 'PER_POLICY', 'name': policy_name } }
    create_policy = requests.post(
      'https://api.newrelic.com/v2/alerts_policies.json',
      headers=self.auth_header,
      data=json.dumps(policy_data))
    create_policy.raise_for_status()
    policy_id = create_policy.json()['policy']['id']
    self.refresh_all_alerts()
    return policy_id
724267
public OvhAlerting project_serviceName_alerting_id_GET(String serviceName, String id) throws IOException {
		String qPath = "/cloud/project/{serviceName}/alerting/{id}";
		StringBuilder sb = path(qPath, serviceName, id);
		String resp = exec(qPath, "GET", sb.toString(), null);
		return convertTo(resp, OvhAlerting.class);
	}
1075480
public static HealthStatus create(int status, String message, Throwable exception) {
    return new AutoValue_HealthStatus(message, status, Optional.ofNullable(exception));
  }
1341622
protected static String createIamRole(String s3Prefix) throws InterruptedException {
        try {
            //set trust policy for the role
            iamClient.createRole(new CreateRoleRequest()
                    .withRoleName(iamRoleName)
                    .withAssumeRolePolicyDocument(getTrustPolicy()));
        } catch (EntityAlreadyExistsException e) {
            LOG.info("IAM role with name " + iamRoleName + " already exists");
        } catch (MalformedPolicyDocumentException policyDocumentException){
			LOG.error(String.format("Please check the trust policy document for malformation: %s",
					IAM_ROLE_TRUST_POLICY_DOCUMENT));
            throw policyDocumentException;
        }

        // Update the role policy with permissions so that principal can access the resources
        // with necessary conditions
        putRolePolicy(s3Prefix);

        String roleARN = iamClient.getRole(new GetRoleRequest().withRoleName(iamRoleName)).getRole().getArn();
        // Sleep for 5 seconds because IAM role creation takes some time to propagate
        Thread.sleep(5000);
        return roleARN;
    }
75665
public Optional<NrqlAlertCondition> update(NrqlAlertCondition condition)
    {
        return HTTP.PUT(String.format("/v2/alerts_nrql_conditions/%d.json", condition.getId()), condition, NRQL_ALERT_CONDITION);
    }
881561
public RuleEnvelope getRule(String ruleId) throws ApiException {
        ApiResponse<RuleEnvelope> resp = getRuleWithHttpInfo(ruleId);
        return resp.getData();
    }