Waiting for engine...
Skip to main content

deployedApiPolicyRuleCreate

Creates new DeployedApiPolicyRule. Accepts the following input: name, description, methods, type, configuration.

The description and configuration are optional fields.

The type field is final and cannot be changed once the DeployedApiPolicyRule is created. The value of the field must be the policy id as specified in the policy plugin.properties file, for instance "policy-request-validation" for Request Validation policy.

Example request to create Request Validation policy:

    mutation{
deployedApiPolicyRuleCreate(deployedApiPolicyRule: {
name:"x-custom header validator",
description: "Validates that x-custom header is present",
methods: [GET, PUT, POST],
type: "policy-request-validation",
configuration: "{\"rules\": [{\"constraint\": {\"type\": \"NOT_NULL\"},\"input\": \"{#request.headers['x-custom']}\"}], \"status\": \"400\"}"
}){
id,
name,
description,
methods,
type,
configuration
}
}

Example request to create JSON Validation policy. Note that the escape character has to be escaped in the configuration's "schema" field:

    mutation{
deployedApiPolicyRuleCreate(deployedApiPolicyRule: {
name:"json validator for calculator",
description: "Validates calculator input",
methods: [POST],
type: "json-validation",
configuration: "{\"scope\":\"REQUEST_CONTENT\", \"errorMessage\": \"so very bad\", \"schema\":\"{\\\"title\\\": \\\"Adder\\\", \\\"type\\\": \\\"object\\\", \\\"properties\\\": {\\\"val1\\\": {\\\"type\\\": \\\"number\\\", \\\"maximum\\\": 10}, \\\"val2\\\": {\\\"type\\\": \\\"number\\\", \\\"maximum\\\": 10}}} \"}"
}){
id,
name,
description,
methods,
type,
configuration
}
}

deployedApiPolicyRuleCreate(
deployedApiPolicyRule: DeployedApiPolicyRuleCreateInput!
): DeployedApiPolicyRule!

Arguments

deployedApiPolicyRuleCreate.deployedApiPolicyRule ● DeployedApiPolicyRuleCreateInput! non-null input platform

Type

DeployedApiPolicyRule object platform

Defines a policy rule for API requests with method restrictions and configuration.

On this Page