Creates the given Synthetics 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
13809
public Optional<SyntheticsAlertCondition> create(long policyId, SyntheticsAlertCondition condition)
    {
        return HTTP.POST(String.format("/v2/alerts_synthetics_conditions/policies/%d.json", policyId), condition, SYNTHETICS_ALERT_CONDITION);
    }
647200
public Optional<AlertCondition> update(AlertCondition condition)
    {
        return HTTP.PUT(String.format("/v2/alerts_conditions/%d.json", condition.getId()), condition, ALERT_CONDITION);
    }
858277
function createPolicy (params, cb) {
      let promise = null
      if (typeof cb !== 'function') [promise, cb] = asyncify()

      const { id, version, name, organizationId, statements } = params

      Joi.validate({ id, version, name, organizationId, statements }, validationRules.createPolicy, function (err) {
        if (err) return cb(Boom.badRequest(err))
        insertPolicies(db, [{
          id: id,
          version: version,
          name: name,
          org_id: organizationId,
          statements: statements
        }], (err, result) => {
          if (utils.isUniqueViolationError(err)) return cb(Boom.conflict('policy already exists'))
          if (err) return cb(Boom.badImplementation(err))

          policyOps.readPolicy({ id: result.rows[0].id, organizationId }, cb)
        })
      })

      return promise
    }
553848
public AlertConditionCache alertConditions(long policyId)
    {
        AlertConditionCache cache = conditions.get(policyId);
        if(cache == null)
            conditions.put(policyId, cache = new AlertConditionCache(policyId));
        return cache;
    }
975073
public LogOutputSpec createSpec(String containerId, ImageConfiguration imageConfiguration) {
        LogOutputSpec.Builder builder = new LogOutputSpec.Builder();
        LogConfiguration logConfig = extractLogConfiguration(imageConfiguration);

        addLogFormat(builder, logConfig);
        addPrefix(builder, logConfig.getPrefix(), imageConfiguration, containerId);
        builder.file(logConfig.getFileLocation())
               .useColor(useColor)
               .logStdout(logStdout)
               .color(logConfig.getColor());

        return builder.build();
    }
849712
def set_policy_alert_threshold(self, policy_ids, alert_threshold):
        """"""
        for policy_id in policy_ids:
            self.logger.debug('Setting alert threshold for policy {0} to {1}'.format(policy_id, alert_threshold))
            result = self.zap.ascan.set_policy_alert_threshold(policy_id, alert_threshold)
            if result != 'OK':
                raise ZAPError('Error setting alert threshold for policy with ID {0}: {1}'.format(policy_id, result))
458409
public OperationFuture<AlertPolicy> delete(AlertPolicy policyRef) {
        client.deleteAlertPolicy(findByRef(policyRef).getId());

        return new OperationFuture<>(
            policyRef,
            new NoWaitingJobFuture()
        );
    }
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);
    }
1300119
public AnnotationTypeCondition addCondition(String element, AnnotationCondition condition)
    {
        this.conditions.put(element, condition);
        return this;
    }
596996
@XmlElementDecl(namespace = "urn:oasis:names:tc:xacml:2.0:policy:schema:os", name = "Policy")
    public JAXBElement<PolicyType> createPolicy(PolicyType value) {
        return new JAXBElement<PolicyType>(_Policy_QNAME, PolicyType.class, null, value);
    }
384293
public CreateConditionResponse createCondition(CreateConditionRequest request) {
    return call(
      new PostRequest(path("create_condition"))
        .setParam("error", request.getError())
        .setParam("gateId", request.getGateId())
        .setParam("metric", request.getMetric())
        .setParam("op", request.getOp())
        .setParam("organization", request.getOrganization()),
      CreateConditionResponse.parser());
  }
646983
public static <T> T assertExpectedCondition(ExpectedCondition<T> condition, WebDriver driver) {
		try {
			return waitUntil(condition, driver);
		} catch(TimeoutException e) {
			throw new AssertionError("Explicit wait timed out. The condition '" + condition + "' was not met" , e);
		}
	}
693124
public static <S, D> Condition<S, D> not(Condition<S, D> condition) {
    Assert.notNull(condition, "condition");
    return new Not<S, D>(condition);
  }
618773
public Collection<AlertChannel> list(long policyId)
    {
        Map<Long,AlertChannel> map = new HashMap<Long,AlertChannel>();
        Collection<AlertChannel> channels = list();
        for(AlertChannel channel : channels)
        {
            List<Long> channelPolicyIds = channel.getLinks().getPolicyIds();
            for(long channelPolicyId : channelPolicyIds)
            {
                if(channelPolicyId == policyId)
                    map.put(channel.getId(), channel);
            }
        }
        return map.values();
    }
1141082
@Override
	public CPDAvailabilityEstimate create(long CPDAvailabilityEstimateId) {
		CPDAvailabilityEstimate cpdAvailabilityEstimate = new CPDAvailabilityEstimateImpl();

		cpdAvailabilityEstimate.setNew(true);
		cpdAvailabilityEstimate.setPrimaryKey(CPDAvailabilityEstimateId);

		String uuid = PortalUUIDUtil.generate();

		cpdAvailabilityEstimate.setUuid(uuid);

		cpdAvailabilityEstimate.setCompanyId(companyProvider.getCompanyId());

		return cpdAvailabilityEstimate;
	}
1060120
private Condition buildIdCondition(Object argument) {
         if (argument instanceof String && ObjectId.isValid((String) argument)) {
             return new Condition(ID_FIELD, new ObjectId((String) argument));
         } else if (Iterable.class.isAssignableFrom(argument.getClass())) {
             List<Object> objectIds = new ArrayList<Object>();

             //noinspection ConstantConditions
             for (Object argumentItem : (Iterable) argument) {
                 if (argumentItem instanceof String && ObjectId.isValid((String) argumentItem)) {
                     objectIds.add(new ObjectId((String) argumentItem));
                 } else if (argumentItem instanceof ObjectId) {
                     objectIds.add( argumentItem);
                 }
             }

             return new Condition(ID_FIELD, new BasicDBObject("$in", objectIds));
         } else {
             return new Condition(ID_FIELD, argument);
         }
     }
1248808
public static RuleProviderBuilder begin(String id)
    {
        MetadataBuilder builder = MetadataBuilder.forProvider(RuleProviderBuilder.class, id);
        return new RuleProviderBuilder(builder).setMetadataBuilder(builder);
    }