For the complete documentation index, see llms.txt. This page is also available as Markdown.

Rules Registry Keywords

Custom Rule Registry Keywords

  • Rule definitions for all built-in rules, including Mule, API, and API Instance, will be accessible on the support portal at Support Portal after the onboarding process is complete.

  • Mule components/configurations stored are GPathResult and NodeChilds from Groovy XML parser. Visit Groovy XMLSlurper for more information.

Registry Keywords - Mule, API

Keywords available for Groovy style rules execution.

Variable
Description
Structure .2+

DOCUMENTS .2+

Contains list of all parsed mule xml configuration files

Map<String, groovy.util.slurpersupport.GPathResult>

COMPONENTS .2+

Contains list of all components/elements across all mule configuration files

Map<String, List<groovy.xml.slurpersupport.NodeChild> >

MUNIT_DOCUMENTS .2+

Contains list of all parsed mule munit xml configuration files

Map<String, groovy.xml.slurpersupport.GPathResult>

MUNIT_COMPONENTS .2+

Contains list of all munit components accross all mule munit configuration files

Map<String, List<groovy.xml.slurpersupport.NodeChild> >

CONFIGURATIONS .6+

Contains list of all Property/YAML files with their object representation used in the application.

CONFIGURATIONS.get(propertyKey) - will return values defined for the property key in all property files

List<java.lang.Object>

Eg: List<Property Values> .2+

PROJECT_HANDLE .2+

Contains the default project level file which can be used to mark project/directory level errors. Eg: Project is not mavenized

File Root Object

API_CONFIGURATIONS

Contains the web api instance of the parsed RAML/OAS

Map<MainAPIFilePath, WebAPI>

ANALYSIS

Can be used to get the project root directory. Eg: ANALYSIS.projectDir would return a java.io.File instance to project directory which is being scanned

Registry Keywords - API Instance

Variable
Description
Example

API.TIERS

Json structure representing the tiers information for a specific API Instance

[ { "masterOrganizationId": "xxx", "organizationId": "xxx", "id": 2075526, "name": "Tier 1", "description": null, "limits": [ { "maximumRequests": 1, "timePeriodInMilliseconds": 10000, "visible": true }, { "maximumRequests": 2, "timePeriodInMilliseconds": 45000, "visible": true } ], "status": "ACTIVE", "autoApprove": false, "applicationCount": 0, "apiId": 20070196 } ]

API.POLICIES

Json structure representing the policies information for a specific API Instance

[ { "policyTemplateId": "386072", "order": 1, "pointcutData": null, "type": "system", "policyId": 6198311, "configuration": { "scopeValidationCriteria": "AND", "tokenUrl": "sdasf", "secureTrustStore": false, "exposeHeaders": false, "skipClientIdValidation": false, "authenticationTimeout": 10000 }, "template": { "groupId": "68ef9520-24e9-4cf2-b2f5-620025690913", "assetId": "external-oauth2-access-token-enforcement", "assetVersion": "1.6.0" }, "version": 1733730272393 } ]

API.CONFIG

Json structure representing the API Instance information

{ "masterOrganizationId": "xxx", "organizationId": "xxx", "id": 20070196, "instanceLabel": null, "groupId": "xxx", "assetId": "shipment-eapi", "assetVersion": "2.0.0", "productVersion": "v1", "description": null, "tags": [], "order": 1, "providerId": null, "deprecated": false, "lastActiveDate": null, "endpointUri": null, "environmentId": "xxx", "isPublic": false, "stage": "release", "technology": "mule4", "status": "unregistered", "endpoint": { "audit": { "created": {}, "updated": {} }, "id": 4605251, "type": "rest", "uri": null, "apiGatewayVersion": null, "proxyUri": null, "proxyRegistrationUri": null, "lastActiveDate": null, "isCloudHub": null, "deploymentType": "CH", "policiesVersion": null, "referencesUserDomain": null, "responseTimeout": null, "wsdlConfig": null, "tlsContexts": null, "muleVersion4OrAbove": true, "apiVersionId": 20070196, "tlsContexts.outbound": null }, "deployment": null, "autodiscoveryInstanceName": "v1:20070196" }

API.CONTRACTS

Json structure representing the contracts information for a specific API Instance

[ { "masterOrganizationId": "xxx", "organizationId": "xxx", "id": 24, "status": "APPROVED", "approvedDate": "2017-07-19T20:46:22.520Z", "rejectedDate": null, "revokedDate": null, "applicationId": 1, "application": { "audit": { "created": { "date": "2017-07-19T20:46:19.307Z" }, "updated": {} }, "id": 1, "name": "dolor 1", "description": "", "coreServicesId": "xxx", "url": "http://sample-app.com/1" }, "tierId": 48, "tier": { "audit": { "created": { "date": "2017-07-19T20:46:22.197Z" }, "updated": {} }, "id": 48, "name": "magni 48", "description": "xxx", "limits": [ { "maximumRequests": 1000000, "timePeriodInMilliseconds": 1000, "visible": true } ], "status": "DEPRECATED", "autoApprove": true }, "requestedTierId": null, "requestedTier": null, "terms": null, "partyId": null, "partyName": null, "apiId": 25, "api": { "audit": { "created": {}, "updated": {} }, "id": 25 } } ]

API.ALERTS

Json structure representing the alerts information for a specific API Instance

[ { "apiAlertsVersion": "1.0.0", "api": { "id": 24, "name": "ad 24" }, "condition": { "aggregate": "COUNT", "operator": "GREATER_THAN", "value": 90, "resourceType": "api" }, "createdAt": 1501526157101, "enabled": true, "environmentId": "xxx", "id": "xxx", "lastModified": 1501526157101, "name": "REQUEST COUNT ALERT", "organizationId": "xxx", "period": { "repeat": 5, "duration": { "count": 5, "weight": "DAYS" } }, "recipients": [ { "type": "user", "value": "xxx", "lastName": "Owner", "firstName": "Organization" } ], "severity": "CRITICAL", "type": "api-request-count" } ]

API.UPSTREAMS

Json structure representing the upstream information for a specific API Instance

{ "total": 1, "upstreams": [ { "id": "xx", "label": null, "uri": "http://upstream-test.com" } ] }

API.GROUP-TIERS

Json structure representing the alerts information for a specific API Instance

[ { "masterOrganizationId": "xxx", "organizationId": "xxx", "id": 2075526, "name": "Tier 1", "description": null, "limits": [ { "maximumRequests": 1, "timePeriodInMilliseconds": 10000, "visible": true }, { "maximumRequests": 2, "timePeriodInMilliseconds": 45000, "visible": true } ], "status": "ACTIVE", "autoApprove": false, "applicationCount": 0, "apiId": 20070196 } ]

API.GROUP-CONTRACTS

Json structure representing the alerts information for a specific API Instance

{ "total": 2, "contracts": [ { "masterOrganizationId": "xxx", "organizationId": "xxx", "id": 24, "status": "APPROVED", "approvedDate": "2017-07-19T20:46:22.520Z", "rejectedDate": null, "revokedDate": null, "applicationId": 1, "application": { "audit": { "created": { "date": "2017-07-19T20:46:19.307Z" }, "updated": {} }, "id": 1, "name": "dolor 1", "description": "", "coreServicesId": "xxx", "url": "http://sample-app.com/1" }, "tierId": 48, "tier": { "audit": { "created": { "date": "2017-07-19T20:46:22.197Z" }, "updated": {} }, "id": 48, "name": "magni 48", "description": "xxx", "limits": [ { "maximumRequests": 1000000, "timePeriodInMilliseconds": 1000, "visible": true } ], "status": "DEPRECATED", "autoApprove": true }, "requestedTierId": null, "requestedTier": null, "terms": null, "partyId": null, "partyName": null, "apiId": 25, "api": { "audit": { "created": {}, "updated": {} }, "id": 25 } } ] }

API.AUTOMATED-POLICIES

Json structure representing the alerts information for a specific API Instance

{ "automatedPolicies": [ { "audit": { "created": { "date": "2018-11-23T14:37:08.953Z" }, "updated": {} }, "id": 11, "ruleOfApplication": { "organizationId": "xxx", "environmentId": "xxx", "range": { "from": "4.1.1", "to": "4.3.x" } }, "policyTemplateId": "2", "groupId": "xxx", "assetId": "rate-limiting", "assetVersion": "1.0.0", "configurationData": { "rateLimits": [ { "timePeriodInMilliseconds": 60000, "maximumRequests": 3 } ], "clusterizable": true, "exposeHeaders": true }, "pointcutData": null, "order": null, "disabled": false } ], "total": 1 }

Custom Mule Rule Example

  • Name: DATABASE - DB queries SHOULD be externalized

  • Custom Rule definition:

Custom property / YAML Rule Example

  • Name: PROPERTY/YAML FILE - Sensitive data NOT encrypted

  • Custom Rule definition:

Custom API Rule Example

  • Name: API RESOURCE - Health API NOT defined

  • Custom Rule definition:

Custom API Instance Rule Example

  • Name: API Instance should have atleast 1 SLA Tier defined

  • Custom Rule definition:

Debugging Custom Rules

When developing custom rules, there may be scenarios where debugging the values of certain components is required. The following section outlines how to add logs to custom rules to print the desired values.

This approach should only be used for debugging purposes. Debug logs must be removed before publishing the rule to the server.

Example: Debugging a Custom Rule to Print SQL Query Values

  • Assume we need to debug the following custom rule to print the value of an SQL query:

  • Create a Log File: Create a file anywhere on the file system for logging. In this example, a log file is created at /tmp/iz_custom_rule.log

  • Write Logs: Log the required details such as SQL query values.

  • Checking Logs: After adding the debug logs, click on Evaluate Rule. Review the generated logs in the configured file (e.g., /tmp/iz_custom_rule.log).

See Also

  • On The Fly Results

  • Rules Playground

Last updated

Was this helpful?