├── .gitignore ├── mediation-oauth ├── .gitignore ├── .devcontainer.json ├── Ballerina.toml ├── Package.md ├── types.bal ├── policy.bal └── tests │ └── utest_policy.bal ├── guardrail-regex-guardrail ├── .gitignore ├── .devcontainer.json ├── Ballerina.toml ├── Package.md ├── policy.bal └── Dependencies.toml ├── guardrail-semantic-cache ├── .gitignore ├── .devcontainer.json ├── Ballerina.toml ├── Package.md ├── policy.bal └── Dependencies.toml ├── guardrail-url-guardrail ├── .gitignore ├── .devcontainer.json ├── Ballerina.toml ├── Package.md ├── policy.bal └── Dependencies.toml ├── guardrail-aws-bedrock-guardrail ├── .gitignore ├── .devcontainer.json ├── Ballerina.toml ├── policy.bal ├── Package.md └── Dependencies.toml ├── guardrail-pii-masking-regex ├── .gitignore ├── .devcontainer.json ├── Ballerina.toml ├── policy.bal ├── Package.md └── Dependencies.toml ├── guardrail-word-count-guardrail ├── .gitignore ├── .devcontainer.json ├── Ballerina.toml ├── Package.md ├── policy.bal └── Dependencies.toml ├── guardrail-content-length-guardrail ├── .gitignore ├── .devcontainer.json ├── Ballerina.toml ├── Package.md ├── policy.bal └── Dependencies.toml ├── guardrail-pii-masking-guardrails-ai ├── .gitignore ├── .devcontainer.json ├── Ballerina.toml ├── policy.bal ├── Package.md └── Dependencies.toml ├── guardrail-sentence-count-guardrail ├── .gitignore ├── .devcontainer.json ├── Ballerina.toml ├── Package.md ├── policy.bal └── Dependencies.toml ├── ratelimit-ai-token-based-ratelimit ├── .gitignore ├── .devcontainer.json ├── Ballerina.toml ├── Package.md ├── policy.bal └── Dependencies.toml ├── guardrail-azure-content-safety-content-moderation ├── .gitignore ├── .devcontainer.json ├── Ballerina.toml ├── Package.md └── policy.bal ├── README.md ├── mediation-add-query-param ├── Ballerina.toml ├── Package.md ├── policy.bal └── tests │ └── utest_policy.bal ├── mediation-remove-query-param ├── Ballerina.toml ├── Package.md ├── policy.bal └── tests │ └── utest_policy.bal ├── mediation-rewrite-resource-path ├── Ballerina.toml ├── policy.bal ├── Package.md └── tests │ └── utest_policy.bal ├── mediation-json-to-xml ├── Ballerina.toml ├── Package.md ├── policy.bal └── tests │ └── utest_policy.bal ├── mediation-xml-to-json ├── Ballerina.toml ├── Package.md ├── policy.bal └── tests │ └── utest_policy.bal ├── mediation-add-header ├── Ballerina.toml ├── Package.md ├── policy.bal └── tests │ └── utest_policy.bal ├── mediation-log-message ├── Ballerina.toml ├── Package.md ├── definitions.bal ├── utils.bal └── policy.bal ├── mediation-set-header ├── Ballerina.toml ├── Package.md ├── policy.bal └── tests │ └── utest_policy.bal ├── mediation-remove-header ├── Ballerina.toml ├── Package.md ├── policy.bal └── tests │ └── utest_policy.bal ├── issue_template.md ├── .github └── workflows │ ├── publish-to-prod-central.yml │ ├── publish-to-dev-central.yml │ ├── release-build.yml │ └── pr-build.yml ├── packages.json └── pull_request_template.md /.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | .DS_Store 3 | .idea/ -------------------------------------------------------------------------------- /mediation-oauth/.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | generated 3 | Config.toml 4 | -------------------------------------------------------------------------------- /guardrail-regex-guardrail/.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | generated 3 | Config.toml 4 | -------------------------------------------------------------------------------- /guardrail-semantic-cache/.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | generated 3 | Config.toml 4 | -------------------------------------------------------------------------------- /guardrail-url-guardrail/.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | generated 3 | Config.toml 4 | -------------------------------------------------------------------------------- /guardrail-aws-bedrock-guardrail/.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | generated 3 | Config.toml 4 | -------------------------------------------------------------------------------- /guardrail-pii-masking-regex/.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | generated 3 | Config.toml 4 | -------------------------------------------------------------------------------- /guardrail-word-count-guardrail/.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | generated 3 | Config.toml 4 | -------------------------------------------------------------------------------- /guardrail-content-length-guardrail/.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | generated 3 | Config.toml 4 | -------------------------------------------------------------------------------- /guardrail-pii-masking-guardrails-ai/.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | generated 3 | Config.toml 4 | -------------------------------------------------------------------------------- /guardrail-sentence-count-guardrail/.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | generated 3 | Config.toml 4 | -------------------------------------------------------------------------------- /ratelimit-ai-token-based-ratelimit/.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | generated 3 | Config.toml 4 | -------------------------------------------------------------------------------- /guardrail-azure-content-safety-content-moderation/.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | generated 3 | Config.toml 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # choreo-apim-mediation-policies 2 | A set of mediation policies provided out of the box in Choreo 3 | -------------------------------------------------------------------------------- /mediation-oauth/.devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "image": "ballerina/ballerina-devcontainer:2201.5.5", 3 | "extensions": ["WSO2.ballerina"], 4 | } 5 | -------------------------------------------------------------------------------- /guardrail-semantic-cache/.devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "image": "ballerina/ballerina-devcontainer:2201.5.5", 3 | "extensions": ["WSO2.ballerina"] 4 | } 5 | -------------------------------------------------------------------------------- /guardrail-url-guardrail/.devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "image": "ballerina/ballerina-devcontainer:2201.5.5", 3 | "extensions": ["WSO2.ballerina"], 4 | } 5 | -------------------------------------------------------------------------------- /guardrail-pii-masking-regex/.devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "image": "ballerina/ballerina-devcontainer:2201.5.5", 3 | "extensions": ["WSO2.ballerina"], 4 | } 5 | -------------------------------------------------------------------------------- /guardrail-regex-guardrail/.devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "image": "ballerina/ballerina-devcontainer:2201.5.5", 3 | "extensions": ["WSO2.ballerina"], 4 | } 5 | -------------------------------------------------------------------------------- /guardrail-aws-bedrock-guardrail/.devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "image": "ballerina/ballerina-devcontainer:2201.5.5", 3 | "extensions": ["WSO2.ballerina"], 4 | } 5 | -------------------------------------------------------------------------------- /guardrail-word-count-guardrail/.devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "image": "ballerina/ballerina-devcontainer:2201.5.5", 3 | "extensions": ["WSO2.ballerina"], 4 | } 5 | -------------------------------------------------------------------------------- /ratelimit-ai-token-based-ratelimit/.devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "image": "ballerina/ballerina-devcontainer:2201.5.5", 3 | "extensions": ["WSO2.ballerina"] 4 | } 5 | -------------------------------------------------------------------------------- /guardrail-content-length-guardrail/.devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "image": "ballerina/ballerina-devcontainer:2201.5.5", 3 | "extensions": ["WSO2.ballerina"], 4 | } 5 | -------------------------------------------------------------------------------- /guardrail-pii-masking-guardrails-ai/.devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "image": "ballerina/ballerina-devcontainer:2201.5.5", 3 | "extensions": ["WSO2.ballerina"], 4 | } 5 | -------------------------------------------------------------------------------- /guardrail-sentence-count-guardrail/.devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "image": "ballerina/ballerina-devcontainer:2201.5.5", 3 | "extensions": ["WSO2.ballerina"], 4 | } 5 | -------------------------------------------------------------------------------- /guardrail-azure-content-safety-content-moderation/.devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "image": "ballerina/ballerina-devcontainer:2201.5.5", 3 | "extensions": ["WSO2.ballerina"], 4 | } 5 | -------------------------------------------------------------------------------- /mediation-add-query-param/Ballerina.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | org = "choreo" 3 | name = "mediation.add_query_param" 4 | version = "2.0.0" 5 | distribution = "2201.3.1" 6 | keywords=["choreo-apim-mediation-policy", "choreo-apim-mediation-request-flow"] 7 | 8 | [build-options] 9 | observabilityIncluded = true 10 | -------------------------------------------------------------------------------- /mediation-remove-query-param/Ballerina.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | org = "choreo" 3 | name = "mediation.remove_query_param" 4 | version = "2.0.0" 5 | distribution = "2201.3.1" 6 | keywords=["choreo-apim-mediation-policy", "choreo-apim-mediation-request-flow"] 7 | 8 | [build-options] 9 | observabilityIncluded = true 10 | -------------------------------------------------------------------------------- /mediation-rewrite-resource-path/Ballerina.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | org = "choreo" 3 | name = "mediation.rewrite_resource_path" 4 | version = "2.0.0" 5 | distribution = "2201.3.1" 6 | keywords=["choreo-apim-mediation-policy", "choreo-apim-mediation-request-flow"] 7 | 8 | [build-options] 9 | observabilityIncluded = true 10 | -------------------------------------------------------------------------------- /mediation-oauth/Ballerina.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | org = "choreo" 3 | name = "oauth_mediator" 4 | version = "1.0.1" 5 | export = ["oauth_mediator"] 6 | distribution = "2201.5.5" 7 | keywords = ["choreo-apim-mediation-policy","choreo-apim-mediation-request-flow"] 8 | 9 | [build-options] 10 | observabilityIncluded = true 11 | -------------------------------------------------------------------------------- /mediation-json-to-xml/Ballerina.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | org = "choreo" 3 | name = "mediation.json_to_xml" 4 | version = "2.0.0" 5 | distribution = "2201.3.1" 6 | keywords=["choreo-apim-mediation-policy", "choreo-apim-mediation-request-flow", "choreo-apim-mediation-response-flow"] 7 | 8 | [build-options] 9 | observabilityIncluded = true 10 | -------------------------------------------------------------------------------- /mediation-xml-to-json/Ballerina.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | org = "choreo" 3 | name = "mediation.xml_to_json" 4 | version = "2.0.0" 5 | distribution = "2201.3.1" 6 | keywords=["choreo-apim-mediation-policy", "choreo-apim-mediation-request-flow", "choreo-apim-mediation-response-flow"] 7 | 8 | [build-options] 9 | observabilityIncluded = true 10 | -------------------------------------------------------------------------------- /mediation-add-header/Ballerina.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | org = "choreo" 3 | name = "mediation.add_header" 4 | version = "2.0.0" 5 | distribution = "2201.3.1" 6 | keywords=["choreo-apim-mediation-policy", "choreo-apim-mediation-request-flow", "choreo-apim-mediation-response-flow", "choreo-apim-mediation-fault-flow"] 7 | 8 | [build-options] 9 | observabilityIncluded = true 10 | -------------------------------------------------------------------------------- /mediation-log-message/Ballerina.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | org = "choreo" 3 | name = "mediation.log_message" 4 | version = "2.0.1" 5 | distribution = "2201.3.1" 6 | keywords=["choreo-apim-mediation-policy", "choreo-apim-mediation-request-flow", "choreo-apim-mediation-response-flow", "choreo-apim-mediation-fault-flow"] 7 | 8 | [build-options] 9 | observabilityIncluded = true 10 | -------------------------------------------------------------------------------- /mediation-set-header/Ballerina.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | org = "choreo" 3 | name = "mediation.set_header" 4 | version = "2.0.0" 5 | distribution = "2201.3.1" 6 | keywords=["choreo-apim-mediation-policy", "choreo-apim-mediation-request-flow", "choreo-apim-mediation-response-flow", "choreo-apim-mediation-fault-flow"] 7 | 8 | [build-options] 9 | observabilityIncluded = true 10 | -------------------------------------------------------------------------------- /mediation-remove-header/Ballerina.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | org = "choreo" 3 | name = "mediation.remove_header" 4 | version = "2.0.0" 5 | distribution = "2201.3.1" 6 | keywords=["choreo-apim-mediation-policy", "choreo-apim-mediation-request-flow", "choreo-apim-mediation-response-flow", "choreo-apim-mediation-fault-flow"] 7 | 8 | [build-options] 9 | observabilityIncluded = true 10 | -------------------------------------------------------------------------------- /ratelimit-ai-token-based-ratelimit/Ballerina.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | org = "choreo" 3 | name = "ratelimit.token_based_ratelimit" 4 | version = "1.0.0" 5 | export = ["ratelimit.token_based_ratelimit"] 6 | distribution = "2201.5.5" 7 | keywords=["choreo-apim-mediation-policy", "choreo-apim-egress-ai", "choreo-apim-mediation-request-flow"] 8 | 9 | [build-options] 10 | observabilityIncluded = true 11 | -------------------------------------------------------------------------------- /guardrail-url-guardrail/Ballerina.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | org = "choreo" 3 | name = "guardrail.url_guardrail" 4 | version = "1.0.0" 5 | export = ["guardrail.url_guardrail"] 6 | distribution = "2201.5.5" 7 | keywords = ["choreo-apim-mediation-policy","choreo-apim-mediation-request-flow","choreo-apim-mediation-response-flow","choreo-apim-egress-ai"] 8 | 9 | [build-options] 10 | observabilityIncluded = true 11 | -------------------------------------------------------------------------------- /guardrail-regex-guardrail/Ballerina.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | org = "choreo" 3 | name = "guardrail.regex_guardrail" 4 | version = "1.0.0" 5 | export = ["guardrail.regex_guardrail"] 6 | distribution = "2201.5.5" 7 | keywords = ["choreo-apim-mediation-policy","choreo-apim-mediation-request-flow","choreo-apim-mediation-response-flow","choreo-apim-egress-ai"] 8 | 9 | [build-options] 10 | observabilityIncluded = true 11 | -------------------------------------------------------------------------------- /guardrail-semantic-cache/Ballerina.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | org = "choreo" 3 | name = "guardrail.semantic_cache" 4 | version = "1.0.0" 5 | export = ["guardrail.semantic_cache"] 6 | distribution = "2201.5.5" 7 | keywords=["choreo-apim-mediation-policy", "choreo-apim-egress-ai", "choreo-apim-mediation-request-flow", "choreo-apim-mediation-response-flow"] 8 | 9 | [build-options] 10 | observabilityIncluded = true 11 | -------------------------------------------------------------------------------- /guardrail-pii-masking-regex/Ballerina.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | org = "choreo" 3 | name = "guardrail.pii_masking_regex" 4 | version = "1.0.0" 5 | export = ["guardrail.pii_masking_regex"] 6 | distribution = "2201.5.5" 7 | keywords = ["choreo-apim-mediation-policy","choreo-apim-mediation-request-flow","choreo-apim-mediation-response-flow","choreo-apim-egress-ai"] 8 | 9 | [build-options] 10 | observabilityIncluded = true 11 | -------------------------------------------------------------------------------- /guardrail-word-count-guardrail/Ballerina.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | org = "choreo" 3 | name = "guardrail.word_count_guardrail" 4 | version = "1.0.0" 5 | export = ["guardrail.word_count_guardrail"] 6 | distribution = "2201.5.5" 7 | keywords = ["choreo-apim-mediation-policy","choreo-apim-mediation-request-flow","choreo-apim-mediation-response-flow","choreo-apim-egress-ai"] 8 | 9 | [build-options] 10 | observabilityIncluded = true 11 | -------------------------------------------------------------------------------- /guardrail-aws-bedrock-guardrail/Ballerina.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | org = "choreo" 3 | name = "guardrail.aws_bedrock_guardrail" 4 | version = "1.0.0" 5 | export = ["guardrail.aws_bedrock_guardrail"] 6 | distribution = "2201.5.5" 7 | keywords = ["choreo-apim-mediation-policy","choreo-apim-mediation-request-flow","choreo-apim-mediation-response-flow","choreo-apim-egress-ai"] 8 | 9 | [build-options] 10 | observabilityIncluded = true 11 | -------------------------------------------------------------------------------- /guardrail-content-length-guardrail/Ballerina.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | org = "choreo" 3 | name = "guardrail.content_length_guardrail" 4 | version = "1.0.0" 5 | export = ["guardrail.content_length_guardrail"] 6 | distribution = "2201.5.5" 7 | keywords = ["choreo-apim-mediation-policy","choreo-apim-mediation-request-flow","choreo-apim-mediation-response-flow","choreo-apim-egress-ai"] 8 | 9 | [build-options] 10 | observabilityIncluded = true 11 | -------------------------------------------------------------------------------- /guardrail-pii-masking-guardrails-ai/Ballerina.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | org = "choreo" 3 | name = "guardrail.pii_masking_guardrails_ai" 4 | version = "1.0.0" 5 | export = ["guardrail.pii_masking_guardrails_ai"] 6 | distribution = "2201.5.5" 7 | keywords = ["choreo-apim-mediation-policy","choreo-apim-mediation-request-flow","choreo-apim-mediation-response-flow","choreo-apim-egress-ai"] 8 | 9 | [build-options] 10 | observabilityIncluded = true 11 | -------------------------------------------------------------------------------- /guardrail-sentence-count-guardrail/Ballerina.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | org = "choreo" 3 | name = "guardrail.sentence_count_guardrail" 4 | version = "1.0.0" 5 | export = ["guardrail.sentence_count_guardrail"] 6 | distribution = "2201.5.5" 7 | keywords = ["choreo-apim-mediation-policy","choreo-apim-mediation-request-flow","choreo-apim-mediation-response-flow","choreo-apim-egress-ai"] 8 | 9 | [build-options] 10 | observabilityIncluded = true 11 | -------------------------------------------------------------------------------- /guardrail-azure-content-safety-content-moderation/Ballerina.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | org = "choreo" 3 | name = "guardrail.azure_content_safety_content_moderation" 4 | version = "1.0.0" 5 | export = ["guardrail.azure_content_safety_content_moderation"] 6 | distribution = "2201.5.5" 7 | keywords = ["choreo-apim-mediation-policy","choreo-apim-mediation-request-flow","choreo-apim-mediation-response-flow","choreo-apim-egress-ai"] 8 | 9 | [build-options] 10 | observabilityIncluded = true 11 | -------------------------------------------------------------------------------- /mediation-xml-to-json/Package.md: -------------------------------------------------------------------------------- 1 | # XML to JSON 2 | 3 | ## Overview 4 | 5 | This policy provides the capability to transform a request/response with an XML payload 6 | to a request/response with a JSON payload. This policy assumes that the request/response 7 | payload is XML. Attempting to use it on a request/response with a non-XML payload will result in premature termination of the mediation flow. 8 | For the same reason, this policy cannot be attached multiple times to a resource since once it is used, the payload will be a JSON value. 9 | -------------------------------------------------------------------------------- /mediation-json-to-xml/Package.md: -------------------------------------------------------------------------------- 1 | # JSON to XML 2 | 3 | ## Overview 4 | 5 | This policy provides the capability to transform a request/response with a 6 | JSON payload to a request/response with an XML payload. This is only applicable to the request flow and response flow mediation 7 | sequences. This policy assumes that the request/response payload is JSON. Attempting to 8 | use it on a request/response with a non-JSON payload will result in premature termination of the mediation flow. For the same reason, 9 | this policy cannot be attached multiple times to a resource since once it is used, the payload will be an XML value. 10 | -------------------------------------------------------------------------------- /mediation-remove-query-param/Package.md: -------------------------------------------------------------------------------- 1 | # Remove Query Parameter 2 | 3 | ## Overview 4 | 5 | This policy provides the capability to remove specified query parameters from the request. 6 | 7 | ## Usage 8 | 9 | This will be available to select when attaching mediation policies to a proxy in Choreo. The following policy parameters are available: 10 | - `name`: name of the param 11 | 12 | If one needs to remove multiple query parameters, one may do so by attaching this policy multiple times. Attempting to remove a non-existent query parameter 13 | does not cause any failures. It'll remove if the parameter is present, if not it'll return. 14 | -------------------------------------------------------------------------------- /mediation-remove-header/Package.md: -------------------------------------------------------------------------------- 1 | # Remove Header 2 | 3 | ## Overview 4 | 5 | This policy provides the capability to remove headers from either the request or the response. 6 | 7 | ## Usage 8 | 9 | This will be available to select when attaching mediation policies to a proxy in Choreo. This policy takes a single parameter: `name`. 10 | 11 | The policy can be attached multiple times if multiple headers need to be removed. 12 | 13 | Header name given when attaching the policy will be a static value. If you need to be able to make this configurable 14 | (say, different values for different environments), you can provide input values in the following format. e.g., 15 | ``` 16 | name: ${headerName} 17 | ``` 18 | Then, later on when deploying, you can specify the value for the `headerName` configurable for each environment. 19 | -------------------------------------------------------------------------------- /issue_template.md: -------------------------------------------------------------------------------- 1 | **Description:** 2 | 3 | 4 | **Suggested Labels:** 5 | 6 | 7 | **Suggested Assignees:** 8 | 9 | 10 | **Affected Product Version:** 11 | 12 | **OS, DB, other environment details and versions:** 13 | 14 | **Steps to reproduce:** 15 | 16 | 17 | **Related Issues:** 18 | -------------------------------------------------------------------------------- /mediation-oauth/Package.md: -------------------------------------------------------------------------------- 1 | # Outbound OAuth 2 | 3 | ## Overview 4 | This policy provides automatic OAuth 2.0 Client Credentials flow implementation for securing API calls. It handles token acquisition, caching, refreshing, and adding appropriate authorization headers to requests. 5 | 6 | ## Usage 7 | This policy will be available to select when attaching mediation policies to a API proxy components in Choreo. When configuring this policy, you need to provide the following parameters: 8 | 9 | - `tokenEndpointUrl`: The URL of the OAuth token endpoint (required) 10 | - `clientId`: Your OAuth client ID (required) 11 | - `clientSecret`: Your OAuth client secret (required) 12 | - `headerName`: The name of the header to add the token to ex: "Authorization" (required) 13 | 14 | This policy will return an error if the token endpoint cannot be reached, credentials are invalid, or the token refresh fails. -------------------------------------------------------------------------------- /ratelimit-ai-token-based-ratelimit/Package.md: -------------------------------------------------------------------------------- 1 | # Token Based Rate Limit 2 | 3 | ## Overview 4 | 5 | This policy applies token based rate limiting to the API resource's request flow by setting a maximum allowed prompt, completion and total token count per time unit. 6 | 7 | ## Usage 8 | 9 | This will be available to select when attaching ratelimit policies to an egress AI Proxy Component in Choreo/Bijira. The following policy parameters are available: 10 | - `Max Prompt Token Count`: The number of prompt tokens allowed per time unit 11 | - `Max Completion Token Count`: The number of completion tokens allowed per time unit 12 | - `Max Total Token Count`: The number of total tokens allowed per time unit 13 | - `Time Unit`: The time unit for the rate limiting 14 | 15 | The policy can be attached single time to a resource. The policy will be applied to the request flow of the API resource. 16 | 17 | -------------------------------------------------------------------------------- /mediation-log-message/Package.md: -------------------------------------------------------------------------------- 1 | # Log Message 2 | 3 | ## Overview 4 | 5 | This policy provides the capability to log the payload and headers of a request/response. 6 | 7 | ## Usage 8 | 9 | This will be available to select when attaching mediation policies to a proxy in Choreo. Attaching this policy multiple times while not restricted, will 10 | only result in duplicate log entries for the same request/response. This will not log the headers or the payload by default. If one needs to log either 11 | the headers or the payload, one needs to set the parameters `logHeaders` and `logBody` to `true`. If you are logging the headers, there's an additional 12 | parameter (`excludedHeaders`) which takes a comma separate list of header names for specifying the headers to exclude when logging. 13 | 14 | This policy will return an error if payload logging is enabled but the payload cannot be read from the request/response. 15 | -------------------------------------------------------------------------------- /.github/workflows/publish-to-prod-central.yml: -------------------------------------------------------------------------------- 1 | name: Publish RC to Central 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | released-asset: 7 | description: The URL of the bala file to be pushed 8 | required: true 9 | 10 | jobs: 11 | release-build: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: Install Ballerina 15 | run: | 16 | BAL_VERSION=2201.5.5 17 | BAL_INSTALLER=ballerina-$BAL_VERSION-swan-lake-linux-x64.deb 18 | wget https://dist.ballerina.io/downloads/$BAL_VERSION/$BAL_INSTALLER 19 | sudo dpkg -i $BAL_INSTALLER 20 | - name: Publish bala to prod Central 21 | env: 22 | BALLERINA_CENTRAL_ACCESS_TOKEN: ${{ secrets.BAL_PROD_CENTRAL_TOKEN }} 23 | run: | 24 | BALA_URL=${{ github.event.inputs.released-asset }} 25 | wget $BALA_URL 26 | bal push $(basename $BALA_URL) 27 | -------------------------------------------------------------------------------- /.github/workflows/publish-to-dev-central.yml: -------------------------------------------------------------------------------- 1 | name: Publish RC to Dev Central 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | released-asset: 7 | description: The URL of the bala file to be pushed 8 | required: true 9 | 10 | jobs: 11 | release-build: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: Install Ballerina 15 | run: | 16 | BAL_VERSION=2201.5.5 17 | BAL_INSTALLER=ballerina-$BAL_VERSION-swan-lake-linux-x64.deb 18 | wget https://dist.ballerina.io/downloads/$BAL_VERSION/$BAL_INSTALLER 19 | sudo dpkg -i $BAL_INSTALLER 20 | - name: Publish bala to dev Central 21 | env: 22 | BALLERINA_CENTRAL_ACCESS_TOKEN: ${{ secrets.BAL_DEV_CENTRAL_TOKEN }} 23 | BALLERINA_DEV_CENTRAL: true 24 | run: | 25 | BALA_URL=${{ github.event.inputs.released-asset }} 26 | wget $BALA_URL 27 | bal push $(basename $BALA_URL) 28 | -------------------------------------------------------------------------------- /mediation-oauth/types.bal: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 WSO2 LLC (http://www.wso2.org) All Rights Reserved. 2 | // 3 | // WSO2 LLC licenses this file to you under the Apache License, 4 | // Version 2.0 (the "License"); you may not use this file except 5 | // in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, 11 | // software distributed under the License is distributed on an 12 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 13 | // KIND, either express or implied. See the License for the 14 | // specific language governing permissions and limitations 15 | // under the License. 16 | 17 | public type OauthEndpointConfig record {| 18 | string tokenApiUrl; 19 | string clientId; 20 | string clientSecret; 21 | |}; 22 | 23 | public type TokenResponse record {| 24 | string accessToken; 25 | string refreshToken?; 26 | string tokenType; 27 | int expiresIn; 28 | int validTill; 29 | |}; 30 | -------------------------------------------------------------------------------- /mediation-set-header/Package.md: -------------------------------------------------------------------------------- 1 | # Set Header 2 | 3 | ## Overview 4 | This policy provides the capability to set arbitrary headers to either the request or the response. Setting the same header multiple times will overwrite the existing header value. 5 | 6 | ## Usage 7 | 8 | This will be available to select when attaching mediation policies to a proxy in Choreo. The following policy parameters are available: 9 | - `Header Name`: the header name 10 | - `Header Value`: the header value 11 | 12 | The policy can be attached multiple times if multiple headers need to be set. Setting the same header multiple times will overwrite the 13 | existing header value. 14 | 15 | Header name and value given when attaching the policy will be static values. If you need to be able to make these values configurable 16 | (say, different values for different environments), you can provide input values in the following format. e.g., 17 | ``` 18 | name: Authorization 19 | value: ${authzHeaderValue} 20 | ``` 21 | Then, later on when deploying, you can specify the value for the `authzHeaderValue` configurable for each environment. 22 | -------------------------------------------------------------------------------- /mediation-add-query-param/Package.md: -------------------------------------------------------------------------------- 1 | # Add Query Parameter 2 | 3 | ## Overview 4 | 5 | This policy Provides the capability to add additional query parameters to a request. 6 | 7 | ## Usage 8 | 9 | This will be available to select when attaching mediation policies to a proxy in Choreo. The following policy parameters are available: 10 | - `name`: name of the param 11 | - `value`: value of the param 12 | 13 | If one needs to add multiple query parameters, one may do so by attaching this policy multiple times. Attaching multiple instances of this policy with the 14 | same `name` does not overwrite the existing value. Adding multiple values for the same parameter creates an array of values. 15 | 16 | Parameter name and value given when attaching the policy will be static values. If you need to be able to make these values configurable 17 | (say, different values for different environments), you can provide input values in the following format. e.g., 18 | ``` 19 | name: foo 20 | value: ${fooValue} 21 | ``` 22 | Then, later on when deploying, you can specify the value for the `fooValue` configurable for each environment. 23 | -------------------------------------------------------------------------------- /mediation-log-message/definitions.bal: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 WSO2 LLC (http://www.wso2.org) All Rights Reserved. 2 | // 3 | // WSO2 LLC licenses this file to you under the Apache License, 4 | // Version 2.0 (the "License"); you may not use this file except 5 | // in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, 11 | // software distributed under the License is distributed on an 12 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 13 | // KIND, either express or implied. See the License for the 14 | // specific language governing permissions and limitations 15 | // under the License. 16 | 17 | import ballerina/log; 18 | 19 | type LogRecord record {| 20 | *log:KeyValues; 21 | MediationFlow mediation\-flow; 22 | string request\-id; 23 | string http\-method; 24 | string resource\-path; 25 | log:Value...; 26 | |}; 27 | 28 | # Represents the mediation flow kind 29 | enum MediationFlow { 30 | REQUEST, RESPONSE, FAULT 31 | } 32 | -------------------------------------------------------------------------------- /mediation-remove-query-param/policy.bal: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 WSO2 LLC (http://www.wso2.org) All Rights Reserved. 2 | // 3 | // WSO2 LLC licenses this file to you under the Apache License, 4 | // Version 2.0 (the "License"); you may not use this file except 5 | // in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, 11 | // software distributed under the License is distributed on an 12 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 13 | // KIND, either express or implied. See the License for the 14 | // specific language governing permissions and limitations 15 | // under the License. 16 | 17 | import choreo/mediation; 18 | import ballerina/http; 19 | 20 | @mediation:RequestFlow 21 | public function removeQueryParam(mediation:Context ctx, http:Request req, string Parameter\ Name) 22 | returns http:Response|false|error|() { 23 | ctx.removeQueryParam(Parameter\ Name); 24 | return (); 25 | } 26 | -------------------------------------------------------------------------------- /mediation-add-query-param/policy.bal: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 WSO2 LLC (http://www.wso2.org) All Rights Reserved. 2 | // 3 | // WSO2 LLC licenses this file to you under the Apache License, 4 | // Version 2.0 (the "License"); you may not use this file except 5 | // in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, 11 | // software distributed under the License is distributed on an 12 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 13 | // KIND, either express or implied. See the License for the 14 | // specific language governing permissions and limitations 15 | // under the License. 16 | 17 | import choreo/mediation; 18 | import ballerina/http; 19 | 20 | @mediation:RequestFlow 21 | public function addQueryParam(mediation:Context ctx, http:Request req, string Parameter\ Name, string Parameter\ Value) 22 | returns http:Response|false|error|() { 23 | ctx.addQueryParam(Parameter\ Name, Parameter\ Value); 24 | return (); 25 | } 26 | -------------------------------------------------------------------------------- /mediation-rewrite-resource-path/policy.bal: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 WSO2 LLC (http://www.wso2.org) All Rights Reserved. 2 | // 3 | // WSO2 LLC licenses this file to you under the Apache License, 4 | // Version 2.0 (the "License"); you may not use this file except 5 | // in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, 11 | // software distributed under the License is distributed on an 12 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 13 | // KIND, either express or implied. See the License for the 14 | // specific language governing permissions and limitations 15 | // under the License. 16 | 17 | import choreo/mediation; 18 | import ballerina/http; 19 | 20 | @mediation:RequestFlow 21 | public function rewrite(mediation:Context ctx, http:Request req, string New\ Path) 22 | returns http:Response|false|error|() { 23 | mediation:ResourcePath mutableResourcePath = check mediation:createMutableResourcePath(New\ Path); 24 | ctx.setResourcePath(mutableResourcePath); 25 | return (); 26 | } 27 | -------------------------------------------------------------------------------- /mediation-add-header/Package.md: -------------------------------------------------------------------------------- 1 | # Add Header 2 | 3 | ## Overview 4 | 5 | This policy provides the capability to add arbitrary headers to either the request or the response. 6 | Adding the same header multiple times will not overwrite the existing header values and it will be appended to the list of values if the header already exists. 7 | 8 | ## Usage 9 | 10 | This will be available to select when attaching mediation policies to a proxy in Choreo. The following policy parameters are available: 11 | - `name`: the header name 12 | - `value`: the header value 13 | 14 | The policy can be attached multiple times if multiple headers need to be added. Adding the same header multiple times will not 15 | overwrite the existing header values. It will be a list of values mapped to the same header name. 16 | 17 | Header name and value given when attaching the policy will be static values. If you need to be able to make these values configurable 18 | (say, different values for different environments), you can provide input values in the following format. e.g., 19 | ``` 20 | name: Authorization 21 | value: ${authzHeaderValue} 22 | ``` 23 | Then, later on when deploying, you can specify the value for the `authzHeaderValue` configurable for each environment. 24 | -------------------------------------------------------------------------------- /ratelimit-ai-token-based-ratelimit/policy.bal: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 WSO2 LLC (http://www.wso2.org) All Rights Reserved. 2 | // 3 | // WSO2 LLC licenses this file to you under the Apache License, 4 | // Version 2.0 (the "License"); you may not use this file except 5 | // in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, 11 | // software distributed under the License is distributed on an 12 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 13 | // KIND, either express or implied. See the License for the 14 | // specific language governing permissions and limitations 15 | // under the License. 16 | 17 | import ballerina/http; 18 | import choreo/mediation; 19 | 20 | @mediation:RequestFlow 21 | public function tokenBasedRatelimit_In(mediation:Context ctx, http:Request req, int Max\ Prompt\ Token\ Count, 22 | int Max\ Completion\ Token\ Count, int Max\ Total\ Token\ Count, string Time\ Unit) returns http:Response|false|error? { 23 | // This is an empty function to list this policy as an egress AI policy. 24 | // The actual logic is implemented in the Egress Gateway using BackendTrafficPolicy CR not utilizing ballerina mediation server. 25 | return; 26 | } -------------------------------------------------------------------------------- /guardrail-url-guardrail/Package.md: -------------------------------------------------------------------------------- 1 | # URL Guardrail 2 | 3 | ## Overview 4 | 5 | This policy provides the capability to perform URL validity checks on incoming or outgoing JSON payloads. This component acts as a guardrail to enforce content safety by validating embedded URLs for accessibility or DNS resolution. 6 | 7 | ## Usage 8 | 9 | This will be available to select when attaching mediation policies to an egress AI proxy component. The following policy parameters are available: 10 | 11 | - `Guardrail Name`: The name of the guardrail policy. This will be used for tracking purposes. 12 | - `Perform DNS Lookup`: If enabled, a DNS lookup will be performed to validate the extracted URLs. If disabled, a connection attempt will be made instead. 13 | - `Connection Timeout`: The connection timeout for DNS lookups or connection attempts, in milliseconds. If not specified, a default timeout will be used. 14 | - `JSON Path`: The JSONPath expression used to extract content from the payload. If not specified, the entire payload will be used for validation. 15 | - `Show Guardrail Assessment`: When enabled, the error response will include detailed information about the reason for the guardrail intervention. 16 | 17 | The policy can be attached multiple time to a resource if multiple URL validations is required. The policy can be applied to the request flow and the response flow of the API resource. 18 | -------------------------------------------------------------------------------- /guardrail-regex-guardrail/Package.md: -------------------------------------------------------------------------------- 1 | # Regex Guardrail 2 | 3 | ## Overview 4 | 5 | This policy provides the capability to perform regular expression-based validation on incoming or outgoing JSON payloads. This component acts as a guardrail to enforce specific security or compliance rules based on configurable regex patterns and JSONPath expressions. 6 | 7 | ## Usage 8 | 9 | This will be available to select when attaching mediation policies to an egress AI proxy component. The following policy parameters are available: 10 | 11 | - `Guardrail Name`: The name of the guardrail policy. This will be used for tracking purposes. 12 | - `Regex Pattern`: The regular expression used to validate the content. 13 | - `JSON Path`: The JSONPath expression used to extract content from the payload. If not specified, the entire payload will be used for validation. 14 | - `Invert the Guardrail Decision`: If enabled, inverts the guardrail blocking decision, causing the guardrail to intervene and return an error response when a match is found in the content. 15 | - `Show Guardrail Assessment`: When enabled, the error response will include detailed information about the reason for the guardrail intervention. 16 | 17 | The policy can be attached multiple time to a resource if multiple regular expression-based validations is required. The policy can be applied to the request flow and the response flow of the API resource. 18 | -------------------------------------------------------------------------------- /guardrail-pii-masking-regex/policy.bal: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 WSO2 LLC (http://www.wso2.org) All Rights Reserved. 2 | // 3 | // WSO2 LLC licenses this file to you under the Apache License, 4 | // Version 2.0 (the "License"); you may not use this file except 5 | // in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, 11 | // software distributed under the License is distributed on an 12 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 13 | // KIND, either express or implied. See the License for the 14 | // specific language governing permissions and limitations 15 | // under the License. 16 | 17 | import ballerina/http; 18 | import choreo/mediation; 19 | 20 | @mediation:RequestFlow 21 | public function piiMaskingRegex_In(mediation:Context ctx, http:Request req, string Guardrail\ Name, string PII\ Entities, string JSON\ Path = "", 22 | boolean Redact\ PII = false) 23 | returns http:Response|false|error|() { 24 | return; 25 | } 26 | 27 | @mediation:ResponseFlow 28 | public function piiMaskingRegex_Out(mediation:Context ctx, http:Request req, http:Response res, string Guardrail\ Name, string PII\ Entities, string JSON\ Path = "", 29 | boolean Redact\ PII = false) 30 | returns http:Response|false|error|() { 31 | return; 32 | } 33 | -------------------------------------------------------------------------------- /guardrail-pii-masking-guardrails-ai/policy.bal: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 WSO2 LLC (http://www.wso2.org) All Rights Reserved. 2 | // 3 | // WSO2 LLC licenses this file to you under the Apache License, 4 | // Version 2.0 (the "License"); you may not use this file except 5 | // in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, 11 | // software distributed under the License is distributed on an 12 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 13 | // KIND, either express or implied. See the License for the 14 | // specific language governing permissions and limitations 15 | // under the License. 16 | 17 | import ballerina/http; 18 | import choreo/mediation; 19 | 20 | @mediation:RequestFlow 21 | public function piiMaskingGuardrailsAI_In(mediation:Context ctx, http:Request req, string Guardrail\ Name, string PII\ Entities, string JSON\ Path = "", 22 | boolean Redact\ PII = false) 23 | returns http:Response|false|error|() { 24 | return; 25 | } 26 | 27 | @mediation:ResponseFlow 28 | public function piiMaskingGuardrailsAI_Out(mediation:Context ctx, http:Request req, http:Response res, string Guardrail\ Name, string PII\ Entities, string JSON\ Path = "", 29 | boolean Redact\ PII = false) 30 | returns http:Response|false|error|() { 31 | return; 32 | } 33 | -------------------------------------------------------------------------------- /mediation-rewrite-resource-path/Package.md: -------------------------------------------------------------------------------- 1 | # Rewrite Resource Path 2 | 3 | ## Overview 4 | 5 | This policy provides the capability to modify the resource path segment 6 | (i.e., the endpoint of the upstream API) of an HTTP request. The original resource path 7 | will be replaced by the provided relative resource path. 8 | 9 | ## Usage 10 | 11 | This will be available to select when attaching mediation policies to a proxy in Choreo. The following policy parameters are available: 12 | - `newPath`: the desired resource path to route to. Path params can be referred to using the following format: `{pathParam}`. For example, if the resource in the proxy is `/foo/{id}`, user can specify the `newPath` as `/arbitrary/path/{id}/more/segments`. This policy is only applicable to the request flow sequence. 13 | - `keepQueryParams`: whether to keep the query params of the request or not. 14 | 15 | While there's no restriction on adding this policy multiple times, it would not be useful to do so. The resource path given in the last instance of 16 | this policy will be the one that'd be used. 17 | 18 | The resource path given when attaching the policy will be static. If you need to be able to make the path configurable 19 | (say, different paths for different environments), you can provide input value in the following format. e.g., 20 | ``` 21 | newPath: ${myResourcePath} 22 | ``` 23 | Then, later on when deploying, you can specify the value for the `myResourcePath` configurable for each environment. 24 | -------------------------------------------------------------------------------- /guardrail-word-count-guardrail/Package.md: -------------------------------------------------------------------------------- 1 | # Word Count Guardrail 2 | 3 | ## Overview 4 | 5 | This policy provides the capability to perform word count-based validation on incoming or outgoing JSON payloads. This component acts as a guardrail to enforce specific content moderation rules based on configurable minimum and maximum word counts and JSONPath expressions. 6 | 7 | ## Usage 8 | 9 | This will be available to select when attaching mediation policies to an egress AI proxy component. The following policy parameters are available: 10 | 11 | - `Guardrail Name`: The name of the guardrail policy. This will be used for tracking purposes. 12 | - `Minimum Word Count`: The minimum number of words the content must contain. 13 | - `Maximum Word Count`: The maximum number of words the content can contain. 14 | - `JSON Path`: The JSONPath expression used to extract content from the payload. If not specified, the entire payload will be used for validation. 15 | - `Invert the Guardrail Decision`: If enabled, inverts the guardrail blocking decision, causing the guardrail to intervene and return an error response when the content is within the specified limits. 16 | - `Show Guardrail Assessment`: When enabled, the error response will include detailed information about the reason for the guardrail intervention. 17 | 18 | The policy can be attached multiple time to a resource if multiple word count based validation is required. The policy can be applied to the request flow and the response flow of the API resource. 19 | -------------------------------------------------------------------------------- /guardrail-content-length-guardrail/Package.md: -------------------------------------------------------------------------------- 1 | # Content Length Guardrail 2 | 3 | ## Overview 4 | 5 | This policy provides the capability to perform content-byte-length validation on incoming or outgoing JSON payloads. This component acts as a guardrail to enforce specific content moderation rules based on configurable minimum and maximum byte sizes and JSONPath expressions. 6 | 7 | ## Usage 8 | 9 | This will be available to select when attaching mediation policies to an egress AI proxy component. The following policy parameters are available: 10 | 11 | - `Guardrail Name`: The name of the guardrail policy. This will be used for tracking purposes. 12 | - `Minimum Content Length`: The minimum number of bytes the content must contain. 13 | - `Maximum Content Length`: The maximum number of bytes the content must contain. 14 | - `JSON Path`: The JSONPath expression used to extract content from the payload. If not specified, the entire payload will be used for validation. 15 | - `Invert the Guardrail Decision`: If enabled, inverts the guardrail blocking decision, causing the guardrail to intervene and return an error response when the content is within the specified limits. 16 | - `Show Guardrail Assessment`: When enabled, the error response will include detailed information about the reason for the guardrail intervention. 17 | 18 | The policy can be attached multiple time to a resource if multiple content length based validations is required. The policy can be applied to the request flow and the response flow of the API resource. 19 | -------------------------------------------------------------------------------- /guardrail-pii-masking-regex/Package.md: -------------------------------------------------------------------------------- 1 | # PII Masking Regex 2 | 3 | ## Overview 4 | 5 | This package provides a mediation policy for Choreo API Manager that allows you to mask Personally Identifiable Information (PII) in API requests and responses using regular expressions. It is designed to help protect sensitive data by masking it before it reaches the AI proxy component. 6 | 7 | ## Usage 8 | 9 | This will be available to select when attaching mediation policies to an egress AI Proxy Component. The following policy parameters are available: 10 | 11 | - `Guardrail Name`: The name of the guardrail policy. This will be used for tracking purposes. 12 | - `PII Entities`: The PII entities to detect and mask using regular expressions. Each entry should include the entity name and its corresponding regex pattern. 13 | - `JSON Path`: The JSONPath expression used to extract content from the payload. If not specified, the entire payload will be used for validation. 14 | - `Redact PII`: When enabled, detected PIIs are redacted and will not be restored to its original form. This should be enabled when the policy is attached to the response flow to prevent exposing AI-generated content with sensitive data to the client. When disabled and applied to the request flow, detected PII is temporarily masked and automatically restored in the corresponding response. 15 | 16 | The policy can be attached multiple time to a resource if multiple PII masking is required. The policy can be applied to the request flow and the response flow of the API resource. 17 | -------------------------------------------------------------------------------- /guardrail-sentence-count-guardrail/Package.md: -------------------------------------------------------------------------------- 1 | # Sentence Count Guardrail 2 | 3 | ## Overview 4 | 5 | This policy provides the capability to perform sentence count-based validation on incoming or outgoing JSON payloads. This component acts as a guardrail to enforce specific content moderation rules based on configurable minimum and maximum sentence counts and JSONPath expressions. 6 | 7 | ## Usage 8 | 9 | This will be available to select when attaching mediation policies to an egress AI proxy component. The following policy parameters are available: 10 | 11 | - `Guardrail Name`: The name of the guardrail policy. This will be used for tracking purposes. 12 | - `Minimum Sentence Count`: The minimum number of sentences the content must contain. 13 | - `Maximum Sentence Count`: The maximum number of sentences the content must contain. 14 | - `JSON Path`: The JSONPath expression used to extract content from the payload. If not specified, the entire payload will be used for validation. 15 | - `Invert the Guardrail Decision`: If enabled, inverts the guardrail blocking decision, causing the guardrail to intervene and return an error response when the content is within the specified limits. 16 | - `Show Guardrail Assessment`: When enabled, the error response will include detailed information about the reason for the guardrail intervention. 17 | 18 | The policy can be attached multiple time to a resource if multiple sentence count based validation is required. The policy can be applied to the request flow and the response flow of the API resource. 19 | -------------------------------------------------------------------------------- /guardrail-pii-masking-guardrails-ai/Package.md: -------------------------------------------------------------------------------- 1 | # PII Masking Guardrails AI 2 | 3 | ## Overview 4 | 5 | This policy provides the capability to mask personally identifiable information (PII) in AI-generated content using Guardrails AI. It allows for the detection and masking of specified PII entities in both request and response payloads. This integration helps ensure that AI applications comply with data protection regulations while preventing the exposure of sensitive information. 6 | 7 | ## Usage 8 | 9 | This will be available to select when attaching mediation policies to an egress AI proxy component. The following policy parameters are available: 10 | 11 | - `Guardrail Name`: The name of the guardrail policy. This will be used for tracking purposes. 12 | - `PII Entities`: The list of PII entities to be masked in the content. 13 | - `JSON Path`: The JSONPath expression used to extract content from the payload. If not specified, the entire payload will be used for validation. 14 | - `Redact PII`: When enabled, detected PIIs are redacted and will not be restored to its original form. This should be enabled when the policy is attached to the response flow to prevent exposing AI-generated content with sensitive data to the client. When disabled and applied to the request flow, detected PII is temporarily masked and automatically restored in the corresponding response. 15 | 16 | The policy can be attached multiple time to a resource if multiple PII masking is required. The policy can be applied to the request flow and the response flow of the API resource. 17 | -------------------------------------------------------------------------------- /guardrail-url-guardrail/policy.bal: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 WSO2 LLC (http://www.wso2.org) All Rights Reserved. 2 | // 3 | // WSO2 LLC licenses this file to you under the Apache License, 4 | // Version 2.0 (the "License"); you may not use this file except 5 | // in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, 11 | // software distributed under the License is distributed on an 12 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 13 | // KIND, either express or implied. See the License for the 14 | // specific language governing permissions and limitations 15 | // under the License. 16 | 17 | import ballerina/http; 18 | import choreo/mediation; 19 | 20 | @mediation:RequestFlow 21 | public function urlGuardrail_In(mediation:Context ctx, http:Request req, string Guardrail\ Name, int Connection\ Timeout, 22 | boolean Perform\ DNS\ Lookup = false, string JSON\ Path = "", boolean Show\ Guardrail\ Assessment = false) 23 | returns http:Response|false|error|() { 24 | return; 25 | } 26 | 27 | @mediation:ResponseFlow 28 | public function urlGuardrail_Out(mediation:Context ctx, http:Request req, http:Response res, string Guardrail\ Name, int Connection\ Timeout, 29 | boolean Perform\ DNS\ Lookup = false, string JSON\ Path = "", boolean Show\ Guardrail\ Assessment = false) 30 | returns http:Response|false|error|() { 31 | return; 32 | } 33 | -------------------------------------------------------------------------------- /mediation-xml-to-json/policy.bal: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 WSO2 LLC (http://www.wso2.org) All Rights Reserved. 2 | // 3 | // WSO2 LLC licenses this file to you under the Apache License, 4 | // Version 2.0 (the "License"); you may not use this file except 5 | // in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, 11 | // software distributed under the License is distributed on an 12 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 13 | // KIND, either express or implied. See the License for the 14 | // specific language governing permissions and limitations 15 | // under the License. 16 | 17 | import choreo/mediation; 18 | import ballerina/xmldata; 19 | import ballerina/mime; 20 | import ballerina/http; 21 | 22 | @mediation:RequestFlow 23 | public function xmlToJsonIn(mediation:Context ctx, http:Request req) returns http:Response|false|error|() { 24 | xml xmlPayload = check req.getXmlPayload(); 25 | json jsonPayload = check xmldata:toJson(xmlPayload); 26 | req.setPayload(jsonPayload, mime:APPLICATION_JSON); 27 | return (); 28 | } 29 | 30 | @mediation:ResponseFlow 31 | public function xmlToJsonOut(mediation:Context ctx, http:Request req, http:Response res) returns http:Response|false|error|() { 32 | xml xmlPayload = check res.getXmlPayload(); 33 | json jsonPayload = check xmldata:toJson(xmlPayload); 34 | res.setPayload(jsonPayload, mime:APPLICATION_JSON); 35 | return (); 36 | } 37 | -------------------------------------------------------------------------------- /guardrail-regex-guardrail/policy.bal: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 WSO2 LLC (http://www.wso2.org) All Rights Reserved. 2 | // 3 | // WSO2 LLC licenses this file to you under the Apache License, 4 | // Version 2.0 (the "License"); you may not use this file except 5 | // in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, 11 | // software distributed under the License is distributed on an 12 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 13 | // KIND, either express or implied. See the License for the 14 | // specific language governing permissions and limitations 15 | // under the License. 16 | 17 | import ballerina/http; 18 | import choreo/mediation; 19 | 20 | @mediation:RequestFlow 21 | public function regexGuardrail_In(mediation:Context ctx, http:Request req, string Guardrail\ Name, string Regex\ Pattern, 22 | string JSON\ Path = "", boolean Invert\ the\ Guardrail\ Decision = false, boolean Show\ Guardrail\ Assessment = false) 23 | returns http:Response|false|error|() { 24 | return; 25 | } 26 | 27 | @mediation:ResponseFlow 28 | public function regexGuardrail_Out(mediation:Context ctx, http:Request req, http:Response res, string Guardrail\ Name, string Regex\ Pattern, 29 | string JSON\ Path = "", boolean Invert\ the\ Guardrail\ Decision = false, boolean Show\ Guardrail\ Assessment = false) 30 | returns http:Response|false|error|() { 31 | return; 32 | } 33 | -------------------------------------------------------------------------------- /guardrail-semantic-cache/Package.md: -------------------------------------------------------------------------------- 1 | # Semantic Caching 2 | 3 | ## Overview 4 | 5 | This policy leverages semantic caching to optimize API performance. When a request is received, the system checks the vector store for a cached response that is semantically similar to the query. If a match is found, the cached response is returned immediately—reducing both latency and computational costs by avoiding unnecessary calls to the LLM backend. 6 | 7 | ## Usage 8 | The following policy parameters are available. Mainly the configurations can be broken down into two main categories: 9 | 10 | Embedding Provider Configurations 11 | - `Header Name`: If AI model requires authentication via Authorization or API key header, specify its name here. 12 | - `API Key`: API Key for the desired embedding provider 13 | - `Embedding Provider`: AI provider format to use for embeddings API 14 | - `Embedding Model Name`: Model name to execute. 15 | - `Embedding Upstream URL`: Endpoint URL for the emedding generation 16 | 17 | Vector DB Configurations 18 | - `Dimensions`: The desired dimensionality for the vectors 19 | - `Threshold`: The default similarity threshold for accepting semantic search results. 20 | - `Vector Store`: Which vector database driver to use(Redis or Milvus) 21 | - `Host`: A string representing the databse host. 22 | - `Port`: An integer representing a port number between 0 and 65535, inclusive. 23 | - `Database`: Name of the database need to be used 24 | - `Username`: Username for the database user 25 | - `Password`: Password for the provided database user 26 | 27 | The policy should be applied to both request and response flow of the API resources. 28 | -------------------------------------------------------------------------------- /guardrail-word-count-guardrail/policy.bal: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 WSO2 LLC (http://www.wso2.org) All Rights Reserved. 2 | // 3 | // WSO2 LLC licenses this file to you under the Apache License, 4 | // Version 2.0 (the "License"); you may not use this file except 5 | // in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, 11 | // software distributed under the License is distributed on an 12 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 13 | // KIND, either express or implied. See the License for the 14 | // specific language governing permissions and limitations 15 | // under the License. 16 | 17 | import ballerina/http; 18 | import choreo/mediation; 19 | 20 | @mediation:RequestFlow 21 | public function wordCountGuardrail_In(mediation:Context ctx, http:Request req, string Guardrail\ Name, int Minimum\ Word\ Count, 22 | int Maximum\ Word\ Count, string JSON\ Path = "", boolean Invert\ the\ Guardrail\ Decision = false, boolean Show\ Guardrail\ Assessment = false) 23 | returns http:Response|false|error|() { 24 | return; 25 | } 26 | 27 | @mediation:ResponseFlow 28 | public function wordCountGuardrail_Out(mediation:Context ctx, http:Request req, http:Response res, string Guardrail\ Name, int Minimum\ Word\ Count, 29 | int Maximum\ Word\ Count, string JSON\ Path = "", boolean Invert\ the\ Guardrail\ Decision = false, boolean Show\ Guardrail\ Assessment = false) 30 | returns http:Response|false|error|() { 31 | return; 32 | } 33 | -------------------------------------------------------------------------------- /guardrail-content-length-guardrail/policy.bal: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 WSO2 LLC (http://www.wso2.org) All Rights Reserved. 2 | // 3 | // WSO2 LLC licenses this file to you under the Apache License, 4 | // Version 2.0 (the "License"); you may not use this file except 5 | // in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, 11 | // software distributed under the License is distributed on an 12 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 13 | // KIND, either express or implied. See the License for the 14 | // specific language governing permissions and limitations 15 | // under the License. 16 | 17 | import ballerina/http; 18 | import choreo/mediation; 19 | 20 | @mediation:RequestFlow 21 | public function contentLengthGuardrail_In(mediation:Context ctx, http:Request req, string Guardrail\ Name, int Minimum\ Content\ Length, 22 | int Maximum\ Content\ Length, string JSON\ Path = "", boolean Invert\ the\ Guardrail\ Decision = false, boolean Show\ Guardrail\ Assessment = false) 23 | returns http:Response|false|error|() { 24 | return; 25 | } 26 | 27 | @mediation:ResponseFlow 28 | public function contentLengthGuardrail_Out(mediation:Context ctx, http:Request req, http:Response res, string Guardrail\ Name, int Minimum\ Content\ Length, 29 | int Maximum\ Content\ Length, string JSON\ Path = "", boolean Invert\ the\ Guardrail\ Decision = false, boolean Show\ Guardrail\ Assessment = false) 30 | returns http:Response|false|error|() { 31 | return; 32 | } 33 | -------------------------------------------------------------------------------- /guardrail-sentence-count-guardrail/policy.bal: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 WSO2 LLC (http://www.wso2.org) All Rights Reserved. 2 | // 3 | // WSO2 LLC licenses this file to you under the Apache License, 4 | // Version 2.0 (the "License"); you may not use this file except 5 | // in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, 11 | // software distributed under the License is distributed on an 12 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 13 | // KIND, either express or implied. See the License for the 14 | // specific language governing permissions and limitations 15 | // under the License. 16 | 17 | import ballerina/http; 18 | import choreo/mediation; 19 | 20 | @mediation:RequestFlow 21 | public function sentenceCountGuardrail_In(mediation:Context ctx, http:Request req, string Guardrail\ Name, int Minimum\ Sentence\ Count, 22 | int Maximum\ Sentence\ Count, string JSON\ Path = "", boolean Invert\ the\ Guardrail\ Decision = false, boolean Show\ Guardrail\ Assessment = false) 23 | returns http:Response|false|error|() { 24 | return; 25 | } 26 | 27 | @mediation:ResponseFlow 28 | public function sentenceCountGuardrail_Out(mediation:Context ctx, http:Request req, http:Response res, string Guardrail\ Name, int Minimum\ Sentence\ Count, 29 | int Maximum\ Sentence\ Count, string JSON\ Path = "", boolean Invert\ the\ Guardrail\ Decision = false, boolean Show\ Guardrail\ Assessment = false) 30 | returns http:Response|false|error|() { 31 | return; 32 | } 33 | -------------------------------------------------------------------------------- /mediation-oauth/policy.bal: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 WSO2 LLC (http://www.wso2.org) All Rights Reserved. 2 | // 3 | // WSO2 LLC licenses this file to you under the Apache License, 4 | // Version 2.0 (the "License"); you may not use this file except 5 | // in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, 11 | // software distributed under the License is distributed on an 12 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 13 | // KIND, either express or implied. See the License for the 14 | // specific language governing permissions and limitations 15 | // under the License. 16 | 17 | import ballerina/http; 18 | import choreo/mediation; 19 | 20 | TokenResponse? oauthAccessToken = (); 21 | http:Client? tokenClient = (); 22 | 23 | @mediation:RequestFlow 24 | public function oauthIn(mediation:Context ctx, 25 | http:Request req, 26 | string tokenEndpointUrl, 27 | string clientId, 28 | string clientSecret, 29 | string headerName="Authorization") 30 | returns http:Response|false|error? { 31 | 32 | OauthEndpointConfig oauthEndpointConfig = { 33 | tokenApiUrl: tokenEndpointUrl, 34 | clientId: clientId, 35 | clientSecret: clientSecret 36 | }; 37 | 38 | TokenResponse|error token = check getToken(oauthEndpointConfig); 39 | if (token is error) { 40 | return error("Failed to get a token", 'error = token); 41 | } 42 | 43 | string headerValue = string `Bearer ${token.accessToken}`; 44 | req.setHeader(headerName, headerValue); 45 | 46 | return; 47 | } 48 | 49 | -------------------------------------------------------------------------------- /mediation-remove-header/policy.bal: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 WSO2 LLC (http://www.wso2.org) All Rights Reserved. 2 | // 3 | // WSO2 LLC licenses this file to you under the Apache License, 4 | // Version 2.0 (the "License"); you may not use this file except 5 | // in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, 11 | // software distributed under the License is distributed on an 12 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 13 | // KIND, either express or implied. See the License for the 14 | // specific language governing permissions and limitations 15 | // under the License. 16 | 17 | import choreo/mediation; 18 | import ballerina/http; 19 | 20 | @mediation:RequestFlow 21 | public function removeHeaderRequestFlow(mediation:Context ctx, http:Request req, string Header\ Name) 22 | returns http:Response|false|error|() { 23 | req.removeHeader(Header\ Name); 24 | return (); 25 | } 26 | 27 | @mediation:ResponseFlow 28 | public function removeHeaderResponseFlow(mediation:Context ctx, http:Request req, http:Response res, 29 | string Header\ Name) returns http:Response|false|error|() { 30 | res.removeHeader(Header\ Name); 31 | return (); 32 | } 33 | 34 | @mediation:FaultFlow 35 | public function removeHeaderFaultFlow(mediation:Context ctx, http:Request req, http:Response? resp, http:Response 36 | errFlowResp, error e, string Header\ Name) 37 | returns http:Response|false|error|() { 38 | errFlowResp.removeHeader(Header\ Name); 39 | return (); 40 | } 41 | -------------------------------------------------------------------------------- /mediation-add-header/policy.bal: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 WSO2 LLC (http://www.wso2.org) All Rights Reserved. 2 | // 3 | // WSO2 LLC licenses this file to you under the Apache License, 4 | // Version 2.0 (the "License"); you may not use this file except 5 | // in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, 11 | // software distributed under the License is distributed on an 12 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 13 | // KIND, either express or implied. See the License for the 14 | // specific language governing permissions and limitations 15 | // under the License. 16 | 17 | import choreo/mediation; 18 | import ballerina/http; 19 | 20 | @mediation:RequestFlow 21 | public function addHeader_In(mediation:Context ctx, http:Request req, string Header\ Name, string Header\ Value) 22 | returns http:Response|false|error|() { 23 | req.addHeader(Header\ Name, Header\ Value); 24 | return (); 25 | } 26 | 27 | @mediation:ResponseFlow 28 | public function addHeader_Out(mediation:Context ctx, http:Request req, http:Response res, string Header\ Name, 29 | string Header\ Value) returns http:Response|false|error|() { 30 | res.addHeader(Header\ Name, Header\ Value); 31 | return (); 32 | } 33 | 34 | @mediation:FaultFlow 35 | public function addHeader_Fault(mediation:Context ctx, http:Request req, http:Response? resp, 36 | http:Response errFlowResp, error e, string Header\ Name, 37 | string Header\ Value) returns http:Response|false|error|() { 38 | errFlowResp.addHeader(Header\ Name, Header\ Value); 39 | return (); 40 | } 41 | -------------------------------------------------------------------------------- /mediation-set-header/policy.bal: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 WSO2 LLC (http://www.wso2.org) All Rights Reserved. 2 | // 3 | // WSO2 LLC licenses this file to you under the Apache License, 4 | // Version 2.0 (the "License"); you may not use this file except 5 | // in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, 11 | // software distributed under the License is distributed on an 12 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 13 | // KIND, either express or implied. See the License for the 14 | // specific language governing permissions and limitations 15 | // under the License. 16 | 17 | import choreo/mediation; 18 | import ballerina/http; 19 | 20 | @mediation:RequestFlow 21 | public function setHeaderInRequest(mediation:Context ctx, http:Request req, string Header\ Name, string Header\ Value) 22 | returns http:Response|false|error|() { 23 | req.setHeader(Header\ Name, Header\ Value); 24 | return (); 25 | } 26 | 27 | @mediation:ResponseFlow 28 | public function setHeaderInResponse(mediation:Context ctx, http:Request req, http:Response res, string Header\ Name, 29 | string Header\ Value) returns http:Response|false|error|() { 30 | res.setHeader(Header\ Name, Header\ Value); 31 | return (); 32 | } 33 | 34 | @mediation:FaultFlow 35 | public function setHeaderInFaultResponse(mediation:Context ctx, http:Request req, http:Response? resp, 36 | http:Response errFlowResp, error e, string Header\ Name, 37 | string Header\ Value) returns http:Response|false|error|() { 38 | errFlowResp.setHeader(Header\ Name, Header\ Value); 39 | return (); 40 | } 41 | -------------------------------------------------------------------------------- /guardrail-azure-content-safety-content-moderation/Package.md: -------------------------------------------------------------------------------- 1 | # Azure Content Safety Content Moderation 2 | 3 | ## Overview 4 | 5 | This policy provides the capability to integrate Azure Content Safety Content Moderation Service to filter out harmful content in request bodies and AI-generated responses. This guardrail checks for hate speech, sexual content, self-harm, and violence, and can be applied to both requests and responses. 6 | 7 | ## Usage 8 | 9 | This will be available to select when attaching mediation policies to an egress AI proxy component. The following policy parameters are available: 10 | 11 | - `Guardrail Name`: The name of the guardrail policy. This will be used for tracking purposes. 12 | - `Azure Content Safety Endpoint`: The endpoint URL of the Azure Content Safety service. 13 | - `Azure Content Safety Key`: The API key for authenticating with the Azure Content Safety service. 14 | - `Hate Severity Level`: The severity level for the hate category. 15 | - `Sexual Severity Level`: The severity level for the sexual content category. 16 | - `Self Harm Severity Level`: The severity level for the self-harm category. 17 | - `Violence Severity Level`: The severity level for the violence category. 18 | - `JSON Path`: The JSONPath expression used to extract content from the payload. If not specified, the entire payload will be used for validation. 19 | - `Passthrough on Error`: If enabled, the request or response is passed through without validation when the Azure Content Safety service is unavailable. Otherwise, a guardrail validation error is triggered. 20 | - `Show Guardrail Assessment`: When enabled, the error response will include detailed information about the reason for the guardrail intervention. 21 | 22 | The policy can be attached multiple time to a resource if multiple Azure Content Safety Content Moderations are required. The policy can be applied to the request flow and the response flow of the API resource. 23 | -------------------------------------------------------------------------------- /mediation-json-to-xml/policy.bal: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 WSO2 LLC (http://www.wso2.org) All Rights Reserved. 2 | // 3 | // WSO2 LLC licenses this file to you under the Apache License, 4 | // Version 2.0 (the "License"); you may not use this file except 5 | // in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, 11 | // software distributed under the License is distributed on an 12 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 13 | // KIND, either express or implied. See the License for the 14 | // specific language governing permissions and limitations 15 | // under the License. 16 | 17 | import choreo/mediation; 18 | import ballerina/xmldata; 19 | import ballerina/mime; 20 | import ballerina/http; 21 | 22 | @mediation:RequestFlow 23 | public function jsonToXmlIn(mediation:Context ctx, http:Request req) returns http:Response|false|error|() { 24 | json jsonPayload = check req.getJsonPayload(); 25 | xml? xmlPayload = check xmldata:fromJson(jsonPayload); 26 | 27 | if xmlPayload is () { 28 | http:Response errResp = new; 29 | errResp.statusCode = http:STATUS_INTERNAL_SERVER_ERROR; 30 | return errResp; 31 | } 32 | 33 | req.setXmlPayload(xmlPayload); 34 | return (); 35 | } 36 | 37 | @mediation:ResponseFlow 38 | public function jsonToXmlOut(mediation:Context ctx, http:Request req, http:Response res) returns http:Response|false|error|() { 39 | json jsonPayload = check res.getJsonPayload(); 40 | xml? xmlPayload = check xmldata:fromJson(jsonPayload); 41 | 42 | if xmlPayload is () { 43 | http:Response errResp = new; 44 | errResp.statusCode = http:STATUS_INTERNAL_SERVER_ERROR; 45 | return errResp; 46 | } 47 | 48 | res.setXmlPayload(xmlPayload, mime:APPLICATION_XML); 49 | return (); 50 | } 51 | -------------------------------------------------------------------------------- /guardrail-azure-content-safety-content-moderation/policy.bal: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 WSO2 LLC (http://www.wso2.org) All Rights Reserved. 2 | // 3 | // WSO2 LLC licenses this file to you under the Apache License, 4 | // Version 2.0 (the "License"); you may not use this file except 5 | // in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, 11 | // software distributed under the License is distributed on an 12 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 13 | // KIND, either express or implied. See the License for the 14 | // specific language governing permissions and limitations 15 | // under the License. 16 | 17 | import ballerina/http; 18 | import choreo/mediation; 19 | 20 | @mediation:RequestFlow 21 | public function azureContentSafetyContentModeration_In(mediation:Context ctx, http:Request req, string Guardrail\ Name, string Azure\ Content\ Safety\ Endpoint, 22 | string Azure\ Content\ Safety\ Key, int Hate\ Severity\ Level = -1, int Sexual\ Severity\ Level = -1, int Self\ Harm\ Severity\ Level = -1, 23 | int Violence\ Severity\ Level = -1, string JSON\ Path = "", boolean Passthrough\ On\ Error = false, boolean Show\ Guardrail\ Assessment = false) 24 | returns http:Response|false|error|() { 25 | return; 26 | } 27 | 28 | @mediation:ResponseFlow 29 | public function azureContentSafetyContentModeration_Out(mediation:Context ctx, http:Request req, http:Response res, string Guardrail\ Name, string Azure\ Content\ Safety\ Endpoint, 30 | string Azure\ Content\ Safety\ Key, int Hate\ Severity\ Level = -1, int Sexual\ Severity\ Level = -1, int Self\ Harm\ Severity\ Level = -1, 31 | int Violence\ Severity\ Level = -1, string JSON\ Path = "", boolean Passthrough\ On\ Error = false, boolean Show\ Guardrail\ Assessment = false) 32 | returns http:Response|false|error|() { 33 | return; 34 | } 35 | -------------------------------------------------------------------------------- /guardrail-semantic-cache/policy.bal: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 WSO2 LLC (http://www.wso2.org) All Rights Reserved. 2 | // 3 | // WSO2 LLC licenses this file to you under the Apache License, 4 | // Version 2.0 (the "License"); you may not use this file except 5 | // in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, 11 | // software distributed under the License is distributed on an 12 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 13 | // KIND, either express or implied. See the License for the 14 | // specific language governing permissions and limitations 15 | // under the License. 16 | 17 | import ballerina/http; 18 | import choreo/mediation; 19 | 20 | @mediation:RequestFlow 21 | public function semanticCache_In(mediation:Context ctx, http:Request req, string Auth\ Header\ Name, string API\ Key, string Embedding\ Provider, string Embedding\ Model\ Name, string Embedding\ Upstream\ URL, 22 | int Dimensions, string Threshold, string Vector\ Store, string Host, int Port, string Database, string Username, string Password 23 | ) returns http:Response|false|error? { 24 | // This is an empty function to list this policy as an egress AI policy. 25 | // The actual logic is implemented in the Egress Gateway instead of utilizing ballerina mediation server. 26 | return; 27 | } 28 | 29 | @mediation:ResponseFlow 30 | public function semanticCache_Out(mediation:Context ctx, http:Request req, http:Response res, string Auth\ Header\ Name, string API\ Key, string Embedding\ Provider, string Embedding\ Model\ Name, string Embedding\ Upstream\ URL, 31 | int Dimensions, string Threshold, string Vector\ Store, string Host, int Port, string Database, string Username, string Password 32 | ) returns http:Response|false|error? { 33 | // This is an empty function to list this policy as an egress AI policy. 34 | // The actual logic is implemented in the Egress Gateway instead of utilizing ballerina mediation server. 35 | return; 36 | } 37 | -------------------------------------------------------------------------------- /packages.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "mediation-add-header", 4 | "version": "2.0.0" 5 | }, 6 | { 7 | "name": "mediation-json-to-xml", 8 | "version": "2.0.0" 9 | }, 10 | { 11 | "name": "mediation-rewrite-resource-path", 12 | "version": "2.0.0" 13 | }, 14 | { 15 | "name": "mediation-xml-to-json", 16 | "version": "2.0.0" 17 | }, 18 | { 19 | "name": "mediation-set-header", 20 | "version": "2.0.0" 21 | }, 22 | { 23 | "name": "mediation-remove-header", 24 | "version": "2.0.0" 25 | }, 26 | { 27 | "name": "mediation-add-query-param", 28 | "version": "2.0.0" 29 | }, 30 | { 31 | "name": "mediation-remove-query-param", 32 | "version": "2.0.0" 33 | }, 34 | { 35 | "name": "mediation-log-message", 36 | "version": "2.0.1" 37 | }, 38 | { 39 | "name": "mediation-oauth", 40 | "version": "1.0.0" 41 | }, 42 | { 43 | "name": "guardrail-regex-guardrail", 44 | "version": "1.0.0" 45 | }, 46 | { 47 | "name": "guardrail-word-count-guardrail", 48 | "version": "1.0.0" 49 | }, 50 | { 51 | "name": "guardrail-sentence-count-guardrail", 52 | "version": "1.0.0" 53 | }, 54 | { 55 | "name": "guardrail-content-length-guardrail", 56 | "version": "1.0.0" 57 | }, 58 | { 59 | "name": "guardrail-url-guardrail", 60 | "version": "1.0.0" 61 | }, 62 | { 63 | "name": "guardrail-azure-content-safety-content-moderation", 64 | "version": "1.0.0" 65 | }, 66 | { 67 | "name": "guardrail-semantic-cache", 68 | "version": "1.0.0" 69 | }, 70 | { 71 | "name": "guardrail-aws-bedrock-guardrail", 72 | "version": "1.0.0" 73 | }, 74 | { 75 | "name": "guardrail-pii-masking-guardrails-ai", 76 | "version": "1.0.0" 77 | }, 78 | { 79 | "name": "guardrail-pii-masking-regex", 80 | "version": "1.0.0" 81 | } 82 | ] 83 | -------------------------------------------------------------------------------- /guardrail-aws-bedrock-guardrail/policy.bal: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 WSO2 LLC (http://www.wso2.org) All Rights Reserved. 2 | // 3 | // WSO2 LLC licenses this file to you under the Apache License, 4 | // Version 2.0 (the "License"); you may not use this file except 5 | // in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, 11 | // software distributed under the License is distributed on an 12 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 13 | // KIND, either express or implied. See the License for the 14 | // specific language governing permissions and limitations 15 | // under the License. 16 | 17 | import ballerina/http; 18 | import choreo/mediation; 19 | 20 | @mediation:RequestFlow 21 | public function awsBedrockGuardrail_In(mediation:Context ctx, http:Request req, string Guardrail\ Name, string AWS\ Guardrail\ ID, 22 | string AWS\ Guardrail\ Version, string AWS\ Guardrail\ Region, string AWS\ Access\ Key\ ID, string AWS\ Secret\ Access\ Key, 23 | string AWS\ Session\ Token = "", string AWS\ Role\ ARN = "", string AWS\ Role\ Region = "", string AWS\ Role\ External\ ID = "", string JSON\ Path = "", 24 | boolean Redact\ PII = false, boolean Passthrough\ On\ Error = false, boolean Show\ Guardrail\ Assessment = false) 25 | returns http:Response|false|error|() { 26 | return; 27 | } 28 | 29 | @mediation:ResponseFlow 30 | public function awsBedrockGuardrail_Out(mediation:Context ctx, http:Request req, http:Response res, string Guardrail\ Name, string AWS\ Guardrail\ ID, 31 | string AWS\ Guardrail\ Version, string AWS\ Guardrail\ Region, string AWS\ Access\ Key\ ID, string AWS\ Secret\ Access\ Key, string AWS\ Session\ Token = "", 32 | string AWS\ Role\ ARN = "", string AWS\ Role\ Region = "", string AWS\ Role\ External\ ID = "", string JSON\ Path = "", boolean Redact\ PII = false, 33 | boolean Passthrough\ On\ Error = false, boolean Show\ Guardrail\ Assessment = false) 34 | returns http:Response|false|error|() { 35 | return; 36 | } 37 | 38 | -------------------------------------------------------------------------------- /mediation-add-query-param/tests/utest_policy.bal: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 WSO2 LLC (http://www.wso2.org) All Rights Reserved. 2 | // 3 | // WSO2 LLC licenses this file to you under the Apache License, 4 | // Version 2.0 (the "License"); you may not use this file except 5 | // in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, 11 | // software distributed under the License is distributed on an 12 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 13 | // KIND, either express or implied. See the License for the 14 | // specific language governing permissions and limitations 15 | // under the License. 16 | 17 | import ballerina/http; 18 | import choreo/mediation; 19 | import ballerina/test; 20 | 21 | @test:Config {} 22 | public function testRequestFlowSingleInstance() { 23 | mediation:Context ctx = createContext("get", "/greet"); 24 | http:Response|false|error|() result = addQueryParam(ctx, new, "x", "y"); 25 | assertResult(result, ctx.queryParams(), {x: ["y"]}); 26 | } 27 | 28 | @test:Config {} 29 | public function testRequestFlowMultipleInstance() { 30 | mediation:Context ctx = createContext("get", "/greet"); 31 | http:Response|false|error|() result = addQueryParam(ctx, new, "arr", "1"); 32 | assertResult(result, ctx.queryParams(), {arr: ["1"]}); 33 | 34 | result = addQueryParam(ctx, new, "arr", "2"); 35 | assertResult(result, ctx.queryParams(), {arr: ["1", "2"]}); 36 | } 37 | 38 | function assertResult(http:Response|false|error|() result, anydata qParamMap, map expQParamMap) { 39 | if result !is () { 40 | test:assertFail("Expected '()', found " + (typeof result).toString()); 41 | } 42 | 43 | test:assertEquals(qParamMap, expQParamMap); 44 | } 45 | 46 | function createContext(string httpMethod, string resPath) returns mediation:Context { 47 | mediation:ResourcePath originalPath = checkpanic mediation:createImmutableResourcePath(resPath); 48 | mediation:Context originalCtx = 49 | mediation:createImmutableMediationContext(httpMethod, originalPath.pathSegments(), {}, {}); 50 | mediation:ResourcePath mutableResPath = checkpanic mediation:createMutableResourcePath(resPath); 51 | return mediation:createMutableMediationContext(originalCtx, mutableResPath.pathSegments(), {}, {}); 52 | } 53 | -------------------------------------------------------------------------------- /mediation-rewrite-resource-path/tests/utest_policy.bal: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 WSO2 LLC (http://www.wso2.org) All Rights Reserved. 2 | // 3 | // WSO2 LLC licenses this file to you under the Apache License, 4 | // Version 2.0 (the "License"); you may not use this file except 5 | // in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, 11 | // software distributed under the License is distributed on an 12 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 13 | // KIND, either express or implied. See the License for the 14 | // specific language governing permissions and limitations 15 | // under the License. 16 | 17 | import ballerina/http; 18 | import ballerina/test; 19 | import choreo/mediation; 20 | 21 | @test:Config {} 22 | public function testRequestFlowSingleInstance() { 23 | mediation:Context ctx = createContext("get", "/greet"); 24 | http:Response|false|error|() result = rewrite(ctx, new, "/new-greet"); 25 | assertResult(result, ctx.resourcePath().toString(), "/new-greet"); 26 | } 27 | 28 | @test:Config {} 29 | public function testRequestFlowMultipleInstance() { 30 | mediation:Context ctx = createContext("get", "/greet"); 31 | http:Response|false|error|() result = rewrite(ctx, new, "/foo-greet"); 32 | assertResult(result, ctx.resourcePath().toString(), "/foo-greet"); 33 | 34 | result = rewrite(ctx, new, "bar-greet"); 35 | assertResult(result, ctx.resourcePath().toString(), "/bar-greet"); 36 | } 37 | 38 | function assertResult(http:Response|false|error|() result, string resourcePath, string expResourcePath) { 39 | if !(result is ()) { 40 | test:assertFail("Expected '()', found " + (typeof result).toString()); 41 | } 42 | 43 | test:assertEquals(resourcePath, expResourcePath); 44 | } 45 | 46 | function createContext(string httpMethod, string resPath) returns mediation:Context { 47 | mediation:ResourcePath originalPath = checkpanic mediation:createImmutableResourcePath(resPath); 48 | mediation:Context originalCtx = 49 | mediation:createImmutableMediationContext(httpMethod, originalPath.pathSegments(), {}, {}); 50 | mediation:ResourcePath mutableResPath = checkpanic mediation:createMutableResourcePath(resPath); 51 | return mediation:createMutableMediationContext(originalCtx, mutableResPath.pathSegments(), {}, {}); 52 | } 53 | -------------------------------------------------------------------------------- /mediation-remove-query-param/tests/utest_policy.bal: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 WSO2 LLC (http://www.wso2.org) All Rights Reserved. 2 | // 3 | // WSO2 LLC licenses this file to you under the Apache License, 4 | // Version 2.0 (the "License"); you may not use this file except 5 | // in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, 11 | // software distributed under the License is distributed on an 12 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 13 | // KIND, either express or implied. See the License for the 14 | // specific language governing permissions and limitations 15 | // under the License. 16 | 17 | import ballerina/http; 18 | import choreo/mediation; 19 | import ballerina/test; 20 | 21 | @test:Config {} 22 | public function testRequestFlowSingleInstance() { 23 | mediation:Context ctx = createContext("get", "/greet"); 24 | ctx.addQueryParam("x", "y"); 25 | http:Response|false|error|() result = removeQueryParam(ctx, new, "x"); 26 | assertResult(result, ctx.queryParams(), {}); 27 | } 28 | 29 | @test:Config {} 30 | public function testRequestFlowMultipleInstance() { 31 | mediation:Context ctx = createContext("get", "/greet"); 32 | ctx.addQueryParam("arr", "1"); 33 | ctx.addQueryParam("arr", "2"); 34 | ctx.addQueryParam("x", "y"); 35 | http:Response|false|error|() result = removeQueryParam(ctx, new, "arr"); 36 | assertResult(result, ctx.queryParams(), {x: ["y"]}); 37 | 38 | result = removeQueryParam(ctx, new, "x"); 39 | assertResult(result, ctx.queryParams(), {}); 40 | } 41 | 42 | function assertResult(http:Response|false|error|() result, anydata qParamMap, map expQParamMap) { 43 | if result !is () { 44 | test:assertFail("Expected '()', found " + (typeof result).toString()); 45 | } 46 | 47 | test:assertEquals(qParamMap, expQParamMap); 48 | } 49 | 50 | function createContext(string httpMethod, string resPath) returns mediation:Context { 51 | mediation:ResourcePath originalPath = checkpanic mediation:createImmutableResourcePath(resPath); 52 | mediation:Context originalCtx = 53 | mediation:createImmutableMediationContext(httpMethod, originalPath.pathSegments(), {}, {}); 54 | mediation:ResourcePath mutableResPath = checkpanic mediation:createMutableResourcePath(resPath); 55 | return mediation:createMutableMediationContext(originalCtx, mutableResPath.pathSegments(), {}, {}); 56 | } 57 | -------------------------------------------------------------------------------- /mediation-log-message/utils.bal: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 WSO2 LLC (http://www.wso2.org) All Rights Reserved. 2 | // 3 | // WSO2 LLC licenses this file to you under the Apache License, 4 | // Version 2.0 (the "License"); you may not use this file except 5 | // in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, 11 | // software distributed under the License is distributed on an 12 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 13 | // KIND, either express or implied. See the License for the 14 | // specific language governing permissions and limitations 15 | // under the License. 16 | 17 | import ballerina/http; 18 | import ballerina/regex; 19 | 20 | function buildRequestHeadersMap(http:Request req, string excluded) returns map { 21 | map headers = {}; 22 | map<()> excludedHeaders = getHeaderNames(excluded); // using map<()> to in lieu of a set 23 | 24 | foreach var name in req.getHeaderNames() { 25 | string[] values = checkpanic req.getHeaders(name); 26 | 27 | if excludedHeaders.hasKey(name.toLowerAscii()) { 28 | continue; 29 | } 30 | 31 | if name.equalsIgnoreCaseAscii(http:AUTHORIZATION) { 32 | headers[name] = "***"; 33 | continue; 34 | } 35 | 36 | if values.length() == 1 { 37 | headers[name] = values[0]; 38 | } else { 39 | headers[name] = values; 40 | } 41 | } 42 | 43 | return headers; 44 | } 45 | 46 | function buildResponseHeadersMap(http:Response res, string excluded) returns map { 47 | map headers = {}; 48 | map<()> excludedHeaders = getHeaderNames(excluded); // using map<()> to in lieu of a set 49 | 50 | foreach var name in res.getHeaderNames() { 51 | string[] values = checkpanic res.getHeaders(name); 52 | 53 | if excludedHeaders.hasKey(name.toLowerAscii()) { 54 | continue; 55 | } 56 | 57 | if values.length() == 1 { 58 | headers[name] = values[0]; 59 | } else { 60 | headers[name] = values; 61 | } 62 | } 63 | 64 | return headers; 65 | } 66 | 67 | function getHeaderNames(string excluded) returns map<()> { 68 | string[] names = regex:split(excluded, ","); 69 | map<()> excludedHeaders = {}; 70 | 71 | foreach var name in names { 72 | excludedHeaders[name.trim().toLowerAscii()] = (); 73 | } 74 | 75 | return excludedHeaders; 76 | } 77 | -------------------------------------------------------------------------------- /mediation-json-to-xml/tests/utest_policy.bal: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 WSO2 LLC (http://www.wso2.org) All Rights Reserved. 2 | // 3 | // WSO2 LLC licenses this file to you under the Apache License, 4 | // Version 2.0 (the "License"); you may not use this file except 5 | // in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, 11 | // software distributed under the License is distributed on an 12 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 13 | // KIND, either express or implied. See the License for the 14 | // specific language governing permissions and limitations 15 | // under the License. 16 | 17 | import ballerina/http; 18 | import ballerina/test; 19 | import choreo/mediation; 20 | 21 | json originalPayload = {"name": "John Doe", "greeting": "Hello World!"}; 22 | xml expPayload = xml `John DoeHello World!`; 23 | 24 | @test:Config {} 25 | public function testRequestFlowSingleInstance() { 26 | http:Request req = new; 27 | req.setJsonPayload(originalPayload); 28 | http:Response|false|error|() result = jsonToXmlIn(createContext("get", "/greet"), req); 29 | assertResult(result, req.getXmlPayload(), expPayload); 30 | } 31 | 32 | @test:Config {} 33 | public function testResponseFlowSingleInstance() { 34 | http:Response res = new; 35 | res.setJsonPayload(originalPayload); 36 | http:Response|false|error|() result = jsonToXmlOut(createContext("get", "/greet"), new, res); 37 | assertResult(result, res.getXmlPayload(), expPayload); 38 | } 39 | 40 | function assertResult(http:Response|false|error|() result, xml|http:ClientError payload, xml expVal) { 41 | if !(result is ()) { 42 | test:assertFail("Expected '()', found " + (typeof result).toString()); 43 | } 44 | 45 | if payload is http:ClientError { 46 | test:assertFail("Failed to retrieve a valid XML payload"); 47 | } 48 | 49 | test:assertEquals(payload, expVal); 50 | } 51 | 52 | function createContext(string httpMethod, string resPath) returns mediation:Context { 53 | mediation:ResourcePath originalPath = checkpanic mediation:createImmutableResourcePath(resPath); 54 | mediation:Context originalCtx = 55 | mediation:createImmutableMediationContext(httpMethod, originalPath.pathSegments(), {}, {}); 56 | mediation:ResourcePath mutableResPath = checkpanic mediation:createMutableResourcePath(resPath); 57 | return mediation:createMutableMediationContext(originalCtx, mutableResPath.pathSegments(), {}, {}); 58 | } 59 | -------------------------------------------------------------------------------- /mediation-xml-to-json/tests/utest_policy.bal: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 WSO2 LLC (http://www.wso2.org) All Rights Reserved. 2 | // 3 | // WSO2 LLC licenses this file to you under the Apache License, 4 | // Version 2.0 (the "License"); you may not use this file except 5 | // in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, 11 | // software distributed under the License is distributed on an 12 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 13 | // KIND, either express or implied. See the License for the 14 | // specific language governing permissions and limitations 15 | // under the License. 16 | 17 | import ballerina/http; 18 | import ballerina/test; 19 | import choreo/mediation; 20 | 21 | xml originalPayload = xml `John DoeHello World!`; 22 | json expPayload = {"greeting": {"name": "John Doe", "message": "Hello World!"}}; 23 | 24 | @test:Config {} 25 | public function testRequestFlowSingleInstance() { 26 | http:Request req = new; 27 | req.setXmlPayload(originalPayload); 28 | http:Response|false|error|() result = xmlToJsonIn(createContext("get", "/greet"), req); 29 | assertResult(result, req.getJsonPayload(), expPayload); 30 | } 31 | 32 | @test:Config {} 33 | public function testResponseFlowSingleInstance() { 34 | http:Response res = new; 35 | res.setXmlPayload(originalPayload); 36 | http:Response|false|error|() result = xmlToJsonOut(createContext("get", "/greet"), new, res); 37 | assertResult(result, res.getJsonPayload(), expPayload); 38 | } 39 | 40 | function assertResult(http:Response|false|error|() result, json|http:ClientError payload, json expVal) { 41 | if !(result is ()) { 42 | test:assertFail("Expected '()', found " + (typeof result).toString()); 43 | } 44 | 45 | if payload is http:ClientError { 46 | test:assertFail("Failed to retrieve a valid JSON payload"); 47 | } 48 | 49 | test:assertEquals(payload, expVal); 50 | } 51 | 52 | function createContext(string httpMethod, string resPath) returns mediation:Context { 53 | mediation:ResourcePath originalPath = checkpanic mediation:createImmutableResourcePath(resPath); 54 | mediation:Context originalCtx = 55 | mediation:createImmutableMediationContext(httpMethod, originalPath.pathSegments(), {}, {}); 56 | mediation:ResourcePath mutableResPath = checkpanic mediation:createMutableResourcePath(resPath); 57 | return mediation:createMutableMediationContext(originalCtx, mutableResPath.pathSegments(), {}, {}); 58 | } 59 | -------------------------------------------------------------------------------- /pull_request_template.md: -------------------------------------------------------------------------------- 1 | ## Purpose 2 | > Describe the problems, issues, or needs driving this feature/fix and include links to related issues in the following format: Resolves issue1, issue2, etc. 3 | 4 | ## Goals 5 | > Describe the solutions that this feature/fix will introduce to resolve the problems described above 6 | 7 | ## Approach 8 | > Describe how you are implementing the solutions. Include an animated GIF or screenshot if the change affects the UI (email documentation@wso2.com to review all UI text). Include a link to a Markdown file or Google doc if the feature write-up is too long to paste here. 9 | 10 | ## User stories 11 | > Summary of user stories addressed by this change> 12 | 13 | ## Release note 14 | > Brief description of the new feature or bug fix as it will appear in the release notes 15 | 16 | ## Documentation 17 | > Link(s) to product documentation that addresses the changes of this PR. If no doc impact, enter “N/A” plus brief explanation of why there’s no doc impact 18 | 19 | ## Training 20 | > Link to the PR for changes to the training content in https://github.com/wso2/WSO2-Training, if applicable 21 | 22 | ## Certification 23 | > Type “Sent” when you have provided new/updated certification questions, plus four answers for each question (correct answer highlighted in bold), based on this change. Certification questions/answers should be sent to certification@wso2.com and NOT pasted in this PR. If there is no impact on certification exams, type “N/A” and explain why. 24 | 25 | ## Marketing 26 | > Link to drafts of marketing content that will describe and promote this feature, including product page changes, technical articles, blog posts, videos, etc., if applicable 27 | 28 | ## Automation tests 29 | - Unit tests 30 | > Code coverage information 31 | - Integration tests 32 | > Details about the test cases and coverage 33 | 34 | ## Security checks 35 | - Followed secure coding standards in http://wso2.com/technical-reports/wso2-secure-engineering-guidelines? yes/no 36 | - Ran FindSecurityBugs plugin and verified report? yes/no 37 | - Confirmed that this PR doesn't commit any keys, passwords, tokens, usernames, or other secrets? yes/no 38 | 39 | ## Samples 40 | > Provide high-level details about the samples related to this feature 41 | 42 | ## Related PRs 43 | > List any other related PRs 44 | 45 | ## Migrations (if applicable) 46 | > Describe migration steps and platforms on which migration has been tested 47 | 48 | ## Test environment 49 | > List all JDK versions, operating systems, databases, and browser/versions on which this feature/fix was tested 50 | 51 | ## Learning 52 | > Describe the research phase and any blog posts, patterns, libraries, or add-ons you used to solve the problem. -------------------------------------------------------------------------------- /guardrail-aws-bedrock-guardrail/Package.md: -------------------------------------------------------------------------------- 1 | # AWS Bedrock Guardrail 2 | 3 | ## Overview 4 | 5 | This policy provides the capability to integrate with AWS Bedrock Guardrails to enable real-time content safety validation and PII protection for AI applications. Through the configured Bedrock Guardrail, it can detect and block harmful content (hate speech, sexual content, self-harm, violence) and mask or redact Personally Identifiable Information (PII) in both request and response payloads. This integration helps ensure AI applications meet safety standards and compliance requirements while protecting against malicious prompt injection attacks. 6 | 7 | ## Usage 8 | 9 | This will be available to select when attaching mediation policies to an egress AI proxy component. The following policy parameters are available: 10 | 11 | - `Guardrail Name`: The name of the guardrail policy. This will be used for tracking purposes. 12 | - `AWS Guardrail ID`: The ID of the AWS Bedrock Guardrail resource. 13 | - `AWS Guardrail Version`: The version of the AWS Bedrock Guardrail resource. 14 | - `AWS Guardrail Region`: The deployed region of the AWS Bedrock Guardrail resource. 15 | - `AWS Access Key ID`: The AWS Access Key ID used to authenticate with the AWS Bedrock service. 16 | - `AWS Secret Access Key`: The AWS Secret Access Key used to authenticate with the AWS Bedrock service. 17 | - `AWS Session Token`: The AWS Session Token used to authenticate with the AWS Bedrock service. 18 | - `AWS Role ARN`: The ARN of the IAM role to assume for accessing the AWS Bedrock Guardrail service. This is optional and can be used if you want to use a role instead of access keys. 19 | - `AWS Role Region`: The AWS region where the IAM role is deployed. This is optional and can be used if you want to use a role instead of access keys. 20 | - `AWS Role External ID`: The external ID used for the AWS role assumption. This is optional and can be used if you want to use a role instead of access keys. 21 | - `JSON Path`: The JSONPath expression used to extract content from the payload. If not specified, the entire payload will be used for validation. 22 | - `Redact PII`: When enabled, detected PIIs are redacted and will not be restored to its original form. This should be enabled when the policy is attached to the response flow to prevent exposing AI-generated content with sensitive data to the client. When disabled and applied to the request flow, detected PII is temporarily masked and automatically restored in the corresponding response. 23 | - `Passthrough on Error`: If enabled, the request or response is passed through without validation when the AWS Bedrock service is unavailable. Otherwise, a guardrail validation error is triggered. 24 | - `Show Guardrail Assessment`: When enabled, the error response will include detailed information about the reason for the guardrail intervention. 25 | 26 | The policy can be attached multiple time to a resource if multiple AWS Bedrock Guardrails are required. The policy can be applied to the request flow and the response flow of the API resource. 27 | -------------------------------------------------------------------------------- /.github/workflows/release-build.yml: -------------------------------------------------------------------------------- 1 | name: Release Candidate Build 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | permissions: write-all 7 | 8 | env: 9 | BAL_VERSION: 2201.5.5 10 | 11 | jobs: 12 | rc-build-on-dev-central: 13 | name: Build RC using Dev Central 14 | runs-on: ubuntu-latest 15 | steps: 16 | - uses: actions/checkout@v3 17 | - name: Install Ballerina 18 | run: | 19 | BAL_INSTALLER=ballerina-$BAL_VERSION-swan-lake-linux-x64.deb 20 | wget https://dist.ballerina.io/downloads/$BAL_VERSION/$BAL_INSTALLER 21 | sudo dpkg -i $BAL_INSTALLER 22 | - uses: actions/setup-python@v4 23 | with: 24 | python-version: '3.10' 25 | - name: Install Python Dependencies 26 | run: | 27 | pip install toml 28 | pip install semantic-version 29 | pip install gitpython 30 | pip install PyGithub 31 | - name: Build Policies 32 | env: 33 | BALLERINA_CENTRAL_ACCESS_TOKEN: ${{ secrets.BAL_DEV_CENTRAL_TOKEN }} 34 | BALLERINA_DEV_CENTRAL: true 35 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 36 | run: | 37 | python build.py release 38 | 39 | rc-build-on-stage-central: 40 | name: Build RC using Stage Central 41 | runs-on: ubuntu-latest 42 | steps: 43 | - uses: actions/checkout@v3 44 | - name: Install Ballerina 45 | run: | 46 | BAL_INSTALLER=ballerina-$BAL_VERSION-swan-lake-linux-x64.deb 47 | wget https://dist.ballerina.io/downloads/$BAL_VERSION/$BAL_INSTALLER 48 | sudo dpkg -i $BAL_INSTALLER 49 | - uses: actions/setup-python@v4 50 | with: 51 | python-version: '3.10' 52 | - name: Install Python Dependencies 53 | run: | 54 | pip install toml 55 | pip install semantic-version 56 | pip install gitpython 57 | pip install PyGithub 58 | - name: Build Policies 59 | env: 60 | BALLERINA_CENTRAL_ACCESS_TOKEN: ${{ secrets.BAL_STAGING_CENTRAL_TOKEN }} 61 | BALLERINA_STAGE_CENTRAL: true 62 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 63 | run: | 64 | python build.py release 65 | 66 | rc-build-on-prod-central: 67 | name: Build RC using Prod Central 68 | runs-on: ubuntu-latest 69 | steps: 70 | - uses: actions/checkout@v3 71 | - name: Install Ballerina 72 | run: | 73 | BAL_INSTALLER=ballerina-$BAL_VERSION-swan-lake-linux-x64.deb 74 | wget https://dist.ballerina.io/downloads/$BAL_VERSION/$BAL_INSTALLER 75 | sudo dpkg -i $BAL_INSTALLER 76 | - uses: actions/setup-python@v4 77 | with: 78 | python-version: '3.10' 79 | - name: Install Python Dependencies 80 | run: | 81 | pip install toml 82 | pip install semantic-version 83 | pip install gitpython 84 | pip install PyGithub 85 | - name: Configure Git 86 | run: | 87 | git config user.name "github-actions[bot]" 88 | git config user.email "github-actions[bot]@users.noreply.github.com" 89 | git checkout -b release-$(git show --pretty=%H HEAD --no-patch) 90 | - name: Build Policies 91 | env: 92 | BALLERINA_CENTRAL_ACCESS_TOKEN: ${{ secrets.BAL_PROD_CENTRAL_TOKEN }} 93 | BALLERINA_PROD_CENTRAL: true 94 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 95 | run: | 96 | python build.py release 97 | -------------------------------------------------------------------------------- /mediation-remove-header/tests/utest_policy.bal: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 WSO2 LLC (http://www.wso2.org) All Rights Reserved. 2 | // 3 | // WSO2 LLC licenses this file to you under the Apache License, 4 | // Version 2.0 (the "License"); you may not use this file except 5 | // in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, 11 | // software distributed under the License is distributed on an 12 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 13 | // KIND, either express or implied. See the License for the 14 | // specific language governing permissions and limitations 15 | // under the License. 16 | 17 | import ballerina/http; 18 | import ballerina/test; 19 | import choreo/mediation; 20 | 21 | @test:Config {} 22 | public function testRequestFlowSingleInstance() { 23 | http:Request req = new; 24 | req.addHeader("x-foo", "request-flow"); 25 | http:Response|false|error|() result = removeHeaderRequestFlow(createContext("get", "/greet"), req, "x-foo"); 26 | assertResult(result, req.getHeaders("x-foo")); 27 | } 28 | 29 | @test:Config {} 30 | public function testResponseFlowSingleInstance() { 31 | http:Response res = new; 32 | res.addHeader("x-foo", "response-flow"); 33 | http:Response|false|error|() result = removeHeaderResponseFlow(createContext("get", "/greet"), new, res, "x-foo"); 34 | assertResult(result, res.getHeaders("x-foo")); 35 | } 36 | 37 | @test:Config {} 38 | public function testFaultFlowSingleInstance() { 39 | http:Response errRes = new; 40 | http:Response|false|error|() result = removeHeaderFaultFlow(createContext("get", "/greet"), new, (), errRes, error("Error"), "x-foo"); 41 | assertResult(result, errRes.getHeaders("x-foo")); 42 | } 43 | 44 | @test:Config {} 45 | public function testRequestFlowMultipleInstances() { 46 | http:Request req = new; 47 | req.addHeader("x-foo", "request-h1"); 48 | req.addHeader("x-foo", "request-h2"); 49 | req.addHeader("x-bar", "request-h3"); 50 | 51 | http:Response|false|error|() result = removeHeaderRequestFlow(createContext("get", "/greet"), req, "x-foo"); 52 | assertResult(result, req.getHeaders("x-foo")); 53 | 54 | result = removeHeaderRequestFlow(createContext("get", "/greet"), req, "x-bar"); 55 | assertResult(result, req.getHeaders("x-bar")); 56 | 57 | result = removeHeaderRequestFlow(createContext("get", "/greet"), req, "x-foo"); 58 | assertResult(result, req.getHeaders("x-foo")); 59 | } 60 | 61 | function assertResult(http:Response|false|error|() result, string[]|http:HeaderNotFoundError headers) { 62 | if result !is () { 63 | test:assertFail("Expected '()', found " + (typeof result).toString()); 64 | } 65 | 66 | if headers is string[] { 67 | test:assertFail("Header 'x-foo' is present in the request"); 68 | } 69 | } 70 | 71 | function createContext(string httpMethod, string resPath) returns mediation:Context { 72 | mediation:ResourcePath originalPath = checkpanic mediation:createImmutableResourcePath(resPath); 73 | mediation:Context originalCtx = 74 | mediation:createImmutableMediationContext(httpMethod, originalPath.pathSegments(), {}, {}); 75 | mediation:ResourcePath mutableResPath = checkpanic mediation:createMutableResourcePath(resPath); 76 | return mediation:createMutableMediationContext(originalCtx, mutableResPath.pathSegments(), {}, {}); 77 | } 78 | -------------------------------------------------------------------------------- /.github/workflows/pr-build.yml: -------------------------------------------------------------------------------- 1 | name: PR Build 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - main 7 | 8 | env: 9 | BAL_VERSION: 2201.5.5 10 | 11 | jobs: 12 | pr-build-on-dev-central: 13 | name: Build PR using Dev Central 14 | runs-on: ubuntu-latest 15 | steps: 16 | - name: Checkout Repository 17 | uses: actions/checkout@v3 18 | with: 19 | token: ${{ secrets.GITHUB_TOKEN }} 20 | - name: Install Ballerina 21 | run: | 22 | BAL_INSTALLER=ballerina-$BAL_VERSION-swan-lake-linux-x64.deb 23 | wget https://dist.ballerina.io/downloads/$BAL_VERSION/$BAL_INSTALLER 24 | sudo dpkg -i $BAL_INSTALLER 25 | - uses: actions/setup-python@v4 26 | with: 27 | python-version: '3.10' 28 | - name: Install Python Dependencies 29 | run: | 30 | pip install toml 31 | pip install semantic-version 32 | pip install gitpython 33 | pip install PyGithub 34 | - name: Build Policies 35 | env: 36 | BALLERINA_CENTRAL_ACCESS_TOKEN: ${{ secrets.BAL_DEV_CENTRAL_TOKEN }} 37 | BALLERINA_DEV_CENTRAL: true 38 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 39 | run: | 40 | python build.py build 41 | 42 | pr-build-on-stage-central: 43 | name: Build PR using Stage Central 44 | runs-on: ubuntu-latest 45 | steps: 46 | - name: Checkout Repository 47 | uses: actions/checkout@v3 48 | with: 49 | token: ${{ secrets.GITHUB_TOKEN }} 50 | - name: Install Ballerina 51 | run: | 52 | BAL_INSTALLER=ballerina-$BAL_VERSION-swan-lake-linux-x64.deb 53 | wget https://dist.ballerina.io/downloads/$BAL_VERSION/$BAL_INSTALLER 54 | sudo dpkg -i $BAL_INSTALLER 55 | - uses: actions/setup-python@v4 56 | with: 57 | python-version: '3.10' 58 | - name: Install Python Dependencies 59 | run: | 60 | pip install toml 61 | pip install semantic-version 62 | pip install gitpython 63 | pip install PyGithub 64 | - name: Build Policies 65 | env: 66 | BALLERINA_CENTRAL_ACCESS_TOKEN: ${{ secrets.BAL_STAGING_CENTRAL_TOKEN }} 67 | BALLERINA_STAGE_CENTRAL: true 68 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 69 | run: | 70 | python build.py build 71 | 72 | pr-build-on-prod-central: 73 | name: Build PR using Prod Central 74 | runs-on: ubuntu-latest 75 | steps: 76 | - name: Checkout Repository 77 | uses: actions/checkout@v3 78 | with: 79 | token: ${{ secrets.GITHUB_TOKEN }} 80 | - name: Install Ballerina 81 | run: | 82 | BAL_INSTALLER=ballerina-$BAL_VERSION-swan-lake-linux-x64.deb 83 | wget https://dist.ballerina.io/downloads/$BAL_VERSION/$BAL_INSTALLER 84 | sudo dpkg -i $BAL_INSTALLER 85 | - uses: actions/setup-python@v4 86 | with: 87 | python-version: '3.10' 88 | - name: Install Python Dependencies 89 | run: | 90 | pip install toml 91 | pip install semantic-version 92 | pip install gitpython 93 | pip install PyGithub 94 | - name: Build Policies 95 | env: 96 | BALLERINA_CENTRAL_ACCESS_TOKEN: ${{ secrets.BAL_PROD_CENTRAL_TOKEN }} 97 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 98 | run: | 99 | python build.py build 100 | -------------------------------------------------------------------------------- /mediation-set-header/tests/utest_policy.bal: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 WSO2 LLC (http://www.wso2.org) All Rights Reserved. 2 | // 3 | // WSO2 LLC licenses this file to you under the Apache License, 4 | // Version 2.0 (the "License"); you may not use this file except 5 | // in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, 11 | // software distributed under the License is distributed on an 12 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 13 | // KIND, either express or implied. See the License for the 14 | // specific language governing permissions and limitations 15 | // under the License. 16 | 17 | import ballerina/http; 18 | import ballerina/test; 19 | import choreo/mediation; 20 | 21 | @test:Config {} 22 | public function testRequestFlowSingleInstance() { 23 | http:Request req = new; 24 | req.setHeader("x-foo", "FooOriginal"); 25 | http:Response|false|error|() result = setHeaderInRequest(createContext("get", "/greet"), req, "x-foo", "FooNew"); 26 | 27 | if result !is () { 28 | test:assertFail("Expected '()', found " + (typeof result).toString()); 29 | } 30 | 31 | string[]|http:HeaderNotFoundError headers = req.getHeaders("x-foo"); 32 | 33 | if headers is http:HeaderNotFoundError { 34 | test:assertFail("Header 'x-foo' not found in the request"); 35 | } 36 | 37 | test:assertEquals(headers, ["FooNew"]); 38 | } 39 | 40 | @test:Config {} 41 | public function testResponseFlowSingleInstance() { 42 | http:Response res = new; 43 | res.setHeader("x-foo", "FooOriginal"); 44 | http:Response|false|error|() result = setHeaderInResponse(createContext("get", "/greet"), new, res, "x-foo", "FooNew"); 45 | assertResult(result, res.getHeaders("x-foo"), "FooNew"); 46 | } 47 | 48 | @test:Config {} 49 | public function testFaultFlowSingleInstance() { 50 | http:Response errRes = new; 51 | errRes.setHeader("x-foo", "FooOriginal"); 52 | http:Response|false|error|() result = setHeaderInFaultResponse(createContext("get", "/greet"), new, (), errRes, error("Error"), "x-foo", "FooNew"); 53 | assertResult(result, errRes.getHeaders("x-foo"), "FooNew"); 54 | } 55 | 56 | @test:Config {} 57 | public function testRequestFlowMultipleInstances() { 58 | http:Request req = new; 59 | http:Response|false|error|() result = setHeaderInRequest(createContext("get", "/greet"), req, "x-foo", "FooIn1"); 60 | assertResult(result, req.getHeaders("x-foo"), "FooIn1"); 61 | 62 | result = setHeaderInRequest(createContext("get", "/greet"), req, "x-bar", "BarIn"); 63 | assertResult(result, req.getHeaders("x-bar"), "BarIn"); 64 | 65 | result = setHeaderInRequest(createContext("get", "/greet"), req, "x-foo", "FooIn2"); 66 | assertResult(result, req.getHeaders("x-foo"), "FooIn2"); 67 | } 68 | 69 | function assertResult(http:Response|false|error|() result, string[]|http:HeaderNotFoundError headers, string... expVal) { 70 | if !(result is ()) { 71 | test:assertFail("Expected '()', found " + (typeof result).toString()); 72 | } 73 | 74 | if headers is http:HeaderNotFoundError { 75 | test:assertFail("Header 'x-foo' not found in the request"); 76 | } 77 | 78 | test:assertEquals(headers, expVal); 79 | } 80 | 81 | function createContext(string httpMethod, string resPath) returns mediation:Context { 82 | mediation:ResourcePath originalPath = checkpanic mediation:createImmutableResourcePath(resPath); 83 | mediation:Context originalCtx = 84 | mediation:createImmutableMediationContext(httpMethod, originalPath.pathSegments(), {}, {}); 85 | mediation:ResourcePath mutableResPath = checkpanic mediation:createMutableResourcePath(resPath); 86 | return mediation:createMutableMediationContext(originalCtx, mutableResPath.pathSegments(), {}, {}); 87 | } 88 | -------------------------------------------------------------------------------- /mediation-add-header/tests/utest_policy.bal: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 WSO2 LLC (http://www.wso2.org) All Rights Reserved. 2 | // 3 | // WSO2 LLC licenses this file to you under the Apache License, 4 | // Version 2.0 (the "License"); you may not use this file except 5 | // in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, 11 | // software distributed under the License is distributed on an 12 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 13 | // KIND, either express or implied. See the License for the 14 | // specific language governing permissions and limitations 15 | // under the License. 16 | 17 | import ballerina/http; 18 | import choreo/mediation; 19 | import ballerina/test; 20 | 21 | @test:Config {} 22 | public function testRequestFlowSingleInstance() { 23 | http:Request req = new; 24 | http:Response|false|error|() result = addHeader_In(createContext("get", "/greet"), req, "x-foo", "FooIn"); 25 | 26 | if result !is () { 27 | test:assertFail("Expected '()', found " + (typeof result).toString()); 28 | } 29 | 30 | string[]|http:HeaderNotFoundError headers = req.getHeaders("x-foo"); 31 | 32 | if headers is http:HeaderNotFoundError { 33 | test:assertFail("Header 'x-foo' not found in the request"); 34 | } 35 | 36 | test:assertEquals(headers, ["FooIn"]); 37 | } 38 | 39 | @test:Config {} 40 | public function testResponseFlowSingleInstance() { 41 | http:Response res = new; 42 | http:Response|false|error|() result = addHeader_Out(createContext("get", "/greet"), new, res, "x-foo", "FooOut"); 43 | assertResult(result, res.getHeaders("x-foo"), "FooOut"); 44 | } 45 | 46 | @test:Config {} 47 | public function testFaultFlowSingleInstance() { 48 | http:Response errRes = new; 49 | http:Response|false|error|() result = addHeader_Fault(createContext("get", "/greet"), new, (), errRes, error("Error"), "x-foo", "FooFault"); 50 | assertResult(result, errRes.getHeaders("x-foo"), "FooFault"); 51 | } 52 | 53 | @test:Config {} 54 | public function testRequestFlowMultipleInstances() { 55 | http:Request req = new; 56 | http:Response|false|error|() result = addHeader_In(createContext("get", "/greet"), req, "x-foo", "FooIn1"); 57 | assertResult(result, req.getHeaders("x-foo"), "FooIn1"); 58 | 59 | result = addHeader_In(createContext("get", "/greet"), req, "x-bar", "BarIn"); 60 | assertResult(result, req.getHeaders("x-bar"), "BarIn"); 61 | 62 | result = addHeader_In(createContext("get", "/greet"), req, "x-foo", "FooIn2"); 63 | assertResult(result, req.getHeaders("x-foo"), "FooIn1", "FooIn2"); 64 | 65 | if !(result is ()) { 66 | test:assertFail("Expected '()', found " + (typeof result).toString()); 67 | } 68 | 69 | string[]|http:HeaderNotFoundError headers = req.getHeaders("x-foo"); 70 | 71 | if headers is http:HeaderNotFoundError { 72 | test:assertFail("Header 'x-foo' not found in the request"); 73 | } 74 | 75 | test:assertEquals(headers, ["FooIn1", "FooIn2"]); 76 | 77 | headers = req.getHeaders("x-bar"); 78 | 79 | if headers is http:HeaderNotFoundError { 80 | test:assertFail("Header 'x-bar' not found in the request"); 81 | } 82 | 83 | test:assertEquals(headers, ["BarIn"]); 84 | } 85 | 86 | function assertResult(http:Response|false|error|() result, string[]|http:HeaderNotFoundError headers, string... expVal) { 87 | if !(result is ()) { 88 | test:assertFail("Expected '()', found " + (typeof result).toString()); 89 | } 90 | 91 | if headers is http:HeaderNotFoundError { 92 | test:assertFail("Header 'x-foo' not found in the request"); 93 | } 94 | 95 | test:assertEquals(headers, expVal); 96 | } 97 | 98 | function createContext(string httpMethod, string resPath) returns mediation:Context { 99 | mediation:ResourcePath originalPath = checkpanic mediation:createImmutableResourcePath(resPath); 100 | mediation:Context originalCtx = 101 | mediation:createImmutableMediationContext(httpMethod, originalPath.pathSegments(), {}, {}); 102 | mediation:ResourcePath mutableResPath = checkpanic mediation:createMutableResourcePath(resPath); 103 | return mediation:createMutableMediationContext(originalCtx, mutableResPath.pathSegments(), {}, {}); 104 | } 105 | -------------------------------------------------------------------------------- /mediation-log-message/policy.bal: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 WSO2 LLC (http://www.wso2.org) All Rights Reserved. 2 | // 3 | // WSO2 LLC licenses this file to you under the Apache License, 4 | // Version 2.0 (the "License"); you may not use this file except 5 | // in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, 11 | // software distributed under the License is distributed on an 12 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 13 | // KIND, either express or implied. See the License for the 14 | // specific language governing permissions and limitations 15 | // under the License. 16 | 17 | import choreo/mediation; 18 | import ballerina/log; 19 | import ballerina/http; 20 | 21 | const HEADER_X_REQUEST_ID = "x-request-id"; 22 | const FIELD_NAME_PAYLOAD = "payload"; 23 | const FIELD_NAME_HEADERS = "headers"; 24 | const ERR_MSG_MISSING_REQ_ID = ""; 25 | 26 | @mediation:RequestFlow 27 | public function logRequestMessage(mediation:Context ctx, http:Request req, boolean Log\ Payload = false, boolean Log\ Headers = false, 28 | string Excluded\ Headers = "") returns http:Response|false|error|() { 29 | LogRecord lRec = { 30 | mediation\-flow: REQUEST, 31 | request\-id: "", 32 | http\-method: req.method, 33 | resource\-path: ctx.originalContext().resourcePath().toString() 34 | }; 35 | 36 | if req.hasHeader(HEADER_X_REQUEST_ID) { 37 | lRec.request\-id = checkpanic req.getHeader(HEADER_X_REQUEST_ID); 38 | } else { 39 | lRec.request\-id = ERR_MSG_MISSING_REQ_ID; 40 | } 41 | 42 | if Log\ Payload { 43 | string|http:ClientError payload = req.getTextPayload(); 44 | 45 | if payload is http:ClientError { 46 | log:printWarn("Error while reading request payload", payload); 47 | } else { 48 | lRec[FIELD_NAME_PAYLOAD] = payload; 49 | } 50 | } 51 | 52 | if Log\ Headers { 53 | lRec[FIELD_NAME_HEADERS] = buildRequestHeadersMap(req, Excluded\ Headers); 54 | } 55 | 56 | log:printInfo("", (), (), lRec); 57 | return (); 58 | } 59 | 60 | @mediation:ResponseFlow 61 | public function logResponseMessage(mediation:Context ctx, http:Request req, http:Response res, boolean Log\ Payload = false, 62 | boolean Log\ Headers = false, string Excluded\ Headers = "") 63 | returns http:Response|false|error|() { 64 | LogRecord lRec = { 65 | mediation\-flow: RESPONSE, 66 | request\-id: "", 67 | http\-method: req.method, 68 | resource\-path: ctx.originalContext().resourcePath().toString() 69 | }; 70 | 71 | if res.hasHeader(HEADER_X_REQUEST_ID) { 72 | lRec.request\-id = checkpanic res.getHeader(HEADER_X_REQUEST_ID); 73 | } else { 74 | lRec.request\-id = ERR_MSG_MISSING_REQ_ID; 75 | } 76 | 77 | if Log\ Payload { 78 | string|http:ClientError payload = res.getTextPayload(); 79 | 80 | if payload is http:ClientError { 81 | log:printWarn("Error while reading response payload", payload); 82 | } else { 83 | lRec[FIELD_NAME_PAYLOAD] = payload; 84 | } 85 | } 86 | 87 | if Log\ Headers { 88 | lRec[FIELD_NAME_HEADERS] = buildResponseHeadersMap(res, Excluded\ Headers); 89 | } 90 | 91 | log:printInfo("", (), (), lRec); 92 | return (); 93 | } 94 | 95 | @mediation:FaultFlow 96 | public function logFaultMessage(mediation:Context ctx, http:Request req, http:Response? resp, 97 | http:Response errFlowResp, error e, boolean Log\ Payload = false, boolean Log\ Headers = false, 98 | string Excluded\ Headers = "") 99 | returns http:Response|false|error|() { 100 | LogRecord lRec = { 101 | mediation\-flow: FAULT, 102 | request\-id: "", 103 | http\-method: req.method, 104 | resource\-path: ctx.originalContext().resourcePath().toString() 105 | }; 106 | 107 | // Since the fault flow may be triggered by both the request flow and the response flow, we take the x-request-id 108 | // header from the flow which triggered the fault flow (if the request flow triggered it, response will be nil) 109 | if resp is () { 110 | if req.hasHeader(HEADER_X_REQUEST_ID) { 111 | lRec.request\-id = checkpanic req.getHeader(HEADER_X_REQUEST_ID); 112 | } else { 113 | lRec.request\-id = ERR_MSG_MISSING_REQ_ID; 114 | } 115 | } else { 116 | if resp.hasHeader(HEADER_X_REQUEST_ID) { 117 | lRec.request\-id = checkpanic resp.getHeader(HEADER_X_REQUEST_ID); 118 | } else { 119 | lRec.request\-id = ERR_MSG_MISSING_REQ_ID; 120 | } 121 | } 122 | 123 | if Log\ Payload { 124 | string|http:ClientError payload = errFlowResp.getTextPayload(); 125 | 126 | if payload is http:ClientError { 127 | log:printWarn("Error while reading fault payload", payload); 128 | } else { 129 | lRec[FIELD_NAME_PAYLOAD] = payload; 130 | } 131 | } 132 | 133 | if Log\ Headers { 134 | if resp is () { 135 | // In case response is nil, request hasn't reached the backend, hence logging the request headers. 136 | lRec[FIELD_NAME_HEADERS] = buildRequestHeadersMap(req, Excluded\ Headers); 137 | } else { 138 | lRec[FIELD_NAME_HEADERS] = buildResponseHeadersMap(resp, Excluded\ Headers); 139 | } 140 | } 141 | 142 | log:printInfo("", (), (), lRec); 143 | return (); 144 | } 145 | -------------------------------------------------------------------------------- /mediation-oauth/tests/utest_policy.bal: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 WSO2 LLC (http://www.wso2.org) All Rights Reserved. 2 | // 3 | // WSO2 LLC licenses this file to you under the Apache License, 4 | // Version 2.0 (the "License"); you may not use this file except 5 | // in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, 11 | // software distributed under the License is distributed on an 12 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 13 | // KIND, either express or implied. See the License for the 14 | // specific language governing permissions and limitations 15 | // under the License. 16 | 17 | import ballerina/http; 18 | import ballerina/test; 19 | import ballerina/time; 20 | 21 | import choreo/mediation; 22 | 23 | final string mockTokenEndpoint = string `http://localhost:9090/token`; 24 | 25 | service /token on new http:Listener(9090) { 26 | resource function post .(http:Caller caller, http:Request req) returns error? { 27 | json payload = { 28 | "access_token": "eyJ4NXQiOiJPcmNycTdfU2FEYVE4ejFFUE1EWWowcENyQm8iLCJraWQiOiJZV05pTm1KallqbGtObU5pWkRkaVpUWTRaREF3WlRNNU5HRmpOVE16WWpBNFlqQTFPR0V4TkRjMll6bGxaREEwWm1Jd01qTTVOMlE1WlRFeE9EWTNOd19SUzI1NiIsInR5cCI6ImF0K2p3dCIsImFsZyI6IlJTMjU2In0.eyJzdWIiOiI3MXpfWHd2SXhnNm9ZcERpY0NlMmp3SWRJNzRhIiwiYXV0IjoiQVBQTElDQVRJT04iLCJhdWQiOlsiNzF6X1h3dkl4ZzZvWXBEaWNDZTJqd0lkSTc0YSIsImNob3JlbzpkZXBsb3ltZW50OnNhbmRib3giXSwibmJmIjoxNzQyODg4Mzk4LCJhenAiOiI3MXpfWHd2SXhnNm9ZcERpY0NlMmp3SWRJNzRhIiwib3JnX2lkIjoiZTdjZWQzOGUtMjZlNi00ODIxLTkwYzYtYTFmYzE4NzBjMDJhIiwiaXNzIjoiaHR0cHM6XC9cL2FwaS5hc2dhcmRlby5pb1wvdFwvdW1hMTIzXC9vYXV0aDJcL3Rva2VuIiwiZXhwIjoxNzQyODg5Mjk4LCJvcmdfbmFtZSI6InVtYTEyMyIsImlhdCI6MTc0Mjg4ODM5OCwianRpIjoiZDgxMWE1MTMtOTljOC00NTUxLWIwY2MtNmYwYzE3NDEzNmNmIiwiY2xpZW50X2lkIjoiNzF6X1h3dkl4ZzZvWXBEaWNDZTJqd0lkSTc0YSJ9.gcHKeUwx_lnNErdxr1jquy3HsJiyn2NW3_XG09yyiDgXFws9CJii5Bcn_kytvrAf4n1qudcYanAjDRNHPc0adJ6kutmgzqBFeTXXtDM1EkwPE0AXfWsV-RmNMDqv18XgSGvFlhxnBFya0HUozkSrVQEABlu-ScF81453GVblYEDJjVuz78vHd9kDHsS_jXPUe-Ormww3XYsXSGP64Qlau6HDp8JDMT8EGd9KwC0T-T8pUouRGQK5NAYRIXgV6Quosc0HxmWkfqiH4snTYiV3X6o3skHH-JUNxOq6UBYV1Dpoe5OYMRwo_zaYLuyVPqVL5e2b2J02rxbSVD0l1HWpDw", 29 | "token_type": "at+jwt", 30 | "expires_in": 3600 31 | }; 32 | 33 | http:Response response = new; 34 | response.setPayload(payload.toJson()); 35 | response.setHeader("Content-Type", "application/json"); 36 | 37 | check caller->respond(response); 38 | } 39 | } 40 | 41 | configurable string testClientId = "71z_XwvIxg6oYpDifjfe2jwIdI74a"; 42 | configurable string testClientSecret = "bqBe_HZGBjklryRfshysAzvn_fUJcywyo4mmhlk5Zg4a"; 43 | configurable string testHeaderName = "TestAuthHeader"; 44 | 45 | OauthEndpointConfig endpoint = { 46 | tokenApiUrl: mockTokenEndpoint, 47 | clientId: testClientId, 48 | clientSecret: testClientSecret 49 | }; 50 | 51 | function createContext(string httpMethod, string resPath) returns mediation:Context { 52 | mediation:ResourcePath originalPath = checkpanic mediation:createImmutableResourcePath(resPath); 53 | mediation:Context originalCtx = 54 | mediation:createImmutableMediationContext(httpMethod, originalPath.pathSegments(), {}, {}); 55 | mediation:ResourcePath mutableResPath = checkpanic mediation:createMutableResourcePath(resPath); 56 | return mediation:createMutableMediationContext(originalCtx, mutableResPath.pathSegments(), {}, {}); 57 | } 58 | 59 | @test:Config {} 60 | function testOAuthInSuccess() returns error? { 61 | mediation:Context ctx = createContext("get", "/greet"); 62 | http:Request req = new; 63 | 64 | http:Response|error|false? result = oauthIn( 65 | ctx, 66 | req, 67 | mockTokenEndpoint, 68 | testClientId, 69 | testClientSecret, 70 | testHeaderName 71 | ); 72 | 73 | test:assertTrue(result is (), "Expected nil response"); 74 | string|error headerValue = req.getHeader(testHeaderName); 75 | 76 | test:assertTrue(headerValue is string, "Header should be present"); 77 | 78 | if (headerValue is string && testHeaderName == "TestAuthHeader") { 79 | test:assertTrue(headerValue.startsWith("Bearer "), "Header should contain a valid token"); 80 | } 81 | 82 | } 83 | 84 | @test:Config {} 85 | function testGetValidTokenWithCache() returns error? { 86 | TokenResponse token1 = check getToken(endpoint); 87 | TokenResponse token2 = check getToken(endpoint); 88 | test:assertEquals(token2, token1, "Cached token mismatch"); 89 | } 90 | 91 | @test:Config {} 92 | function testGenerateNewToken() returns error? { 93 | TokenResponse token = check generateNewToken(endpoint); 94 | test:assertEquals(token.accessToken, "eyJ4NXQiOiJPcmNycTdfU2FEYVE4ejFFUE1EWWowcENyQm8iLCJraWQiOiJZV05pTm1KallqbGtObU5pWkRkaVpUWTRaREF3WlRNNU5HRmpOVE16WWpBNFlqQTFPR0V4TkRjMll6bGxaREEwWm1Jd01qTTVOMlE1WlRFeE9EWTNOd19SUzI1NiIsInR5cCI6ImF0K2p3dCIsImFsZyI6IlJTMjU2In0.eyJzdWIiOiI3MXpfWHd2SXhnNm9ZcERpY0NlMmp3SWRJNzRhIiwiYXV0IjoiQVBQTElDQVRJT04iLCJhdWQiOlsiNzF6X1h3dkl4ZzZvWXBEaWNDZTJqd0lkSTc0YSIsImNob3JlbzpkZXBsb3ltZW50OnNhbmRib3giXSwibmJmIjoxNzQyODg4Mzk4LCJhenAiOiI3MXpfWHd2SXhnNm9ZcERpY0NlMmp3SWRJNzRhIiwib3JnX2lkIjoiZTdjZWQzOGUtMjZlNi00ODIxLTkwYzYtYTFmYzE4NzBjMDJhIiwiaXNzIjoiaHR0cHM6XC9cL2FwaS5hc2dhcmRlby5pb1wvdFwvdW1hMTIzXC9vYXV0aDJcL3Rva2VuIiwiZXhwIjoxNzQyODg5Mjk4LCJvcmdfbmFtZSI6InVtYTEyMyIsImlhdCI6MTc0Mjg4ODM5OCwianRpIjoiZDgxMWE1MTMtOTljOC00NTUxLWIwY2MtNmYwYzE3NDEzNmNmIiwiY2xpZW50X2lkIjoiNzF6X1h3dkl4ZzZvWXBEaWNDZTJqd0lkSTc0YSJ9.gcHKeUwx_lnNErdxr1jquy3HsJiyn2NW3_XG09yyiDgXFws9CJii5Bcn_kytvrAf4n1qudcYanAjDRNHPc0adJ6kutmgzqBFeTXXtDM1EkwPE0AXfWsV-RmNMDqv18XgSGvFlhxnBFya0HUozkSrVQEABlu-ScF81453GVblYEDJjVuz78vHd9kDHsS_jXPUe-Ormww3XYsXSGP64Qlau6HDp8JDMT8EGd9KwC0T-T8pUouRGQK5NAYRIXgV6Quosc0HxmWkfqiH4snTYiV3X6o3skHH-JUNxOq6UBYV1Dpoe5OYMRwo_zaYLuyVPqVL5e2b2J02rxbSVD0l1HWpDw", "Incorrect access token"); 95 | test:assertEquals(token.tokenType, "at+jwt", "Incorrect token type"); 96 | test:assertEquals(token.expiresIn, 3600, "Incorrect expires_in"); 97 | test:assertTrue(token.validTill > time:utcNow()[0], "Invalid token expiry time"); 98 | } 99 | 100 | @test:Config {} 101 | function testGenerateNewTokenWhenRemainFiveMin() returns error? { 102 | TokenResponse token = { 103 | "accessToken": "eyJ4NXQiOiJPcmNycTdfU2FEYVE4ejefgjinnffgvjhviOiJZV05pTm1KallqbGtObU5pWkRkaVpUWTRaREF3WlRNNU5HRmpOVE16WWpBNFlqQTFPR0V4TkRjMll6bGxaREEwWm1Jd01qTTVOMlE1WlRFeE9EWTNOd19SUzI1NiIsInR5cCI6ImF0K2p3dCIsImFsZyI6IlJTMjU2In0.eyJzdWIiOiI3MXpfWHd2SXhnNm9ZcERpY0NlMmp3SWRJNzRhIiwiYXV0IjoiQVBQTElDQVRJT04iLCJhdWQiOlsiNzF6X1h3dkl4ZzZvWXBEaWNDZTJqd0lkSTc0YSIsImNob3JlbzpkZXBsb3ltZW50OnNhbmRib3giXSwibmJmIjoxNzQyODg4Mzk4LCJhenAiOiI3MXpfWHd2SXhnNm9ZcERpY0NlMmp3SWRJNzRhIiwib3JnX2lkIjoiZTdjZWQzOGUtMjZlNi00ODIxLTkwYzYtYTFmYzE4NzBjMDJhIiwiaXNzIjoiaHR0cHM6XC9cL2FwaS5hc2dhcmRlby5pb1wvdFwvdW1hMTIzXC9vYXV0aDJcL3Rva2VuIiwiZXhwIjoxNzQyODg5Mjk4LCJvcmdfbmFtZSI6InVtYTEyMyIsImlhdCI6MTc0Mjg4ODM5OCwianRpIjoiZDgxMWE1MTMtOTljOC00NTUxLWIwY2MtNmYwYzE3NDEzNmNmIiwiY2xpZW50X2lkIjoiNzF6X1h3dkl4ZzZvWXBEaWNDZTJqd0lkSTc0YSJ9.gcHKeUwx_lnNErdxr1jquy3HsJiyn2NW3_XG09yyiDgXFws9CJii5Bcn_kytvrAf4n1qudcYanAjDRNHPc0adJ6kutmgzqBFeTXXtDM1EkwPE0AXfWsV-RmNMDqv18XgSGvFlhxnBFya0HUozkSrVQEABlu-ScF81453GVblYEDJjVuz78vHd9kDHsS_jXPUe-Ormww3XYsXSGP64Qlau6HDp8JDMT8EGd9KwC0T-T8pUouRGQK5NAYRIXgV6Quosc0HxmWkfqiH4snTYiV3X6o3skHH-JUNxOq6UBYV1Dpoe5OYMRwo_zaYLuyVPqVL5e2b2J02rxbSVD0l1HWpDw", 104 | "tokenType": "at+jwt", 105 | "expiresIn": 900, 106 | "validTill": time:utcNow()[0] + 300, 107 | "refreshToken": "eyJ4NXQiOiJPcmNycTdfU2FEYVE4ejFFUE1EWWowcENyQm8iLCJraWQiOiJZV05pTm1KallqbGtObU5pWkRkaVpUWTRaREF3WlRNNU5HRmpOVE16WWpBNFlqQTFPR0V4TkRjMll6bGxaREEwWm1Jd01qTTVOMlE1WlRFeE9EWTNOd19SUzI1NiIsInR5cCI6ImF0K2p3dCIsImFsZyI6IlJTMjU2In0" 108 | }; 109 | 110 | oauthAccessToken = token; 111 | TokenResponse token1 = check getToken(endpoint); 112 | test:assertNotEquals(token1.accessToken, token.accessToken, "Cached token and generated tocken are matched"); 113 | } 114 | 115 | @test:BeforeSuite 116 | function startMockServer() { 117 | } 118 | -------------------------------------------------------------------------------- /guardrail-url-guardrail/Dependencies.toml: -------------------------------------------------------------------------------- 1 | # AUTO-GENERATED FILE. DO NOT MODIFY. 2 | 3 | # This file is auto-generated by Ballerina for managing dependency versions. 4 | # It should not be modified by hand. 5 | 6 | [ballerina] 7 | dependencies-toml-version = "2" 8 | distribution-version = "2201.5.5" 9 | 10 | [[package]] 11 | org = "ballerina" 12 | name = "auth" 13 | version = "2.8.0" 14 | dependencies = [ 15 | {org = "ballerina", name = "crypto"}, 16 | {org = "ballerina", name = "jballerina.java"}, 17 | {org = "ballerina", name = "lang.array"}, 18 | {org = "ballerina", name = "lang.string"}, 19 | {org = "ballerina", name = "log"} 20 | ] 21 | 22 | [[package]] 23 | org = "ballerina" 24 | name = "cache" 25 | version = "3.5.0" 26 | dependencies = [ 27 | {org = "ballerina", name = "constraint"}, 28 | {org = "ballerina", name = "jballerina.java"}, 29 | {org = "ballerina", name = "task"}, 30 | {org = "ballerina", name = "time"} 31 | ] 32 | 33 | [[package]] 34 | org = "ballerina" 35 | name = "constraint" 36 | version = "1.2.0" 37 | dependencies = [ 38 | {org = "ballerina", name = "jballerina.java"} 39 | ] 40 | 41 | [[package]] 42 | org = "ballerina" 43 | name = "crypto" 44 | version = "2.3.2" 45 | dependencies = [ 46 | {org = "ballerina", name = "jballerina.java"}, 47 | {org = "ballerina", name = "time"} 48 | ] 49 | 50 | [[package]] 51 | org = "ballerina" 52 | name = "file" 53 | version = "1.7.1" 54 | dependencies = [ 55 | {org = "ballerina", name = "io"}, 56 | {org = "ballerina", name = "jballerina.java"}, 57 | {org = "ballerina", name = "os"}, 58 | {org = "ballerina", name = "time"} 59 | ] 60 | 61 | [[package]] 62 | org = "ballerina" 63 | name = "http" 64 | version = "2.8.9" 65 | dependencies = [ 66 | {org = "ballerina", name = "auth"}, 67 | {org = "ballerina", name = "cache"}, 68 | {org = "ballerina", name = "constraint"}, 69 | {org = "ballerina", name = "crypto"}, 70 | {org = "ballerina", name = "file"}, 71 | {org = "ballerina", name = "io"}, 72 | {org = "ballerina", name = "jballerina.java"}, 73 | {org = "ballerina", name = "jwt"}, 74 | {org = "ballerina", name = "lang.array"}, 75 | {org = "ballerina", name = "lang.decimal"}, 76 | {org = "ballerina", name = "lang.int"}, 77 | {org = "ballerina", name = "lang.regexp"}, 78 | {org = "ballerina", name = "lang.runtime"}, 79 | {org = "ballerina", name = "lang.string"}, 80 | {org = "ballerina", name = "lang.value"}, 81 | {org = "ballerina", name = "log"}, 82 | {org = "ballerina", name = "mime"}, 83 | {org = "ballerina", name = "oauth2"}, 84 | {org = "ballerina", name = "observe"}, 85 | {org = "ballerina", name = "time"}, 86 | {org = "ballerina", name = "url"} 87 | ] 88 | modules = [ 89 | {org = "ballerina", packageName = "http", moduleName = "http"} 90 | ] 91 | 92 | [[package]] 93 | org = "ballerina" 94 | name = "io" 95 | version = "1.4.1" 96 | dependencies = [ 97 | {org = "ballerina", name = "jballerina.java"}, 98 | {org = "ballerina", name = "lang.value"} 99 | ] 100 | 101 | [[package]] 102 | org = "ballerina" 103 | name = "jballerina.java" 104 | version = "0.0.0" 105 | 106 | [[package]] 107 | org = "ballerina" 108 | name = "jwt" 109 | version = "2.8.0" 110 | dependencies = [ 111 | {org = "ballerina", name = "cache"}, 112 | {org = "ballerina", name = "crypto"}, 113 | {org = "ballerina", name = "jballerina.java"}, 114 | {org = "ballerina", name = "lang.int"}, 115 | {org = "ballerina", name = "lang.string"}, 116 | {org = "ballerina", name = "log"}, 117 | {org = "ballerina", name = "time"} 118 | ] 119 | 120 | [[package]] 121 | org = "ballerina" 122 | name = "lang.__internal" 123 | version = "0.0.0" 124 | dependencies = [ 125 | {org = "ballerina", name = "jballerina.java"}, 126 | {org = "ballerina", name = "lang.object"} 127 | ] 128 | 129 | [[package]] 130 | org = "ballerina" 131 | name = "lang.array" 132 | version = "0.0.0" 133 | dependencies = [ 134 | {org = "ballerina", name = "jballerina.java"}, 135 | {org = "ballerina", name = "lang.__internal"} 136 | ] 137 | 138 | [[package]] 139 | org = "ballerina" 140 | name = "lang.decimal" 141 | version = "0.0.0" 142 | dependencies = [ 143 | {org = "ballerina", name = "jballerina.java"} 144 | ] 145 | 146 | [[package]] 147 | org = "ballerina" 148 | name = "lang.int" 149 | version = "0.0.0" 150 | dependencies = [ 151 | {org = "ballerina", name = "jballerina.java"}, 152 | {org = "ballerina", name = "lang.__internal"}, 153 | {org = "ballerina", name = "lang.object"} 154 | ] 155 | 156 | [[package]] 157 | org = "ballerina" 158 | name = "lang.object" 159 | version = "0.0.0" 160 | 161 | [[package]] 162 | org = "ballerina" 163 | name = "lang.regexp" 164 | version = "0.0.0" 165 | dependencies = [ 166 | {org = "ballerina", name = "jballerina.java"} 167 | ] 168 | 169 | [[package]] 170 | org = "ballerina" 171 | name = "lang.runtime" 172 | version = "0.0.0" 173 | dependencies = [ 174 | {org = "ballerina", name = "jballerina.java"} 175 | ] 176 | 177 | [[package]] 178 | org = "ballerina" 179 | name = "lang.string" 180 | version = "0.0.0" 181 | dependencies = [ 182 | {org = "ballerina", name = "jballerina.java"}, 183 | {org = "ballerina", name = "lang.regexp"} 184 | ] 185 | 186 | [[package]] 187 | org = "ballerina" 188 | name = "lang.value" 189 | version = "0.0.0" 190 | dependencies = [ 191 | {org = "ballerina", name = "jballerina.java"} 192 | ] 193 | 194 | [[package]] 195 | org = "ballerina" 196 | name = "log" 197 | version = "2.7.1" 198 | dependencies = [ 199 | {org = "ballerina", name = "io"}, 200 | {org = "ballerina", name = "jballerina.java"}, 201 | {org = "ballerina", name = "lang.value"}, 202 | {org = "ballerina", name = "observe"} 203 | ] 204 | 205 | [[package]] 206 | org = "ballerina" 207 | name = "mime" 208 | version = "2.7.1" 209 | dependencies = [ 210 | {org = "ballerina", name = "io"}, 211 | {org = "ballerina", name = "jballerina.java"}, 212 | {org = "ballerina", name = "lang.int"} 213 | ] 214 | 215 | [[package]] 216 | org = "ballerina" 217 | name = "oauth2" 218 | version = "2.8.0" 219 | dependencies = [ 220 | {org = "ballerina", name = "cache"}, 221 | {org = "ballerina", name = "crypto"}, 222 | {org = "ballerina", name = "jballerina.java"}, 223 | {org = "ballerina", name = "log"}, 224 | {org = "ballerina", name = "time"}, 225 | {org = "ballerina", name = "url"} 226 | ] 227 | 228 | [[package]] 229 | org = "ballerina" 230 | name = "observe" 231 | version = "1.0.7" 232 | dependencies = [ 233 | {org = "ballerina", name = "jballerina.java"} 234 | ] 235 | 236 | [[package]] 237 | org = "ballerina" 238 | name = "os" 239 | version = "1.6.0" 240 | dependencies = [ 241 | {org = "ballerina", name = "io"}, 242 | {org = "ballerina", name = "jballerina.java"} 243 | ] 244 | 245 | [[package]] 246 | org = "ballerina" 247 | name = "regex" 248 | version = "1.4.3" 249 | dependencies = [ 250 | {org = "ballerina", name = "jballerina.java"}, 251 | {org = "ballerina", name = "lang.string"} 252 | ] 253 | 254 | [[package]] 255 | org = "ballerina" 256 | name = "task" 257 | version = "2.3.2" 258 | dependencies = [ 259 | {org = "ballerina", name = "jballerina.java"}, 260 | {org = "ballerina", name = "time"} 261 | ] 262 | 263 | [[package]] 264 | org = "ballerina" 265 | name = "time" 266 | version = "2.2.5" 267 | dependencies = [ 268 | {org = "ballerina", name = "jballerina.java"} 269 | ] 270 | 271 | [[package]] 272 | org = "ballerina" 273 | name = "url" 274 | version = "2.2.4" 275 | dependencies = [ 276 | {org = "ballerina", name = "jballerina.java"} 277 | ] 278 | 279 | [[package]] 280 | org = "ballerinai" 281 | name = "observe" 282 | version = "0.0.0" 283 | dependencies = [ 284 | {org = "ballerina", name = "jballerina.java"}, 285 | {org = "ballerina", name = "observe"} 286 | ] 287 | modules = [ 288 | {org = "ballerinai", packageName = "observe", moduleName = "observe"} 289 | ] 290 | 291 | [[package]] 292 | org = "choreo" 293 | name = "guardrail.url_guardrail" 294 | version = "1.0.0" 295 | dependencies = [ 296 | {org = "ballerina", name = "http"}, 297 | {org = "ballerinai", name = "observe"}, 298 | {org = "choreo", name = "mediation"} 299 | ] 300 | modules = [ 301 | {org = "choreo", packageName = "guardrail.url_guardrail", moduleName = "guardrail.url_guardrail"} 302 | ] 303 | 304 | [[package]] 305 | org = "choreo" 306 | name = "mediation" 307 | version = "1.0.1" 308 | dependencies = [ 309 | {org = "ballerina", name = "regex"} 310 | ] 311 | modules = [ 312 | {org = "choreo", packageName = "mediation", moduleName = "mediation"} 313 | ] 314 | 315 | -------------------------------------------------------------------------------- /guardrail-semantic-cache/Dependencies.toml: -------------------------------------------------------------------------------- 1 | # AUTO-GENERATED FILE. DO NOT MODIFY. 2 | 3 | # This file is auto-generated by Ballerina for managing dependency versions. 4 | # It should not be modified by hand. 5 | 6 | [ballerina] 7 | dependencies-toml-version = "2" 8 | distribution-version = "2201.5.5" 9 | 10 | [[package]] 11 | org = "ballerina" 12 | name = "auth" 13 | version = "2.8.0" 14 | dependencies = [ 15 | {org = "ballerina", name = "crypto"}, 16 | {org = "ballerina", name = "jballerina.java"}, 17 | {org = "ballerina", name = "lang.array"}, 18 | {org = "ballerina", name = "lang.string"}, 19 | {org = "ballerina", name = "log"} 20 | ] 21 | 22 | [[package]] 23 | org = "ballerina" 24 | name = "cache" 25 | version = "3.5.0" 26 | dependencies = [ 27 | {org = "ballerina", name = "constraint"}, 28 | {org = "ballerina", name = "jballerina.java"}, 29 | {org = "ballerina", name = "task"}, 30 | {org = "ballerina", name = "time"} 31 | ] 32 | 33 | [[package]] 34 | org = "ballerina" 35 | name = "constraint" 36 | version = "1.2.0" 37 | dependencies = [ 38 | {org = "ballerina", name = "jballerina.java"} 39 | ] 40 | 41 | [[package]] 42 | org = "ballerina" 43 | name = "crypto" 44 | version = "2.3.2" 45 | dependencies = [ 46 | {org = "ballerina", name = "jballerina.java"}, 47 | {org = "ballerina", name = "time"} 48 | ] 49 | 50 | [[package]] 51 | org = "ballerina" 52 | name = "file" 53 | version = "1.7.1" 54 | dependencies = [ 55 | {org = "ballerina", name = "io"}, 56 | {org = "ballerina", name = "jballerina.java"}, 57 | {org = "ballerina", name = "os"}, 58 | {org = "ballerina", name = "time"} 59 | ] 60 | 61 | [[package]] 62 | org = "ballerina" 63 | name = "http" 64 | version = "2.8.9" 65 | dependencies = [ 66 | {org = "ballerina", name = "auth"}, 67 | {org = "ballerina", name = "cache"}, 68 | {org = "ballerina", name = "constraint"}, 69 | {org = "ballerina", name = "crypto"}, 70 | {org = "ballerina", name = "file"}, 71 | {org = "ballerina", name = "io"}, 72 | {org = "ballerina", name = "jballerina.java"}, 73 | {org = "ballerina", name = "jwt"}, 74 | {org = "ballerina", name = "lang.array"}, 75 | {org = "ballerina", name = "lang.decimal"}, 76 | {org = "ballerina", name = "lang.int"}, 77 | {org = "ballerina", name = "lang.regexp"}, 78 | {org = "ballerina", name = "lang.runtime"}, 79 | {org = "ballerina", name = "lang.string"}, 80 | {org = "ballerina", name = "lang.value"}, 81 | {org = "ballerina", name = "log"}, 82 | {org = "ballerina", name = "mime"}, 83 | {org = "ballerina", name = "oauth2"}, 84 | {org = "ballerina", name = "observe"}, 85 | {org = "ballerina", name = "time"}, 86 | {org = "ballerina", name = "url"} 87 | ] 88 | modules = [ 89 | {org = "ballerina", packageName = "http", moduleName = "http"} 90 | ] 91 | 92 | [[package]] 93 | org = "ballerina" 94 | name = "io" 95 | version = "1.4.1" 96 | dependencies = [ 97 | {org = "ballerina", name = "jballerina.java"}, 98 | {org = "ballerina", name = "lang.value"} 99 | ] 100 | 101 | [[package]] 102 | org = "ballerina" 103 | name = "jballerina.java" 104 | version = "0.0.0" 105 | 106 | [[package]] 107 | org = "ballerina" 108 | name = "jwt" 109 | version = "2.8.0" 110 | dependencies = [ 111 | {org = "ballerina", name = "cache"}, 112 | {org = "ballerina", name = "crypto"}, 113 | {org = "ballerina", name = "jballerina.java"}, 114 | {org = "ballerina", name = "lang.int"}, 115 | {org = "ballerina", name = "lang.string"}, 116 | {org = "ballerina", name = "log"}, 117 | {org = "ballerina", name = "time"} 118 | ] 119 | 120 | [[package]] 121 | org = "ballerina" 122 | name = "lang.__internal" 123 | version = "0.0.0" 124 | dependencies = [ 125 | {org = "ballerina", name = "jballerina.java"}, 126 | {org = "ballerina", name = "lang.object"} 127 | ] 128 | 129 | [[package]] 130 | org = "ballerina" 131 | name = "lang.array" 132 | version = "0.0.0" 133 | dependencies = [ 134 | {org = "ballerina", name = "jballerina.java"}, 135 | {org = "ballerina", name = "lang.__internal"} 136 | ] 137 | 138 | [[package]] 139 | org = "ballerina" 140 | name = "lang.decimal" 141 | version = "0.0.0" 142 | dependencies = [ 143 | {org = "ballerina", name = "jballerina.java"} 144 | ] 145 | 146 | [[package]] 147 | org = "ballerina" 148 | name = "lang.int" 149 | version = "0.0.0" 150 | dependencies = [ 151 | {org = "ballerina", name = "jballerina.java"}, 152 | {org = "ballerina", name = "lang.__internal"}, 153 | {org = "ballerina", name = "lang.object"} 154 | ] 155 | 156 | [[package]] 157 | org = "ballerina" 158 | name = "lang.object" 159 | version = "0.0.0" 160 | 161 | [[package]] 162 | org = "ballerina" 163 | name = "lang.regexp" 164 | version = "0.0.0" 165 | dependencies = [ 166 | {org = "ballerina", name = "jballerina.java"} 167 | ] 168 | 169 | [[package]] 170 | org = "ballerina" 171 | name = "lang.runtime" 172 | version = "0.0.0" 173 | dependencies = [ 174 | {org = "ballerina", name = "jballerina.java"} 175 | ] 176 | 177 | [[package]] 178 | org = "ballerina" 179 | name = "lang.string" 180 | version = "0.0.0" 181 | dependencies = [ 182 | {org = "ballerina", name = "jballerina.java"}, 183 | {org = "ballerina", name = "lang.regexp"} 184 | ] 185 | 186 | [[package]] 187 | org = "ballerina" 188 | name = "lang.value" 189 | version = "0.0.0" 190 | dependencies = [ 191 | {org = "ballerina", name = "jballerina.java"} 192 | ] 193 | 194 | [[package]] 195 | org = "ballerina" 196 | name = "log" 197 | version = "2.7.1" 198 | dependencies = [ 199 | {org = "ballerina", name = "io"}, 200 | {org = "ballerina", name = "jballerina.java"}, 201 | {org = "ballerina", name = "lang.value"}, 202 | {org = "ballerina", name = "observe"} 203 | ] 204 | 205 | [[package]] 206 | org = "ballerina" 207 | name = "mime" 208 | version = "2.7.1" 209 | dependencies = [ 210 | {org = "ballerina", name = "io"}, 211 | {org = "ballerina", name = "jballerina.java"}, 212 | {org = "ballerina", name = "lang.int"} 213 | ] 214 | 215 | [[package]] 216 | org = "ballerina" 217 | name = "oauth2" 218 | version = "2.8.0" 219 | dependencies = [ 220 | {org = "ballerina", name = "cache"}, 221 | {org = "ballerina", name = "crypto"}, 222 | {org = "ballerina", name = "jballerina.java"}, 223 | {org = "ballerina", name = "log"}, 224 | {org = "ballerina", name = "time"}, 225 | {org = "ballerina", name = "url"} 226 | ] 227 | 228 | [[package]] 229 | org = "ballerina" 230 | name = "observe" 231 | version = "1.0.7" 232 | dependencies = [ 233 | {org = "ballerina", name = "jballerina.java"} 234 | ] 235 | 236 | [[package]] 237 | org = "ballerina" 238 | name = "os" 239 | version = "1.6.0" 240 | dependencies = [ 241 | {org = "ballerina", name = "io"}, 242 | {org = "ballerina", name = "jballerina.java"} 243 | ] 244 | 245 | [[package]] 246 | org = "ballerina" 247 | name = "regex" 248 | version = "1.3.2" 249 | dependencies = [ 250 | {org = "ballerina", name = "jballerina.java"}, 251 | {org = "ballerina", name = "lang.string"} 252 | ] 253 | 254 | [[package]] 255 | org = "ballerina" 256 | name = "task" 257 | version = "2.3.2" 258 | dependencies = [ 259 | {org = "ballerina", name = "jballerina.java"}, 260 | {org = "ballerina", name = "time"} 261 | ] 262 | 263 | [[package]] 264 | org = "ballerina" 265 | name = "time" 266 | version = "2.2.5" 267 | dependencies = [ 268 | {org = "ballerina", name = "jballerina.java"} 269 | ] 270 | 271 | [[package]] 272 | org = "ballerina" 273 | name = "url" 274 | version = "2.2.4" 275 | dependencies = [ 276 | {org = "ballerina", name = "jballerina.java"} 277 | ] 278 | 279 | [[package]] 280 | org = "ballerinai" 281 | name = "observe" 282 | version = "0.0.0" 283 | dependencies = [ 284 | {org = "ballerina", name = "jballerina.java"}, 285 | {org = "ballerina", name = "observe"} 286 | ] 287 | modules = [ 288 | {org = "ballerinai", packageName = "observe", moduleName = "observe"} 289 | ] 290 | 291 | [[package]] 292 | org = "choreo" 293 | name = "mediation" 294 | version = "1.0.1" 295 | dependencies = [ 296 | {org = "ballerina", name = "regex"} 297 | ] 298 | modules = [ 299 | {org = "choreo", packageName = "mediation", moduleName = "mediation"} 300 | ] 301 | 302 | [[package]] 303 | org = "choreo" 304 | name = "guardrail.semantic_cache" 305 | version = "1.0.0" 306 | dependencies = [ 307 | {org = "ballerina", name = "http"}, 308 | {org = "ballerinai", name = "observe"}, 309 | {org = "choreo", name = "mediation"} 310 | ] 311 | modules = [ 312 | {org = "choreo", packageName = "guardrail.semantic_cache", moduleName = "guardrail.semantic_cache"} 313 | ] 314 | 315 | -------------------------------------------------------------------------------- /guardrail-regex-guardrail/Dependencies.toml: -------------------------------------------------------------------------------- 1 | # AUTO-GENERATED FILE. DO NOT MODIFY. 2 | 3 | # This file is auto-generated by Ballerina for managing dependency versions. 4 | # It should not be modified by hand. 5 | 6 | [ballerina] 7 | dependencies-toml-version = "2" 8 | distribution-version = "2201.5.5" 9 | 10 | [[package]] 11 | org = "ballerina" 12 | name = "auth" 13 | version = "2.8.0" 14 | dependencies = [ 15 | {org = "ballerina", name = "crypto"}, 16 | {org = "ballerina", name = "jballerina.java"}, 17 | {org = "ballerina", name = "lang.array"}, 18 | {org = "ballerina", name = "lang.string"}, 19 | {org = "ballerina", name = "log"} 20 | ] 21 | 22 | [[package]] 23 | org = "ballerina" 24 | name = "cache" 25 | version = "3.5.0" 26 | dependencies = [ 27 | {org = "ballerina", name = "constraint"}, 28 | {org = "ballerina", name = "jballerina.java"}, 29 | {org = "ballerina", name = "task"}, 30 | {org = "ballerina", name = "time"} 31 | ] 32 | 33 | [[package]] 34 | org = "ballerina" 35 | name = "constraint" 36 | version = "1.2.0" 37 | dependencies = [ 38 | {org = "ballerina", name = "jballerina.java"} 39 | ] 40 | 41 | [[package]] 42 | org = "ballerina" 43 | name = "crypto" 44 | version = "2.3.2" 45 | dependencies = [ 46 | {org = "ballerina", name = "jballerina.java"}, 47 | {org = "ballerina", name = "time"} 48 | ] 49 | 50 | [[package]] 51 | org = "ballerina" 52 | name = "file" 53 | version = "1.7.1" 54 | dependencies = [ 55 | {org = "ballerina", name = "io"}, 56 | {org = "ballerina", name = "jballerina.java"}, 57 | {org = "ballerina", name = "os"}, 58 | {org = "ballerina", name = "time"} 59 | ] 60 | 61 | [[package]] 62 | org = "ballerina" 63 | name = "http" 64 | version = "2.8.9" 65 | dependencies = [ 66 | {org = "ballerina", name = "auth"}, 67 | {org = "ballerina", name = "cache"}, 68 | {org = "ballerina", name = "constraint"}, 69 | {org = "ballerina", name = "crypto"}, 70 | {org = "ballerina", name = "file"}, 71 | {org = "ballerina", name = "io"}, 72 | {org = "ballerina", name = "jballerina.java"}, 73 | {org = "ballerina", name = "jwt"}, 74 | {org = "ballerina", name = "lang.array"}, 75 | {org = "ballerina", name = "lang.decimal"}, 76 | {org = "ballerina", name = "lang.int"}, 77 | {org = "ballerina", name = "lang.regexp"}, 78 | {org = "ballerina", name = "lang.runtime"}, 79 | {org = "ballerina", name = "lang.string"}, 80 | {org = "ballerina", name = "lang.value"}, 81 | {org = "ballerina", name = "log"}, 82 | {org = "ballerina", name = "mime"}, 83 | {org = "ballerina", name = "oauth2"}, 84 | {org = "ballerina", name = "observe"}, 85 | {org = "ballerina", name = "time"}, 86 | {org = "ballerina", name = "url"} 87 | ] 88 | modules = [ 89 | {org = "ballerina", packageName = "http", moduleName = "http"} 90 | ] 91 | 92 | [[package]] 93 | org = "ballerina" 94 | name = "io" 95 | version = "1.4.1" 96 | dependencies = [ 97 | {org = "ballerina", name = "jballerina.java"}, 98 | {org = "ballerina", name = "lang.value"} 99 | ] 100 | 101 | [[package]] 102 | org = "ballerina" 103 | name = "jballerina.java" 104 | version = "0.0.0" 105 | 106 | [[package]] 107 | org = "ballerina" 108 | name = "jwt" 109 | version = "2.8.0" 110 | dependencies = [ 111 | {org = "ballerina", name = "cache"}, 112 | {org = "ballerina", name = "crypto"}, 113 | {org = "ballerina", name = "jballerina.java"}, 114 | {org = "ballerina", name = "lang.int"}, 115 | {org = "ballerina", name = "lang.string"}, 116 | {org = "ballerina", name = "log"}, 117 | {org = "ballerina", name = "time"} 118 | ] 119 | 120 | [[package]] 121 | org = "ballerina" 122 | name = "lang.__internal" 123 | version = "0.0.0" 124 | dependencies = [ 125 | {org = "ballerina", name = "jballerina.java"}, 126 | {org = "ballerina", name = "lang.object"} 127 | ] 128 | 129 | [[package]] 130 | org = "ballerina" 131 | name = "lang.array" 132 | version = "0.0.0" 133 | dependencies = [ 134 | {org = "ballerina", name = "jballerina.java"}, 135 | {org = "ballerina", name = "lang.__internal"} 136 | ] 137 | 138 | [[package]] 139 | org = "ballerina" 140 | name = "lang.decimal" 141 | version = "0.0.0" 142 | dependencies = [ 143 | {org = "ballerina", name = "jballerina.java"} 144 | ] 145 | 146 | [[package]] 147 | org = "ballerina" 148 | name = "lang.int" 149 | version = "0.0.0" 150 | dependencies = [ 151 | {org = "ballerina", name = "jballerina.java"}, 152 | {org = "ballerina", name = "lang.__internal"}, 153 | {org = "ballerina", name = "lang.object"} 154 | ] 155 | 156 | [[package]] 157 | org = "ballerina" 158 | name = "lang.object" 159 | version = "0.0.0" 160 | 161 | [[package]] 162 | org = "ballerina" 163 | name = "lang.regexp" 164 | version = "0.0.0" 165 | dependencies = [ 166 | {org = "ballerina", name = "jballerina.java"} 167 | ] 168 | 169 | [[package]] 170 | org = "ballerina" 171 | name = "lang.runtime" 172 | version = "0.0.0" 173 | dependencies = [ 174 | {org = "ballerina", name = "jballerina.java"} 175 | ] 176 | 177 | [[package]] 178 | org = "ballerina" 179 | name = "lang.string" 180 | version = "0.0.0" 181 | dependencies = [ 182 | {org = "ballerina", name = "jballerina.java"}, 183 | {org = "ballerina", name = "lang.regexp"} 184 | ] 185 | 186 | [[package]] 187 | org = "ballerina" 188 | name = "lang.value" 189 | version = "0.0.0" 190 | dependencies = [ 191 | {org = "ballerina", name = "jballerina.java"} 192 | ] 193 | 194 | [[package]] 195 | org = "ballerina" 196 | name = "log" 197 | version = "2.7.1" 198 | dependencies = [ 199 | {org = "ballerina", name = "io"}, 200 | {org = "ballerina", name = "jballerina.java"}, 201 | {org = "ballerina", name = "lang.value"}, 202 | {org = "ballerina", name = "observe"} 203 | ] 204 | 205 | [[package]] 206 | org = "ballerina" 207 | name = "mime" 208 | version = "2.7.1" 209 | dependencies = [ 210 | {org = "ballerina", name = "io"}, 211 | {org = "ballerina", name = "jballerina.java"}, 212 | {org = "ballerina", name = "lang.int"} 213 | ] 214 | 215 | [[package]] 216 | org = "ballerina" 217 | name = "oauth2" 218 | version = "2.8.0" 219 | dependencies = [ 220 | {org = "ballerina", name = "cache"}, 221 | {org = "ballerina", name = "crypto"}, 222 | {org = "ballerina", name = "jballerina.java"}, 223 | {org = "ballerina", name = "log"}, 224 | {org = "ballerina", name = "time"}, 225 | {org = "ballerina", name = "url"} 226 | ] 227 | 228 | [[package]] 229 | org = "ballerina" 230 | name = "observe" 231 | version = "1.0.7" 232 | dependencies = [ 233 | {org = "ballerina", name = "jballerina.java"} 234 | ] 235 | 236 | [[package]] 237 | org = "ballerina" 238 | name = "os" 239 | version = "1.6.0" 240 | dependencies = [ 241 | {org = "ballerina", name = "io"}, 242 | {org = "ballerina", name = "jballerina.java"} 243 | ] 244 | 245 | [[package]] 246 | org = "ballerina" 247 | name = "regex" 248 | version = "1.4.3" 249 | dependencies = [ 250 | {org = "ballerina", name = "jballerina.java"}, 251 | {org = "ballerina", name = "lang.string"} 252 | ] 253 | 254 | [[package]] 255 | org = "ballerina" 256 | name = "task" 257 | version = "2.3.2" 258 | dependencies = [ 259 | {org = "ballerina", name = "jballerina.java"}, 260 | {org = "ballerina", name = "time"} 261 | ] 262 | 263 | [[package]] 264 | org = "ballerina" 265 | name = "time" 266 | version = "2.2.5" 267 | dependencies = [ 268 | {org = "ballerina", name = "jballerina.java"} 269 | ] 270 | 271 | [[package]] 272 | org = "ballerina" 273 | name = "url" 274 | version = "2.2.4" 275 | dependencies = [ 276 | {org = "ballerina", name = "jballerina.java"} 277 | ] 278 | 279 | [[package]] 280 | org = "ballerinai" 281 | name = "observe" 282 | version = "0.0.0" 283 | dependencies = [ 284 | {org = "ballerina", name = "jballerina.java"}, 285 | {org = "ballerina", name = "observe"} 286 | ] 287 | modules = [ 288 | {org = "ballerinai", packageName = "observe", moduleName = "observe"} 289 | ] 290 | 291 | [[package]] 292 | org = "choreo" 293 | name = "guardrail.regex_guardrail" 294 | version = "1.0.0" 295 | dependencies = [ 296 | {org = "ballerina", name = "http"}, 297 | {org = "ballerinai", name = "observe"}, 298 | {org = "choreo", name = "mediation"} 299 | ] 300 | modules = [ 301 | {org = "choreo", packageName = "guardrail.regex_guardrail", moduleName = "guardrail.regex_guardrail"} 302 | ] 303 | 304 | [[package]] 305 | org = "choreo" 306 | name = "mediation" 307 | version = "1.0.1" 308 | dependencies = [ 309 | {org = "ballerina", name = "regex"} 310 | ] 311 | modules = [ 312 | {org = "choreo", packageName = "mediation", moduleName = "mediation"} 313 | ] 314 | 315 | -------------------------------------------------------------------------------- /guardrail-pii-masking-regex/Dependencies.toml: -------------------------------------------------------------------------------- 1 | # AUTO-GENERATED FILE. DO NOT MODIFY. 2 | 3 | # This file is auto-generated by Ballerina for managing dependency versions. 4 | # It should not be modified by hand. 5 | 6 | [ballerina] 7 | dependencies-toml-version = "2" 8 | distribution-version = "2201.5.5" 9 | 10 | [[package]] 11 | org = "ballerina" 12 | name = "auth" 13 | version = "2.8.0" 14 | dependencies = [ 15 | {org = "ballerina", name = "crypto"}, 16 | {org = "ballerina", name = "jballerina.java"}, 17 | {org = "ballerina", name = "lang.array"}, 18 | {org = "ballerina", name = "lang.string"}, 19 | {org = "ballerina", name = "log"} 20 | ] 21 | 22 | [[package]] 23 | org = "ballerina" 24 | name = "cache" 25 | version = "3.5.0" 26 | dependencies = [ 27 | {org = "ballerina", name = "constraint"}, 28 | {org = "ballerina", name = "jballerina.java"}, 29 | {org = "ballerina", name = "task"}, 30 | {org = "ballerina", name = "time"} 31 | ] 32 | 33 | [[package]] 34 | org = "ballerina" 35 | name = "constraint" 36 | version = "1.2.0" 37 | dependencies = [ 38 | {org = "ballerina", name = "jballerina.java"} 39 | ] 40 | 41 | [[package]] 42 | org = "ballerina" 43 | name = "crypto" 44 | version = "2.3.2" 45 | dependencies = [ 46 | {org = "ballerina", name = "jballerina.java"}, 47 | {org = "ballerina", name = "time"} 48 | ] 49 | 50 | [[package]] 51 | org = "ballerina" 52 | name = "file" 53 | version = "1.7.1" 54 | dependencies = [ 55 | {org = "ballerina", name = "io"}, 56 | {org = "ballerina", name = "jballerina.java"}, 57 | {org = "ballerina", name = "os"}, 58 | {org = "ballerina", name = "time"} 59 | ] 60 | 61 | [[package]] 62 | org = "ballerina" 63 | name = "http" 64 | version = "2.8.9" 65 | dependencies = [ 66 | {org = "ballerina", name = "auth"}, 67 | {org = "ballerina", name = "cache"}, 68 | {org = "ballerina", name = "constraint"}, 69 | {org = "ballerina", name = "crypto"}, 70 | {org = "ballerina", name = "file"}, 71 | {org = "ballerina", name = "io"}, 72 | {org = "ballerina", name = "jballerina.java"}, 73 | {org = "ballerina", name = "jwt"}, 74 | {org = "ballerina", name = "lang.array"}, 75 | {org = "ballerina", name = "lang.decimal"}, 76 | {org = "ballerina", name = "lang.int"}, 77 | {org = "ballerina", name = "lang.regexp"}, 78 | {org = "ballerina", name = "lang.runtime"}, 79 | {org = "ballerina", name = "lang.string"}, 80 | {org = "ballerina", name = "lang.value"}, 81 | {org = "ballerina", name = "log"}, 82 | {org = "ballerina", name = "mime"}, 83 | {org = "ballerina", name = "oauth2"}, 84 | {org = "ballerina", name = "observe"}, 85 | {org = "ballerina", name = "time"}, 86 | {org = "ballerina", name = "url"} 87 | ] 88 | modules = [ 89 | {org = "ballerina", packageName = "http", moduleName = "http"} 90 | ] 91 | 92 | [[package]] 93 | org = "ballerina" 94 | name = "io" 95 | version = "1.4.1" 96 | dependencies = [ 97 | {org = "ballerina", name = "jballerina.java"}, 98 | {org = "ballerina", name = "lang.value"} 99 | ] 100 | 101 | [[package]] 102 | org = "ballerina" 103 | name = "jballerina.java" 104 | version = "0.0.0" 105 | 106 | [[package]] 107 | org = "ballerina" 108 | name = "jwt" 109 | version = "2.8.0" 110 | dependencies = [ 111 | {org = "ballerina", name = "cache"}, 112 | {org = "ballerina", name = "crypto"}, 113 | {org = "ballerina", name = "jballerina.java"}, 114 | {org = "ballerina", name = "lang.int"}, 115 | {org = "ballerina", name = "lang.string"}, 116 | {org = "ballerina", name = "log"}, 117 | {org = "ballerina", name = "time"} 118 | ] 119 | 120 | [[package]] 121 | org = "ballerina" 122 | name = "lang.__internal" 123 | version = "0.0.0" 124 | dependencies = [ 125 | {org = "ballerina", name = "jballerina.java"}, 126 | {org = "ballerina", name = "lang.object"} 127 | ] 128 | 129 | [[package]] 130 | org = "ballerina" 131 | name = "lang.array" 132 | version = "0.0.0" 133 | dependencies = [ 134 | {org = "ballerina", name = "jballerina.java"}, 135 | {org = "ballerina", name = "lang.__internal"} 136 | ] 137 | 138 | [[package]] 139 | org = "ballerina" 140 | name = "lang.decimal" 141 | version = "0.0.0" 142 | dependencies = [ 143 | {org = "ballerina", name = "jballerina.java"} 144 | ] 145 | 146 | [[package]] 147 | org = "ballerina" 148 | name = "lang.int" 149 | version = "0.0.0" 150 | dependencies = [ 151 | {org = "ballerina", name = "jballerina.java"}, 152 | {org = "ballerina", name = "lang.__internal"}, 153 | {org = "ballerina", name = "lang.object"} 154 | ] 155 | 156 | [[package]] 157 | org = "ballerina" 158 | name = "lang.object" 159 | version = "0.0.0" 160 | 161 | [[package]] 162 | org = "ballerina" 163 | name = "lang.regexp" 164 | version = "0.0.0" 165 | dependencies = [ 166 | {org = "ballerina", name = "jballerina.java"} 167 | ] 168 | 169 | [[package]] 170 | org = "ballerina" 171 | name = "lang.runtime" 172 | version = "0.0.0" 173 | dependencies = [ 174 | {org = "ballerina", name = "jballerina.java"} 175 | ] 176 | 177 | [[package]] 178 | org = "ballerina" 179 | name = "lang.string" 180 | version = "0.0.0" 181 | dependencies = [ 182 | {org = "ballerina", name = "jballerina.java"}, 183 | {org = "ballerina", name = "lang.regexp"} 184 | ] 185 | 186 | [[package]] 187 | org = "ballerina" 188 | name = "lang.value" 189 | version = "0.0.0" 190 | dependencies = [ 191 | {org = "ballerina", name = "jballerina.java"} 192 | ] 193 | 194 | [[package]] 195 | org = "ballerina" 196 | name = "log" 197 | version = "2.7.1" 198 | dependencies = [ 199 | {org = "ballerina", name = "io"}, 200 | {org = "ballerina", name = "jballerina.java"}, 201 | {org = "ballerina", name = "lang.value"}, 202 | {org = "ballerina", name = "observe"} 203 | ] 204 | 205 | [[package]] 206 | org = "ballerina" 207 | name = "mime" 208 | version = "2.7.1" 209 | dependencies = [ 210 | {org = "ballerina", name = "io"}, 211 | {org = "ballerina", name = "jballerina.java"}, 212 | {org = "ballerina", name = "lang.int"} 213 | ] 214 | 215 | [[package]] 216 | org = "ballerina" 217 | name = "oauth2" 218 | version = "2.8.0" 219 | dependencies = [ 220 | {org = "ballerina", name = "cache"}, 221 | {org = "ballerina", name = "crypto"}, 222 | {org = "ballerina", name = "jballerina.java"}, 223 | {org = "ballerina", name = "log"}, 224 | {org = "ballerina", name = "time"}, 225 | {org = "ballerina", name = "url"} 226 | ] 227 | 228 | [[package]] 229 | org = "ballerina" 230 | name = "observe" 231 | version = "1.0.7" 232 | dependencies = [ 233 | {org = "ballerina", name = "jballerina.java"} 234 | ] 235 | 236 | [[package]] 237 | org = "ballerina" 238 | name = "os" 239 | version = "1.6.0" 240 | dependencies = [ 241 | {org = "ballerina", name = "io"}, 242 | {org = "ballerina", name = "jballerina.java"} 243 | ] 244 | 245 | [[package]] 246 | org = "ballerina" 247 | name = "regex" 248 | version = "1.4.3" 249 | dependencies = [ 250 | {org = "ballerina", name = "jballerina.java"}, 251 | {org = "ballerina", name = "lang.string"} 252 | ] 253 | 254 | [[package]] 255 | org = "ballerina" 256 | name = "task" 257 | version = "2.3.2" 258 | dependencies = [ 259 | {org = "ballerina", name = "jballerina.java"}, 260 | {org = "ballerina", name = "time"} 261 | ] 262 | 263 | [[package]] 264 | org = "ballerina" 265 | name = "time" 266 | version = "2.2.5" 267 | dependencies = [ 268 | {org = "ballerina", name = "jballerina.java"} 269 | ] 270 | 271 | [[package]] 272 | org = "ballerina" 273 | name = "url" 274 | version = "2.2.4" 275 | dependencies = [ 276 | {org = "ballerina", name = "jballerina.java"} 277 | ] 278 | 279 | [[package]] 280 | org = "ballerinai" 281 | name = "observe" 282 | version = "0.0.0" 283 | dependencies = [ 284 | {org = "ballerina", name = "jballerina.java"}, 285 | {org = "ballerina", name = "observe"} 286 | ] 287 | modules = [ 288 | {org = "ballerinai", packageName = "observe", moduleName = "observe"} 289 | ] 290 | 291 | [[package]] 292 | org = "choreo" 293 | name = "guardrail.pii_masking_regex" 294 | version = "1.0.0" 295 | dependencies = [ 296 | {org = "ballerina", name = "http"}, 297 | {org = "ballerinai", name = "observe"}, 298 | {org = "choreo", name = "mediation"} 299 | ] 300 | modules = [ 301 | {org = "choreo", packageName = "guardrail.pii_masking_regex", moduleName = "guardrail.pii_masking_regex"} 302 | ] 303 | 304 | [[package]] 305 | org = "choreo" 306 | name = "mediation" 307 | version = "1.0.1" 308 | dependencies = [ 309 | {org = "ballerina", name = "regex"} 310 | ] 311 | modules = [ 312 | {org = "choreo", packageName = "mediation", moduleName = "mediation"} 313 | ] 314 | 315 | -------------------------------------------------------------------------------- /guardrail-word-count-guardrail/Dependencies.toml: -------------------------------------------------------------------------------- 1 | # AUTO-GENERATED FILE. DO NOT MODIFY. 2 | 3 | # This file is auto-generated by Ballerina for managing dependency versions. 4 | # It should not be modified by hand. 5 | 6 | [ballerina] 7 | dependencies-toml-version = "2" 8 | distribution-version = "2201.5.5" 9 | 10 | [[package]] 11 | org = "ballerina" 12 | name = "auth" 13 | version = "2.8.0" 14 | dependencies = [ 15 | {org = "ballerina", name = "crypto"}, 16 | {org = "ballerina", name = "jballerina.java"}, 17 | {org = "ballerina", name = "lang.array"}, 18 | {org = "ballerina", name = "lang.string"}, 19 | {org = "ballerina", name = "log"} 20 | ] 21 | 22 | [[package]] 23 | org = "ballerina" 24 | name = "cache" 25 | version = "3.5.0" 26 | dependencies = [ 27 | {org = "ballerina", name = "constraint"}, 28 | {org = "ballerina", name = "jballerina.java"}, 29 | {org = "ballerina", name = "task"}, 30 | {org = "ballerina", name = "time"} 31 | ] 32 | 33 | [[package]] 34 | org = "ballerina" 35 | name = "constraint" 36 | version = "1.2.0" 37 | dependencies = [ 38 | {org = "ballerina", name = "jballerina.java"} 39 | ] 40 | 41 | [[package]] 42 | org = "ballerina" 43 | name = "crypto" 44 | version = "2.3.2" 45 | dependencies = [ 46 | {org = "ballerina", name = "jballerina.java"}, 47 | {org = "ballerina", name = "time"} 48 | ] 49 | 50 | [[package]] 51 | org = "ballerina" 52 | name = "file" 53 | version = "1.7.1" 54 | dependencies = [ 55 | {org = "ballerina", name = "io"}, 56 | {org = "ballerina", name = "jballerina.java"}, 57 | {org = "ballerina", name = "os"}, 58 | {org = "ballerina", name = "time"} 59 | ] 60 | 61 | [[package]] 62 | org = "ballerina" 63 | name = "http" 64 | version = "2.8.9" 65 | dependencies = [ 66 | {org = "ballerina", name = "auth"}, 67 | {org = "ballerina", name = "cache"}, 68 | {org = "ballerina", name = "constraint"}, 69 | {org = "ballerina", name = "crypto"}, 70 | {org = "ballerina", name = "file"}, 71 | {org = "ballerina", name = "io"}, 72 | {org = "ballerina", name = "jballerina.java"}, 73 | {org = "ballerina", name = "jwt"}, 74 | {org = "ballerina", name = "lang.array"}, 75 | {org = "ballerina", name = "lang.decimal"}, 76 | {org = "ballerina", name = "lang.int"}, 77 | {org = "ballerina", name = "lang.regexp"}, 78 | {org = "ballerina", name = "lang.runtime"}, 79 | {org = "ballerina", name = "lang.string"}, 80 | {org = "ballerina", name = "lang.value"}, 81 | {org = "ballerina", name = "log"}, 82 | {org = "ballerina", name = "mime"}, 83 | {org = "ballerina", name = "oauth2"}, 84 | {org = "ballerina", name = "observe"}, 85 | {org = "ballerina", name = "time"}, 86 | {org = "ballerina", name = "url"} 87 | ] 88 | modules = [ 89 | {org = "ballerina", packageName = "http", moduleName = "http"} 90 | ] 91 | 92 | [[package]] 93 | org = "ballerina" 94 | name = "io" 95 | version = "1.4.1" 96 | dependencies = [ 97 | {org = "ballerina", name = "jballerina.java"}, 98 | {org = "ballerina", name = "lang.value"} 99 | ] 100 | 101 | [[package]] 102 | org = "ballerina" 103 | name = "jballerina.java" 104 | version = "0.0.0" 105 | 106 | [[package]] 107 | org = "ballerina" 108 | name = "jwt" 109 | version = "2.8.0" 110 | dependencies = [ 111 | {org = "ballerina", name = "cache"}, 112 | {org = "ballerina", name = "crypto"}, 113 | {org = "ballerina", name = "jballerina.java"}, 114 | {org = "ballerina", name = "lang.int"}, 115 | {org = "ballerina", name = "lang.string"}, 116 | {org = "ballerina", name = "log"}, 117 | {org = "ballerina", name = "time"} 118 | ] 119 | 120 | [[package]] 121 | org = "ballerina" 122 | name = "lang.__internal" 123 | version = "0.0.0" 124 | dependencies = [ 125 | {org = "ballerina", name = "jballerina.java"}, 126 | {org = "ballerina", name = "lang.object"} 127 | ] 128 | 129 | [[package]] 130 | org = "ballerina" 131 | name = "lang.array" 132 | version = "0.0.0" 133 | dependencies = [ 134 | {org = "ballerina", name = "jballerina.java"}, 135 | {org = "ballerina", name = "lang.__internal"} 136 | ] 137 | 138 | [[package]] 139 | org = "ballerina" 140 | name = "lang.decimal" 141 | version = "0.0.0" 142 | dependencies = [ 143 | {org = "ballerina", name = "jballerina.java"} 144 | ] 145 | 146 | [[package]] 147 | org = "ballerina" 148 | name = "lang.int" 149 | version = "0.0.0" 150 | dependencies = [ 151 | {org = "ballerina", name = "jballerina.java"}, 152 | {org = "ballerina", name = "lang.__internal"}, 153 | {org = "ballerina", name = "lang.object"} 154 | ] 155 | 156 | [[package]] 157 | org = "ballerina" 158 | name = "lang.object" 159 | version = "0.0.0" 160 | 161 | [[package]] 162 | org = "ballerina" 163 | name = "lang.regexp" 164 | version = "0.0.0" 165 | dependencies = [ 166 | {org = "ballerina", name = "jballerina.java"} 167 | ] 168 | 169 | [[package]] 170 | org = "ballerina" 171 | name = "lang.runtime" 172 | version = "0.0.0" 173 | dependencies = [ 174 | {org = "ballerina", name = "jballerina.java"} 175 | ] 176 | 177 | [[package]] 178 | org = "ballerina" 179 | name = "lang.string" 180 | version = "0.0.0" 181 | dependencies = [ 182 | {org = "ballerina", name = "jballerina.java"}, 183 | {org = "ballerina", name = "lang.regexp"} 184 | ] 185 | 186 | [[package]] 187 | org = "ballerina" 188 | name = "lang.value" 189 | version = "0.0.0" 190 | dependencies = [ 191 | {org = "ballerina", name = "jballerina.java"} 192 | ] 193 | 194 | [[package]] 195 | org = "ballerina" 196 | name = "log" 197 | version = "2.7.1" 198 | dependencies = [ 199 | {org = "ballerina", name = "io"}, 200 | {org = "ballerina", name = "jballerina.java"}, 201 | {org = "ballerina", name = "lang.value"}, 202 | {org = "ballerina", name = "observe"} 203 | ] 204 | 205 | [[package]] 206 | org = "ballerina" 207 | name = "mime" 208 | version = "2.7.1" 209 | dependencies = [ 210 | {org = "ballerina", name = "io"}, 211 | {org = "ballerina", name = "jballerina.java"}, 212 | {org = "ballerina", name = "lang.int"} 213 | ] 214 | 215 | [[package]] 216 | org = "ballerina" 217 | name = "oauth2" 218 | version = "2.8.0" 219 | dependencies = [ 220 | {org = "ballerina", name = "cache"}, 221 | {org = "ballerina", name = "crypto"}, 222 | {org = "ballerina", name = "jballerina.java"}, 223 | {org = "ballerina", name = "log"}, 224 | {org = "ballerina", name = "time"}, 225 | {org = "ballerina", name = "url"} 226 | ] 227 | 228 | [[package]] 229 | org = "ballerina" 230 | name = "observe" 231 | version = "1.0.7" 232 | dependencies = [ 233 | {org = "ballerina", name = "jballerina.java"} 234 | ] 235 | 236 | [[package]] 237 | org = "ballerina" 238 | name = "os" 239 | version = "1.6.0" 240 | dependencies = [ 241 | {org = "ballerina", name = "io"}, 242 | {org = "ballerina", name = "jballerina.java"} 243 | ] 244 | 245 | [[package]] 246 | org = "ballerina" 247 | name = "regex" 248 | version = "1.4.3" 249 | dependencies = [ 250 | {org = "ballerina", name = "jballerina.java"}, 251 | {org = "ballerina", name = "lang.string"} 252 | ] 253 | 254 | [[package]] 255 | org = "ballerina" 256 | name = "task" 257 | version = "2.3.2" 258 | dependencies = [ 259 | {org = "ballerina", name = "jballerina.java"}, 260 | {org = "ballerina", name = "time"} 261 | ] 262 | 263 | [[package]] 264 | org = "ballerina" 265 | name = "time" 266 | version = "2.2.5" 267 | dependencies = [ 268 | {org = "ballerina", name = "jballerina.java"} 269 | ] 270 | 271 | [[package]] 272 | org = "ballerina" 273 | name = "url" 274 | version = "2.2.4" 275 | dependencies = [ 276 | {org = "ballerina", name = "jballerina.java"} 277 | ] 278 | 279 | [[package]] 280 | org = "ballerinai" 281 | name = "observe" 282 | version = "0.0.0" 283 | dependencies = [ 284 | {org = "ballerina", name = "jballerina.java"}, 285 | {org = "ballerina", name = "observe"} 286 | ] 287 | modules = [ 288 | {org = "ballerinai", packageName = "observe", moduleName = "observe"} 289 | ] 290 | 291 | [[package]] 292 | org = "choreo" 293 | name = "guardrail.word_count_guardrail" 294 | version = "1.0.0" 295 | dependencies = [ 296 | {org = "ballerina", name = "http"}, 297 | {org = "ballerinai", name = "observe"}, 298 | {org = "choreo", name = "mediation"} 299 | ] 300 | modules = [ 301 | {org = "choreo", packageName = "guardrail.word_count_guardrail", moduleName = "guardrail.word_count_guardrail"} 302 | ] 303 | 304 | [[package]] 305 | org = "choreo" 306 | name = "mediation" 307 | version = "1.0.1" 308 | dependencies = [ 309 | {org = "ballerina", name = "regex"} 310 | ] 311 | modules = [ 312 | {org = "choreo", packageName = "mediation", moduleName = "mediation"} 313 | ] 314 | 315 | -------------------------------------------------------------------------------- /guardrail-aws-bedrock-guardrail/Dependencies.toml: -------------------------------------------------------------------------------- 1 | # AUTO-GENERATED FILE. DO NOT MODIFY. 2 | 3 | # This file is auto-generated by Ballerina for managing dependency versions. 4 | # It should not be modified by hand. 5 | 6 | [ballerina] 7 | dependencies-toml-version = "2" 8 | distribution-version = "2201.5.5" 9 | 10 | [[package]] 11 | org = "ballerina" 12 | name = "auth" 13 | version = "2.8.0" 14 | dependencies = [ 15 | {org = "ballerina", name = "crypto"}, 16 | {org = "ballerina", name = "jballerina.java"}, 17 | {org = "ballerina", name = "lang.array"}, 18 | {org = "ballerina", name = "lang.string"}, 19 | {org = "ballerina", name = "log"} 20 | ] 21 | 22 | [[package]] 23 | org = "ballerina" 24 | name = "cache" 25 | version = "3.5.0" 26 | dependencies = [ 27 | {org = "ballerina", name = "constraint"}, 28 | {org = "ballerina", name = "jballerina.java"}, 29 | {org = "ballerina", name = "task"}, 30 | {org = "ballerina", name = "time"} 31 | ] 32 | 33 | [[package]] 34 | org = "ballerina" 35 | name = "constraint" 36 | version = "1.2.0" 37 | dependencies = [ 38 | {org = "ballerina", name = "jballerina.java"} 39 | ] 40 | 41 | [[package]] 42 | org = "ballerina" 43 | name = "crypto" 44 | version = "2.3.2" 45 | dependencies = [ 46 | {org = "ballerina", name = "jballerina.java"}, 47 | {org = "ballerina", name = "time"} 48 | ] 49 | 50 | [[package]] 51 | org = "ballerina" 52 | name = "file" 53 | version = "1.7.1" 54 | dependencies = [ 55 | {org = "ballerina", name = "io"}, 56 | {org = "ballerina", name = "jballerina.java"}, 57 | {org = "ballerina", name = "os"}, 58 | {org = "ballerina", name = "time"} 59 | ] 60 | 61 | [[package]] 62 | org = "ballerina" 63 | name = "http" 64 | version = "2.8.9" 65 | dependencies = [ 66 | {org = "ballerina", name = "auth"}, 67 | {org = "ballerina", name = "cache"}, 68 | {org = "ballerina", name = "constraint"}, 69 | {org = "ballerina", name = "crypto"}, 70 | {org = "ballerina", name = "file"}, 71 | {org = "ballerina", name = "io"}, 72 | {org = "ballerina", name = "jballerina.java"}, 73 | {org = "ballerina", name = "jwt"}, 74 | {org = "ballerina", name = "lang.array"}, 75 | {org = "ballerina", name = "lang.decimal"}, 76 | {org = "ballerina", name = "lang.int"}, 77 | {org = "ballerina", name = "lang.regexp"}, 78 | {org = "ballerina", name = "lang.runtime"}, 79 | {org = "ballerina", name = "lang.string"}, 80 | {org = "ballerina", name = "lang.value"}, 81 | {org = "ballerina", name = "log"}, 82 | {org = "ballerina", name = "mime"}, 83 | {org = "ballerina", name = "oauth2"}, 84 | {org = "ballerina", name = "observe"}, 85 | {org = "ballerina", name = "time"}, 86 | {org = "ballerina", name = "url"} 87 | ] 88 | modules = [ 89 | {org = "ballerina", packageName = "http", moduleName = "http"} 90 | ] 91 | 92 | [[package]] 93 | org = "ballerina" 94 | name = "io" 95 | version = "1.4.1" 96 | dependencies = [ 97 | {org = "ballerina", name = "jballerina.java"}, 98 | {org = "ballerina", name = "lang.value"} 99 | ] 100 | 101 | [[package]] 102 | org = "ballerina" 103 | name = "jballerina.java" 104 | version = "0.0.0" 105 | 106 | [[package]] 107 | org = "ballerina" 108 | name = "jwt" 109 | version = "2.8.0" 110 | dependencies = [ 111 | {org = "ballerina", name = "cache"}, 112 | {org = "ballerina", name = "crypto"}, 113 | {org = "ballerina", name = "jballerina.java"}, 114 | {org = "ballerina", name = "lang.int"}, 115 | {org = "ballerina", name = "lang.string"}, 116 | {org = "ballerina", name = "log"}, 117 | {org = "ballerina", name = "time"} 118 | ] 119 | 120 | [[package]] 121 | org = "ballerina" 122 | name = "lang.__internal" 123 | version = "0.0.0" 124 | dependencies = [ 125 | {org = "ballerina", name = "jballerina.java"}, 126 | {org = "ballerina", name = "lang.object"} 127 | ] 128 | 129 | [[package]] 130 | org = "ballerina" 131 | name = "lang.array" 132 | version = "0.0.0" 133 | dependencies = [ 134 | {org = "ballerina", name = "jballerina.java"}, 135 | {org = "ballerina", name = "lang.__internal"} 136 | ] 137 | 138 | [[package]] 139 | org = "ballerina" 140 | name = "lang.decimal" 141 | version = "0.0.0" 142 | dependencies = [ 143 | {org = "ballerina", name = "jballerina.java"} 144 | ] 145 | 146 | [[package]] 147 | org = "ballerina" 148 | name = "lang.int" 149 | version = "0.0.0" 150 | dependencies = [ 151 | {org = "ballerina", name = "jballerina.java"}, 152 | {org = "ballerina", name = "lang.__internal"}, 153 | {org = "ballerina", name = "lang.object"} 154 | ] 155 | 156 | [[package]] 157 | org = "ballerina" 158 | name = "lang.object" 159 | version = "0.0.0" 160 | 161 | [[package]] 162 | org = "ballerina" 163 | name = "lang.regexp" 164 | version = "0.0.0" 165 | dependencies = [ 166 | {org = "ballerina", name = "jballerina.java"} 167 | ] 168 | 169 | [[package]] 170 | org = "ballerina" 171 | name = "lang.runtime" 172 | version = "0.0.0" 173 | dependencies = [ 174 | {org = "ballerina", name = "jballerina.java"} 175 | ] 176 | 177 | [[package]] 178 | org = "ballerina" 179 | name = "lang.string" 180 | version = "0.0.0" 181 | dependencies = [ 182 | {org = "ballerina", name = "jballerina.java"}, 183 | {org = "ballerina", name = "lang.regexp"} 184 | ] 185 | 186 | [[package]] 187 | org = "ballerina" 188 | name = "lang.value" 189 | version = "0.0.0" 190 | dependencies = [ 191 | {org = "ballerina", name = "jballerina.java"} 192 | ] 193 | 194 | [[package]] 195 | org = "ballerina" 196 | name = "log" 197 | version = "2.7.1" 198 | dependencies = [ 199 | {org = "ballerina", name = "io"}, 200 | {org = "ballerina", name = "jballerina.java"}, 201 | {org = "ballerina", name = "lang.value"}, 202 | {org = "ballerina", name = "observe"} 203 | ] 204 | 205 | [[package]] 206 | org = "ballerina" 207 | name = "mime" 208 | version = "2.7.1" 209 | dependencies = [ 210 | {org = "ballerina", name = "io"}, 211 | {org = "ballerina", name = "jballerina.java"}, 212 | {org = "ballerina", name = "lang.int"} 213 | ] 214 | 215 | [[package]] 216 | org = "ballerina" 217 | name = "oauth2" 218 | version = "2.8.0" 219 | dependencies = [ 220 | {org = "ballerina", name = "cache"}, 221 | {org = "ballerina", name = "crypto"}, 222 | {org = "ballerina", name = "jballerina.java"}, 223 | {org = "ballerina", name = "log"}, 224 | {org = "ballerina", name = "time"}, 225 | {org = "ballerina", name = "url"} 226 | ] 227 | 228 | [[package]] 229 | org = "ballerina" 230 | name = "observe" 231 | version = "1.0.7" 232 | dependencies = [ 233 | {org = "ballerina", name = "jballerina.java"} 234 | ] 235 | 236 | [[package]] 237 | org = "ballerina" 238 | name = "os" 239 | version = "1.6.0" 240 | dependencies = [ 241 | {org = "ballerina", name = "io"}, 242 | {org = "ballerina", name = "jballerina.java"} 243 | ] 244 | 245 | [[package]] 246 | org = "ballerina" 247 | name = "regex" 248 | version = "1.4.3" 249 | dependencies = [ 250 | {org = "ballerina", name = "jballerina.java"}, 251 | {org = "ballerina", name = "lang.string"} 252 | ] 253 | 254 | [[package]] 255 | org = "ballerina" 256 | name = "task" 257 | version = "2.3.2" 258 | dependencies = [ 259 | {org = "ballerina", name = "jballerina.java"}, 260 | {org = "ballerina", name = "time"} 261 | ] 262 | 263 | [[package]] 264 | org = "ballerina" 265 | name = "time" 266 | version = "2.2.5" 267 | dependencies = [ 268 | {org = "ballerina", name = "jballerina.java"} 269 | ] 270 | 271 | [[package]] 272 | org = "ballerina" 273 | name = "url" 274 | version = "2.2.4" 275 | dependencies = [ 276 | {org = "ballerina", name = "jballerina.java"} 277 | ] 278 | 279 | [[package]] 280 | org = "ballerinai" 281 | name = "observe" 282 | version = "0.0.0" 283 | dependencies = [ 284 | {org = "ballerina", name = "jballerina.java"}, 285 | {org = "ballerina", name = "observe"} 286 | ] 287 | modules = [ 288 | {org = "ballerinai", packageName = "observe", moduleName = "observe"} 289 | ] 290 | 291 | [[package]] 292 | org = "choreo" 293 | name = "guardrail.aws_bedrock_guardrail" 294 | version = "1.0.0" 295 | dependencies = [ 296 | {org = "ballerina", name = "http"}, 297 | {org = "ballerinai", name = "observe"}, 298 | {org = "choreo", name = "mediation"} 299 | ] 300 | modules = [ 301 | {org = "choreo", packageName = "guardrail.aws_bedrock_guardrail", moduleName = "guardrail.aws_bedrock_guardrail"} 302 | ] 303 | 304 | [[package]] 305 | org = "choreo" 306 | name = "mediation" 307 | version = "1.0.1" 308 | dependencies = [ 309 | {org = "ballerina", name = "regex"} 310 | ] 311 | modules = [ 312 | {org = "choreo", packageName = "mediation", moduleName = "mediation"} 313 | ] 314 | 315 | -------------------------------------------------------------------------------- /ratelimit-ai-token-based-ratelimit/Dependencies.toml: -------------------------------------------------------------------------------- 1 | # AUTO-GENERATED FILE. DO NOT MODIFY. 2 | 3 | # This file is auto-generated by Ballerina for managing dependency versions. 4 | # It should not be modified by hand. 5 | 6 | [ballerina] 7 | dependencies-toml-version = "2" 8 | distribution-version = "2201.5.5" 9 | 10 | [[package]] 11 | org = "ballerina" 12 | name = "auth" 13 | version = "2.8.0" 14 | dependencies = [ 15 | {org = "ballerina", name = "crypto"}, 16 | {org = "ballerina", name = "jballerina.java"}, 17 | {org = "ballerina", name = "lang.array"}, 18 | {org = "ballerina", name = "lang.string"}, 19 | {org = "ballerina", name = "log"} 20 | ] 21 | 22 | [[package]] 23 | org = "ballerina" 24 | name = "cache" 25 | version = "3.5.0" 26 | dependencies = [ 27 | {org = "ballerina", name = "constraint"}, 28 | {org = "ballerina", name = "jballerina.java"}, 29 | {org = "ballerina", name = "task"}, 30 | {org = "ballerina", name = "time"} 31 | ] 32 | 33 | [[package]] 34 | org = "ballerina" 35 | name = "constraint" 36 | version = "1.2.0" 37 | dependencies = [ 38 | {org = "ballerina", name = "jballerina.java"} 39 | ] 40 | 41 | [[package]] 42 | org = "ballerina" 43 | name = "crypto" 44 | version = "2.3.2" 45 | dependencies = [ 46 | {org = "ballerina", name = "jballerina.java"}, 47 | {org = "ballerina", name = "time"} 48 | ] 49 | 50 | [[package]] 51 | org = "ballerina" 52 | name = "file" 53 | version = "1.7.1" 54 | dependencies = [ 55 | {org = "ballerina", name = "io"}, 56 | {org = "ballerina", name = "jballerina.java"}, 57 | {org = "ballerina", name = "os"}, 58 | {org = "ballerina", name = "time"} 59 | ] 60 | 61 | [[package]] 62 | org = "ballerina" 63 | name = "http" 64 | version = "2.8.9" 65 | dependencies = [ 66 | {org = "ballerina", name = "auth"}, 67 | {org = "ballerina", name = "cache"}, 68 | {org = "ballerina", name = "constraint"}, 69 | {org = "ballerina", name = "crypto"}, 70 | {org = "ballerina", name = "file"}, 71 | {org = "ballerina", name = "io"}, 72 | {org = "ballerina", name = "jballerina.java"}, 73 | {org = "ballerina", name = "jwt"}, 74 | {org = "ballerina", name = "lang.array"}, 75 | {org = "ballerina", name = "lang.decimal"}, 76 | {org = "ballerina", name = "lang.int"}, 77 | {org = "ballerina", name = "lang.regexp"}, 78 | {org = "ballerina", name = "lang.runtime"}, 79 | {org = "ballerina", name = "lang.string"}, 80 | {org = "ballerina", name = "lang.value"}, 81 | {org = "ballerina", name = "log"}, 82 | {org = "ballerina", name = "mime"}, 83 | {org = "ballerina", name = "oauth2"}, 84 | {org = "ballerina", name = "observe"}, 85 | {org = "ballerina", name = "time"}, 86 | {org = "ballerina", name = "url"} 87 | ] 88 | modules = [ 89 | {org = "ballerina", packageName = "http", moduleName = "http"} 90 | ] 91 | 92 | [[package]] 93 | org = "ballerina" 94 | name = "io" 95 | version = "1.4.1" 96 | dependencies = [ 97 | {org = "ballerina", name = "jballerina.java"}, 98 | {org = "ballerina", name = "lang.value"} 99 | ] 100 | 101 | [[package]] 102 | org = "ballerina" 103 | name = "jballerina.java" 104 | version = "0.0.0" 105 | 106 | [[package]] 107 | org = "ballerina" 108 | name = "jwt" 109 | version = "2.8.0" 110 | dependencies = [ 111 | {org = "ballerina", name = "cache"}, 112 | {org = "ballerina", name = "crypto"}, 113 | {org = "ballerina", name = "jballerina.java"}, 114 | {org = "ballerina", name = "lang.int"}, 115 | {org = "ballerina", name = "lang.string"}, 116 | {org = "ballerina", name = "log"}, 117 | {org = "ballerina", name = "time"} 118 | ] 119 | 120 | [[package]] 121 | org = "ballerina" 122 | name = "lang.__internal" 123 | version = "0.0.0" 124 | dependencies = [ 125 | {org = "ballerina", name = "jballerina.java"}, 126 | {org = "ballerina", name = "lang.object"} 127 | ] 128 | 129 | [[package]] 130 | org = "ballerina" 131 | name = "lang.array" 132 | version = "0.0.0" 133 | dependencies = [ 134 | {org = "ballerina", name = "jballerina.java"}, 135 | {org = "ballerina", name = "lang.__internal"} 136 | ] 137 | 138 | [[package]] 139 | org = "ballerina" 140 | name = "lang.decimal" 141 | version = "0.0.0" 142 | dependencies = [ 143 | {org = "ballerina", name = "jballerina.java"} 144 | ] 145 | 146 | [[package]] 147 | org = "ballerina" 148 | name = "lang.int" 149 | version = "0.0.0" 150 | dependencies = [ 151 | {org = "ballerina", name = "jballerina.java"}, 152 | {org = "ballerina", name = "lang.__internal"}, 153 | {org = "ballerina", name = "lang.object"} 154 | ] 155 | 156 | [[package]] 157 | org = "ballerina" 158 | name = "lang.object" 159 | version = "0.0.0" 160 | 161 | [[package]] 162 | org = "ballerina" 163 | name = "lang.regexp" 164 | version = "0.0.0" 165 | dependencies = [ 166 | {org = "ballerina", name = "jballerina.java"} 167 | ] 168 | 169 | [[package]] 170 | org = "ballerina" 171 | name = "lang.runtime" 172 | version = "0.0.0" 173 | dependencies = [ 174 | {org = "ballerina", name = "jballerina.java"} 175 | ] 176 | 177 | [[package]] 178 | org = "ballerina" 179 | name = "lang.string" 180 | version = "0.0.0" 181 | dependencies = [ 182 | {org = "ballerina", name = "jballerina.java"}, 183 | {org = "ballerina", name = "lang.regexp"} 184 | ] 185 | 186 | [[package]] 187 | org = "ballerina" 188 | name = "lang.value" 189 | version = "0.0.0" 190 | dependencies = [ 191 | {org = "ballerina", name = "jballerina.java"} 192 | ] 193 | 194 | [[package]] 195 | org = "ballerina" 196 | name = "log" 197 | version = "2.7.1" 198 | dependencies = [ 199 | {org = "ballerina", name = "io"}, 200 | {org = "ballerina", name = "jballerina.java"}, 201 | {org = "ballerina", name = "lang.value"}, 202 | {org = "ballerina", name = "observe"} 203 | ] 204 | 205 | [[package]] 206 | org = "ballerina" 207 | name = "mime" 208 | version = "2.7.1" 209 | dependencies = [ 210 | {org = "ballerina", name = "io"}, 211 | {org = "ballerina", name = "jballerina.java"}, 212 | {org = "ballerina", name = "lang.int"} 213 | ] 214 | 215 | [[package]] 216 | org = "ballerina" 217 | name = "oauth2" 218 | version = "2.8.0" 219 | dependencies = [ 220 | {org = "ballerina", name = "cache"}, 221 | {org = "ballerina", name = "crypto"}, 222 | {org = "ballerina", name = "jballerina.java"}, 223 | {org = "ballerina", name = "log"}, 224 | {org = "ballerina", name = "time"}, 225 | {org = "ballerina", name = "url"} 226 | ] 227 | 228 | [[package]] 229 | org = "ballerina" 230 | name = "observe" 231 | version = "1.0.7" 232 | dependencies = [ 233 | {org = "ballerina", name = "jballerina.java"} 234 | ] 235 | 236 | [[package]] 237 | org = "ballerina" 238 | name = "os" 239 | version = "1.6.0" 240 | dependencies = [ 241 | {org = "ballerina", name = "io"}, 242 | {org = "ballerina", name = "jballerina.java"} 243 | ] 244 | 245 | [[package]] 246 | org = "ballerina" 247 | name = "regex" 248 | version = "1.4.3" 249 | dependencies = [ 250 | {org = "ballerina", name = "jballerina.java"}, 251 | {org = "ballerina", name = "lang.string"} 252 | ] 253 | 254 | [[package]] 255 | org = "ballerina" 256 | name = "task" 257 | version = "2.3.2" 258 | dependencies = [ 259 | {org = "ballerina", name = "jballerina.java"}, 260 | {org = "ballerina", name = "time"} 261 | ] 262 | 263 | [[package]] 264 | org = "ballerina" 265 | name = "time" 266 | version = "2.2.5" 267 | dependencies = [ 268 | {org = "ballerina", name = "jballerina.java"} 269 | ] 270 | 271 | [[package]] 272 | org = "ballerina" 273 | name = "url" 274 | version = "2.2.4" 275 | dependencies = [ 276 | {org = "ballerina", name = "jballerina.java"} 277 | ] 278 | 279 | [[package]] 280 | org = "ballerinai" 281 | name = "observe" 282 | version = "0.0.0" 283 | dependencies = [ 284 | {org = "ballerina", name = "jballerina.java"}, 285 | {org = "ballerina", name = "observe"} 286 | ] 287 | modules = [ 288 | {org = "ballerinai", packageName = "observe", moduleName = "observe"} 289 | ] 290 | 291 | [[package]] 292 | org = "choreo" 293 | name = "mediation" 294 | version = "1.0.1" 295 | dependencies = [ 296 | {org = "ballerina", name = "regex"} 297 | ] 298 | modules = [ 299 | {org = "choreo", packageName = "mediation", moduleName = "mediation"} 300 | ] 301 | 302 | [[package]] 303 | org = "choreo" 304 | name = "ratelimit.token_based_ratelimit" 305 | version = "1.0.0" 306 | dependencies = [ 307 | {org = "ballerina", name = "http"}, 308 | {org = "ballerinai", name = "observe"}, 309 | {org = "choreo", name = "mediation"} 310 | ] 311 | modules = [ 312 | {org = "choreo", packageName = "ratelimit.token_based_ratelimit", moduleName = "ratelimit.token_based_ratelimit"} 313 | ] 314 | 315 | -------------------------------------------------------------------------------- /guardrail-content-length-guardrail/Dependencies.toml: -------------------------------------------------------------------------------- 1 | # AUTO-GENERATED FILE. DO NOT MODIFY. 2 | 3 | # This file is auto-generated by Ballerina for managing dependency versions. 4 | # It should not be modified by hand. 5 | 6 | [ballerina] 7 | dependencies-toml-version = "2" 8 | distribution-version = "2201.5.5" 9 | 10 | [[package]] 11 | org = "ballerina" 12 | name = "auth" 13 | version = "2.8.0" 14 | dependencies = [ 15 | {org = "ballerina", name = "crypto"}, 16 | {org = "ballerina", name = "jballerina.java"}, 17 | {org = "ballerina", name = "lang.array"}, 18 | {org = "ballerina", name = "lang.string"}, 19 | {org = "ballerina", name = "log"} 20 | ] 21 | 22 | [[package]] 23 | org = "ballerina" 24 | name = "cache" 25 | version = "3.5.0" 26 | dependencies = [ 27 | {org = "ballerina", name = "constraint"}, 28 | {org = "ballerina", name = "jballerina.java"}, 29 | {org = "ballerina", name = "task"}, 30 | {org = "ballerina", name = "time"} 31 | ] 32 | 33 | [[package]] 34 | org = "ballerina" 35 | name = "constraint" 36 | version = "1.2.0" 37 | dependencies = [ 38 | {org = "ballerina", name = "jballerina.java"} 39 | ] 40 | 41 | [[package]] 42 | org = "ballerina" 43 | name = "crypto" 44 | version = "2.3.2" 45 | dependencies = [ 46 | {org = "ballerina", name = "jballerina.java"}, 47 | {org = "ballerina", name = "time"} 48 | ] 49 | 50 | [[package]] 51 | org = "ballerina" 52 | name = "file" 53 | version = "1.7.1" 54 | dependencies = [ 55 | {org = "ballerina", name = "io"}, 56 | {org = "ballerina", name = "jballerina.java"}, 57 | {org = "ballerina", name = "os"}, 58 | {org = "ballerina", name = "time"} 59 | ] 60 | 61 | [[package]] 62 | org = "ballerina" 63 | name = "http" 64 | version = "2.8.9" 65 | dependencies = [ 66 | {org = "ballerina", name = "auth"}, 67 | {org = "ballerina", name = "cache"}, 68 | {org = "ballerina", name = "constraint"}, 69 | {org = "ballerina", name = "crypto"}, 70 | {org = "ballerina", name = "file"}, 71 | {org = "ballerina", name = "io"}, 72 | {org = "ballerina", name = "jballerina.java"}, 73 | {org = "ballerina", name = "jwt"}, 74 | {org = "ballerina", name = "lang.array"}, 75 | {org = "ballerina", name = "lang.decimal"}, 76 | {org = "ballerina", name = "lang.int"}, 77 | {org = "ballerina", name = "lang.regexp"}, 78 | {org = "ballerina", name = "lang.runtime"}, 79 | {org = "ballerina", name = "lang.string"}, 80 | {org = "ballerina", name = "lang.value"}, 81 | {org = "ballerina", name = "log"}, 82 | {org = "ballerina", name = "mime"}, 83 | {org = "ballerina", name = "oauth2"}, 84 | {org = "ballerina", name = "observe"}, 85 | {org = "ballerina", name = "time"}, 86 | {org = "ballerina", name = "url"} 87 | ] 88 | modules = [ 89 | {org = "ballerina", packageName = "http", moduleName = "http"} 90 | ] 91 | 92 | [[package]] 93 | org = "ballerina" 94 | name = "io" 95 | version = "1.4.1" 96 | dependencies = [ 97 | {org = "ballerina", name = "jballerina.java"}, 98 | {org = "ballerina", name = "lang.value"} 99 | ] 100 | 101 | [[package]] 102 | org = "ballerina" 103 | name = "jballerina.java" 104 | version = "0.0.0" 105 | 106 | [[package]] 107 | org = "ballerina" 108 | name = "jwt" 109 | version = "2.8.0" 110 | dependencies = [ 111 | {org = "ballerina", name = "cache"}, 112 | {org = "ballerina", name = "crypto"}, 113 | {org = "ballerina", name = "jballerina.java"}, 114 | {org = "ballerina", name = "lang.int"}, 115 | {org = "ballerina", name = "lang.string"}, 116 | {org = "ballerina", name = "log"}, 117 | {org = "ballerina", name = "time"} 118 | ] 119 | 120 | [[package]] 121 | org = "ballerina" 122 | name = "lang.__internal" 123 | version = "0.0.0" 124 | dependencies = [ 125 | {org = "ballerina", name = "jballerina.java"}, 126 | {org = "ballerina", name = "lang.object"} 127 | ] 128 | 129 | [[package]] 130 | org = "ballerina" 131 | name = "lang.array" 132 | version = "0.0.0" 133 | dependencies = [ 134 | {org = "ballerina", name = "jballerina.java"}, 135 | {org = "ballerina", name = "lang.__internal"} 136 | ] 137 | 138 | [[package]] 139 | org = "ballerina" 140 | name = "lang.decimal" 141 | version = "0.0.0" 142 | dependencies = [ 143 | {org = "ballerina", name = "jballerina.java"} 144 | ] 145 | 146 | [[package]] 147 | org = "ballerina" 148 | name = "lang.int" 149 | version = "0.0.0" 150 | dependencies = [ 151 | {org = "ballerina", name = "jballerina.java"}, 152 | {org = "ballerina", name = "lang.__internal"}, 153 | {org = "ballerina", name = "lang.object"} 154 | ] 155 | 156 | [[package]] 157 | org = "ballerina" 158 | name = "lang.object" 159 | version = "0.0.0" 160 | 161 | [[package]] 162 | org = "ballerina" 163 | name = "lang.regexp" 164 | version = "0.0.0" 165 | dependencies = [ 166 | {org = "ballerina", name = "jballerina.java"} 167 | ] 168 | 169 | [[package]] 170 | org = "ballerina" 171 | name = "lang.runtime" 172 | version = "0.0.0" 173 | dependencies = [ 174 | {org = "ballerina", name = "jballerina.java"} 175 | ] 176 | 177 | [[package]] 178 | org = "ballerina" 179 | name = "lang.string" 180 | version = "0.0.0" 181 | dependencies = [ 182 | {org = "ballerina", name = "jballerina.java"}, 183 | {org = "ballerina", name = "lang.regexp"} 184 | ] 185 | 186 | [[package]] 187 | org = "ballerina" 188 | name = "lang.value" 189 | version = "0.0.0" 190 | dependencies = [ 191 | {org = "ballerina", name = "jballerina.java"} 192 | ] 193 | 194 | [[package]] 195 | org = "ballerina" 196 | name = "log" 197 | version = "2.7.1" 198 | dependencies = [ 199 | {org = "ballerina", name = "io"}, 200 | {org = "ballerina", name = "jballerina.java"}, 201 | {org = "ballerina", name = "lang.value"}, 202 | {org = "ballerina", name = "observe"} 203 | ] 204 | 205 | [[package]] 206 | org = "ballerina" 207 | name = "mime" 208 | version = "2.7.1" 209 | dependencies = [ 210 | {org = "ballerina", name = "io"}, 211 | {org = "ballerina", name = "jballerina.java"}, 212 | {org = "ballerina", name = "lang.int"} 213 | ] 214 | 215 | [[package]] 216 | org = "ballerina" 217 | name = "oauth2" 218 | version = "2.8.0" 219 | dependencies = [ 220 | {org = "ballerina", name = "cache"}, 221 | {org = "ballerina", name = "crypto"}, 222 | {org = "ballerina", name = "jballerina.java"}, 223 | {org = "ballerina", name = "log"}, 224 | {org = "ballerina", name = "time"}, 225 | {org = "ballerina", name = "url"} 226 | ] 227 | 228 | [[package]] 229 | org = "ballerina" 230 | name = "observe" 231 | version = "1.0.7" 232 | dependencies = [ 233 | {org = "ballerina", name = "jballerina.java"} 234 | ] 235 | 236 | [[package]] 237 | org = "ballerina" 238 | name = "os" 239 | version = "1.6.0" 240 | dependencies = [ 241 | {org = "ballerina", name = "io"}, 242 | {org = "ballerina", name = "jballerina.java"} 243 | ] 244 | 245 | [[package]] 246 | org = "ballerina" 247 | name = "regex" 248 | version = "1.4.3" 249 | dependencies = [ 250 | {org = "ballerina", name = "jballerina.java"}, 251 | {org = "ballerina", name = "lang.string"} 252 | ] 253 | 254 | [[package]] 255 | org = "ballerina" 256 | name = "task" 257 | version = "2.3.2" 258 | dependencies = [ 259 | {org = "ballerina", name = "jballerina.java"}, 260 | {org = "ballerina", name = "time"} 261 | ] 262 | 263 | [[package]] 264 | org = "ballerina" 265 | name = "time" 266 | version = "2.2.5" 267 | dependencies = [ 268 | {org = "ballerina", name = "jballerina.java"} 269 | ] 270 | 271 | [[package]] 272 | org = "ballerina" 273 | name = "url" 274 | version = "2.2.4" 275 | dependencies = [ 276 | {org = "ballerina", name = "jballerina.java"} 277 | ] 278 | 279 | [[package]] 280 | org = "ballerinai" 281 | name = "observe" 282 | version = "0.0.0" 283 | dependencies = [ 284 | {org = "ballerina", name = "jballerina.java"}, 285 | {org = "ballerina", name = "observe"} 286 | ] 287 | modules = [ 288 | {org = "ballerinai", packageName = "observe", moduleName = "observe"} 289 | ] 290 | 291 | [[package]] 292 | org = "choreo" 293 | name = "guardrail.content_length_guardrail" 294 | version = "1.0.0" 295 | dependencies = [ 296 | {org = "ballerina", name = "http"}, 297 | {org = "ballerinai", name = "observe"}, 298 | {org = "choreo", name = "mediation"} 299 | ] 300 | modules = [ 301 | {org = "choreo", packageName = "guardrail.content_length_guardrail", moduleName = "guardrail.content_length_guardrail"} 302 | ] 303 | 304 | [[package]] 305 | org = "choreo" 306 | name = "mediation" 307 | version = "1.0.1" 308 | dependencies = [ 309 | {org = "ballerina", name = "regex"} 310 | ] 311 | modules = [ 312 | {org = "choreo", packageName = "mediation", moduleName = "mediation"} 313 | ] 314 | 315 | -------------------------------------------------------------------------------- /guardrail-sentence-count-guardrail/Dependencies.toml: -------------------------------------------------------------------------------- 1 | # AUTO-GENERATED FILE. DO NOT MODIFY. 2 | 3 | # This file is auto-generated by Ballerina for managing dependency versions. 4 | # It should not be modified by hand. 5 | 6 | [ballerina] 7 | dependencies-toml-version = "2" 8 | distribution-version = "2201.5.5" 9 | 10 | [[package]] 11 | org = "ballerina" 12 | name = "auth" 13 | version = "2.8.0" 14 | dependencies = [ 15 | {org = "ballerina", name = "crypto"}, 16 | {org = "ballerina", name = "jballerina.java"}, 17 | {org = "ballerina", name = "lang.array"}, 18 | {org = "ballerina", name = "lang.string"}, 19 | {org = "ballerina", name = "log"} 20 | ] 21 | 22 | [[package]] 23 | org = "ballerina" 24 | name = "cache" 25 | version = "3.5.0" 26 | dependencies = [ 27 | {org = "ballerina", name = "constraint"}, 28 | {org = "ballerina", name = "jballerina.java"}, 29 | {org = "ballerina", name = "task"}, 30 | {org = "ballerina", name = "time"} 31 | ] 32 | 33 | [[package]] 34 | org = "ballerina" 35 | name = "constraint" 36 | version = "1.2.0" 37 | dependencies = [ 38 | {org = "ballerina", name = "jballerina.java"} 39 | ] 40 | 41 | [[package]] 42 | org = "ballerina" 43 | name = "crypto" 44 | version = "2.3.2" 45 | dependencies = [ 46 | {org = "ballerina", name = "jballerina.java"}, 47 | {org = "ballerina", name = "time"} 48 | ] 49 | 50 | [[package]] 51 | org = "ballerina" 52 | name = "file" 53 | version = "1.7.1" 54 | dependencies = [ 55 | {org = "ballerina", name = "io"}, 56 | {org = "ballerina", name = "jballerina.java"}, 57 | {org = "ballerina", name = "os"}, 58 | {org = "ballerina", name = "time"} 59 | ] 60 | 61 | [[package]] 62 | org = "ballerina" 63 | name = "http" 64 | version = "2.8.9" 65 | dependencies = [ 66 | {org = "ballerina", name = "auth"}, 67 | {org = "ballerina", name = "cache"}, 68 | {org = "ballerina", name = "constraint"}, 69 | {org = "ballerina", name = "crypto"}, 70 | {org = "ballerina", name = "file"}, 71 | {org = "ballerina", name = "io"}, 72 | {org = "ballerina", name = "jballerina.java"}, 73 | {org = "ballerina", name = "jwt"}, 74 | {org = "ballerina", name = "lang.array"}, 75 | {org = "ballerina", name = "lang.decimal"}, 76 | {org = "ballerina", name = "lang.int"}, 77 | {org = "ballerina", name = "lang.regexp"}, 78 | {org = "ballerina", name = "lang.runtime"}, 79 | {org = "ballerina", name = "lang.string"}, 80 | {org = "ballerina", name = "lang.value"}, 81 | {org = "ballerina", name = "log"}, 82 | {org = "ballerina", name = "mime"}, 83 | {org = "ballerina", name = "oauth2"}, 84 | {org = "ballerina", name = "observe"}, 85 | {org = "ballerina", name = "time"}, 86 | {org = "ballerina", name = "url"} 87 | ] 88 | modules = [ 89 | {org = "ballerina", packageName = "http", moduleName = "http"} 90 | ] 91 | 92 | [[package]] 93 | org = "ballerina" 94 | name = "io" 95 | version = "1.4.1" 96 | dependencies = [ 97 | {org = "ballerina", name = "jballerina.java"}, 98 | {org = "ballerina", name = "lang.value"} 99 | ] 100 | 101 | [[package]] 102 | org = "ballerina" 103 | name = "jballerina.java" 104 | version = "0.0.0" 105 | 106 | [[package]] 107 | org = "ballerina" 108 | name = "jwt" 109 | version = "2.8.0" 110 | dependencies = [ 111 | {org = "ballerina", name = "cache"}, 112 | {org = "ballerina", name = "crypto"}, 113 | {org = "ballerina", name = "jballerina.java"}, 114 | {org = "ballerina", name = "lang.int"}, 115 | {org = "ballerina", name = "lang.string"}, 116 | {org = "ballerina", name = "log"}, 117 | {org = "ballerina", name = "time"} 118 | ] 119 | 120 | [[package]] 121 | org = "ballerina" 122 | name = "lang.__internal" 123 | version = "0.0.0" 124 | dependencies = [ 125 | {org = "ballerina", name = "jballerina.java"}, 126 | {org = "ballerina", name = "lang.object"} 127 | ] 128 | 129 | [[package]] 130 | org = "ballerina" 131 | name = "lang.array" 132 | version = "0.0.0" 133 | dependencies = [ 134 | {org = "ballerina", name = "jballerina.java"}, 135 | {org = "ballerina", name = "lang.__internal"} 136 | ] 137 | 138 | [[package]] 139 | org = "ballerina" 140 | name = "lang.decimal" 141 | version = "0.0.0" 142 | dependencies = [ 143 | {org = "ballerina", name = "jballerina.java"} 144 | ] 145 | 146 | [[package]] 147 | org = "ballerina" 148 | name = "lang.int" 149 | version = "0.0.0" 150 | dependencies = [ 151 | {org = "ballerina", name = "jballerina.java"}, 152 | {org = "ballerina", name = "lang.__internal"}, 153 | {org = "ballerina", name = "lang.object"} 154 | ] 155 | 156 | [[package]] 157 | org = "ballerina" 158 | name = "lang.object" 159 | version = "0.0.0" 160 | 161 | [[package]] 162 | org = "ballerina" 163 | name = "lang.regexp" 164 | version = "0.0.0" 165 | dependencies = [ 166 | {org = "ballerina", name = "jballerina.java"} 167 | ] 168 | 169 | [[package]] 170 | org = "ballerina" 171 | name = "lang.runtime" 172 | version = "0.0.0" 173 | dependencies = [ 174 | {org = "ballerina", name = "jballerina.java"} 175 | ] 176 | 177 | [[package]] 178 | org = "ballerina" 179 | name = "lang.string" 180 | version = "0.0.0" 181 | dependencies = [ 182 | {org = "ballerina", name = "jballerina.java"}, 183 | {org = "ballerina", name = "lang.regexp"} 184 | ] 185 | 186 | [[package]] 187 | org = "ballerina" 188 | name = "lang.value" 189 | version = "0.0.0" 190 | dependencies = [ 191 | {org = "ballerina", name = "jballerina.java"} 192 | ] 193 | 194 | [[package]] 195 | org = "ballerina" 196 | name = "log" 197 | version = "2.7.1" 198 | dependencies = [ 199 | {org = "ballerina", name = "io"}, 200 | {org = "ballerina", name = "jballerina.java"}, 201 | {org = "ballerina", name = "lang.value"}, 202 | {org = "ballerina", name = "observe"} 203 | ] 204 | 205 | [[package]] 206 | org = "ballerina" 207 | name = "mime" 208 | version = "2.7.1" 209 | dependencies = [ 210 | {org = "ballerina", name = "io"}, 211 | {org = "ballerina", name = "jballerina.java"}, 212 | {org = "ballerina", name = "lang.int"} 213 | ] 214 | 215 | [[package]] 216 | org = "ballerina" 217 | name = "oauth2" 218 | version = "2.8.0" 219 | dependencies = [ 220 | {org = "ballerina", name = "cache"}, 221 | {org = "ballerina", name = "crypto"}, 222 | {org = "ballerina", name = "jballerina.java"}, 223 | {org = "ballerina", name = "log"}, 224 | {org = "ballerina", name = "time"}, 225 | {org = "ballerina", name = "url"} 226 | ] 227 | 228 | [[package]] 229 | org = "ballerina" 230 | name = "observe" 231 | version = "1.0.7" 232 | dependencies = [ 233 | {org = "ballerina", name = "jballerina.java"} 234 | ] 235 | 236 | [[package]] 237 | org = "ballerina" 238 | name = "os" 239 | version = "1.6.0" 240 | dependencies = [ 241 | {org = "ballerina", name = "io"}, 242 | {org = "ballerina", name = "jballerina.java"} 243 | ] 244 | 245 | [[package]] 246 | org = "ballerina" 247 | name = "regex" 248 | version = "1.4.3" 249 | dependencies = [ 250 | {org = "ballerina", name = "jballerina.java"}, 251 | {org = "ballerina", name = "lang.string"} 252 | ] 253 | 254 | [[package]] 255 | org = "ballerina" 256 | name = "task" 257 | version = "2.3.2" 258 | dependencies = [ 259 | {org = "ballerina", name = "jballerina.java"}, 260 | {org = "ballerina", name = "time"} 261 | ] 262 | 263 | [[package]] 264 | org = "ballerina" 265 | name = "time" 266 | version = "2.2.5" 267 | dependencies = [ 268 | {org = "ballerina", name = "jballerina.java"} 269 | ] 270 | 271 | [[package]] 272 | org = "ballerina" 273 | name = "url" 274 | version = "2.2.4" 275 | dependencies = [ 276 | {org = "ballerina", name = "jballerina.java"} 277 | ] 278 | 279 | [[package]] 280 | org = "ballerinai" 281 | name = "observe" 282 | version = "0.0.0" 283 | dependencies = [ 284 | {org = "ballerina", name = "jballerina.java"}, 285 | {org = "ballerina", name = "observe"} 286 | ] 287 | modules = [ 288 | {org = "ballerinai", packageName = "observe", moduleName = "observe"} 289 | ] 290 | 291 | [[package]] 292 | org = "choreo" 293 | name = "guardrail.sentence_count_guardrail" 294 | version = "1.0.0" 295 | dependencies = [ 296 | {org = "ballerina", name = "http"}, 297 | {org = "ballerinai", name = "observe"}, 298 | {org = "choreo", name = "mediation"} 299 | ] 300 | modules = [ 301 | {org = "choreo", packageName = "guardrail.sentence_count_guardrail", moduleName = "guardrail.sentence_count_guardrail"} 302 | ] 303 | 304 | [[package]] 305 | org = "choreo" 306 | name = "mediation" 307 | version = "1.0.1" 308 | dependencies = [ 309 | {org = "ballerina", name = "regex"} 310 | ] 311 | modules = [ 312 | {org = "choreo", packageName = "mediation", moduleName = "mediation"} 313 | ] 314 | 315 | -------------------------------------------------------------------------------- /guardrail-pii-masking-guardrails-ai/Dependencies.toml: -------------------------------------------------------------------------------- 1 | # AUTO-GENERATED FILE. DO NOT MODIFY. 2 | 3 | # This file is auto-generated by Ballerina for managing dependency versions. 4 | # It should not be modified by hand. 5 | 6 | [ballerina] 7 | dependencies-toml-version = "2" 8 | distribution-version = "2201.5.5" 9 | 10 | [[package]] 11 | org = "ballerina" 12 | name = "auth" 13 | version = "2.8.0" 14 | dependencies = [ 15 | {org = "ballerina", name = "crypto"}, 16 | {org = "ballerina", name = "jballerina.java"}, 17 | {org = "ballerina", name = "lang.array"}, 18 | {org = "ballerina", name = "lang.string"}, 19 | {org = "ballerina", name = "log"} 20 | ] 21 | 22 | [[package]] 23 | org = "ballerina" 24 | name = "cache" 25 | version = "3.5.0" 26 | dependencies = [ 27 | {org = "ballerina", name = "constraint"}, 28 | {org = "ballerina", name = "jballerina.java"}, 29 | {org = "ballerina", name = "task"}, 30 | {org = "ballerina", name = "time"} 31 | ] 32 | 33 | [[package]] 34 | org = "ballerina" 35 | name = "constraint" 36 | version = "1.2.0" 37 | dependencies = [ 38 | {org = "ballerina", name = "jballerina.java"} 39 | ] 40 | 41 | [[package]] 42 | org = "ballerina" 43 | name = "crypto" 44 | version = "2.3.2" 45 | dependencies = [ 46 | {org = "ballerina", name = "jballerina.java"}, 47 | {org = "ballerina", name = "time"} 48 | ] 49 | 50 | [[package]] 51 | org = "ballerina" 52 | name = "file" 53 | version = "1.7.1" 54 | dependencies = [ 55 | {org = "ballerina", name = "io"}, 56 | {org = "ballerina", name = "jballerina.java"}, 57 | {org = "ballerina", name = "os"}, 58 | {org = "ballerina", name = "time"} 59 | ] 60 | 61 | [[package]] 62 | org = "ballerina" 63 | name = "http" 64 | version = "2.8.9" 65 | dependencies = [ 66 | {org = "ballerina", name = "auth"}, 67 | {org = "ballerina", name = "cache"}, 68 | {org = "ballerina", name = "constraint"}, 69 | {org = "ballerina", name = "crypto"}, 70 | {org = "ballerina", name = "file"}, 71 | {org = "ballerina", name = "io"}, 72 | {org = "ballerina", name = "jballerina.java"}, 73 | {org = "ballerina", name = "jwt"}, 74 | {org = "ballerina", name = "lang.array"}, 75 | {org = "ballerina", name = "lang.decimal"}, 76 | {org = "ballerina", name = "lang.int"}, 77 | {org = "ballerina", name = "lang.regexp"}, 78 | {org = "ballerina", name = "lang.runtime"}, 79 | {org = "ballerina", name = "lang.string"}, 80 | {org = "ballerina", name = "lang.value"}, 81 | {org = "ballerina", name = "log"}, 82 | {org = "ballerina", name = "mime"}, 83 | {org = "ballerina", name = "oauth2"}, 84 | {org = "ballerina", name = "observe"}, 85 | {org = "ballerina", name = "time"}, 86 | {org = "ballerina", name = "url"} 87 | ] 88 | modules = [ 89 | {org = "ballerina", packageName = "http", moduleName = "http"} 90 | ] 91 | 92 | [[package]] 93 | org = "ballerina" 94 | name = "io" 95 | version = "1.4.1" 96 | dependencies = [ 97 | {org = "ballerina", name = "jballerina.java"}, 98 | {org = "ballerina", name = "lang.value"} 99 | ] 100 | 101 | [[package]] 102 | org = "ballerina" 103 | name = "jballerina.java" 104 | version = "0.0.0" 105 | 106 | [[package]] 107 | org = "ballerina" 108 | name = "jwt" 109 | version = "2.8.0" 110 | dependencies = [ 111 | {org = "ballerina", name = "cache"}, 112 | {org = "ballerina", name = "crypto"}, 113 | {org = "ballerina", name = "jballerina.java"}, 114 | {org = "ballerina", name = "lang.int"}, 115 | {org = "ballerina", name = "lang.string"}, 116 | {org = "ballerina", name = "log"}, 117 | {org = "ballerina", name = "time"} 118 | ] 119 | 120 | [[package]] 121 | org = "ballerina" 122 | name = "lang.__internal" 123 | version = "0.0.0" 124 | dependencies = [ 125 | {org = "ballerina", name = "jballerina.java"}, 126 | {org = "ballerina", name = "lang.object"} 127 | ] 128 | 129 | [[package]] 130 | org = "ballerina" 131 | name = "lang.array" 132 | version = "0.0.0" 133 | dependencies = [ 134 | {org = "ballerina", name = "jballerina.java"}, 135 | {org = "ballerina", name = "lang.__internal"} 136 | ] 137 | 138 | [[package]] 139 | org = "ballerina" 140 | name = "lang.decimal" 141 | version = "0.0.0" 142 | dependencies = [ 143 | {org = "ballerina", name = "jballerina.java"} 144 | ] 145 | 146 | [[package]] 147 | org = "ballerina" 148 | name = "lang.int" 149 | version = "0.0.0" 150 | dependencies = [ 151 | {org = "ballerina", name = "jballerina.java"}, 152 | {org = "ballerina", name = "lang.__internal"}, 153 | {org = "ballerina", name = "lang.object"} 154 | ] 155 | 156 | [[package]] 157 | org = "ballerina" 158 | name = "lang.object" 159 | version = "0.0.0" 160 | 161 | [[package]] 162 | org = "ballerina" 163 | name = "lang.regexp" 164 | version = "0.0.0" 165 | dependencies = [ 166 | {org = "ballerina", name = "jballerina.java"} 167 | ] 168 | 169 | [[package]] 170 | org = "ballerina" 171 | name = "lang.runtime" 172 | version = "0.0.0" 173 | dependencies = [ 174 | {org = "ballerina", name = "jballerina.java"} 175 | ] 176 | 177 | [[package]] 178 | org = "ballerina" 179 | name = "lang.string" 180 | version = "0.0.0" 181 | dependencies = [ 182 | {org = "ballerina", name = "jballerina.java"}, 183 | {org = "ballerina", name = "lang.regexp"} 184 | ] 185 | 186 | [[package]] 187 | org = "ballerina" 188 | name = "lang.value" 189 | version = "0.0.0" 190 | dependencies = [ 191 | {org = "ballerina", name = "jballerina.java"} 192 | ] 193 | 194 | [[package]] 195 | org = "ballerina" 196 | name = "log" 197 | version = "2.7.1" 198 | dependencies = [ 199 | {org = "ballerina", name = "io"}, 200 | {org = "ballerina", name = "jballerina.java"}, 201 | {org = "ballerina", name = "lang.value"}, 202 | {org = "ballerina", name = "observe"} 203 | ] 204 | 205 | [[package]] 206 | org = "ballerina" 207 | name = "mime" 208 | version = "2.7.1" 209 | dependencies = [ 210 | {org = "ballerina", name = "io"}, 211 | {org = "ballerina", name = "jballerina.java"}, 212 | {org = "ballerina", name = "lang.int"} 213 | ] 214 | 215 | [[package]] 216 | org = "ballerina" 217 | name = "oauth2" 218 | version = "2.8.0" 219 | dependencies = [ 220 | {org = "ballerina", name = "cache"}, 221 | {org = "ballerina", name = "crypto"}, 222 | {org = "ballerina", name = "jballerina.java"}, 223 | {org = "ballerina", name = "log"}, 224 | {org = "ballerina", name = "time"}, 225 | {org = "ballerina", name = "url"} 226 | ] 227 | 228 | [[package]] 229 | org = "ballerina" 230 | name = "observe" 231 | version = "1.0.7" 232 | dependencies = [ 233 | {org = "ballerina", name = "jballerina.java"} 234 | ] 235 | 236 | [[package]] 237 | org = "ballerina" 238 | name = "os" 239 | version = "1.6.0" 240 | dependencies = [ 241 | {org = "ballerina", name = "io"}, 242 | {org = "ballerina", name = "jballerina.java"} 243 | ] 244 | 245 | [[package]] 246 | org = "ballerina" 247 | name = "regex" 248 | version = "1.4.3" 249 | dependencies = [ 250 | {org = "ballerina", name = "jballerina.java"}, 251 | {org = "ballerina", name = "lang.string"} 252 | ] 253 | 254 | [[package]] 255 | org = "ballerina" 256 | name = "task" 257 | version = "2.3.2" 258 | dependencies = [ 259 | {org = "ballerina", name = "jballerina.java"}, 260 | {org = "ballerina", name = "time"} 261 | ] 262 | 263 | [[package]] 264 | org = "ballerina" 265 | name = "time" 266 | version = "2.2.5" 267 | dependencies = [ 268 | {org = "ballerina", name = "jballerina.java"} 269 | ] 270 | 271 | [[package]] 272 | org = "ballerina" 273 | name = "url" 274 | version = "2.2.4" 275 | dependencies = [ 276 | {org = "ballerina", name = "jballerina.java"} 277 | ] 278 | 279 | [[package]] 280 | org = "ballerinai" 281 | name = "observe" 282 | version = "0.0.0" 283 | dependencies = [ 284 | {org = "ballerina", name = "jballerina.java"}, 285 | {org = "ballerina", name = "observe"} 286 | ] 287 | modules = [ 288 | {org = "ballerinai", packageName = "observe", moduleName = "observe"} 289 | ] 290 | 291 | [[package]] 292 | org = "choreo" 293 | name = "guardrail.pii_masking_guardrails_ai" 294 | version = "1.0.0" 295 | dependencies = [ 296 | {org = "ballerina", name = "http"}, 297 | {org = "ballerinai", name = "observe"}, 298 | {org = "choreo", name = "mediation"} 299 | ] 300 | modules = [ 301 | {org = "choreo", packageName = "guardrail.pii_masking_guardrails_ai", moduleName = "guardrail.pii_masking_guardrails_ai"} 302 | ] 303 | 304 | [[package]] 305 | org = "choreo" 306 | name = "mediation" 307 | version = "1.0.1" 308 | dependencies = [ 309 | {org = "ballerina", name = "regex"} 310 | ] 311 | modules = [ 312 | {org = "choreo", packageName = "mediation", moduleName = "mediation"} 313 | ] 314 | 315 | --------------------------------------------------------------------------------