diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 947e6e2..87e6eb3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: fail-fast: false matrix: version: - - '1.6' + - '1.10' # OpenAPI.jl 1.x floor - '1' # automatically expands to the latest stable 1.x release of Julia - nightly os: @@ -32,24 +32,15 @@ jobs: version: 1 steps: - uses: actions/checkout@v4 - - uses: julia-actions/setup-julia@v1 + - uses: julia-actions/setup-julia@v2 with: version: ${{ matrix.version }} arch: ${{ matrix.arch }} - - uses: actions/cache@v4 - env: - cache-name: cache-artifacts - with: - path: ~/.julia/artifacts - key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }} - restore-keys: | - ${{ runner.os }}-test-${{ env.cache-name }}- - ${{ runner.os }}-test- - ${{ runner.os }}- + - uses: julia-actions/cache@v2 - uses: julia-actions/julia-buildpkg@v1 - uses: julia-actions/julia-runtest@v1 - uses: julia-actions/julia-processcoverage@v1 - - uses: codecov/codecov-action@v2 + - uses: codecov/codecov-action@v4 with: files: lcov.info docs: @@ -60,6 +51,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 + with: + version: '1' - uses: julia-actions/julia-buildpkg@latest - uses: julia-actions/julia-docdeploy@latest env: diff --git a/Project.toml b/Project.toml index 4026ba1..058ce75 100644 --- a/Project.toml +++ b/Project.toml @@ -1,24 +1,28 @@ name = "OpenPolicyAgent" uuid = "8f257efb-743c-4ebc-8197-d291a1f743b4" authors = ["JuliaHub Inc.", "Tanmay Mohapatra "] -version = "0.4.2" +version = "0.5.0" [deps] +Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" +HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3" +JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" OpenAPI = "d5e62ea6-ddf3-4d43-8e4c-ad5e6c8bfd7d" -TimeZones = "f269a46b-ccf7-5d73-abea-4c690281aa53" +UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" [compat] -Dates = "1.6" -OpenAPI = "0.1,0.2" -TimeZones = "1" -julia = "1.6" +Base64 = "1.10" +Dates = "1.10" +HTTP = "2" +JSON = "1.7" +OpenAPI = "1.1.1" +UUIDs = "1.10" +julia = "1.10" [extras] -Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" -JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" -HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3" OpenPolicyAgent_jll = "6ea5c882-2ec3-5826-84d1-aff636352c13" +Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [targets] -test = ["Test", "JSON", "HTTP", "OpenPolicyAgent_jll"] +test = ["Test", "OpenPolicyAgent_jll"] diff --git a/README.md b/README.md index 126e8ae..131a6e6 100644 --- a/README.md +++ b/README.md @@ -7,4 +7,6 @@ This package provides a Julia interface to the OPA server, and the client APIs to interact with the server. It also includes a command-line interface to the OPA command-line tool. +The REST client is generated from the OPA OpenAPI specification with [OpenAPI.jl](https://github.com/JuliaComputing/OpenAPI.jl) 1.x (Julia 1.10 or newer). Version 0.5 changed the client API; see the Client page of the documentation for a migration table. + [![](https://img.shields.io/badge/docs-latest-blue.svg)](https://JuliaComputing.github.io/OpenPolicyAgent.jl) diff --git a/docs/src/ast_walker.md b/docs/src/ast_walker.md index 6f666c9..5300b35 100644 --- a/docs/src/ast_walker.md +++ b/docs/src/ast_walker.md @@ -18,13 +18,12 @@ import OpenPolicyAgent.ASTWalker.AST: ASTVisitor import OpenPolicyAgent.ASTWalker.SQL: SQLVisitor, SQLCondition, UnconditionalInclude, UnconditionalExclude # invoke the partial evaluation endpoint +client = OpenPolicyAgent.Client.Client("http://localhost:8181") partial_query_schema = OpenPolicyAgent.Client.PartialQuerySchema(; ...) -response, _http_resp = OpenPolicyAgent.Client.post_compile( - compile_client; - partial_query_schema = partial_query_schema, -) +response = OpenPolicyAgent.Client.postcompile(; body = partial_query_schema, client) +result = response.result -# crete a Julia representation of the AST +# create a Julia representation of the AST ast = OpenPolicyAgent.ASTWalker.walk(ASTVisitor(), result) # Provide a mapping of schema names and table names that can be used to convert policy paths to SQL table names diff --git a/docs/src/client.md b/docs/src/client.md index 7ec9967..e6f720a 100644 --- a/docs/src/client.md +++ b/docs/src/client.md @@ -10,18 +10,65 @@ OPA exposes domain-agnostic APIs that your service can call to manage and enforc - **Config API** - view instance configuration. - **Status API** - view instance status state. -The `OpenPolicyAgent.Client` module includes methods to help interact with the OPA server using the OpenAPI client. +The `OpenPolicyAgent.Client` module is generated from the OPA OpenAPI specification by [OpenAPI.jl](https://github.com/JuliaComputing/OpenAPI.jl). Each API operation is a function named after its `operationId`, and each schema is a Julia struct. ```julia -opa_client = OpenPolicyAgent.Client.DataApi(openapi_client) +import OpenPolicyAgent: Client -response, _http_resp = OpenPolicyAgent.Client.get_document( - opa_client, - "policies/server/rest/allowed" -); +# One client per OPA server; pass it to every call as the `client` keyword. +client = Client.Client("http://localhost:8181") + +response = Client.getdocument("policies/server/rest/allowed"; client) @test response.result == false + +# Evaluate a rule with an input document +body = Client.InputSchema(; input = Dict("name" => "bob")) +response = Client.getdocumentwithpath("policies/server/rest/allowed", body; client) +@test response.result == true +``` + +Path parameters are positional, a request body is the last positional argument, and every other parameter is a keyword. Optional model fields default to `Client.ABSENT`, which is distinct from an explicit JSON `null`. + +## Responses and errors + +An operation returns the decoded body of a successful response. Pass `with_http_info = true` to get an `ApiResponse` with the status, headers and typed body instead. + +```julia +resp = Client.getdocument("servers"; with_http_info = true, client) +resp.status # 200 +resp.body # a Client.GetDocumentSuccessResponse ``` +A non-2xx response raises `Client.ApiError`. Its `status` field holds the HTTP status, and `decoded` holds the documented error body (an `OpenPolicyAgent.Client.ServerErrorResponse` for most OPA errors) when it could be decoded: + +```julia +try + Client.getstatus(; client) +catch ex + ex isa Client.ApiError || rethrow() + ex.status # 500 + ex.decoded.code # "internal_error" +end +``` + +## Client options + +`Client.Client(server; kwargs...)` accepts `headers` applied to every request and `request_options`, a named tuple passed through to `HTTP.request` (for example `(request_timeout = 5,)`). Request and response validation against the specification is on by default and can be disabled per client with `validate_requests = false` / `validate_responses = false`. + Complete reference is available in the Reference section. -OpenAPI [API Documents](https://github.com/JuliaComputing/OpenPolicyAgent.jl/blob/main/src/client/README.md) also give more details on the API methods. +## Migrating from OpenPolicyAgent 0.4 + +Version 0.5 replaced the client generated by openapi-generator (OpenAPI.jl 0.2) with one generated by OpenAPI.jl 1.x. + +| 0.4 | 0.5 | +| --- | --- | +| `OpenAPI.Clients.Client(url; escape_path_params=false)` | `Client.Client(url)` | +| `api = Client.DataApi(openapi_client)` | no per-tag API structs; pass `client` as a keyword | +| `Client.get_document_with_path(api, path, Dict("input" => x))` | `Client.getdocumentwithpath(path, Client.InputSchema(; input = x); client)` | +| `response, http_resp = Client.get_document(api, path)` | `response = Client.getdocument(path; client)` (`with_http_info = true` for the status) | +| `Client.post_compile(api; partial_query_schema = s)` | `Client.postcompile(; body = s, client)` | +| `explain = true` | `explain = Client.ExplainMode("full")` | +| error bodies returned as the result (e.g. `ServerErrorResponse`) | `Client.ApiError` is thrown; the body is in `ex.decoded` | +| `OpenAPI.Clients.ApiException` | `Client.ApiError` | +| `metrics::Dict{String,Any}` | metrics structs; the entries are in `metrics.additional_properties` | diff --git a/docs/src/reference.md b/docs/src/reference.md index 1e9ed25..a950a7f 100644 --- a/docs/src/reference.md +++ b/docs/src/reference.md @@ -11,56 +11,60 @@ CurrentModule = OpenPolicyAgent ## Client -### PolicyApi +```@docs +OpenPolicyAgent.Client +``` + +### Policy API ```@docs -OpenPolicyAgent.Client.get_policies -OpenPolicyAgent.Client.get_policy_module -OpenPolicyAgent.Client.put_policy_module -OpenPolicyAgent.Client.delete_policy_module +OpenPolicyAgent.Client.getpolicies +OpenPolicyAgent.Client.getpolicymodule +OpenPolicyAgent.Client.putpolicymodule +OpenPolicyAgent.Client.deletepolicymodule ``` -### DataApi +### Data API ```@docs -OpenPolicyAgent.Client.get_document -OpenPolicyAgent.Client.get_document_with_path -OpenPolicyAgent.Client.get_document_from_webhook -OpenPolicyAgent.Client.create_document -OpenPolicyAgent.Client.patch_document -OpenPolicyAgent.Client.delete_document +OpenPolicyAgent.Client.getdocument +OpenPolicyAgent.Client.getdocumentwithpath +OpenPolicyAgent.Client.getdocumentfromwebhook +OpenPolicyAgent.Client.createdocument +OpenPolicyAgent.Client.patchdocument +OpenPolicyAgent.Client.deletedocument ``` -### QueryApi +### Query API ```@docs -OpenPolicyAgent.Client.query_get -OpenPolicyAgent.Client.query_post -OpenPolicyAgent.Client.simple_query +OpenPolicyAgent.Client.queryget +OpenPolicyAgent.Client.querypost +OpenPolicyAgent.Client.simplequery ``` -### CompileApi +### Compile API ```@docs -OpenPolicyAgent.Client.post_compile +OpenPolicyAgent.Client.postcompile ``` -### HealthApi +### Health API ```@docs -OpenPolicyAgent.Client.get_health +OpenPolicyAgent.Client.gethealth ``` -### ConfigApi +### Config API ```@docs -OpenPolicyAgent.Client.get_config +OpenPolicyAgent.Client.getconfig ``` -### StatusApi +### Status API ```@docs -OpenPolicyAgent.Client.get_status +OpenPolicyAgent.Client.getstatus ``` ## Server diff --git a/specs/README.md b/specs/README.md index 17dc8e2..e25dac9 100644 --- a/specs/README.md +++ b/specs/README.md @@ -4,7 +4,7 @@ OPA OpenAPI client and command line interface code is mostly generated from spec ## CLI -The CLI interface is generated using [FigCLIGen.j;](https://github.com/tanmaykm/FigCLIGen.jl), using a [specification](cli/opa.json) derived from the OPA fig specification. To regenerate, install the `FigCLIGen` package and run `cli/generate.jl`. +The CLI interface is generated using [FigCLIGen.jl](https://github.com/tanmaykm/FigCLIGen.jl), using a [specification](cli/opa.json) derived from the OPA fig specification. To regenerate, install the `FigCLIGen` package and run `cli/generate.jl`. ```bash $ julia cli/generate.jl @@ -12,8 +12,10 @@ $ julia cli/generate.jl ## OpenAPI Client -The OpenAPI client is generated using [openapi-generator](https://github.com/OpenAPITools/openapi-generator), using the OpenAPI [specification](openapi/open_policy_agent.yaml) included in this repo. To regenerate, install `openapi-generator` and run `openapi/generate.sh`. +The OpenAPI client (`src/client/OPAClient.jl`) is generated using [OpenAPI.jl](https://github.com/JuliaComputing/OpenAPI.jl), using the OpenAPI [specification](openapi/open_policy_agent.yaml) included in this repo. To regenerate, run `openapi/generate.jl`; it uses the pinned generator version in `openapi/Project.toml`. ```bash -$ openapi/generate.sh +$ julia openapi/generate.jl ``` + +Generation is strict: a specification defect fails the run instead of degrading a generated type. The generated file is committed, so a change to the specification or to the pinned generator version shows up as a diff in `src/client/OPAClient.jl`. diff --git a/specs/openapi/.gitignore b/specs/openapi/.gitignore index 04ab142..ba39cc5 100644 --- a/specs/openapi/.gitignore +++ b/specs/openapi/.gitignore @@ -1,2 +1 @@ -OpenPolicyAgent -*.jar +Manifest.toml diff --git a/specs/openapi/Project.toml b/specs/openapi/Project.toml new file mode 100644 index 0000000..4c03373 --- /dev/null +++ b/specs/openapi/Project.toml @@ -0,0 +1,12 @@ +# Environment for specs/openapi/generate.jl. +# +# OpenAPI is pinned exactly: the generator version determines the emitted +# source byte for byte, so bumping it regenerates src/client/OPAClient.jl and +# is a deliberate change. + +[deps] +OpenAPI = "d5e62ea6-ddf3-4d43-8e4c-ad5e6c8bfd7d" + +[compat] +OpenAPI = "=1.1.0" +julia = "1.10" diff --git a/specs/openapi/generate.jl b/specs/openapi/generate.jl new file mode 100644 index 0000000..fa976e3 --- /dev/null +++ b/specs/openapi/generate.jl @@ -0,0 +1,29 @@ +#!/usr/bin/env julia +# +# Regenerates the OPA REST API client (src/client/OPAClient.jl) from +# open_policy_agent.yaml using OpenAPI.jl's native generator. +# +# julia specs/openapi/generate.jl +# +# The script activates and instantiates the pinned environment in this +# directory (see Project.toml), so no manual setup is needed beyond registry +# access. Planning runs in strict mode: a specification defect fails the run +# instead of silently degrading a generated type. +# +# The module is named `OPAClient` rather than `Client` because it defines the +# `Client(server; kwargs...)` constructor, and a module cannot share a name +# with one of its own bindings. `OpenPolicyAgent.Client` is an alias of it. + +import Pkg +Pkg.activate(@__DIR__) +Pkg.instantiate() + +using OpenAPI + +const SPEC = joinpath(@__DIR__, "open_policy_agent.yaml") +const DEST = normpath(joinpath(@__DIR__, "..", "..", "src", "client", "OPAClient.jl")) + +plan = OpenAPI.plan(SPEC; name = "OPAClient", strict = true) +mkpath(dirname(DEST)) +OpenAPI.client(plan; path = DEST) +@info "generated" DEST diff --git a/specs/openapi/generate.sh b/specs/openapi/generate.sh deleted file mode 100755 index 302d51c..0000000 --- a/specs/openapi/generate.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env bash - -SDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -DESTDIR=${SDIR}/../../src - -rm -rf ${SDIR}/client -java -jar openapi-generator-cli.jar generate \ - -i ${SDIR}/open_policy_agent.yaml \ - -g julia-client \ - -o ${SDIR}/client \ - --additional-properties=packageName=Client \ - --additional-properties=exportModels=false \ - --additional-properties=exportOperations=false - -git rm -rf ${DESTDIR}/client -mkdir ${DESTDIR} -mv ${SDIR}/client ${DESTDIR}/ -git add ${DESTDIR}/client diff --git a/specs/openapi/open_policy_agent.yaml b/specs/openapi/open_policy_agent.yaml index 5161bf9..d783b99 100644 --- a/specs/openapi/open_policy_agent.yaml +++ b/specs/openapi/open_policy_agent.yaml @@ -259,8 +259,7 @@ paths: content: application/json: schema: - type: object - additionalProperties: {} + description: The document to create or overwrite. Can be any JSON value. example: {"example": {"flag": true}} responses: '200': @@ -471,7 +470,7 @@ paths: - $ref: '#/components/parameters/metricsParameter' responses: '200': - $ref: '#/components/responses/noContentResponse' + $ref: '#/components/responses/deletePolicySuccessResponse' '400': $ref: '#/components/responses/badRequestResponse' '404': @@ -616,7 +615,7 @@ paths: - $ref: '#/components/parameters/excludePluginsParameter' responses: '200': - description: OPA service is healthy + $ref: '#/components/responses/healthyResponse' '500': $ref: '#/components/responses/unhealthyResponse' components: @@ -676,12 +675,7 @@ components: in: query required: false schema: - type: string - enum: - - full - - notes - - fails - - debug + $ref: '#/components/schemas/explainMode' instrumentParameter: name: instrument description: |- @@ -791,6 +785,18 @@ components: $ref: '#/components/schemas/compileSuccessResponse' noContentResponse: description: No content + healthyResponse: + description: OPA service is healthy + content: + application/json: + schema: + $ref: '#/components/schemas/healthyResponse' + deletePolicySuccessResponse: + description: Policy module deleted + content: + application/json: + schema: + $ref: '#/components/schemas/deletePolicySuccessResponse' badRequestResponse: description: Bad request content: @@ -862,9 +868,7 @@ components: description: The ad-hoc query to execute. OPA will parse, compile, and execute the query represented by the parameter value. The value MUST be URL encoded. Only used in GET method. For POST method the query is sent as part of the request body and this parameter is not used. type: string input: - description: The input document (in JSON format) - type: object - additionalProperties: {} + description: The input document (in JSON format). Can be any JSON value. errorLocation: type: object properties: @@ -952,7 +956,9 @@ components: } } } - additionalProperties: {} + properties: + input: + description: The input document. Can be any JSON value. x-examples: example: |- { @@ -967,7 +973,6 @@ components: properties: result: description: The result of the query. Can be whatever type the query returns - bool, number, string, array, json. - type: object decision_id: type: string metrics: @@ -982,6 +987,24 @@ components: metrics: type: object additionalProperties: {} + deletePolicySuccessResponse: + type: object + properties: + metrics: + type: object + additionalProperties: {} + healthyResponse: + description: An empty object + type: object + additionalProperties: {} + explainMode: + description: The level of query explanation to include in the response + type: string + enum: + - full + - notes + - fails + - debug createDocumentSuccessResponse: type: object properties: @@ -1011,12 +1034,12 @@ components: from: type: string value: - type: object + description: The value for the operation. Can be any JSON value. compileSuccessResponse: type: object properties: result: - type: object + description: The partial evaluation result - an object with `queries` and optionally `support` (AST nodes). Absent when the query is unconditionally false. provenance: $ref: '#/components/schemas/provenance' metrics: @@ -1115,8 +1138,7 @@ components: example: 1 type: number terms: - description: The type/value pairing for this term - type: object + description: The type/value pairing for this term - an object for a single term, or an array of them for a call partialQuerySchema: type: object example: |- @@ -1136,11 +1158,9 @@ components: description: The query to partially evaluate and compile. type: string input: - description: The input document to use during partial evaluation - type: object + description: The input document to use during partial evaluation. Can be any JSON value. options: description: Additional options to use during partial evaluation. Only disableInlining option is supported. - type: object unknowns: description: The terms to treat as unknown during partial evaluation. type: array diff --git a/src/OpenPolicyAgent.jl b/src/OpenPolicyAgent.jl index cb9224e..9191291 100644 --- a/src/OpenPolicyAgent.jl +++ b/src/OpenPolicyAgent.jl @@ -1,8 +1,26 @@ module OpenPolicyAgent include("cli/cli.jl") -include("client/src/Client.jl") +include("client/OPAClient.jl") include("server/server.jl") include("utils/ast_walker.jl") -end # module OpenPolicyAgent \ No newline at end of file +""" + OpenPolicyAgent.Client + +Client for the OPA REST API, generated from `specs/openapi/open_policy_agent.yaml` +by OpenAPI.jl (see `specs/openapi/generate.jl`). + +`Client` is an alias of the generated module `OPAClient`. The generated module +cannot itself be named `Client` because it defines the `Client(server; kwargs...)` +constructor, and a module cannot share a name with one of its own bindings. + +```julia +client = OpenPolicyAgent.Client.Client("http://localhost:8181") +response = OpenPolicyAgent.Client.getdocument("policies/server/rest/allowed"; client) +response.result +``` +""" +const Client = OPAClient + +end # module OpenPolicyAgent diff --git a/src/client/.openapi-generator-ignore b/src/client/.openapi-generator-ignore deleted file mode 100644 index 7484ee5..0000000 --- a/src/client/.openapi-generator-ignore +++ /dev/null @@ -1,23 +0,0 @@ -# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapitools/openapi-generator - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -# As an example, the C# client generator defines ApiClient.cs. -# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: -#ApiClient.cs - -# You can match any string of characters against a directory, file or extension with a single asterisk (*): -#foo/*/qux -# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux - -# You can recursively match patterns against a directory, file or extension with a double asterisk (**): -#foo/**/qux -# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux - -# You can also negate patterns with an exclamation (!). -# For example, you can ignore all files in a docs folder with the file extension .md: -#docs/*.md -# Then explicitly reverse the ignore rule for a single file: -#!docs/README.md diff --git a/src/client/.openapi-generator/FILES b/src/client/.openapi-generator/FILES deleted file mode 100644 index 4a1f273..0000000 --- a/src/client/.openapi-generator/FILES +++ /dev/null @@ -1,64 +0,0 @@ -.openapi-generator-ignore -README.md -docs/CompileApi.md -docs/CompileSuccessResponse.md -docs/ConfigApi.md -docs/CreateDocumentSuccessResponse.md -docs/DataApi.md -docs/DeleteDocumentSuccessResponse.md -docs/ErrorDetail.md -docs/ErrorLocation.md -docs/GetDocumentSuccessResponse.md -docs/GetPolicyListSuccessResponse.md -docs/GetPolicyModuleSuccessResponse.md -docs/HealthApi.md -docs/PartialQuerySchema.md -docs/PatchOperation.md -docs/Policy.md -docs/PolicyApi.md -docs/PolicyAst.md -docs/PolicyAstPackage.md -docs/PolicyAstPackagePathInner.md -docs/PolicyAstRulesInner.md -docs/PolicyAstRulesInnerBodyInner.md -docs/PolicyAstRulesInnerHead.md -docs/PolicyAstRulesInnerHeadKey.md -docs/Provenance.md -docs/PutPolicySuccessResponse.md -docs/QueryApi.md -docs/QueryParameterPost.md -docs/ServerErrorResponse.md -docs/StatusApi.md -docs/UnhealthyResponse.md -src/Client.jl -src/apis/api_CompileApi.jl -src/apis/api_ConfigApi.jl -src/apis/api_DataApi.jl -src/apis/api_HealthApi.jl -src/apis/api_PolicyApi.jl -src/apis/api_QueryApi.jl -src/apis/api_StatusApi.jl -src/modelincludes.jl -src/models/model_CompileSuccessResponse.jl -src/models/model_CreateDocumentSuccessResponse.jl -src/models/model_DeleteDocumentSuccessResponse.jl -src/models/model_ErrorDetail.jl -src/models/model_ErrorLocation.jl -src/models/model_GetDocumentSuccessResponse.jl -src/models/model_GetPolicyListSuccessResponse.jl -src/models/model_GetPolicyModuleSuccessResponse.jl -src/models/model_PartialQuerySchema.jl -src/models/model_PatchOperation.jl -src/models/model_Policy.jl -src/models/model_PolicyAst.jl -src/models/model_PolicyAstPackage.jl -src/models/model_PolicyAstPackagePathInner.jl -src/models/model_PolicyAstRulesInner.jl -src/models/model_PolicyAstRulesInnerBodyInner.jl -src/models/model_PolicyAstRulesInnerHead.jl -src/models/model_PolicyAstRulesInnerHeadKey.jl -src/models/model_Provenance.jl -src/models/model_PutPolicySuccessResponse.jl -src/models/model_QueryParameterPost.jl -src/models/model_ServerErrorResponse.jl -src/models/model_UnhealthyResponse.jl diff --git a/src/client/.openapi-generator/VERSION b/src/client/.openapi-generator/VERSION deleted file mode 100644 index 44bad91..0000000 --- a/src/client/.openapi-generator/VERSION +++ /dev/null @@ -1 +0,0 @@ -7.0.1-SNAPSHOT \ No newline at end of file diff --git a/src/client/OPAClient.jl b/src/client/OPAClient.jl new file mode 100644 index 0000000..1bbacad --- /dev/null +++ b/src/client/OPAClient.jl @@ -0,0 +1,1901 @@ +# Generated by OpenAPI.jl v1.1.0 from "Open Policy Agent (OPA) REST API" version "0.57.0". Do not edit. +module OPAClient + +using HTTP, JSON, OpenAPI, Base64, Dates, UUIDs +const Runtime = OpenAPI.Runtime +Runtime.require_contract(3, "1.1.0") + +const SchemaEngine = OpenAPI.SchemaEngine +import OpenAPI.Runtime: + ABSENT, Absent, AbstractCredential, ApiError, ApiKeyCredential, ApiResponse, + BasicCredential, BearerCredential, DecodeError, HttpCredential, + MultipartPartHeaders, MutualTLSCredential, SchemaValidationError, + UnexpectedBody, UnexpectedContentType, UnsupportedMediaType, Upload, + _decode, _encode, _form_fields, _object, _required, _request, + _schema_valid, _validate_schema + +const _SECURITY_SCHEMES = Dict{String,NamedTuple}( +) + +const _SCHEMA_RESOURCE_DATA = Any[ + (id = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", retrieval = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", media_type = "application/openapi+yaml", json = "{\"openapi\":\"3.0.3\",\"servers\":[{\"url\":\"http://localhost:8181\",\"description\":\"Local server on default port\"}],\"tags\":[{\"name\":\"Policy\",\"description\":\"The Policy API exposes CRUD endpoints for managing policy modules. Policy modules can be added, removed, and modified at any time.\\nThe identifiers given to policy modules are only used for management purposes. They are not used outside of the Policy API.\"},{\"name\":\"Data\",\"description\":\"Exposes endpoints for reading and writing documents in OPA.\\nFor an explanation of the different types of documents, see [How Does OPA Work?](https://www.openpolicyagent.org/docs/latest/philosophy#how-does-opa-work)\"},{\"name\":\"Query\",\"description\":\"Posting queries to OPA\"},{\"name\":\"Compile\",\"description\":\"Posting partial queries to OPA\"},{\"name\":\"Health\",\"description\":\"Executes a simple built-in policy query to verify that the server is operational.\\nOptionally it can account for bundle activation as well (useful for \\\"ready\\\" checks at startup).\"},{\"name\":\"Config\",\"description\":\"Returns OPA’s active configuration.\\nWhen the discovery feature is enabled, this API can be used to fetch the discovered configuration in the last evaluated discovery bundle.\\nThe credentials field in the Services configuration and the private_key and key fields in the Keys configuration will be omitted from the API response.\"},{\"name\":\"Status\",\"description\":\"Exposes a pull-based API for accessing OPA Status information.\\nNormally this information is pushed by OPA to a remote service via HTTP, console, or custom plugins.\\nHowever, in some cases, callers may wish to poll OPA and fetch the information.\"}],\"info\":{\"title\":\"Open Policy Agent (OPA) REST API\",\"description\":\"OPA provides policy-based control for cloud native environments.\\nThe REST API is a very common way to integrate with OPA.\\nThere are [18 OPA Ecosystem projects](https://www.openpolicyagent.org/ecosystem/rest-api-integration) - many\\nof which are open source - built on the REST API which might serve as inspiration. You may also want to\\nreview the [integration documentation](https://www.openpolicyagent.org/docs/latest/integration) for other\\noptions to build on OPA by embedding functionality directly into your application.\",\"version\":\"0.57.0\",\"x-logo\":{\"url\":\"https://github.com/open-policy-agent/opa/blob/master/docs/website/static/img/logos/opa-horizontal-color.png?raw=true\",\"backgroundColor\":\"#FFFFFF\",\"altText\":\"OPA logo\"},\"contact\":{\"name\":\"The OPA team\",\"url\":\"https://github.com/open-policy-agent/opa\"},\"license\":{\"name\":\"Apache 2.0\",\"url\":\"https://www.apache.org/licenses/LICENSE-2.0\"}},\"externalDocs\":{\"description\":\"OPA documentation\",\"url\":\"https://www.openpolicyagent.org/docs/latest/\"},\"paths\":{\"/\":{\"post\":{\"summary\":\"Execute a simple query.\",\"operationId\":\"simpleQuery\",\"description\":\"OPA serves POST requests without a URL path by querying for the document at path `/data/system/main`.\\nThe content of that document defines the response entirely.\",\"tags\":[\"Query\"],\"parameters\":[{\"\$ref\":\"#/components/parameters/prettyParameter\"}],\"requestBody\":{\"description\":\"The input document (in JSON format)\",\"required\":true,\"content\":{\"application/json\":{\"schema\":{\"\$ref\":\"https://openapi.invalid/schema/root-77324536bc407399a05f.json#/components/schemas/inputSchema\"}}}},\"responses\":{\"200\":{\"\$ref\":\"#/components/responses/simpleQuerySuccessResponse\"},\"400\":{\"\$ref\":\"#/components/responses/badRequestResponse\"},\"404\":{\"\$ref\":\"#/components/responses/notFoundResponse\"},\"500\":{\"\$ref\":\"#/components/responses/serverErrorResponse\"}}}},\"/v1/query\":{\"get\":{\"summary\":\"Execute an ad-hoc query and return bindings for variables found in the query.\",\"operationId\":\"queryGet\",\"description\":\"For queries that have large JSON values it is recommended to use the POST method with the query included as the POST body\",\"tags\":[\"Query\"],\"parameters\":[{\"\$ref\":\"#/components/parameters/prettyParameter\"},{\"\$ref\":\"#/components/parameters/explainParameter\"},{\"\$ref\":\"#/components/parameters/metricsParameter\"},{\"\$ref\":\"#/components/parameters/queryParameterGet\"}],\"responses\":{\"200\":{\"\$ref\":\"#/components/responses/getDocumentSuccessResponse\"},\"400\":{\"\$ref\":\"#/components/responses/badRequestResponse\"},\"404\":{\"\$ref\":\"#/components/responses/notFoundResponse\"},\"500\":{\"\$ref\":\"#/components/responses/serverErrorResponse\"},\"501\":{\"\$ref\":\"#/components/responses/streamingNotImplementedErrorResponse\"}}},\"post\":{\"summary\":\"Execute an ad-hoc query and return bindings for variables found in the query.\",\"operationId\":\"queryPost\",\"description\":\"Query included as the POST body. E.g.:\\n```\\n{\\n \\\"query\\\": \\\"input.servers[i].ports[_] = \\\\\\\"p2\\\\\\\"; input.servers[i].name = name\\\",\\n \\\"input\\\": {\\n \\\"servers\\\": [ ... ],\\n }\\n}\\n```\",\"tags\":[\"Query\"],\"parameters\":[{\"\$ref\":\"#/components/parameters/prettyParameter\"},{\"\$ref\":\"#/components/parameters/explainParameter\"},{\"\$ref\":\"#/components/parameters/metricsParameter\"}],\"requestBody\":{\"description\":\"The query and input document (in JSON format)\",\"required\":true,\"content\":{\"application/json\":{\"schema\":{\"\$ref\":\"https://openapi.invalid/schema/root-77324536bc407399a05f.json#/components/schemas/queryParameterPost\"}}}},\"responses\":{\"200\":{\"\$ref\":\"#/components/responses/getDocumentSuccessResponse\"},\"400\":{\"\$ref\":\"#/components/responses/badRequestResponse\"},\"404\":{\"\$ref\":\"#/components/responses/notFoundResponse\"},\"500\":{\"\$ref\":\"#/components/responses/serverErrorResponse\"},\"501\":{\"\$ref\":\"#/components/responses/streamingNotImplementedErrorResponse\"}}}},\"/v0/data/{path}\":{\"parameters\":[{\"\$ref\":\"#/components/parameters/pathParameter\"}],\"post\":{\"summary\":\"Get a document from a webhook.\",\"description\":\"Use this API if you are enforcing policy decisions via webhooks that have pre-defined request/response formats.\\nNote, the API path prefix is /v0 instead of /v1.\\nThe request message body defines the content of the The input Document. The request message body may be empty.\\nThe path separator is used to access values inside object and array documents.\",\"tags\":[\"Data\"],\"operationId\":\"getDocumentFromWebhook\",\"parameters\":[{\"\$ref\":\"#/components/parameters/prettyParameter\"}],\"requestBody\":{\"description\":\"The input document (in JSON format)\",\"required\":true,\"content\":{\"application/json\":{\"schema\":{\"\$ref\":\"https://openapi.invalid/schema/root-77324536bc407399a05f.json#/components/schemas/inputSchema\"}}}},\"responses\":{\"200\":{\"\$ref\":\"#/components/responses/getDocumentSuccessResponse\"},\"400\":{\"\$ref\":\"#/components/responses/badRequestResponse\"},\"500\":{\"\$ref\":\"#/components/responses/serverErrorResponse\"}}}},\"/v1/data/{path}\":{\"parameters\":[{\"\$ref\":\"#/components/parameters/pathParameter\"}],\"get\":{\"summary\":\"Get a document\",\"description\":\"This API endpoint returns the document specified by `path`.\\n\\nThe path separator is used to access values inside object and array documents.\\nIf the path indexes into an array, the server will attempt to convert the array index to an integer.\\nIf the path element cannot be converted to an integer, the server will respond with 404.\\n\\nThe server will return a *bad request* (400) response if either:\\n- The query requires an input document and you do not provide it\\n- You provide the input document but the query has already defined it.\",\"tags\":[\"Data\"],\"operationId\":\"getDocument\",\"parameters\":[{\"\$ref\":\"#/components/parameters/inputParameter\"},{\"\$ref\":\"#/components/parameters/prettyParameter\"},{\"\$ref\":\"#/components/parameters/provenanceParameter\"},{\"\$ref\":\"#/components/parameters/explainParameter\"},{\"\$ref\":\"#/components/parameters/metricsParameter\"},{\"\$ref\":\"#/components/parameters/instrumentParameter\"},{\"\$ref\":\"#/components/parameters/strictBuiltInErrorParameter\"}],\"responses\":{\"200\":{\"\$ref\":\"#/components/responses/getDocumentSuccessResponse\"},\"400\":{\"\$ref\":\"#/components/responses/badRequestResponse\"},\"500\":{\"\$ref\":\"#/components/responses/serverErrorResponse\"}}},\"post\":{\"summary\":\"Get a document that required an input\",\"description\":\"The request body contains an object that specifies a value for the input document.\\n\\nThe path separator is used to access values inside object and array documents.\\nIf the path indexes into an array, the server will attempt to convert the array index to an integer.\\nIf the path element cannot be converted to an integer, the server will respond with 404.\\n\\nThe server will return a *bad request* (400) response if either:\\n- The query requires an input document and you do not provide it\\n- You provided an input document but the query has already defined it.\",\"tags\":[\"Data\"],\"operationId\":\"getDocumentWithPath\",\"parameters\":[{\"\$ref\":\"#/components/parameters/prettyParameter\"},{\"\$ref\":\"#/components/parameters/provenanceParameter\"},{\"\$ref\":\"#/components/parameters/explainParameter\"},{\"\$ref\":\"#/components/parameters/metricsParameter\"},{\"\$ref\":\"#/components/parameters/instrumentParameter\"},{\"\$ref\":\"#/components/parameters/strictBuiltInErrorParameter\"}],\"requestBody\":{\"description\":\"The input document (in JSON format)\",\"required\":true,\"content\":{\"application/json\":{\"schema\":{\"\$ref\":\"https://openapi.invalid/schema/root-77324536bc407399a05f.json#/components/schemas/inputSchema\"}}}},\"responses\":{\"200\":{\"\$ref\":\"#/components/responses/getDocumentSuccessResponse\"},\"400\":{\"\$ref\":\"#/components/responses/badRequestResponse\"},\"500\":{\"\$ref\":\"#/components/responses/serverErrorResponse\"}}},\"put\":{\"summary\":\"Create or overwrite a document.\",\"operationId\":\"createDocument\",\"description\":\"If the path does not refer to an existing document, the server will attempt to create all of the necessary containing documents.\\nThis behavior is similar in principle to the Unix command mkdir -p.\\nThe server will respect the If-None-Match header if it is set to *.\\nIn this case, the server will not overwrite an existing document located at the path.\",\"tags\":[\"Data\"],\"parameters\":[{\"\$ref\":\"#/components/parameters/metricsParameter\"}],\"requestBody\":{\"description\":\"The document to create or overwrite (in JSON format)\",\"required\":true,\"content\":{\"application/json\":{\"schema\":{\"description\":\"The document to create or overwrite. Can be any JSON value.\",\"example\":{\"example\":{\"flag\":true}}}}}},\"responses\":{\"200\":{\"\$ref\":\"#/components/responses/createDocumentSuccessResponse\"},\"204\":{\"\$ref\":\"#/components/responses/noContentResponse\"},\"304\":{\"\$ref\":\"#/components/responses/noContentResponse\"},\"400\":{\"\$ref\":\"#/components/responses/badRequestResponse\"},\"404\":{\"\$ref\":\"#/components/responses/writeConflictResponse\"},\"500\":{\"\$ref\":\"#/components/responses/serverErrorResponse\"}}},\"patch\":{\"summary\":\"Patch a document\",\"operationId\":\"patchDocument\",\"description\":\"Update a document. The patch operation is specified in the request body.\",\"tags\":[\"Data\"],\"requestBody\":{\"description\":\"The patch operation in `application/json-patch+json` format\",\"required\":true,\"content\":{\"application/json-patch+json\":{\"schema\":{\"type\":\"array\",\"items\":{\"\$ref\":\"https://openapi.invalid/schema/root-77324536bc407399a05f.json#/components/schemas/patchOperation\"}}}}},\"responses\":{\"204\":{\"\$ref\":\"#/components/responses/noContentResponse\"},\"304\":{\"\$ref\":\"#/components/responses/noContentResponse\"},\"400\":{\"\$ref\":\"#/components/responses/badRequestResponse\"},\"404\":{\"\$ref\":\"#/components/responses/writeConflictResponse\"},\"500\":{\"\$ref\":\"#/components/responses/serverErrorResponse\"}}},\"delete\":{\"summary\":\"Delete a document\",\"operationId\":\"deleteDocument\",\"description\":\"The server processes the DELETE method as if the client had sent a PATCH request containing a single remove operation.\",\"tags\":[\"Data\"],\"parameters\":[{\"\$ref\":\"#/components/parameters/metricsParameter\"}],\"responses\":{\"200\":{\"\$ref\":\"#/components/responses/deleteDocumentSuccessResponse\"},\"204\":{\"\$ref\":\"#/components/responses/noContentResponse\"},\"304\":{\"\$ref\":\"#/components/responses/noContentResponse\"},\"400\":{\"\$ref\":\"#/components/responses/badRequestResponse\"},\"404\":{\"\$ref\":\"#/components/responses/writeConflictResponse\"},\"500\":{\"\$ref\":\"#/components/responses/serverErrorResponse\"}}}},\"/v1/policies\":{\"get\":{\"summary\":\"List policies\",\"description\":\"This API endpoint responds with a list of all policy modules on the server (result response)\",\"tags\":[\"Policy\"],\"operationId\":\"getPolicies\",\"parameters\":[{\"\$ref\":\"#/components/parameters/prettyParameter\"}],\"responses\":{\"200\":{\"\$ref\":\"#/components/responses/listPoliciesSuccessResponse\"},\"500\":{\"\$ref\":\"#/components/responses/serverErrorResponse\"}},\"x-code-samples\":[{\"lang\":\"JavaScript\",\"source\":\"fetch(\\\"http://localhost:8181/v1/policies\\\", {\\n \\\"method\\\": \\\"GET\\\",\\n \\\"headers\\\": {}\\n })\\n .then(response => {\\n console.log(response);\\n })\\n .catch(err => {\\n console.error(err);\\n });\\n\"},{\"lang\":\"Python\",\"source\":\"import http.client\\nconn = http.client.HTTPConnection(\\\"localhost:8181\\\")\\nconn.request(\\\"GET\\\", \\\"/v1/policies\\\")\\nres = conn.getresponse()\\ndata = res.read()\\nprint(data.decode(\\\"utf-8\\\"))\\n\"},{\"lang\":\"Java\",\"source\":\"AsyncHttpClient client = new DefaultAsyncHttpClient();\\nclient.prepare(\\\"GET\\\", \\\"http://localhost:8181/v1/policies\\\")\\n .execute()\\n .toCompletableFuture()\\n .thenAccept(System.out::println)\\n .join();\\nclient.close();\\n\"},{\"lang\":\"Go\",\"source\":\"package main\\nimport (\\n \\\"fmt\\\"\\n \\\"net/http\\\"\\n \\\"io/ioutil\\\"\\n )\\nfunc main() {\\n url := \\\"http://localhost:8181/v1/policies\\\"\\n req, _ := http.NewRequest(\\\"GET\\\", url, nil)\\n res, _ := http.DefaultClient.Do(req)\\n defer res.Body.Close()\\n body, _ := ioutil.ReadAll(res.Body)\\n fmt.Println(res)\\n fmt.Println(string(body))\\n}\\n\"}]}},\"/v1/policies/{id}\":{\"parameters\":[{\"\$ref\":\"#/components/parameters/idParameter\"}],\"get\":{\"summary\":\"Get a policy module\",\"description\":\"This API endpoint returns the details of the specified policy module (`{id}`)\",\"tags\":[\"Policy\"],\"operationId\":\"getPolicyModule\",\"parameters\":[{\"\$ref\":\"#/components/parameters/prettyParameter\"}],\"responses\":{\"200\":{\"\$ref\":\"#/components/responses/getPolicyModuleSuccessResponse\"},\"404\":{\"\$ref\":\"#/components/responses/notFoundResponse\"},\"500\":{\"\$ref\":\"#/components/responses/serverErrorResponse\"}}},\"put\":{\"summary\":\"Create or update a policy module\",\"description\":\"- If the policy module does not exist, it is created.\\n- If the policy module already exists, it is replaced.\\n\\nIf the policy module isn't correctly defined, a *bad request* (400) response is returned.\\n\\n### Example policy module\\n```yaml\\npackage opa.examples\\n\\nimport data.servers\\nimport data.networks\\nimport data.ports\\n\\npublic_servers[server] {\\n some k, m\\n \\tserver := servers[_]\\n \\tserver.ports[_] == ports[k].id\\n \\tports[k].networks[_] == networks[m].id\\n \\tnetworks[m].public == true\\n}\\n```\",\"operationId\":\"putPolicyModule\",\"parameters\":[{\"\$ref\":\"#/components/parameters/prettyParameter\"},{\"\$ref\":\"#/components/parameters/metricsParameter\"}],\"requestBody\":{\"required\":true,\"content\":{\"text/plain\":{\"schema\":{\"type\":\"string\",\"example\":\"package opa.examples\\n\\nimport data.servers\\nimport data.networks\\nimport data.ports\\n\\npublic_servers[server] {\\n some k, m\\n \\tserver := servers[_]\\n \\tserver.ports[_] == ports[k].id\\n \\tports[k].networks[_] == networks[m].id\\n \\tnetworks[m].public == true\\n}\"}}}},\"tags\":[\"Policy\"],\"responses\":{\"200\":{\"\$ref\":\"#/components/responses/putPolicySuccessResponse\"},\"400\":{\"\$ref\":\"#/components/responses/badRequestResponse\"},\"500\":{\"\$ref\":\"#/components/responses/serverErrorResponse\"}}},\"delete\":{\"summary\":\"Delete a policy module\",\"description\":\"This API endpoint removes an existing policy module from the server\",\"tags\":[\"Policy\"],\"operationId\":\"deletePolicyModule\",\"parameters\":[{\"\$ref\":\"#/components/parameters/prettyParameter\"},{\"\$ref\":\"#/components/parameters/metricsParameter\"}],\"responses\":{\"200\":{\"\$ref\":\"#/components/responses/deletePolicySuccessResponse\"},\"400\":{\"\$ref\":\"#/components/responses/badRequestResponse\"},\"404\":{\"\$ref\":\"#/components/responses/notFoundResponse\"},\"500\":{\"\$ref\":\"#/components/responses/serverErrorResponse\"}}}},\"/v1/compile\":{\"post\":{\"summary\":\"Partially evaluate a query.\",\"description\":\"The Compile API allows you to partially evaluate Rego queries and obtain a simplified version of the policy.\\nThis is most useful when building integrations where policy logic is to be translated and evaluated in another environment.\\n
\\nFor example, [this post](https://blog.openpolicyagent.org/write-policy-in-opa-enforce-policy-in-sql-d9d24db93bf4) on the\\nOPA blog shows how SQL can be generated based on Compile API output. For more details on Partial Evaluation in OPA, please\\nrefer to [this blog post](https://blog.openpolicyagent.org/partial-evaluation-162750eaf422).\\n
\\nThe example below assumes that OPA has been given the following policy (use `PUT /v1/policies/{path}`):\\n
\\n
\\npackage example\\nallow {\\n  input.subject.clearance_level >= data.reports[_].clearance_level\\n}\\n
\\n
\\nCompile API **request body** so that it contain the following fields:\\n
\\n\\n\\n\\n\\n\\n\\n
FieldTypeRequiredDescription
querystringYesThe query to partially evaluate and compile.
inputanyNoThe input document to use during partial evaluation (default: undefined).
optionsobject[string, any]NoAdditional options to use during partial evaluation. Only disableInlining option is supported. (default: undefined).
unknownsarray[string]NoThe terms to treat as unknown during partial evaluation (default: [\\\"input\\\"]]).
\\n
\\nFor example:\\n
\\n\\n{\\n \\\"query\\\": \\\"data.example.allow == true\\\",\\n \\\"input\\\": {\\n \\\"subject\\\": {\\n \\\"clearance_level\\\": 4\\n }\\n },\\n \\\"unknowns\\\": [\\n \\\"data.reports\\\"\\n ]\\n}\\n\\n
\\nUnconditional Results from Partial Evaluation\\nWhen you partially evaluate a query with the Compile API, OPA returns a new set of queries and supporting policies.\\nHowever, in some cases, the result of Partial Evaluation is a conclusive, unconditional answer.\\n
\\nSee [the guidance](https://www.openpolicyagent.org/docs/latest/rest-api/#unconditional-results-from-partial-evaluation) for details.\",\"tags\":[\"Compile\"],\"externalDocs\":{\"description\":\"Partial evaluation article\",\"url\":\"https://blog.openpolicyagent.org/partial-evaluation-162750eaf422\"},\"operationId\":\"postCompile\",\"parameters\":[{\"\$ref\":\"#/components/parameters/prettyParameter\"},{\"\$ref\":\"#/components/parameters/explainParameter\"},{\"\$ref\":\"#/components/parameters/metricsParameter\"},{\"\$ref\":\"#/components/parameters/instrumentParameter\"}],\"requestBody\":{\"description\":\"The query (in JSON format)\",\"required\":false,\"content\":{\"application/json\":{\"schema\":{\"\$ref\":\"https://openapi.invalid/schema/root-77324536bc407399a05f.json#/components/schemas/partialQuerySchema\"}}}},\"responses\":{\"200\":{\"\$ref\":\"#/components/responses/compileSuccessResponse\"},\"400\":{\"\$ref\":\"#/components/responses/badRequestResponse\"},\"500\":{\"\$ref\":\"#/components/responses/serverErrorResponse\"}}}},\"/v1/config\":{\"get\":{\"summary\":\"Get configurations\",\"description\":\"The /config API endpoint returns OPA's active configuration.\\nWhen the discovery feature is enabled, this API can be used to fetch the discovered configuration in the last evaluated discovery bundle.\\nThe credentials field in the Services configuration and the private_key and key fields in the Keys configuration will be omitted from the API response.\",\"operationId\":\"getConfig\",\"parameters\":[{\"\$ref\":\"#/components/parameters/prettyParameter\"}],\"tags\":[\"Config\"],\"responses\":{\"200\":{\"\$ref\":\"#/components/responses/getConfigSuccessResponse\"},\"500\":{\"\$ref\":\"#/components/responses/serverErrorResponse\"}}}},\"/v1/status\":{\"get\":{\"summary\":\"Get status\",\"description\":\"The /status API endpoint returns the status of the OPA server.\\nThis includes the status of the bundles and plugins.\",\"operationId\":\"getStatus\",\"parameters\":[{\"\$ref\":\"#/components/parameters/prettyParameter\"}],\"tags\":[\"Status\"],\"responses\":{\"200\":{\"\$ref\":\"#/components/responses/getStatusResponse\"},\"500\":{\"\$ref\":\"#/components/responses/serverErrorResponse\"}}}},\"/health\":{\"get\":{\"summary\":\"Health\",\"description\":\"This API endpoint verifies that the server is operational.\\n\\nThe response from the server is either 200 or 500:\\n- **200** - OPA service is healthy. If `bundles` is true, then all configured bundles have been activated. If `plugins` is true, then all plugins are in an 'OK' state.\\n- **500** - OPA service is *not* healthy. If `bundles` is true, at least one of configured bundles has not yet been activated. If `plugins` is true, at least one plugins is in a 'not OK' state.\\n\\n---\\n**Note**\\nThis check is only for initial bundle activation. Subsequent downloads will not affect the health check.\\n\\nUse the **status** endpoint (in the (management API)[management.html]) for more fine-grained bundle status monitoring.\\n\\n---\",\"tags\":[\"Health\"],\"externalDocs\":{\"description\":\"Health API\",\"url\":\"https://www.openpolicyagent.org/docs/latest/rest-api/#health-api\"},\"operationId\":\"getHealth\",\"parameters\":[{\"\$ref\":\"#/components/parameters/bundlesParameter\"},{\"\$ref\":\"#/components/parameters/pluginsParameter\"},{\"\$ref\":\"#/components/parameters/excludePluginsParameter\"}],\"responses\":{\"200\":{\"\$ref\":\"#/components/responses/healthyResponse\"},\"500\":{\"\$ref\":\"#/components/responses/unhealthyResponse\"}}}}},\"components\":{\"parameters\":{\"idParameter\":{\"name\":\"id\",\"description\":\"The name of a policy module\",\"example\":\"example1\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}},\"queryParameterGet\":{\"name\":\"q\",\"description\":\"The ad-hoc query to execute. OPA will parse, compile, and execute the query represented by the parameter value. The value MUST be URL encoded. Only used in GET method. For POST method the query is sent as part of the request body and this parameter is not used.\",\"in\":\"query\",\"required\":true,\"schema\":{\"type\":\"string\"}},\"prettyParameter\":{\"name\":\"pretty\",\"description\":\"If true, response will be in a human-readable format.\",\"example\":true,\"in\":\"query\",\"required\":false,\"schema\":{\"type\":\"boolean\"}},\"metricsParameter\":{\"name\":\"metrics\",\"description\":\"If true, compiler performance metrics will be returned in the response.\",\"example\":false,\"in\":\"query\",\"required\":false,\"schema\":{\"type\":\"boolean\"}},\"pathParameter\":{\"name\":\"path\",\"description\":\"A backslash (/) delimited path to access values inside object and array documents. If the path points to an array, the server will attempt to convert the array index to an integer. If the path element cannot be converted to an integer, the server will respond with 404.\",\"example\":\"opa/examples/public_servers\",\"in\":\"path\",\"required\":true,\"allowReserved\":true,\"schema\":{\"type\":\"string\"}},\"provenanceParameter\":{\"name\":\"provenance\",\"description\":\"If true, response will include build and version information in addition to the result.\",\"example\":false,\"in\":\"query\",\"required\":false,\"schema\":{\"type\":\"boolean\"}},\"explainParameter\":{\"name\":\"explain\",\"description\":\"If set to *full*, response will include query explanations in addition to the result.\",\"example\":\"full\",\"in\":\"query\",\"required\":false,\"schema\":{\"\$ref\":\"https://openapi.invalid/schema/root-77324536bc407399a05f.json#/components/schemas/explainMode\"}},\"instrumentParameter\":{\"name\":\"instrument\",\"description\":\"If true, response will return additional performance metrics in addition to the result and the standard metrics.\\n\\n**Caution:** This can add significant overhead to query evaluation. The recommendation is to only use this parameter if you are debugging a performance problem.\",\"example\":false,\"in\":\"query\",\"required\":false,\"schema\":{\"type\":\"boolean\"}},\"strictBuiltInErrorParameter\":{\"name\":\"strict-builtin-errors\",\"description\":\"Treat built-in function call errors as fatal and return an error immediately.\",\"example\":false,\"in\":\"query\",\"required\":false,\"schema\":{\"type\":\"boolean\"}},\"inputParameter\":{\"name\":\"input\",\"description\":\"Provide the text for an [input document](https://www.openpolicyagent.org/docs/latest/kubernetes-primer/#input-document) in JSON format\",\"in\":\"query\",\"required\":false,\"schema\":{\"type\":\"object\",\"additionalProperties\":{},\"example\":{\"input\":{\"example\":{\"flag\":true}}}}},\"bundlesParameter\":{\"name\":\"bundles\",\"description\":\"Reports on bundle activation status (useful for 'ready' checks at startup).\\n\\nThis includes any discovery bundles or bundles defined in the loaded discovery configuration.\",\"example\":true,\"in\":\"query\",\"required\":false,\"schema\":{\"type\":\"boolean\"}},\"pluginsParameter\":{\"name\":\"plugins\",\"description\":\"Reports on plugin status\",\"example\":false,\"in\":\"query\",\"required\":false,\"schema\":{\"type\":\"boolean\"}},\"excludePluginsParameter\":{\"name\":\"exclude-plugin\",\"description\":\"String parameter to exclude a plugin from status checks.\\nCan be added multiple times. Does nothing if plugins is not true.\\nThis parameter is useful for special use cases where a plugin depends on the server being fully initialized before it can fully initialize itself.\\nExclude the specified plugin from the response.\",\"in\":\"query\",\"required\":false,\"schema\":{\"type\":\"string\"}}},\"responses\":{\"putPolicySuccessResponse\":{\"description\":\"Success\",\"content\":{\"application/json\":{\"schema\":{\"\$ref\":\"https://openapi.invalid/schema/root-77324536bc407399a05f.json#/components/schemas/putPolicySuccessResponse\"}}}},\"createDocumentSuccessResponse\":{\"description\":\"Success\",\"content\":{\"application/json\":{\"schema\":{\"\$ref\":\"https://openapi.invalid/schema/root-77324536bc407399a05f.json#/components/schemas/createDocumentSuccessResponse\"}}}},\"deleteDocumentSuccessResponse\":{\"description\":\"Success\",\"content\":{\"application/json\":{\"schema\":{\"\$ref\":\"https://openapi.invalid/schema/root-77324536bc407399a05f.json#/components/schemas/deleteDocumentSuccessResponse\"}}}},\"listPoliciesSuccessResponse\":{\"description\":\"Success\",\"content\":{\"application/json\":{\"schema\":{\"\$ref\":\"https://openapi.invalid/schema/root-77324536bc407399a05f.json#/components/schemas/getPolicyListSuccessResponse\"}}}},\"getPolicyModuleSuccessResponse\":{\"description\":\"Success\",\"content\":{\"application/json\":{\"schema\":{\"\$ref\":\"https://openapi.invalid/schema/root-77324536bc407399a05f.json#/components/schemas/getPolicyModuleSuccessResponse\"}}}},\"getDocumentSuccessResponse\":{\"description\":\"Success\",\"content\":{\"application/json\":{\"schema\":{\"\$ref\":\"https://openapi.invalid/schema/root-77324536bc407399a05f.json#/components/schemas/getDocumentSuccessResponse\"}}}},\"simpleQuerySuccessResponse\":{\"description\":\"Success\",\"content\":{\"application/json\":{\"schema\":{\"\$ref\":\"https://openapi.invalid/schema/root-77324536bc407399a05f.json#/components/schemas/simpleQuerySuccessResponse\"}}}},\"compileSuccessResponse\":{\"description\":\"Success\",\"content\":{\"application/json\":{\"schema\":{\"\$ref\":\"https://openapi.invalid/schema/root-77324536bc407399a05f.json#/components/schemas/compileSuccessResponse\"}}}},\"noContentResponse\":{\"description\":\"No content\"},\"healthyResponse\":{\"description\":\"OPA service is healthy\",\"content\":{\"application/json\":{\"schema\":{\"\$ref\":\"https://openapi.invalid/schema/root-77324536bc407399a05f.json#/components/schemas/healthyResponse\"}}}},\"deletePolicySuccessResponse\":{\"description\":\"Policy module deleted\",\"content\":{\"application/json\":{\"schema\":{\"\$ref\":\"https://openapi.invalid/schema/root-77324536bc407399a05f.json#/components/schemas/deletePolicySuccessResponse\"}}}},\"badRequestResponse\":{\"description\":\"Bad request\",\"content\":{\"application/json\":{\"schema\":{\"\$ref\":\"https://openapi.invalid/schema/root-77324536bc407399a05f.json#/components/schemas/serverErrorResponse\"}}}},\"notFoundResponse\":{\"description\":\"Not found\",\"content\":{\"application/json\":{\"schema\":{\"\$ref\":\"https://openapi.invalid/schema/root-77324536bc407399a05f.json#/components/schemas/serverErrorResponse\"}}}},\"writeConflictResponse\":{\"description\":\"Write conflict\",\"content\":{\"application/json\":{\"schema\":{\"\$ref\":\"https://openapi.invalid/schema/root-77324536bc407399a05f.json#/components/schemas/serverErrorResponse\"}}}},\"serverErrorResponse\":{\"description\":\"Server error\",\"content\":{\"application/json\":{\"schema\":{\"\$ref\":\"https://openapi.invalid/schema/root-77324536bc407399a05f.json#/components/schemas/serverErrorResponse\"}}}},\"streamingNotImplementedErrorResponse\":{\"description\":\"Streaming not implemented\",\"content\":{\"application/json\":{\"schema\":{\"\$ref\":\"https://openapi.invalid/schema/root-77324536bc407399a05f.json#/components/schemas/serverErrorResponse\"}}}},\"getConfigSuccessResponse\":{\"description\":\"Represents the active configuration\",\"content\":{\"application/json\":{\"schema\":{\"\$ref\":\"https://openapi.invalid/schema/root-77324536bc407399a05f.json#/components/schemas/activeConfiguration\"}}}},\"getStatusResponse\":{\"description\":\"Represents the status of the OPA server\",\"content\":{\"application/json\":{\"schema\":{\"\$ref\":\"https://openapi.invalid/schema/root-77324536bc407399a05f.json#/components/schemas/status\"}}}},\"unhealthyResponse\":{\"description\":\"Unhealthy\",\"content\":{\"application/json\":{\"schema\":{\"\$ref\":\"https://openapi.invalid/schema/root-77324536bc407399a05f.json#/components/schemas/unhealthyResponse\"}}}}},\"schemas\":{\"unhealthyResponse\":{\"type\":\"object\",\"properties\":{\"error\":{\"type\":\"string\",\"description\":\"The error message\",\"example\":\"not all plugins in OK state\"}},\"required\":[\"error\"]},\"status\":{\"type\":\"object\",\"additionalProperties\":{}},\"activeConfiguration\":{\"type\":\"object\",\"additionalProperties\":{}},\"queryParameterPost\":{\"type\":\"object\",\"properties\":{\"query\":{\"description\":\"The ad-hoc query to execute. OPA will parse, compile, and execute the query represented by the parameter value. The value MUST be URL encoded. Only used in GET method. For POST method the query is sent as part of the request body and this parameter is not used.\",\"type\":\"string\"},\"input\":{\"description\":\"The input document (in JSON format). Can be any JSON value.\"}}},\"errorLocation\":{\"type\":\"object\",\"properties\":{\"file\":{\"description\":\"The policy module name that generated the error\",\"type\":\"string\",\"example\":\"example1\"},\"row\":{\"description\":\"The line number in the policy module where the error occurred\",\"type\":\"number\",\"example\":3},\"col\":{\"description\":\"The column in the policy module where the error occurred\",\"type\":\"number\",\"example\":1}}},\"errorDetail\":{\"type\":\"object\",\"properties\":{\"code\":{\"description\":\"The error code name\",\"type\":\"string\",\"minLength\":1,\"example\":\"rego_unsafe_var_error\"},\"message\":{\"description\":\"A general description of the error\",\"type\":\"string\",\"minLength\":1,\"example\":\"var x is unsafe\"},\"location\":{\"description\":\"Where the error occurred\",\"\$ref\":\"https://openapi.invalid/schema/root-77324536bc407399a05f.json#/components/schemas/errorLocation\"}},\"required\":[\"code\",\"message\"]},\"serverErrorResponse\":{\"type\":\"object\",\"properties\":{\"code\":{\"description\":\"The error code name\",\"example\":\"internal_error\",\"type\":\"string\",\"minLength\":1},\"message\":{\"description\":\"A general description of the error\",\"type\":\"string\",\"minLength\":1,\"example\":\"error(s) occurred while compiling module(s)\"},\"errors\":{\"description\":\"Errors that may have been generated during the parse, compile, or installation of a policy module\",\"type\":\"array\",\"uniqueItems\":true,\"items\":{\"\$ref\":\"https://openapi.invalid/schema/root-77324536bc407399a05f.json#/components/schemas/errorDetail\"}}},\"required\":[\"code\",\"message\"]},\"provenance\":{\"type\":\"object\",\"properties\":{\"version\":{\"type\":\"string\",\"description\":\"The version of this OPA instance\"},\"build_commit\":{\"type\":\"string\",\"example\":\"4c6e524\",\"description\":\"The Git commit id of this OPA build.\"},\"build_timestamp\":{\"type\":\"string\",\"description\":\"When this OPA instance was built (in [ISO8601 format](https://www.w3.org/TR/NOTE-datetime))\"},\"build_hostname\":{\"type\":\"string\",\"description\":\"The hostname where this instance was built.\",\"example\":\"3bb58334a5a9\"},\"bundles\":{\"type\":\"object\",\"description\":\"A set of key-value pairs describing each bundle activated on the server.\",\"additionalProperties\":{}}}},\"inputSchema\":{\"type\":\"object\",\"example\":\"{\\n \\\"input\\\": {\\n \\\"example\\\": {\\n \\\"flag\\\": true\\n }\\n }\\n }\",\"properties\":{\"input\":{\"description\":\"The input document. Can be any JSON value.\"}},\"x-examples\":{\"example\":\"{\\n \\\"input\\\": {\\n \\\"example\\\": {\\n \\\"flag\\\": true\\n }\\n }\\n }\"}},\"getDocumentSuccessResponse\":{\"type\":\"object\",\"properties\":{\"result\":{\"description\":\"The result of the query. Can be whatever type the query returns - bool, number, string, array, json.\"},\"decision_id\":{\"type\":\"string\"},\"metrics\":{\"type\":\"object\",\"additionalProperties\":{}}}},\"simpleQuerySuccessResponse\":{\"type\":\"object\",\"additionalProperties\":{}},\"putPolicySuccessResponse\":{\"type\":\"object\",\"properties\":{\"metrics\":{\"type\":\"object\",\"additionalProperties\":{}}}},\"deletePolicySuccessResponse\":{\"type\":\"object\",\"properties\":{\"metrics\":{\"type\":\"object\",\"additionalProperties\":{}}}},\"healthyResponse\":{\"description\":\"An empty object\",\"type\":\"object\",\"additionalProperties\":{}},\"explainMode\":{\"description\":\"The level of query explanation to include in the response\",\"type\":\"string\",\"enum\":[\"full\",\"notes\",\"fails\",\"debug\"]},\"createDocumentSuccessResponse\":{\"type\":\"object\",\"properties\":{\"metrics\":{\"type\":\"object\",\"additionalProperties\":{}}}},\"deleteDocumentSuccessResponse\":{\"type\":\"object\",\"properties\":{\"metrics\":{\"type\":\"object\",\"additionalProperties\":{}}}},\"patchOperation\":{\"type\":\"object\",\"properties\":{\"op\":{\"type\":\"string\",\"enum\":[\"add\",\"remove\",\"replace\",\"move\",\"copy\",\"test\"]},\"path\":{\"type\":\"string\"},\"from\":{\"type\":\"string\"},\"value\":{\"description\":\"The value for the operation. Can be any JSON value.\"}}},\"compileSuccessResponse\":{\"type\":\"object\",\"properties\":{\"result\":{\"description\":\"The partial evaluation result - an object with `queries` and optionally `support` (AST nodes). Absent when the query is unconditionally false.\"},\"provenance\":{\"\$ref\":\"https://openapi.invalid/schema/root-77324536bc407399a05f.json#/components/schemas/provenance\"},\"metrics\":{\"type\":\"object\",\"additionalProperties\":{}}}},\"getPolicyListSuccessResponse\":{\"type\":\"object\",\"properties\":{\"result\":{\"\$ref\":\"https://openapi.invalid/schema/root-77324536bc407399a05f.json#/components/schemas/policyList\"}},\"required\":[\"result\"]},\"getPolicyModuleSuccessResponse\":{\"type\":\"object\",\"properties\":{\"result\":{\"\$ref\":\"https://openapi.invalid/schema/root-77324536bc407399a05f.json#/components/schemas/policy\"}},\"required\":[\"result\"]},\"policyList\":{\"type\":\"array\",\"items\":{\"\$ref\":\"https://openapi.invalid/schema/root-77324536bc407399a05f.json#/components/schemas/policy\"}},\"policy\":{\"type\":\"object\",\"description\":\"A policy module\",\"properties\":{\"id\":{\"description\":\"The name of a policy module\",\"example\":\"policies/policies/server/rest/policy.rego\",\"type\":\"string\",\"minLength\":1},\"raw\":{\"description\":\"A string representation of the full Rego policy\",\"type\":\"string\",\"example\":\"package opa.examples\\\\n\\\\nimport data.servers\\\\n\\\\nviolations[server] {\\\\n\\\\tserver = servers[_]\\\\n\\\\tserver.protocols[_] = \\\\\\\"http\\\\\\\"\\\\n\\\\tpublic_servers[server]\\\\n}\\\\n\",\"minLength\":1},\"ast\":{\"description\":\"The types for declarations and runtime objects passed to your implementation. This consists of an abstract syntax tree (AST) of policy modules, package and import declarations, rules, expressions, and terms.\",\"externalDocs\":{\"description\":\"AST\",\"url\":\"https://godoc.org/github.com/open-policy-agent/opa/ast\"},\"type\":\"object\",\"properties\":{\"package\":{\"type\":\"object\",\"properties\":{\"path\":{\"description\":\"The path to the package\",\"type\":\"array\",\"items\":{\"properties\":{\"type\":{\"description\":\"The type of the path operation\",\"example\":\"import\",\"type\":\"string\"},\"value\":{\"description\":\"The path variable\",\"example\":\"data.opa.example\",\"type\":\"string\"}}}}}},\"rules\":{\"description\":\"When OPA evaluates a rule, it generates the content of a [virtual documents](https://www.openpolicyagent.org/docs/latest/philosophy/#the-opa-document-model)\",\"externalDocs\":{\"description\":\"Rules\",\"url\":\"https://www.openpolicyagent.org/docs/latest/policy-language/#rules\"},\"type\":\"array\",\"uniqueItems\":true,\"items\":{\"properties\":{\"head\":{\"type\":\"object\",\"properties\":{\"name\":{\"description\":\"The head of the rule\",\"example\":\"violations\",\"type\":\"string\"},\"key\":{\"description\":\"The type/value pairing for this rule's head\",\"type\":\"object\",\"properties\":{\"type\":{\"description\":\"The type of the head\",\"example\":\"var\",\"type\":\"string\"},\"value\":{\"description\":\"The value of the head\",\"example\":\"server\",\"type\":\"string\"}}}}},\"body\":{\"description\":\"A list of the terms in this rule\",\"type\":\"array\",\"items\":{\"properties\":{\"index\":{\"description\":\"The location of this term in the list (starts at 0)\",\"example\":1,\"type\":\"number\"},\"terms\":{\"description\":\"The type/value pairing for this term - an object for a single term, or an array of them for a call\"}}}}}}}}}}},\"partialQuerySchema\":{\"type\":\"object\",\"example\":\"{\\n \\\"query\\\": \\\"data.example.allow == true\\\",\\n \\\"input\\\": {\\n \\\"subject\\\": {\\n \\\"clearance_level\\\": 4\\n }\\n },\\n \\\"unknowns\\\": [\\n \\\"data.reports\\\"\\n ]\\n}\",\"properties\":{\"query\":{\"description\":\"The query to partially evaluate and compile.\",\"type\":\"string\"},\"input\":{\"description\":\"The input document to use during partial evaluation. Can be any JSON value.\"},\"options\":{\"description\":\"Additional options to use during partial evaluation. Only disableInlining option is supported.\"},\"unknowns\":{\"description\":\"The terms to treat as unknown during partial evaluation.\",\"type\":\"array\",\"items\":{\"type\":\"string\"}}}}},\"securitySchemes\":{}},\"security\":[]}"), +] +const _SCHEMA_ROOT_DATA = Any[ + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/bundlesParameter/schema", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/excludePluginsParameter/schema", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/explainParameter/schema", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/idParameter/schema", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/inputParameter/schema", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/instrumentParameter/schema", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/metricsParameter/schema", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/pathParameter/schema", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/pluginsParameter/schema", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/prettyParameter/schema", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/provenanceParameter/schema", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/queryParameterGet/schema", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/strictBuiltInErrorParameter/schema", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/badRequestResponse/content/application~1json/schema", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/compileSuccessResponse/content/application~1json/schema", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/createDocumentSuccessResponse/content/application~1json/schema", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/deleteDocumentSuccessResponse/content/application~1json/schema", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/deletePolicySuccessResponse/content/application~1json/schema", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/getConfigSuccessResponse/content/application~1json/schema", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/getDocumentSuccessResponse/content/application~1json/schema", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/getPolicyModuleSuccessResponse/content/application~1json/schema", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/getStatusResponse/content/application~1json/schema", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/healthyResponse/content/application~1json/schema", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/listPoliciesSuccessResponse/content/application~1json/schema", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/notFoundResponse/content/application~1json/schema", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/putPolicySuccessResponse/content/application~1json/schema", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/serverErrorResponse/content/application~1json/schema", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/simpleQuerySuccessResponse/content/application~1json/schema", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/streamingNotImplementedErrorResponse/content/application~1json/schema", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/unhealthyResponse/content/application~1json/schema", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/writeConflictResponse/content/application~1json/schema", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/activeConfiguration", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/compileSuccessResponse", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/createDocumentSuccessResponse", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/deleteDocumentSuccessResponse", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/deletePolicySuccessResponse", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/errorDetail", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/errorLocation", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/explainMode", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/getDocumentSuccessResponse", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/getPolicyListSuccessResponse", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/getPolicyModuleSuccessResponse", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/healthyResponse", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/inputSchema", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/partialQuerySchema", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/patchOperation", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/policy", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/policyList", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/provenance", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/putPolicySuccessResponse", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/queryParameterPost", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/serverErrorResponse", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/simpleQuerySuccessResponse", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/status", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/unhealthyResponse", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/paths/~1/post/requestBody/content/application~1json/schema", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/paths/~1v0~1data~1{path}/post/requestBody/content/application~1json/schema", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/paths/~1v1~1compile/post/requestBody/content/application~1json/schema", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/paths/~1v1~1data~1{path}/patch/requestBody/content/application~1json-patch+json/schema", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/paths/~1v1~1data~1{path}/post/requestBody/content/application~1json/schema", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/paths/~1v1~1data~1{path}/put/requestBody/content/application~1json/schema", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/paths/~1v1~1policies~1{id}/put/requestBody/content/text~1plain/schema", dialect = SchemaEngine.dialect(:draft4)), + (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/paths/~1v1~1query/post/requestBody/content/application~1json/schema", dialect = SchemaEngine.dialect(:draft4)), +] +const _SCHEMA_DIALECT_DATA = Any[ +] +const _SCHEMA_DIRECTIONAL_REQUIRED = Any[ +] + +const _SPEC = Runtime.Spec(; + security_schemes = _SECURITY_SCHEMES, + resources = _SCHEMA_RESOURCE_DATA, + roots = _SCHEMA_ROOT_DATA, + dialects = _SCHEMA_DIALECT_DATA, + directional_required = _SCHEMA_DIRECTIONAL_REQUIRED, + default_server = "http://localhost:8181", +) + +const SERVER = _SPEC.server + +Client(server::Union{Nothing,AbstractString} = nothing; kwargs...) = + Runtime.Client(_SPEC, server; kwargs...) +const DEFAULT_CLIENT = Runtime.Client(_SPEC; _default = true) + +credential!(client::Runtime.Client, name::AbstractString, credential::AbstractCredential) = + Runtime.credential!(client, name, credential) +credential!(name::AbstractString, credential::AbstractCredential) = + Runtime.credential!(DEFAULT_CLIENT, name, credential) +clearcredential!(client::Runtime.Client, name::AbstractString) = + Runtime.clearcredential!(client, name) +clearcredential!(name::AbstractString) = Runtime.clearcredential!(DEFAULT_CLIENT, name) +server!(client::Runtime.Client, server::Union{Nothing,AbstractString}) = + Runtime.server!(client, server) +server!(server::Union{Nothing,AbstractString}) = Runtime.server!(DEFAULT_CLIENT, server) +server_index!(client::Runtime.Client, index::Integer) = Runtime.server_index!(client, index) +server_index!(index::Integer) = Runtime.server_index!(DEFAULT_CLIENT, index) +server_name!(client::Runtime.Client, name::Union{Nothing,AbstractString}) = + Runtime.server_name!(client, name) +server_name!(name::Union{Nothing,AbstractString}) = Runtime.server_name!(DEFAULT_CLIENT, name) +server_variable!(client::Runtime.Client, name::AbstractString, value::AbstractString) = + Runtime.server_variable!(client, name, value) +server_variable!(name::AbstractString, value::AbstractString) = + Runtime.server_variable!(DEFAULT_CLIENT, name, value) +codec!(client::Runtime.Client, media_type::AbstractString; kwargs...) = + Runtime.codec!(client, media_type; kwargs...) +codec!(media_type::AbstractString; kwargs...) = + Runtime.codec!(DEFAULT_CLIENT, media_type; kwargs...) +authorization!(client::Runtime.Client, token::Union{Nothing,AbstractString}) = + Runtime.authorization!(client, token) +authorization!(token::Union{Nothing,AbstractString}) = + Runtime.authorization!(DEFAULT_CLIENT, token) + +Base.@kwdef struct ActiveConfiguration + additional_properties::Dict{String,Any} = Dict{String,Any}() +end +_decode(::Type{ActiveConfiguration}, value) = _decode(ActiveConfiguration, value, true) +function _decode(::Type{ActiveConfiguration}, _openapi_raw, _openapi_validate::Bool) + _openapi_validate && _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/activeConfiguration"), _openapi_raw, "decoding ActiveConfiguration"; direction = :neutral) + _openapi_object = _object(_openapi_raw, "ActiveConfiguration") + _openapi_additional_properties = Dict{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_object + String(_openapi_key) in () && continue + _openapi_additional_properties[String(_openapi_key)] = _decode(Any, _openapi_item, _openapi_validate) + end + return ActiveConfiguration(; additional_properties = _openapi_additional_properties) +end +function _encode(_openapi_value::ActiveConfiguration) + _openapi_output = JSON.Object{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_value.additional_properties + haskey(_openapi_output, _openapi_key) && throw(ArgumentError("additional property conflicts with declared field: " * _openapi_key)) + _openapi_output[_openapi_key] = _encode(_openapi_item) + end + return _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/activeConfiguration"), _openapi_output, "encoding ActiveConfiguration"; direction = :neutral) +end + +function _form_fields(_openapi_value::ActiveConfiguration) + _openapi_output = Pair{String,Any}[] + append!(_openapi_output, collect(_openapi_value.additional_properties)) + return _openapi_output +end + +@doc " ProvenanceBundles\n\nA set of key-value pairs describing each bundle activated on the server." +Base.@kwdef struct ProvenanceBundles + additional_properties::Dict{String,Any} = Dict{String,Any}() +end +_decode(::Type{ProvenanceBundles}, value) = _decode(ProvenanceBundles, value, true) +function _decode(::Type{ProvenanceBundles}, _openapi_raw, _openapi_validate::Bool) + _openapi_validate && _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/provenance/properties/bundles"), _openapi_raw, "decoding ProvenanceBundles"; direction = :neutral) + _openapi_object = _object(_openapi_raw, "ProvenanceBundles") + _openapi_additional_properties = Dict{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_object + String(_openapi_key) in () && continue + _openapi_additional_properties[String(_openapi_key)] = _decode(Any, _openapi_item, _openapi_validate) + end + return ProvenanceBundles(; additional_properties = _openapi_additional_properties) +end +function _encode(_openapi_value::ProvenanceBundles) + _openapi_output = JSON.Object{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_value.additional_properties + haskey(_openapi_output, _openapi_key) && throw(ArgumentError("additional property conflicts with declared field: " * _openapi_key)) + _openapi_output[_openapi_key] = _encode(_openapi_item) + end + return _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/provenance/properties/bundles"), _openapi_output, "encoding ProvenanceBundles"; direction = :neutral) +end + +function _form_fields(_openapi_value::ProvenanceBundles) + _openapi_output = Pair{String,Any}[] + append!(_openapi_output, collect(_openapi_value.additional_properties)) + return _openapi_output +end + +@doc " Provenance\n\n- `version`: The version of this OPA instance\n- `build_commit`: The Git commit id of this OPA build.\n- `build_timestamp`: When this OPA instance was built (in [ISO8601 format](https://www.w3.org/TR/NOTE-datetime))\n- `build_hostname`: The hostname where this instance was built.\n- `bundles`: A set of key-value pairs describing each bundle activated on the server." +Base.@kwdef struct Provenance + version::Union{Absent,Nothing,String} = ABSENT + build_commit::Union{Absent,Nothing,String} = ABSENT + build_timestamp::Union{Absent,Nothing,String} = ABSENT + build_hostname::Union{Absent,Nothing,String} = ABSENT + bundles::Union{Absent,Nothing,ProvenanceBundles} = ABSENT + additional_properties::Dict{String,Any} = Dict{String,Any}() +end +_decode(::Type{Provenance}, value) = _decode(Provenance, value, true) +function _decode(::Type{Provenance}, _openapi_raw, _openapi_validate::Bool) + _openapi_validate && _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/provenance"), _openapi_raw, "decoding Provenance"; direction = :neutral) + _openapi_object = _object(_openapi_raw, "Provenance") + _openapi_field_version = haskey(_openapi_object, "version") ? _decode(Union{Absent,Nothing,String}, _openapi_object["version"], _openapi_validate) : ABSENT + _openapi_field_build_commit = haskey(_openapi_object, "build_commit") ? _decode(Union{Absent,Nothing,String}, _openapi_object["build_commit"], _openapi_validate) : ABSENT + _openapi_field_build_timestamp = haskey(_openapi_object, "build_timestamp") ? _decode(Union{Absent,Nothing,String}, _openapi_object["build_timestamp"], _openapi_validate) : ABSENT + _openapi_field_build_hostname = haskey(_openapi_object, "build_hostname") ? _decode(Union{Absent,Nothing,String}, _openapi_object["build_hostname"], _openapi_validate) : ABSENT + _openapi_field_bundles = haskey(_openapi_object, "bundles") ? _decode(Union{Absent,Nothing,ProvenanceBundles}, _openapi_object["bundles"], _openapi_validate) : ABSENT + _openapi_additional_properties = Dict{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_object + String(_openapi_key) in ("version","build_commit","build_timestamp","build_hostname","bundles") && continue + _openapi_additional_properties[String(_openapi_key)] = _decode(Any, _openapi_item, _openapi_validate) + end + return Provenance(; version = _openapi_field_version, build_commit = _openapi_field_build_commit, build_timestamp = _openapi_field_build_timestamp, build_hostname = _openapi_field_build_hostname, bundles = _openapi_field_bundles, additional_properties = _openapi_additional_properties) +end +function _encode(_openapi_value::Provenance) + _openapi_output = JSON.Object{String,Any}() + _openapi_value.version isa Absent || (_openapi_output["version"] = _encode(_openapi_value.version)) + _openapi_value.build_commit isa Absent || (_openapi_output["build_commit"] = _encode(_openapi_value.build_commit)) + _openapi_value.build_timestamp isa Absent || (_openapi_output["build_timestamp"] = _encode(_openapi_value.build_timestamp)) + _openapi_value.build_hostname isa Absent || (_openapi_output["build_hostname"] = _encode(_openapi_value.build_hostname)) + _openapi_value.bundles isa Absent || (_openapi_output["bundles"] = _encode(_openapi_value.bundles)) + for (_openapi_key, _openapi_item) in _openapi_value.additional_properties + haskey(_openapi_output, _openapi_key) && throw(ArgumentError("additional property conflicts with declared field: " * _openapi_key)) + _openapi_output[_openapi_key] = _encode(_openapi_item) + end + return _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/provenance"), _openapi_output, "encoding Provenance"; direction = :neutral) +end + +function _form_fields(_openapi_value::Provenance) + _openapi_output = Pair{String,Any}[] + _openapi_value.version isa Absent || push!(_openapi_output, "version" => _openapi_value.version) + _openapi_value.build_commit isa Absent || push!(_openapi_output, "build_commit" => _openapi_value.build_commit) + _openapi_value.build_timestamp isa Absent || push!(_openapi_output, "build_timestamp" => _openapi_value.build_timestamp) + _openapi_value.build_hostname isa Absent || push!(_openapi_output, "build_hostname" => _openapi_value.build_hostname) + _openapi_value.bundles isa Absent || push!(_openapi_output, "bundles" => _openapi_value.bundles) + append!(_openapi_output, collect(_openapi_value.additional_properties)) + return _openapi_output +end + +Base.@kwdef struct CompileSuccessResponseMetrics + additional_properties::Dict{String,Any} = Dict{String,Any}() +end +_decode(::Type{CompileSuccessResponseMetrics}, value) = _decode(CompileSuccessResponseMetrics, value, true) +function _decode(::Type{CompileSuccessResponseMetrics}, _openapi_raw, _openapi_validate::Bool) + _openapi_validate && _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/compileSuccessResponse/properties/metrics"), _openapi_raw, "decoding CompileSuccessResponseMetrics"; direction = :neutral) + _openapi_object = _object(_openapi_raw, "CompileSuccessResponseMetrics") + _openapi_additional_properties = Dict{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_object + String(_openapi_key) in () && continue + _openapi_additional_properties[String(_openapi_key)] = _decode(Any, _openapi_item, _openapi_validate) + end + return CompileSuccessResponseMetrics(; additional_properties = _openapi_additional_properties) +end +function _encode(_openapi_value::CompileSuccessResponseMetrics) + _openapi_output = JSON.Object{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_value.additional_properties + haskey(_openapi_output, _openapi_key) && throw(ArgumentError("additional property conflicts with declared field: " * _openapi_key)) + _openapi_output[_openapi_key] = _encode(_openapi_item) + end + return _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/compileSuccessResponse/properties/metrics"), _openapi_output, "encoding CompileSuccessResponseMetrics"; direction = :neutral) +end + +function _form_fields(_openapi_value::CompileSuccessResponseMetrics) + _openapi_output = Pair{String,Any}[] + append!(_openapi_output, collect(_openapi_value.additional_properties)) + return _openapi_output +end + +@doc " CompileSuccessResponse\n\n- `result`: The partial evaluation result - an object with `queries` and optionally `support` (AST nodes). Absent when the query is unconditionally false." +Base.@kwdef struct CompileSuccessResponse + result::Any = ABSENT + provenance::Union{Absent,Nothing,Provenance} = ABSENT + metrics::Union{Absent,CompileSuccessResponseMetrics,Nothing} = ABSENT + additional_properties::Dict{String,Any} = Dict{String,Any}() +end +_decode(::Type{CompileSuccessResponse}, value) = _decode(CompileSuccessResponse, value, true) +function _decode(::Type{CompileSuccessResponse}, _openapi_raw, _openapi_validate::Bool) + _openapi_validate && _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/compileSuccessResponse"), _openapi_raw, "decoding CompileSuccessResponse"; direction = :neutral) + _openapi_object = _object(_openapi_raw, "CompileSuccessResponse") + _openapi_field_result = haskey(_openapi_object, "result") ? _decode(Any, _openapi_object["result"], _openapi_validate) : ABSENT + _openapi_field_provenance = haskey(_openapi_object, "provenance") ? _decode(Union{Absent,Nothing,Provenance}, _openapi_object["provenance"], _openapi_validate) : ABSENT + _openapi_field_metrics = haskey(_openapi_object, "metrics") ? _decode(Union{Absent,CompileSuccessResponseMetrics,Nothing}, _openapi_object["metrics"], _openapi_validate) : ABSENT + _openapi_additional_properties = Dict{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_object + String(_openapi_key) in ("result","provenance","metrics") && continue + _openapi_additional_properties[String(_openapi_key)] = _decode(Any, _openapi_item, _openapi_validate) + end + return CompileSuccessResponse(; result = _openapi_field_result, provenance = _openapi_field_provenance, metrics = _openapi_field_metrics, additional_properties = _openapi_additional_properties) +end +function _encode(_openapi_value::CompileSuccessResponse) + _openapi_output = JSON.Object{String,Any}() + _openapi_value.result isa Absent || (_openapi_output["result"] = _encode(_openapi_value.result)) + _openapi_value.provenance isa Absent || (_openapi_output["provenance"] = _encode(_openapi_value.provenance)) + _openapi_value.metrics isa Absent || (_openapi_output["metrics"] = _encode(_openapi_value.metrics)) + for (_openapi_key, _openapi_item) in _openapi_value.additional_properties + haskey(_openapi_output, _openapi_key) && throw(ArgumentError("additional property conflicts with declared field: " * _openapi_key)) + _openapi_output[_openapi_key] = _encode(_openapi_item) + end + return _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/compileSuccessResponse"), _openapi_output, "encoding CompileSuccessResponse"; direction = :neutral) +end + +function _form_fields(_openapi_value::CompileSuccessResponse) + _openapi_output = Pair{String,Any}[] + _openapi_value.result isa Absent || push!(_openapi_output, "result" => _openapi_value.result) + _openapi_value.provenance isa Absent || push!(_openapi_output, "provenance" => _openapi_value.provenance) + _openapi_value.metrics isa Absent || push!(_openapi_output, "metrics" => _openapi_value.metrics) + append!(_openapi_output, collect(_openapi_value.additional_properties)) + return _openapi_output +end + +Base.@kwdef struct CreateDocumentSuccessResponseMetrics + additional_properties::Dict{String,Any} = Dict{String,Any}() +end +_decode(::Type{CreateDocumentSuccessResponseMetrics}, value) = _decode(CreateDocumentSuccessResponseMetrics, value, true) +function _decode(::Type{CreateDocumentSuccessResponseMetrics}, _openapi_raw, _openapi_validate::Bool) + _openapi_validate && _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/createDocumentSuccessResponse/properties/metrics"), _openapi_raw, "decoding CreateDocumentSuccessResponseMetrics"; direction = :neutral) + _openapi_object = _object(_openapi_raw, "CreateDocumentSuccessResponseMetrics") + _openapi_additional_properties = Dict{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_object + String(_openapi_key) in () && continue + _openapi_additional_properties[String(_openapi_key)] = _decode(Any, _openapi_item, _openapi_validate) + end + return CreateDocumentSuccessResponseMetrics(; additional_properties = _openapi_additional_properties) +end +function _encode(_openapi_value::CreateDocumentSuccessResponseMetrics) + _openapi_output = JSON.Object{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_value.additional_properties + haskey(_openapi_output, _openapi_key) && throw(ArgumentError("additional property conflicts with declared field: " * _openapi_key)) + _openapi_output[_openapi_key] = _encode(_openapi_item) + end + return _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/createDocumentSuccessResponse/properties/metrics"), _openapi_output, "encoding CreateDocumentSuccessResponseMetrics"; direction = :neutral) +end + +function _form_fields(_openapi_value::CreateDocumentSuccessResponseMetrics) + _openapi_output = Pair{String,Any}[] + append!(_openapi_output, collect(_openapi_value.additional_properties)) + return _openapi_output +end + +Base.@kwdef struct CreateDocumentSuccessResponse + metrics::Union{Absent,CreateDocumentSuccessResponseMetrics,Nothing} = ABSENT + additional_properties::Dict{String,Any} = Dict{String,Any}() +end +_decode(::Type{CreateDocumentSuccessResponse}, value) = _decode(CreateDocumentSuccessResponse, value, true) +function _decode(::Type{CreateDocumentSuccessResponse}, _openapi_raw, _openapi_validate::Bool) + _openapi_validate && _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/createDocumentSuccessResponse"), _openapi_raw, "decoding CreateDocumentSuccessResponse"; direction = :neutral) + _openapi_object = _object(_openapi_raw, "CreateDocumentSuccessResponse") + _openapi_field_metrics = haskey(_openapi_object, "metrics") ? _decode(Union{Absent,CreateDocumentSuccessResponseMetrics,Nothing}, _openapi_object["metrics"], _openapi_validate) : ABSENT + _openapi_additional_properties = Dict{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_object + String(_openapi_key) in ("metrics",) && continue + _openapi_additional_properties[String(_openapi_key)] = _decode(Any, _openapi_item, _openapi_validate) + end + return CreateDocumentSuccessResponse(; metrics = _openapi_field_metrics, additional_properties = _openapi_additional_properties) +end +function _encode(_openapi_value::CreateDocumentSuccessResponse) + _openapi_output = JSON.Object{String,Any}() + _openapi_value.metrics isa Absent || (_openapi_output["metrics"] = _encode(_openapi_value.metrics)) + for (_openapi_key, _openapi_item) in _openapi_value.additional_properties + haskey(_openapi_output, _openapi_key) && throw(ArgumentError("additional property conflicts with declared field: " * _openapi_key)) + _openapi_output[_openapi_key] = _encode(_openapi_item) + end + return _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/createDocumentSuccessResponse"), _openapi_output, "encoding CreateDocumentSuccessResponse"; direction = :neutral) +end + +function _form_fields(_openapi_value::CreateDocumentSuccessResponse) + _openapi_output = Pair{String,Any}[] + _openapi_value.metrics isa Absent || push!(_openapi_output, "metrics" => _openapi_value.metrics) + append!(_openapi_output, collect(_openapi_value.additional_properties)) + return _openapi_output +end + +Base.@kwdef struct DeleteDocumentSuccessResponseMetrics + additional_properties::Dict{String,Any} = Dict{String,Any}() +end +_decode(::Type{DeleteDocumentSuccessResponseMetrics}, value) = _decode(DeleteDocumentSuccessResponseMetrics, value, true) +function _decode(::Type{DeleteDocumentSuccessResponseMetrics}, _openapi_raw, _openapi_validate::Bool) + _openapi_validate && _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/deleteDocumentSuccessResponse/properties/metrics"), _openapi_raw, "decoding DeleteDocumentSuccessResponseMetrics"; direction = :neutral) + _openapi_object = _object(_openapi_raw, "DeleteDocumentSuccessResponseMetrics") + _openapi_additional_properties = Dict{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_object + String(_openapi_key) in () && continue + _openapi_additional_properties[String(_openapi_key)] = _decode(Any, _openapi_item, _openapi_validate) + end + return DeleteDocumentSuccessResponseMetrics(; additional_properties = _openapi_additional_properties) +end +function _encode(_openapi_value::DeleteDocumentSuccessResponseMetrics) + _openapi_output = JSON.Object{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_value.additional_properties + haskey(_openapi_output, _openapi_key) && throw(ArgumentError("additional property conflicts with declared field: " * _openapi_key)) + _openapi_output[_openapi_key] = _encode(_openapi_item) + end + return _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/deleteDocumentSuccessResponse/properties/metrics"), _openapi_output, "encoding DeleteDocumentSuccessResponseMetrics"; direction = :neutral) +end + +function _form_fields(_openapi_value::DeleteDocumentSuccessResponseMetrics) + _openapi_output = Pair{String,Any}[] + append!(_openapi_output, collect(_openapi_value.additional_properties)) + return _openapi_output +end + +Base.@kwdef struct DeleteDocumentSuccessResponse + metrics::Union{Absent,DeleteDocumentSuccessResponseMetrics,Nothing} = ABSENT + additional_properties::Dict{String,Any} = Dict{String,Any}() +end +_decode(::Type{DeleteDocumentSuccessResponse}, value) = _decode(DeleteDocumentSuccessResponse, value, true) +function _decode(::Type{DeleteDocumentSuccessResponse}, _openapi_raw, _openapi_validate::Bool) + _openapi_validate && _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/deleteDocumentSuccessResponse"), _openapi_raw, "decoding DeleteDocumentSuccessResponse"; direction = :neutral) + _openapi_object = _object(_openapi_raw, "DeleteDocumentSuccessResponse") + _openapi_field_metrics = haskey(_openapi_object, "metrics") ? _decode(Union{Absent,DeleteDocumentSuccessResponseMetrics,Nothing}, _openapi_object["metrics"], _openapi_validate) : ABSENT + _openapi_additional_properties = Dict{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_object + String(_openapi_key) in ("metrics",) && continue + _openapi_additional_properties[String(_openapi_key)] = _decode(Any, _openapi_item, _openapi_validate) + end + return DeleteDocumentSuccessResponse(; metrics = _openapi_field_metrics, additional_properties = _openapi_additional_properties) +end +function _encode(_openapi_value::DeleteDocumentSuccessResponse) + _openapi_output = JSON.Object{String,Any}() + _openapi_value.metrics isa Absent || (_openapi_output["metrics"] = _encode(_openapi_value.metrics)) + for (_openapi_key, _openapi_item) in _openapi_value.additional_properties + haskey(_openapi_output, _openapi_key) && throw(ArgumentError("additional property conflicts with declared field: " * _openapi_key)) + _openapi_output[_openapi_key] = _encode(_openapi_item) + end + return _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/deleteDocumentSuccessResponse"), _openapi_output, "encoding DeleteDocumentSuccessResponse"; direction = :neutral) +end + +function _form_fields(_openapi_value::DeleteDocumentSuccessResponse) + _openapi_output = Pair{String,Any}[] + _openapi_value.metrics isa Absent || push!(_openapi_output, "metrics" => _openapi_value.metrics) + append!(_openapi_output, collect(_openapi_value.additional_properties)) + return _openapi_output +end + +Base.@kwdef struct DeletePolicySuccessResponseMetrics + additional_properties::Dict{String,Any} = Dict{String,Any}() +end +_decode(::Type{DeletePolicySuccessResponseMetrics}, value) = _decode(DeletePolicySuccessResponseMetrics, value, true) +function _decode(::Type{DeletePolicySuccessResponseMetrics}, _openapi_raw, _openapi_validate::Bool) + _openapi_validate && _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/deletePolicySuccessResponse/properties/metrics"), _openapi_raw, "decoding DeletePolicySuccessResponseMetrics"; direction = :neutral) + _openapi_object = _object(_openapi_raw, "DeletePolicySuccessResponseMetrics") + _openapi_additional_properties = Dict{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_object + String(_openapi_key) in () && continue + _openapi_additional_properties[String(_openapi_key)] = _decode(Any, _openapi_item, _openapi_validate) + end + return DeletePolicySuccessResponseMetrics(; additional_properties = _openapi_additional_properties) +end +function _encode(_openapi_value::DeletePolicySuccessResponseMetrics) + _openapi_output = JSON.Object{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_value.additional_properties + haskey(_openapi_output, _openapi_key) && throw(ArgumentError("additional property conflicts with declared field: " * _openapi_key)) + _openapi_output[_openapi_key] = _encode(_openapi_item) + end + return _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/deletePolicySuccessResponse/properties/metrics"), _openapi_output, "encoding DeletePolicySuccessResponseMetrics"; direction = :neutral) +end + +function _form_fields(_openapi_value::DeletePolicySuccessResponseMetrics) + _openapi_output = Pair{String,Any}[] + append!(_openapi_output, collect(_openapi_value.additional_properties)) + return _openapi_output +end + +Base.@kwdef struct DeletePolicySuccessResponse + metrics::Union{Absent,DeletePolicySuccessResponseMetrics,Nothing} = ABSENT + additional_properties::Dict{String,Any} = Dict{String,Any}() +end +_decode(::Type{DeletePolicySuccessResponse}, value) = _decode(DeletePolicySuccessResponse, value, true) +function _decode(::Type{DeletePolicySuccessResponse}, _openapi_raw, _openapi_validate::Bool) + _openapi_validate && _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/deletePolicySuccessResponse"), _openapi_raw, "decoding DeletePolicySuccessResponse"; direction = :neutral) + _openapi_object = _object(_openapi_raw, "DeletePolicySuccessResponse") + _openapi_field_metrics = haskey(_openapi_object, "metrics") ? _decode(Union{Absent,DeletePolicySuccessResponseMetrics,Nothing}, _openapi_object["metrics"], _openapi_validate) : ABSENT + _openapi_additional_properties = Dict{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_object + String(_openapi_key) in ("metrics",) && continue + _openapi_additional_properties[String(_openapi_key)] = _decode(Any, _openapi_item, _openapi_validate) + end + return DeletePolicySuccessResponse(; metrics = _openapi_field_metrics, additional_properties = _openapi_additional_properties) +end +function _encode(_openapi_value::DeletePolicySuccessResponse) + _openapi_output = JSON.Object{String,Any}() + _openapi_value.metrics isa Absent || (_openapi_output["metrics"] = _encode(_openapi_value.metrics)) + for (_openapi_key, _openapi_item) in _openapi_value.additional_properties + haskey(_openapi_output, _openapi_key) && throw(ArgumentError("additional property conflicts with declared field: " * _openapi_key)) + _openapi_output[_openapi_key] = _encode(_openapi_item) + end + return _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/deletePolicySuccessResponse"), _openapi_output, "encoding DeletePolicySuccessResponse"; direction = :neutral) +end + +function _form_fields(_openapi_value::DeletePolicySuccessResponse) + _openapi_output = Pair{String,Any}[] + _openapi_value.metrics isa Absent || push!(_openapi_output, "metrics" => _openapi_value.metrics) + append!(_openapi_output, collect(_openapi_value.additional_properties)) + return _openapi_output +end + +@doc " ErrorLocation\n\n- `file`: The policy module name that generated the error\n- `row`: The line number in the policy module where the error occurred\n- `col`: The column in the policy module where the error occurred" +Base.@kwdef struct ErrorLocation + file::Union{Absent,Nothing,String} = ABSENT + row::Union{Absent,Float64,Nothing} = ABSENT + col::Union{Absent,Float64,Nothing} = ABSENT + additional_properties::Dict{String,Any} = Dict{String,Any}() +end +_decode(::Type{ErrorLocation}, value) = _decode(ErrorLocation, value, true) +function _decode(::Type{ErrorLocation}, _openapi_raw, _openapi_validate::Bool) + _openapi_validate && _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/errorLocation"), _openapi_raw, "decoding ErrorLocation"; direction = :neutral) + _openapi_object = _object(_openapi_raw, "ErrorLocation") + _openapi_field_file = haskey(_openapi_object, "file") ? _decode(Union{Absent,Nothing,String}, _openapi_object["file"], _openapi_validate) : ABSENT + _openapi_field_row = haskey(_openapi_object, "row") ? _decode(Union{Absent,Float64,Nothing}, _openapi_object["row"], _openapi_validate) : ABSENT + _openapi_field_col = haskey(_openapi_object, "col") ? _decode(Union{Absent,Float64,Nothing}, _openapi_object["col"], _openapi_validate) : ABSENT + _openapi_additional_properties = Dict{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_object + String(_openapi_key) in ("file","row","col") && continue + _openapi_additional_properties[String(_openapi_key)] = _decode(Any, _openapi_item, _openapi_validate) + end + return ErrorLocation(; file = _openapi_field_file, row = _openapi_field_row, col = _openapi_field_col, additional_properties = _openapi_additional_properties) +end +function _encode(_openapi_value::ErrorLocation) + _openapi_output = JSON.Object{String,Any}() + _openapi_value.file isa Absent || (_openapi_output["file"] = _encode(_openapi_value.file)) + _openapi_value.row isa Absent || (_openapi_output["row"] = _encode(_openapi_value.row)) + _openapi_value.col isa Absent || (_openapi_output["col"] = _encode(_openapi_value.col)) + for (_openapi_key, _openapi_item) in _openapi_value.additional_properties + haskey(_openapi_output, _openapi_key) && throw(ArgumentError("additional property conflicts with declared field: " * _openapi_key)) + _openapi_output[_openapi_key] = _encode(_openapi_item) + end + return _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/errorLocation"), _openapi_output, "encoding ErrorLocation"; direction = :neutral) +end + +function _form_fields(_openapi_value::ErrorLocation) + _openapi_output = Pair{String,Any}[] + _openapi_value.file isa Absent || push!(_openapi_output, "file" => _openapi_value.file) + _openapi_value.row isa Absent || push!(_openapi_output, "row" => _openapi_value.row) + _openapi_value.col isa Absent || push!(_openapi_output, "col" => _openapi_value.col) + append!(_openapi_output, collect(_openapi_value.additional_properties)) + return _openapi_output +end + +@doc " ErrorDetail\n\n- `code`: The error code name\n- `message`: A general description of the error" +Base.@kwdef struct ErrorDetail + code::String + message::String + location::Union{Absent,ErrorLocation,Nothing} = ABSENT + additional_properties::Dict{String,Any} = Dict{String,Any}() +end +_decode(::Type{ErrorDetail}, value) = _decode(ErrorDetail, value, true) +function _decode(::Type{ErrorDetail}, _openapi_raw, _openapi_validate::Bool) + _openapi_validate && _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/errorDetail"), _openapi_raw, "decoding ErrorDetail"; direction = :neutral) + _openapi_object = _object(_openapi_raw, "ErrorDetail") + _openapi_field_code = _decode(String, _required(_openapi_object, "code", "ErrorDetail"), _openapi_validate) + _openapi_field_message = _decode(String, _required(_openapi_object, "message", "ErrorDetail"), _openapi_validate) + _openapi_field_location = haskey(_openapi_object, "location") ? _decode(Union{Absent,ErrorLocation,Nothing}, _openapi_object["location"], _openapi_validate) : ABSENT + _openapi_additional_properties = Dict{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_object + String(_openapi_key) in ("code","message","location") && continue + _openapi_additional_properties[String(_openapi_key)] = _decode(Any, _openapi_item, _openapi_validate) + end + return ErrorDetail(; code = _openapi_field_code, message = _openapi_field_message, location = _openapi_field_location, additional_properties = _openapi_additional_properties) +end +function _encode(_openapi_value::ErrorDetail) + _openapi_output = JSON.Object{String,Any}() + _openapi_value.code isa Absent || (_openapi_output["code"] = _encode(_openapi_value.code)) + _openapi_value.message isa Absent || (_openapi_output["message"] = _encode(_openapi_value.message)) + _openapi_value.location isa Absent || (_openapi_output["location"] = _encode(_openapi_value.location)) + for (_openapi_key, _openapi_item) in _openapi_value.additional_properties + haskey(_openapi_output, _openapi_key) && throw(ArgumentError("additional property conflicts with declared field: " * _openapi_key)) + _openapi_output[_openapi_key] = _encode(_openapi_item) + end + return _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/errorDetail"), _openapi_output, "encoding ErrorDetail"; direction = :neutral) +end + +function _form_fields(_openapi_value::ErrorDetail) + _openapi_output = Pair{String,Any}[] + _openapi_value.code isa Absent || push!(_openapi_output, "code" => _openapi_value.code) + _openapi_value.message isa Absent || push!(_openapi_output, "message" => _openapi_value.message) + _openapi_value.location isa Absent || push!(_openapi_output, "location" => _openapi_value.location) + append!(_openapi_output, collect(_openapi_value.additional_properties)) + return _openapi_output +end + +@doc " ExplainMode\n\nThe level of query explanation to include in the response" +struct ExplainMode + value::String + function ExplainMode(value::String) + value in ("full","notes","fails","debug") || throw(ArgumentError("invalid ExplainMode value $(repr(value))")) + return new(value) + end +end +_decode(::Type{ExplainMode}, value) = _decode(ExplainMode, value, true) +function _decode(::Type{ExplainMode}, value, _openapi_validate::Bool) + _openapi_validate && _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/explainMode"), value, "decoding ExplainMode"; direction = :neutral) + return ExplainMode(_decode(String, value, _openapi_validate)) +end +function _encode(value::ExplainMode) + output = _encode(value.value) + return _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/explainMode"), output, "encoding ExplainMode"; direction = :neutral) +end +Base.string(value::ExplainMode) = string(value.value) + +Base.@kwdef struct GetDocumentSuccessResponseMetrics + additional_properties::Dict{String,Any} = Dict{String,Any}() +end +_decode(::Type{GetDocumentSuccessResponseMetrics}, value) = _decode(GetDocumentSuccessResponseMetrics, value, true) +function _decode(::Type{GetDocumentSuccessResponseMetrics}, _openapi_raw, _openapi_validate::Bool) + _openapi_validate && _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/getDocumentSuccessResponse/properties/metrics"), _openapi_raw, "decoding GetDocumentSuccessResponseMetrics"; direction = :neutral) + _openapi_object = _object(_openapi_raw, "GetDocumentSuccessResponseMetrics") + _openapi_additional_properties = Dict{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_object + String(_openapi_key) in () && continue + _openapi_additional_properties[String(_openapi_key)] = _decode(Any, _openapi_item, _openapi_validate) + end + return GetDocumentSuccessResponseMetrics(; additional_properties = _openapi_additional_properties) +end +function _encode(_openapi_value::GetDocumentSuccessResponseMetrics) + _openapi_output = JSON.Object{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_value.additional_properties + haskey(_openapi_output, _openapi_key) && throw(ArgumentError("additional property conflicts with declared field: " * _openapi_key)) + _openapi_output[_openapi_key] = _encode(_openapi_item) + end + return _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/getDocumentSuccessResponse/properties/metrics"), _openapi_output, "encoding GetDocumentSuccessResponseMetrics"; direction = :neutral) +end + +function _form_fields(_openapi_value::GetDocumentSuccessResponseMetrics) + _openapi_output = Pair{String,Any}[] + append!(_openapi_output, collect(_openapi_value.additional_properties)) + return _openapi_output +end + +@doc " GetDocumentSuccessResponse\n\n- `result`: The result of the query. Can be whatever type the query returns - bool, number, string, array, json." +Base.@kwdef struct GetDocumentSuccessResponse + result::Any = ABSENT + decision_id::Union{Absent,Nothing,String} = ABSENT + metrics::Union{Absent,GetDocumentSuccessResponseMetrics,Nothing} = ABSENT + additional_properties::Dict{String,Any} = Dict{String,Any}() +end +_decode(::Type{GetDocumentSuccessResponse}, value) = _decode(GetDocumentSuccessResponse, value, true) +function _decode(::Type{GetDocumentSuccessResponse}, _openapi_raw, _openapi_validate::Bool) + _openapi_validate && _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/getDocumentSuccessResponse"), _openapi_raw, "decoding GetDocumentSuccessResponse"; direction = :neutral) + _openapi_object = _object(_openapi_raw, "GetDocumentSuccessResponse") + _openapi_field_result = haskey(_openapi_object, "result") ? _decode(Any, _openapi_object["result"], _openapi_validate) : ABSENT + _openapi_field_decision_id = haskey(_openapi_object, "decision_id") ? _decode(Union{Absent,Nothing,String}, _openapi_object["decision_id"], _openapi_validate) : ABSENT + _openapi_field_metrics = haskey(_openapi_object, "metrics") ? _decode(Union{Absent,GetDocumentSuccessResponseMetrics,Nothing}, _openapi_object["metrics"], _openapi_validate) : ABSENT + _openapi_additional_properties = Dict{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_object + String(_openapi_key) in ("result","decision_id","metrics") && continue + _openapi_additional_properties[String(_openapi_key)] = _decode(Any, _openapi_item, _openapi_validate) + end + return GetDocumentSuccessResponse(; result = _openapi_field_result, decision_id = _openapi_field_decision_id, metrics = _openapi_field_metrics, additional_properties = _openapi_additional_properties) +end +function _encode(_openapi_value::GetDocumentSuccessResponse) + _openapi_output = JSON.Object{String,Any}() + _openapi_value.result isa Absent || (_openapi_output["result"] = _encode(_openapi_value.result)) + _openapi_value.decision_id isa Absent || (_openapi_output["decision_id"] = _encode(_openapi_value.decision_id)) + _openapi_value.metrics isa Absent || (_openapi_output["metrics"] = _encode(_openapi_value.metrics)) + for (_openapi_key, _openapi_item) in _openapi_value.additional_properties + haskey(_openapi_output, _openapi_key) && throw(ArgumentError("additional property conflicts with declared field: " * _openapi_key)) + _openapi_output[_openapi_key] = _encode(_openapi_item) + end + return _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/getDocumentSuccessResponse"), _openapi_output, "encoding GetDocumentSuccessResponse"; direction = :neutral) +end + +function _form_fields(_openapi_value::GetDocumentSuccessResponse) + _openapi_output = Pair{String,Any}[] + _openapi_value.result isa Absent || push!(_openapi_output, "result" => _openapi_value.result) + _openapi_value.decision_id isa Absent || push!(_openapi_output, "decision_id" => _openapi_value.decision_id) + _openapi_value.metrics isa Absent || push!(_openapi_output, "metrics" => _openapi_value.metrics) + append!(_openapi_output, collect(_openapi_value.additional_properties)) + return _openapi_output +end + +@doc " PolicyAstPackagePathItem\n\n- `type_`: The type of the path operation\n- `value`: The path variable" +Base.@kwdef struct PolicyAstPackagePathItem + type_::Union{Absent,Nothing,String} = ABSENT + value::Union{Absent,Nothing,String} = ABSENT + additional_properties::Dict{String,Any} = Dict{String,Any}() +end +_decode(::Type{PolicyAstPackagePathItem}, value) = _decode(PolicyAstPackagePathItem, value, true) +function _decode(::Type{PolicyAstPackagePathItem}, _openapi_raw, _openapi_validate::Bool) + _openapi_validate && _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/policy/properties/ast/properties/package/properties/path/items"), _openapi_raw, "decoding PolicyAstPackagePathItem"; direction = :neutral) + _openapi_object = _object(_openapi_raw, "PolicyAstPackagePathItem") + _openapi_field_type_ = haskey(_openapi_object, "type") ? _decode(Union{Absent,Nothing,String}, _openapi_object["type"], _openapi_validate) : ABSENT + _openapi_field_value = haskey(_openapi_object, "value") ? _decode(Union{Absent,Nothing,String}, _openapi_object["value"], _openapi_validate) : ABSENT + _openapi_additional_properties = Dict{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_object + String(_openapi_key) in ("type","value") && continue + _openapi_additional_properties[String(_openapi_key)] = _decode(Any, _openapi_item, _openapi_validate) + end + return PolicyAstPackagePathItem(; type_ = _openapi_field_type_, value = _openapi_field_value, additional_properties = _openapi_additional_properties) +end +function _encode(_openapi_value::PolicyAstPackagePathItem) + _openapi_output = JSON.Object{String,Any}() + _openapi_value.type_ isa Absent || (_openapi_output["type"] = _encode(_openapi_value.type_)) + _openapi_value.value isa Absent || (_openapi_output["value"] = _encode(_openapi_value.value)) + for (_openapi_key, _openapi_item) in _openapi_value.additional_properties + haskey(_openapi_output, _openapi_key) && throw(ArgumentError("additional property conflicts with declared field: " * _openapi_key)) + _openapi_output[_openapi_key] = _encode(_openapi_item) + end + return _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/policy/properties/ast/properties/package/properties/path/items"), _openapi_output, "encoding PolicyAstPackagePathItem"; direction = :neutral) +end + +function _form_fields(_openapi_value::PolicyAstPackagePathItem) + _openapi_output = Pair{String,Any}[] + _openapi_value.type_ isa Absent || push!(_openapi_output, "type" => _openapi_value.type_) + _openapi_value.value isa Absent || push!(_openapi_output, "value" => _openapi_value.value) + append!(_openapi_output, collect(_openapi_value.additional_properties)) + return _openapi_output +end + +@doc " PolicyAstPackage\n\n- `path`: The path to the package" +Base.@kwdef struct PolicyAstPackage + path::Union{Absent,Nothing,Vector{PolicyAstPackagePathItem}} = ABSENT + additional_properties::Dict{String,Any} = Dict{String,Any}() +end +_decode(::Type{PolicyAstPackage}, value) = _decode(PolicyAstPackage, value, true) +function _decode(::Type{PolicyAstPackage}, _openapi_raw, _openapi_validate::Bool) + _openapi_validate && _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/policy/properties/ast/properties/package"), _openapi_raw, "decoding PolicyAstPackage"; direction = :neutral) + _openapi_object = _object(_openapi_raw, "PolicyAstPackage") + _openapi_field_path = haskey(_openapi_object, "path") ? _decode(Union{Absent,Nothing,Vector{PolicyAstPackagePathItem}}, _openapi_object["path"], _openapi_validate) : ABSENT + _openapi_additional_properties = Dict{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_object + String(_openapi_key) in ("path",) && continue + _openapi_additional_properties[String(_openapi_key)] = _decode(Any, _openapi_item, _openapi_validate) + end + return PolicyAstPackage(; path = _openapi_field_path, additional_properties = _openapi_additional_properties) +end +function _encode(_openapi_value::PolicyAstPackage) + _openapi_output = JSON.Object{String,Any}() + _openapi_value.path isa Absent || (_openapi_output["path"] = _encode(_openapi_value.path)) + for (_openapi_key, _openapi_item) in _openapi_value.additional_properties + haskey(_openapi_output, _openapi_key) && throw(ArgumentError("additional property conflicts with declared field: " * _openapi_key)) + _openapi_output[_openapi_key] = _encode(_openapi_item) + end + return _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/policy/properties/ast/properties/package"), _openapi_output, "encoding PolicyAstPackage"; direction = :neutral) +end + +function _form_fields(_openapi_value::PolicyAstPackage) + _openapi_output = Pair{String,Any}[] + _openapi_value.path isa Absent || push!(_openapi_output, "path" => _openapi_value.path) + append!(_openapi_output, collect(_openapi_value.additional_properties)) + return _openapi_output +end + +@doc " PolicyAstRulesItemHeadKey\n\nThe type/value pairing for this rule's head\n\n- `type_`: The type of the head\n- `value`: The value of the head" +Base.@kwdef struct PolicyAstRulesItemHeadKey + type_::Union{Absent,Nothing,String} = ABSENT + value::Union{Absent,Nothing,String} = ABSENT + additional_properties::Dict{String,Any} = Dict{String,Any}() +end +_decode(::Type{PolicyAstRulesItemHeadKey}, value) = _decode(PolicyAstRulesItemHeadKey, value, true) +function _decode(::Type{PolicyAstRulesItemHeadKey}, _openapi_raw, _openapi_validate::Bool) + _openapi_validate && _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/policy/properties/ast/properties/rules/items/properties/head/properties/key"), _openapi_raw, "decoding PolicyAstRulesItemHeadKey"; direction = :neutral) + _openapi_object = _object(_openapi_raw, "PolicyAstRulesItemHeadKey") + _openapi_field_type_ = haskey(_openapi_object, "type") ? _decode(Union{Absent,Nothing,String}, _openapi_object["type"], _openapi_validate) : ABSENT + _openapi_field_value = haskey(_openapi_object, "value") ? _decode(Union{Absent,Nothing,String}, _openapi_object["value"], _openapi_validate) : ABSENT + _openapi_additional_properties = Dict{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_object + String(_openapi_key) in ("type","value") && continue + _openapi_additional_properties[String(_openapi_key)] = _decode(Any, _openapi_item, _openapi_validate) + end + return PolicyAstRulesItemHeadKey(; type_ = _openapi_field_type_, value = _openapi_field_value, additional_properties = _openapi_additional_properties) +end +function _encode(_openapi_value::PolicyAstRulesItemHeadKey) + _openapi_output = JSON.Object{String,Any}() + _openapi_value.type_ isa Absent || (_openapi_output["type"] = _encode(_openapi_value.type_)) + _openapi_value.value isa Absent || (_openapi_output["value"] = _encode(_openapi_value.value)) + for (_openapi_key, _openapi_item) in _openapi_value.additional_properties + haskey(_openapi_output, _openapi_key) && throw(ArgumentError("additional property conflicts with declared field: " * _openapi_key)) + _openapi_output[_openapi_key] = _encode(_openapi_item) + end + return _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/policy/properties/ast/properties/rules/items/properties/head/properties/key"), _openapi_output, "encoding PolicyAstRulesItemHeadKey"; direction = :neutral) +end + +function _form_fields(_openapi_value::PolicyAstRulesItemHeadKey) + _openapi_output = Pair{String,Any}[] + _openapi_value.type_ isa Absent || push!(_openapi_output, "type" => _openapi_value.type_) + _openapi_value.value isa Absent || push!(_openapi_output, "value" => _openapi_value.value) + append!(_openapi_output, collect(_openapi_value.additional_properties)) + return _openapi_output +end + +@doc " PolicyAstRulesItemHead\n\n- `name`: The head of the rule\n- `key`: The type/value pairing for this rule's head" +Base.@kwdef struct PolicyAstRulesItemHead + name::Union{Absent,Nothing,String} = ABSENT + key::Union{Absent,Nothing,PolicyAstRulesItemHeadKey} = ABSENT + additional_properties::Dict{String,Any} = Dict{String,Any}() +end +_decode(::Type{PolicyAstRulesItemHead}, value) = _decode(PolicyAstRulesItemHead, value, true) +function _decode(::Type{PolicyAstRulesItemHead}, _openapi_raw, _openapi_validate::Bool) + _openapi_validate && _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/policy/properties/ast/properties/rules/items/properties/head"), _openapi_raw, "decoding PolicyAstRulesItemHead"; direction = :neutral) + _openapi_object = _object(_openapi_raw, "PolicyAstRulesItemHead") + _openapi_field_name = haskey(_openapi_object, "name") ? _decode(Union{Absent,Nothing,String}, _openapi_object["name"], _openapi_validate) : ABSENT + _openapi_field_key = haskey(_openapi_object, "key") ? _decode(Union{Absent,Nothing,PolicyAstRulesItemHeadKey}, _openapi_object["key"], _openapi_validate) : ABSENT + _openapi_additional_properties = Dict{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_object + String(_openapi_key) in ("name","key") && continue + _openapi_additional_properties[String(_openapi_key)] = _decode(Any, _openapi_item, _openapi_validate) + end + return PolicyAstRulesItemHead(; name = _openapi_field_name, key = _openapi_field_key, additional_properties = _openapi_additional_properties) +end +function _encode(_openapi_value::PolicyAstRulesItemHead) + _openapi_output = JSON.Object{String,Any}() + _openapi_value.name isa Absent || (_openapi_output["name"] = _encode(_openapi_value.name)) + _openapi_value.key isa Absent || (_openapi_output["key"] = _encode(_openapi_value.key)) + for (_openapi_key, _openapi_item) in _openapi_value.additional_properties + haskey(_openapi_output, _openapi_key) && throw(ArgumentError("additional property conflicts with declared field: " * _openapi_key)) + _openapi_output[_openapi_key] = _encode(_openapi_item) + end + return _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/policy/properties/ast/properties/rules/items/properties/head"), _openapi_output, "encoding PolicyAstRulesItemHead"; direction = :neutral) +end + +function _form_fields(_openapi_value::PolicyAstRulesItemHead) + _openapi_output = Pair{String,Any}[] + _openapi_value.name isa Absent || push!(_openapi_output, "name" => _openapi_value.name) + _openapi_value.key isa Absent || push!(_openapi_output, "key" => _openapi_value.key) + append!(_openapi_output, collect(_openapi_value.additional_properties)) + return _openapi_output +end + +@doc " PolicyAstRulesItemBodyItem\n\n- `index`: The location of this term in the list (starts at 0)\n- `terms`: The type/value pairing for this term - an object for a single term, or an array of them for a call" +Base.@kwdef struct PolicyAstRulesItemBodyItem + index::Union{Absent,Float64,Nothing} = ABSENT + terms::Any = ABSENT + additional_properties::Dict{String,Any} = Dict{String,Any}() +end +_decode(::Type{PolicyAstRulesItemBodyItem}, value) = _decode(PolicyAstRulesItemBodyItem, value, true) +function _decode(::Type{PolicyAstRulesItemBodyItem}, _openapi_raw, _openapi_validate::Bool) + _openapi_validate && _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/policy/properties/ast/properties/rules/items/properties/body/items"), _openapi_raw, "decoding PolicyAstRulesItemBodyItem"; direction = :neutral) + _openapi_object = _object(_openapi_raw, "PolicyAstRulesItemBodyItem") + _openapi_field_index = haskey(_openapi_object, "index") ? _decode(Union{Absent,Float64,Nothing}, _openapi_object["index"], _openapi_validate) : ABSENT + _openapi_field_terms = haskey(_openapi_object, "terms") ? _decode(Any, _openapi_object["terms"], _openapi_validate) : ABSENT + _openapi_additional_properties = Dict{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_object + String(_openapi_key) in ("index","terms") && continue + _openapi_additional_properties[String(_openapi_key)] = _decode(Any, _openapi_item, _openapi_validate) + end + return PolicyAstRulesItemBodyItem(; index = _openapi_field_index, terms = _openapi_field_terms, additional_properties = _openapi_additional_properties) +end +function _encode(_openapi_value::PolicyAstRulesItemBodyItem) + _openapi_output = JSON.Object{String,Any}() + _openapi_value.index isa Absent || (_openapi_output["index"] = _encode(_openapi_value.index)) + _openapi_value.terms isa Absent || (_openapi_output["terms"] = _encode(_openapi_value.terms)) + for (_openapi_key, _openapi_item) in _openapi_value.additional_properties + haskey(_openapi_output, _openapi_key) && throw(ArgumentError("additional property conflicts with declared field: " * _openapi_key)) + _openapi_output[_openapi_key] = _encode(_openapi_item) + end + return _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/policy/properties/ast/properties/rules/items/properties/body/items"), _openapi_output, "encoding PolicyAstRulesItemBodyItem"; direction = :neutral) +end + +function _form_fields(_openapi_value::PolicyAstRulesItemBodyItem) + _openapi_output = Pair{String,Any}[] + _openapi_value.index isa Absent || push!(_openapi_output, "index" => _openapi_value.index) + _openapi_value.terms isa Absent || push!(_openapi_output, "terms" => _openapi_value.terms) + append!(_openapi_output, collect(_openapi_value.additional_properties)) + return _openapi_output +end + +@doc " PolicyAstRulesItem\n\n- `body`: A list of the terms in this rule" +Base.@kwdef struct PolicyAstRulesItem + head::Union{Absent,Nothing,PolicyAstRulesItemHead} = ABSENT + body::Union{Absent,Nothing,Vector{PolicyAstRulesItemBodyItem}} = ABSENT + additional_properties::Dict{String,Any} = Dict{String,Any}() +end +_decode(::Type{PolicyAstRulesItem}, value) = _decode(PolicyAstRulesItem, value, true) +function _decode(::Type{PolicyAstRulesItem}, _openapi_raw, _openapi_validate::Bool) + _openapi_validate && _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/policy/properties/ast/properties/rules/items"), _openapi_raw, "decoding PolicyAstRulesItem"; direction = :neutral) + _openapi_object = _object(_openapi_raw, "PolicyAstRulesItem") + _openapi_field_head = haskey(_openapi_object, "head") ? _decode(Union{Absent,Nothing,PolicyAstRulesItemHead}, _openapi_object["head"], _openapi_validate) : ABSENT + _openapi_field_body = haskey(_openapi_object, "body") ? _decode(Union{Absent,Nothing,Vector{PolicyAstRulesItemBodyItem}}, _openapi_object["body"], _openapi_validate) : ABSENT + _openapi_additional_properties = Dict{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_object + String(_openapi_key) in ("head","body") && continue + _openapi_additional_properties[String(_openapi_key)] = _decode(Any, _openapi_item, _openapi_validate) + end + return PolicyAstRulesItem(; head = _openapi_field_head, body = _openapi_field_body, additional_properties = _openapi_additional_properties) +end +function _encode(_openapi_value::PolicyAstRulesItem) + _openapi_output = JSON.Object{String,Any}() + _openapi_value.head isa Absent || (_openapi_output["head"] = _encode(_openapi_value.head)) + _openapi_value.body isa Absent || (_openapi_output["body"] = _encode(_openapi_value.body)) + for (_openapi_key, _openapi_item) in _openapi_value.additional_properties + haskey(_openapi_output, _openapi_key) && throw(ArgumentError("additional property conflicts with declared field: " * _openapi_key)) + _openapi_output[_openapi_key] = _encode(_openapi_item) + end + return _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/policy/properties/ast/properties/rules/items"), _openapi_output, "encoding PolicyAstRulesItem"; direction = :neutral) +end + +function _form_fields(_openapi_value::PolicyAstRulesItem) + _openapi_output = Pair{String,Any}[] + _openapi_value.head isa Absent || push!(_openapi_output, "head" => _openapi_value.head) + _openapi_value.body isa Absent || push!(_openapi_output, "body" => _openapi_value.body) + append!(_openapi_output, collect(_openapi_value.additional_properties)) + return _openapi_output +end + +@doc " PolicyAst\n\nThe types for declarations and runtime objects passed to your implementation. This consists of an abstract syntax tree (AST) of policy modules, package and import declarations, rules, expressions, and terms.\n\n- `rules`: When OPA evaluates a rule, it generates the content of a [virtual documents](https://www.openpolicyagent.org/docs/latest/philosophy/#the-opa-document-model)" +Base.@kwdef struct PolicyAst + package::Union{Absent,Nothing,PolicyAstPackage} = ABSENT + rules::Union{Absent,Nothing,Vector{PolicyAstRulesItem}} = ABSENT + additional_properties::Dict{String,Any} = Dict{String,Any}() +end +_decode(::Type{PolicyAst}, value) = _decode(PolicyAst, value, true) +function _decode(::Type{PolicyAst}, _openapi_raw, _openapi_validate::Bool) + _openapi_validate && _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/policy/properties/ast"), _openapi_raw, "decoding PolicyAst"; direction = :neutral) + _openapi_object = _object(_openapi_raw, "PolicyAst") + _openapi_field_package = haskey(_openapi_object, "package") ? _decode(Union{Absent,Nothing,PolicyAstPackage}, _openapi_object["package"], _openapi_validate) : ABSENT + _openapi_field_rules = haskey(_openapi_object, "rules") ? _decode(Union{Absent,Nothing,Vector{PolicyAstRulesItem}}, _openapi_object["rules"], _openapi_validate) : ABSENT + _openapi_additional_properties = Dict{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_object + String(_openapi_key) in ("package","rules") && continue + _openapi_additional_properties[String(_openapi_key)] = _decode(Any, _openapi_item, _openapi_validate) + end + return PolicyAst(; package = _openapi_field_package, rules = _openapi_field_rules, additional_properties = _openapi_additional_properties) +end +function _encode(_openapi_value::PolicyAst) + _openapi_output = JSON.Object{String,Any}() + _openapi_value.package isa Absent || (_openapi_output["package"] = _encode(_openapi_value.package)) + _openapi_value.rules isa Absent || (_openapi_output["rules"] = _encode(_openapi_value.rules)) + for (_openapi_key, _openapi_item) in _openapi_value.additional_properties + haskey(_openapi_output, _openapi_key) && throw(ArgumentError("additional property conflicts with declared field: " * _openapi_key)) + _openapi_output[_openapi_key] = _encode(_openapi_item) + end + return _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/policy/properties/ast"), _openapi_output, "encoding PolicyAst"; direction = :neutral) +end + +function _form_fields(_openapi_value::PolicyAst) + _openapi_output = Pair{String,Any}[] + _openapi_value.package isa Absent || push!(_openapi_output, "package" => _openapi_value.package) + _openapi_value.rules isa Absent || push!(_openapi_output, "rules" => _openapi_value.rules) + append!(_openapi_output, collect(_openapi_value.additional_properties)) + return _openapi_output +end + +@doc " Policy\n\nA policy module\n\n- `id`: The name of a policy module\n- `raw`: A string representation of the full Rego policy\n- `ast`: The types for declarations and runtime objects passed to your implementation. This consists of an abstract syntax tree (AST) of policy modules, package and import declarations, rules, expressions, and terms." +Base.@kwdef struct Policy + id::Union{Absent,Nothing,String} = ABSENT + raw::Union{Absent,Nothing,String} = ABSENT + ast::Union{Absent,Nothing,PolicyAst} = ABSENT + additional_properties::Dict{String,Any} = Dict{String,Any}() +end +_decode(::Type{Policy}, value) = _decode(Policy, value, true) +function _decode(::Type{Policy}, _openapi_raw, _openapi_validate::Bool) + _openapi_validate && _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/policy"), _openapi_raw, "decoding Policy"; direction = :neutral) + _openapi_object = _object(_openapi_raw, "Policy") + _openapi_field_id = haskey(_openapi_object, "id") ? _decode(Union{Absent,Nothing,String}, _openapi_object["id"], _openapi_validate) : ABSENT + _openapi_field_raw = haskey(_openapi_object, "raw") ? _decode(Union{Absent,Nothing,String}, _openapi_object["raw"], _openapi_validate) : ABSENT + _openapi_field_ast = haskey(_openapi_object, "ast") ? _decode(Union{Absent,Nothing,PolicyAst}, _openapi_object["ast"], _openapi_validate) : ABSENT + _openapi_additional_properties = Dict{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_object + String(_openapi_key) in ("id","raw","ast") && continue + _openapi_additional_properties[String(_openapi_key)] = _decode(Any, _openapi_item, _openapi_validate) + end + return Policy(; id = _openapi_field_id, raw = _openapi_field_raw, ast = _openapi_field_ast, additional_properties = _openapi_additional_properties) +end +function _encode(_openapi_value::Policy) + _openapi_output = JSON.Object{String,Any}() + _openapi_value.id isa Absent || (_openapi_output["id"] = _encode(_openapi_value.id)) + _openapi_value.raw isa Absent || (_openapi_output["raw"] = _encode(_openapi_value.raw)) + _openapi_value.ast isa Absent || (_openapi_output["ast"] = _encode(_openapi_value.ast)) + for (_openapi_key, _openapi_item) in _openapi_value.additional_properties + haskey(_openapi_output, _openapi_key) && throw(ArgumentError("additional property conflicts with declared field: " * _openapi_key)) + _openapi_output[_openapi_key] = _encode(_openapi_item) + end + return _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/policy"), _openapi_output, "encoding Policy"; direction = :neutral) +end + +function _form_fields(_openapi_value::Policy) + _openapi_output = Pair{String,Any}[] + _openapi_value.id isa Absent || push!(_openapi_output, "id" => _openapi_value.id) + _openapi_value.raw isa Absent || push!(_openapi_output, "raw" => _openapi_value.raw) + _openapi_value.ast isa Absent || push!(_openapi_output, "ast" => _openapi_value.ast) + append!(_openapi_output, collect(_openapi_value.additional_properties)) + return _openapi_output +end + +const PolicyList = Vector{Policy} + +Base.@kwdef struct GetPolicyListSuccessResponse + result::PolicyList + additional_properties::Dict{String,Any} = Dict{String,Any}() +end +_decode(::Type{GetPolicyListSuccessResponse}, value) = _decode(GetPolicyListSuccessResponse, value, true) +function _decode(::Type{GetPolicyListSuccessResponse}, _openapi_raw, _openapi_validate::Bool) + _openapi_validate && _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/getPolicyListSuccessResponse"), _openapi_raw, "decoding GetPolicyListSuccessResponse"; direction = :neutral) + _openapi_object = _object(_openapi_raw, "GetPolicyListSuccessResponse") + _openapi_field_result = _decode(PolicyList, _required(_openapi_object, "result", "GetPolicyListSuccessResponse"), _openapi_validate) + _openapi_additional_properties = Dict{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_object + String(_openapi_key) in ("result",) && continue + _openapi_additional_properties[String(_openapi_key)] = _decode(Any, _openapi_item, _openapi_validate) + end + return GetPolicyListSuccessResponse(; result = _openapi_field_result, additional_properties = _openapi_additional_properties) +end +function _encode(_openapi_value::GetPolicyListSuccessResponse) + _openapi_output = JSON.Object{String,Any}() + _openapi_value.result isa Absent || (_openapi_output["result"] = _encode(_openapi_value.result)) + for (_openapi_key, _openapi_item) in _openapi_value.additional_properties + haskey(_openapi_output, _openapi_key) && throw(ArgumentError("additional property conflicts with declared field: " * _openapi_key)) + _openapi_output[_openapi_key] = _encode(_openapi_item) + end + return _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/getPolicyListSuccessResponse"), _openapi_output, "encoding GetPolicyListSuccessResponse"; direction = :neutral) +end + +function _form_fields(_openapi_value::GetPolicyListSuccessResponse) + _openapi_output = Pair{String,Any}[] + _openapi_value.result isa Absent || push!(_openapi_output, "result" => _openapi_value.result) + append!(_openapi_output, collect(_openapi_value.additional_properties)) + return _openapi_output +end + +@doc " GetPolicyModuleSuccessResponse\n\n- `result`: A policy module" +Base.@kwdef struct GetPolicyModuleSuccessResponse + result::Policy + additional_properties::Dict{String,Any} = Dict{String,Any}() +end +_decode(::Type{GetPolicyModuleSuccessResponse}, value) = _decode(GetPolicyModuleSuccessResponse, value, true) +function _decode(::Type{GetPolicyModuleSuccessResponse}, _openapi_raw, _openapi_validate::Bool) + _openapi_validate && _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/getPolicyModuleSuccessResponse"), _openapi_raw, "decoding GetPolicyModuleSuccessResponse"; direction = :neutral) + _openapi_object = _object(_openapi_raw, "GetPolicyModuleSuccessResponse") + _openapi_field_result = _decode(Policy, _required(_openapi_object, "result", "GetPolicyModuleSuccessResponse"), _openapi_validate) + _openapi_additional_properties = Dict{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_object + String(_openapi_key) in ("result",) && continue + _openapi_additional_properties[String(_openapi_key)] = _decode(Any, _openapi_item, _openapi_validate) + end + return GetPolicyModuleSuccessResponse(; result = _openapi_field_result, additional_properties = _openapi_additional_properties) +end +function _encode(_openapi_value::GetPolicyModuleSuccessResponse) + _openapi_output = JSON.Object{String,Any}() + _openapi_value.result isa Absent || (_openapi_output["result"] = _encode(_openapi_value.result)) + for (_openapi_key, _openapi_item) in _openapi_value.additional_properties + haskey(_openapi_output, _openapi_key) && throw(ArgumentError("additional property conflicts with declared field: " * _openapi_key)) + _openapi_output[_openapi_key] = _encode(_openapi_item) + end + return _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/getPolicyModuleSuccessResponse"), _openapi_output, "encoding GetPolicyModuleSuccessResponse"; direction = :neutral) +end + +function _form_fields(_openapi_value::GetPolicyModuleSuccessResponse) + _openapi_output = Pair{String,Any}[] + _openapi_value.result isa Absent || push!(_openapi_output, "result" => _openapi_value.result) + append!(_openapi_output, collect(_openapi_value.additional_properties)) + return _openapi_output +end + +@doc " HealthyResponse\n\nAn empty object" +Base.@kwdef struct HealthyResponse + additional_properties::Dict{String,Any} = Dict{String,Any}() +end +_decode(::Type{HealthyResponse}, value) = _decode(HealthyResponse, value, true) +function _decode(::Type{HealthyResponse}, _openapi_raw, _openapi_validate::Bool) + _openapi_validate && _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/healthyResponse"), _openapi_raw, "decoding HealthyResponse"; direction = :neutral) + _openapi_object = _object(_openapi_raw, "HealthyResponse") + _openapi_additional_properties = Dict{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_object + String(_openapi_key) in () && continue + _openapi_additional_properties[String(_openapi_key)] = _decode(Any, _openapi_item, _openapi_validate) + end + return HealthyResponse(; additional_properties = _openapi_additional_properties) +end +function _encode(_openapi_value::HealthyResponse) + _openapi_output = JSON.Object{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_value.additional_properties + haskey(_openapi_output, _openapi_key) && throw(ArgumentError("additional property conflicts with declared field: " * _openapi_key)) + _openapi_output[_openapi_key] = _encode(_openapi_item) + end + return _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/healthyResponse"), _openapi_output, "encoding HealthyResponse"; direction = :neutral) +end + +function _form_fields(_openapi_value::HealthyResponse) + _openapi_output = Pair{String,Any}[] + append!(_openapi_output, collect(_openapi_value.additional_properties)) + return _openapi_output +end + +@doc " InputSchema\n\n- `input`: The input document. Can be any JSON value." +Base.@kwdef struct InputSchema + input::Any = ABSENT + additional_properties::Dict{String,Any} = Dict{String,Any}() +end +_decode(::Type{InputSchema}, value) = _decode(InputSchema, value, true) +function _decode(::Type{InputSchema}, _openapi_raw, _openapi_validate::Bool) + _openapi_validate && _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/inputSchema"), _openapi_raw, "decoding InputSchema"; direction = :neutral) + _openapi_object = _object(_openapi_raw, "InputSchema") + _openapi_field_input = haskey(_openapi_object, "input") ? _decode(Any, _openapi_object["input"], _openapi_validate) : ABSENT + _openapi_additional_properties = Dict{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_object + String(_openapi_key) in ("input",) && continue + _openapi_additional_properties[String(_openapi_key)] = _decode(Any, _openapi_item, _openapi_validate) + end + return InputSchema(; input = _openapi_field_input, additional_properties = _openapi_additional_properties) +end +function _encode(_openapi_value::InputSchema) + _openapi_output = JSON.Object{String,Any}() + _openapi_value.input isa Absent || (_openapi_output["input"] = _encode(_openapi_value.input)) + for (_openapi_key, _openapi_item) in _openapi_value.additional_properties + haskey(_openapi_output, _openapi_key) && throw(ArgumentError("additional property conflicts with declared field: " * _openapi_key)) + _openapi_output[_openapi_key] = _encode(_openapi_item) + end + return _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/inputSchema"), _openapi_output, "encoding InputSchema"; direction = :neutral) +end + +function _form_fields(_openapi_value::InputSchema) + _openapi_output = Pair{String,Any}[] + _openapi_value.input isa Absent || push!(_openapi_output, "input" => _openapi_value.input) + append!(_openapi_output, collect(_openapi_value.additional_properties)) + return _openapi_output +end + +@doc " PartialQuerySchema\n\n- `query`: The query to partially evaluate and compile.\n- `input`: The input document to use during partial evaluation. Can be any JSON value.\n- `options`: Additional options to use during partial evaluation. Only disableInlining option is supported.\n- `unknowns`: The terms to treat as unknown during partial evaluation." +Base.@kwdef struct PartialQuerySchema + query::Union{Absent,Nothing,String} = ABSENT + input::Any = ABSENT + options::Any = ABSENT + unknowns::Union{Absent,Nothing,Vector{String}} = ABSENT + additional_properties::Dict{String,Any} = Dict{String,Any}() +end +_decode(::Type{PartialQuerySchema}, value) = _decode(PartialQuerySchema, value, true) +function _decode(::Type{PartialQuerySchema}, _openapi_raw, _openapi_validate::Bool) + _openapi_validate && _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/partialQuerySchema"), _openapi_raw, "decoding PartialQuerySchema"; direction = :neutral) + _openapi_object = _object(_openapi_raw, "PartialQuerySchema") + _openapi_field_query = haskey(_openapi_object, "query") ? _decode(Union{Absent,Nothing,String}, _openapi_object["query"], _openapi_validate) : ABSENT + _openapi_field_input = haskey(_openapi_object, "input") ? _decode(Any, _openapi_object["input"], _openapi_validate) : ABSENT + _openapi_field_options = haskey(_openapi_object, "options") ? _decode(Any, _openapi_object["options"], _openapi_validate) : ABSENT + _openapi_field_unknowns = haskey(_openapi_object, "unknowns") ? _decode(Union{Absent,Nothing,Vector{String}}, _openapi_object["unknowns"], _openapi_validate) : ABSENT + _openapi_additional_properties = Dict{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_object + String(_openapi_key) in ("query","input","options","unknowns") && continue + _openapi_additional_properties[String(_openapi_key)] = _decode(Any, _openapi_item, _openapi_validate) + end + return PartialQuerySchema(; query = _openapi_field_query, input = _openapi_field_input, options = _openapi_field_options, unknowns = _openapi_field_unknowns, additional_properties = _openapi_additional_properties) +end +function _encode(_openapi_value::PartialQuerySchema) + _openapi_output = JSON.Object{String,Any}() + _openapi_value.query isa Absent || (_openapi_output["query"] = _encode(_openapi_value.query)) + _openapi_value.input isa Absent || (_openapi_output["input"] = _encode(_openapi_value.input)) + _openapi_value.options isa Absent || (_openapi_output["options"] = _encode(_openapi_value.options)) + _openapi_value.unknowns isa Absent || (_openapi_output["unknowns"] = _encode(_openapi_value.unknowns)) + for (_openapi_key, _openapi_item) in _openapi_value.additional_properties + haskey(_openapi_output, _openapi_key) && throw(ArgumentError("additional property conflicts with declared field: " * _openapi_key)) + _openapi_output[_openapi_key] = _encode(_openapi_item) + end + return _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/partialQuerySchema"), _openapi_output, "encoding PartialQuerySchema"; direction = :neutral) +end + +function _form_fields(_openapi_value::PartialQuerySchema) + _openapi_output = Pair{String,Any}[] + _openapi_value.query isa Absent || push!(_openapi_output, "query" => _openapi_value.query) + _openapi_value.input isa Absent || push!(_openapi_output, "input" => _openapi_value.input) + _openapi_value.options isa Absent || push!(_openapi_output, "options" => _openapi_value.options) + _openapi_value.unknowns isa Absent || push!(_openapi_output, "unknowns" => _openapi_value.unknowns) + append!(_openapi_output, collect(_openapi_value.additional_properties)) + return _openapi_output +end + +struct PatchOperationOp + value::String + function PatchOperationOp(value::String) + value in ("add","remove","replace","move","copy","test") || throw(ArgumentError("invalid PatchOperationOp value $(repr(value))")) + return new(value) + end +end +_decode(::Type{PatchOperationOp}, value) = _decode(PatchOperationOp, value, true) +function _decode(::Type{PatchOperationOp}, value, _openapi_validate::Bool) + _openapi_validate && _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/patchOperation/properties/op"), value, "decoding PatchOperationOp"; direction = :neutral) + return PatchOperationOp(_decode(String, value, _openapi_validate)) +end +function _encode(value::PatchOperationOp) + output = _encode(value.value) + return _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/patchOperation/properties/op"), output, "encoding PatchOperationOp"; direction = :neutral) +end +Base.string(value::PatchOperationOp) = string(value.value) + +@doc " PatchOperation\n\n- `value`: The value for the operation. Can be any JSON value." +Base.@kwdef struct PatchOperation + op::Union{Absent,Nothing,PatchOperationOp} = ABSENT + path::Union{Absent,Nothing,String} = ABSENT + from::Union{Absent,Nothing,String} = ABSENT + value::Any = ABSENT + additional_properties::Dict{String,Any} = Dict{String,Any}() +end +_decode(::Type{PatchOperation}, value) = _decode(PatchOperation, value, true) +function _decode(::Type{PatchOperation}, _openapi_raw, _openapi_validate::Bool) + _openapi_validate && _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/patchOperation"), _openapi_raw, "decoding PatchOperation"; direction = :neutral) + _openapi_object = _object(_openapi_raw, "PatchOperation") + _openapi_field_op = haskey(_openapi_object, "op") ? _decode(Union{Absent,Nothing,PatchOperationOp}, _openapi_object["op"], _openapi_validate) : ABSENT + _openapi_field_path = haskey(_openapi_object, "path") ? _decode(Union{Absent,Nothing,String}, _openapi_object["path"], _openapi_validate) : ABSENT + _openapi_field_from = haskey(_openapi_object, "from") ? _decode(Union{Absent,Nothing,String}, _openapi_object["from"], _openapi_validate) : ABSENT + _openapi_field_value = haskey(_openapi_object, "value") ? _decode(Any, _openapi_object["value"], _openapi_validate) : ABSENT + _openapi_additional_properties = Dict{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_object + String(_openapi_key) in ("op","path","from","value") && continue + _openapi_additional_properties[String(_openapi_key)] = _decode(Any, _openapi_item, _openapi_validate) + end + return PatchOperation(; op = _openapi_field_op, path = _openapi_field_path, from = _openapi_field_from, value = _openapi_field_value, additional_properties = _openapi_additional_properties) +end +function _encode(_openapi_value::PatchOperation) + _openapi_output = JSON.Object{String,Any}() + _openapi_value.op isa Absent || (_openapi_output["op"] = _encode(_openapi_value.op)) + _openapi_value.path isa Absent || (_openapi_output["path"] = _encode(_openapi_value.path)) + _openapi_value.from isa Absent || (_openapi_output["from"] = _encode(_openapi_value.from)) + _openapi_value.value isa Absent || (_openapi_output["value"] = _encode(_openapi_value.value)) + for (_openapi_key, _openapi_item) in _openapi_value.additional_properties + haskey(_openapi_output, _openapi_key) && throw(ArgumentError("additional property conflicts with declared field: " * _openapi_key)) + _openapi_output[_openapi_key] = _encode(_openapi_item) + end + return _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/patchOperation"), _openapi_output, "encoding PatchOperation"; direction = :neutral) +end + +function _form_fields(_openapi_value::PatchOperation) + _openapi_output = Pair{String,Any}[] + _openapi_value.op isa Absent || push!(_openapi_output, "op" => _openapi_value.op) + _openapi_value.path isa Absent || push!(_openapi_output, "path" => _openapi_value.path) + _openapi_value.from isa Absent || push!(_openapi_output, "from" => _openapi_value.from) + _openapi_value.value isa Absent || push!(_openapi_output, "value" => _openapi_value.value) + append!(_openapi_output, collect(_openapi_value.additional_properties)) + return _openapi_output +end + +Base.@kwdef struct PutPolicySuccessResponseMetrics + additional_properties::Dict{String,Any} = Dict{String,Any}() +end +_decode(::Type{PutPolicySuccessResponseMetrics}, value) = _decode(PutPolicySuccessResponseMetrics, value, true) +function _decode(::Type{PutPolicySuccessResponseMetrics}, _openapi_raw, _openapi_validate::Bool) + _openapi_validate && _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/putPolicySuccessResponse/properties/metrics"), _openapi_raw, "decoding PutPolicySuccessResponseMetrics"; direction = :neutral) + _openapi_object = _object(_openapi_raw, "PutPolicySuccessResponseMetrics") + _openapi_additional_properties = Dict{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_object + String(_openapi_key) in () && continue + _openapi_additional_properties[String(_openapi_key)] = _decode(Any, _openapi_item, _openapi_validate) + end + return PutPolicySuccessResponseMetrics(; additional_properties = _openapi_additional_properties) +end +function _encode(_openapi_value::PutPolicySuccessResponseMetrics) + _openapi_output = JSON.Object{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_value.additional_properties + haskey(_openapi_output, _openapi_key) && throw(ArgumentError("additional property conflicts with declared field: " * _openapi_key)) + _openapi_output[_openapi_key] = _encode(_openapi_item) + end + return _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/putPolicySuccessResponse/properties/metrics"), _openapi_output, "encoding PutPolicySuccessResponseMetrics"; direction = :neutral) +end + +function _form_fields(_openapi_value::PutPolicySuccessResponseMetrics) + _openapi_output = Pair{String,Any}[] + append!(_openapi_output, collect(_openapi_value.additional_properties)) + return _openapi_output +end + +Base.@kwdef struct PutPolicySuccessResponse + metrics::Union{Absent,Nothing,PutPolicySuccessResponseMetrics} = ABSENT + additional_properties::Dict{String,Any} = Dict{String,Any}() +end +_decode(::Type{PutPolicySuccessResponse}, value) = _decode(PutPolicySuccessResponse, value, true) +function _decode(::Type{PutPolicySuccessResponse}, _openapi_raw, _openapi_validate::Bool) + _openapi_validate && _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/putPolicySuccessResponse"), _openapi_raw, "decoding PutPolicySuccessResponse"; direction = :neutral) + _openapi_object = _object(_openapi_raw, "PutPolicySuccessResponse") + _openapi_field_metrics = haskey(_openapi_object, "metrics") ? _decode(Union{Absent,Nothing,PutPolicySuccessResponseMetrics}, _openapi_object["metrics"], _openapi_validate) : ABSENT + _openapi_additional_properties = Dict{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_object + String(_openapi_key) in ("metrics",) && continue + _openapi_additional_properties[String(_openapi_key)] = _decode(Any, _openapi_item, _openapi_validate) + end + return PutPolicySuccessResponse(; metrics = _openapi_field_metrics, additional_properties = _openapi_additional_properties) +end +function _encode(_openapi_value::PutPolicySuccessResponse) + _openapi_output = JSON.Object{String,Any}() + _openapi_value.metrics isa Absent || (_openapi_output["metrics"] = _encode(_openapi_value.metrics)) + for (_openapi_key, _openapi_item) in _openapi_value.additional_properties + haskey(_openapi_output, _openapi_key) && throw(ArgumentError("additional property conflicts with declared field: " * _openapi_key)) + _openapi_output[_openapi_key] = _encode(_openapi_item) + end + return _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/putPolicySuccessResponse"), _openapi_output, "encoding PutPolicySuccessResponse"; direction = :neutral) +end + +function _form_fields(_openapi_value::PutPolicySuccessResponse) + _openapi_output = Pair{String,Any}[] + _openapi_value.metrics isa Absent || push!(_openapi_output, "metrics" => _openapi_value.metrics) + append!(_openapi_output, collect(_openapi_value.additional_properties)) + return _openapi_output +end + +@doc " QueryParameterPost\n\n- `query`: The ad-hoc query to execute. OPA will parse, compile, and execute the query represented by the parameter value. The value MUST be URL encoded. Only used in GET method. For POST method the query is sent as part of the request body and this parameter is not used.\n- `input`: The input document (in JSON format). Can be any JSON value." +Base.@kwdef struct QueryParameterPost + query::Union{Absent,Nothing,String} = ABSENT + input::Any = ABSENT + additional_properties::Dict{String,Any} = Dict{String,Any}() +end +_decode(::Type{QueryParameterPost}, value) = _decode(QueryParameterPost, value, true) +function _decode(::Type{QueryParameterPost}, _openapi_raw, _openapi_validate::Bool) + _openapi_validate && _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/queryParameterPost"), _openapi_raw, "decoding QueryParameterPost"; direction = :neutral) + _openapi_object = _object(_openapi_raw, "QueryParameterPost") + _openapi_field_query = haskey(_openapi_object, "query") ? _decode(Union{Absent,Nothing,String}, _openapi_object["query"], _openapi_validate) : ABSENT + _openapi_field_input = haskey(_openapi_object, "input") ? _decode(Any, _openapi_object["input"], _openapi_validate) : ABSENT + _openapi_additional_properties = Dict{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_object + String(_openapi_key) in ("query","input") && continue + _openapi_additional_properties[String(_openapi_key)] = _decode(Any, _openapi_item, _openapi_validate) + end + return QueryParameterPost(; query = _openapi_field_query, input = _openapi_field_input, additional_properties = _openapi_additional_properties) +end +function _encode(_openapi_value::QueryParameterPost) + _openapi_output = JSON.Object{String,Any}() + _openapi_value.query isa Absent || (_openapi_output["query"] = _encode(_openapi_value.query)) + _openapi_value.input isa Absent || (_openapi_output["input"] = _encode(_openapi_value.input)) + for (_openapi_key, _openapi_item) in _openapi_value.additional_properties + haskey(_openapi_output, _openapi_key) && throw(ArgumentError("additional property conflicts with declared field: " * _openapi_key)) + _openapi_output[_openapi_key] = _encode(_openapi_item) + end + return _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/queryParameterPost"), _openapi_output, "encoding QueryParameterPost"; direction = :neutral) +end + +function _form_fields(_openapi_value::QueryParameterPost) + _openapi_output = Pair{String,Any}[] + _openapi_value.query isa Absent || push!(_openapi_output, "query" => _openapi_value.query) + _openapi_value.input isa Absent || push!(_openapi_output, "input" => _openapi_value.input) + append!(_openapi_output, collect(_openapi_value.additional_properties)) + return _openapi_output +end + +@doc " ServerErrorResponse\n\n- `code`: The error code name\n- `message`: A general description of the error\n- `errors`: Errors that may have been generated during the parse, compile, or installation of a policy module" +Base.@kwdef struct ServerErrorResponse + code::String + message::String + errors::Union{Absent,Nothing,Vector{ErrorDetail}} = ABSENT + additional_properties::Dict{String,Any} = Dict{String,Any}() +end +_decode(::Type{ServerErrorResponse}, value) = _decode(ServerErrorResponse, value, true) +function _decode(::Type{ServerErrorResponse}, _openapi_raw, _openapi_validate::Bool) + _openapi_validate && _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/serverErrorResponse"), _openapi_raw, "decoding ServerErrorResponse"; direction = :neutral) + _openapi_object = _object(_openapi_raw, "ServerErrorResponse") + _openapi_field_code = _decode(String, _required(_openapi_object, "code", "ServerErrorResponse"), _openapi_validate) + _openapi_field_message = _decode(String, _required(_openapi_object, "message", "ServerErrorResponse"), _openapi_validate) + _openapi_field_errors = haskey(_openapi_object, "errors") ? _decode(Union{Absent,Nothing,Vector{ErrorDetail}}, _openapi_object["errors"], _openapi_validate) : ABSENT + _openapi_additional_properties = Dict{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_object + String(_openapi_key) in ("code","message","errors") && continue + _openapi_additional_properties[String(_openapi_key)] = _decode(Any, _openapi_item, _openapi_validate) + end + return ServerErrorResponse(; code = _openapi_field_code, message = _openapi_field_message, errors = _openapi_field_errors, additional_properties = _openapi_additional_properties) +end +function _encode(_openapi_value::ServerErrorResponse) + _openapi_output = JSON.Object{String,Any}() + _openapi_value.code isa Absent || (_openapi_output["code"] = _encode(_openapi_value.code)) + _openapi_value.message isa Absent || (_openapi_output["message"] = _encode(_openapi_value.message)) + _openapi_value.errors isa Absent || (_openapi_output["errors"] = _encode(_openapi_value.errors)) + for (_openapi_key, _openapi_item) in _openapi_value.additional_properties + haskey(_openapi_output, _openapi_key) && throw(ArgumentError("additional property conflicts with declared field: " * _openapi_key)) + _openapi_output[_openapi_key] = _encode(_openapi_item) + end + return _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/serverErrorResponse"), _openapi_output, "encoding ServerErrorResponse"; direction = :neutral) +end + +function _form_fields(_openapi_value::ServerErrorResponse) + _openapi_output = Pair{String,Any}[] + _openapi_value.code isa Absent || push!(_openapi_output, "code" => _openapi_value.code) + _openapi_value.message isa Absent || push!(_openapi_output, "message" => _openapi_value.message) + _openapi_value.errors isa Absent || push!(_openapi_output, "errors" => _openapi_value.errors) + append!(_openapi_output, collect(_openapi_value.additional_properties)) + return _openapi_output +end + +Base.@kwdef struct SimpleQuerySuccessResponse + additional_properties::Dict{String,Any} = Dict{String,Any}() +end +_decode(::Type{SimpleQuerySuccessResponse}, value) = _decode(SimpleQuerySuccessResponse, value, true) +function _decode(::Type{SimpleQuerySuccessResponse}, _openapi_raw, _openapi_validate::Bool) + _openapi_validate && _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/simpleQuerySuccessResponse"), _openapi_raw, "decoding SimpleQuerySuccessResponse"; direction = :neutral) + _openapi_object = _object(_openapi_raw, "SimpleQuerySuccessResponse") + _openapi_additional_properties = Dict{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_object + String(_openapi_key) in () && continue + _openapi_additional_properties[String(_openapi_key)] = _decode(Any, _openapi_item, _openapi_validate) + end + return SimpleQuerySuccessResponse(; additional_properties = _openapi_additional_properties) +end +function _encode(_openapi_value::SimpleQuerySuccessResponse) + _openapi_output = JSON.Object{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_value.additional_properties + haskey(_openapi_output, _openapi_key) && throw(ArgumentError("additional property conflicts with declared field: " * _openapi_key)) + _openapi_output[_openapi_key] = _encode(_openapi_item) + end + return _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/simpleQuerySuccessResponse"), _openapi_output, "encoding SimpleQuerySuccessResponse"; direction = :neutral) +end + +function _form_fields(_openapi_value::SimpleQuerySuccessResponse) + _openapi_output = Pair{String,Any}[] + append!(_openapi_output, collect(_openapi_value.additional_properties)) + return _openapi_output +end + +Base.@kwdef struct Status + additional_properties::Dict{String,Any} = Dict{String,Any}() +end +_decode(::Type{Status}, value) = _decode(Status, value, true) +function _decode(::Type{Status}, _openapi_raw, _openapi_validate::Bool) + _openapi_validate && _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/status"), _openapi_raw, "decoding Status"; direction = :neutral) + _openapi_object = _object(_openapi_raw, "Status") + _openapi_additional_properties = Dict{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_object + String(_openapi_key) in () && continue + _openapi_additional_properties[String(_openapi_key)] = _decode(Any, _openapi_item, _openapi_validate) + end + return Status(; additional_properties = _openapi_additional_properties) +end +function _encode(_openapi_value::Status) + _openapi_output = JSON.Object{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_value.additional_properties + haskey(_openapi_output, _openapi_key) && throw(ArgumentError("additional property conflicts with declared field: " * _openapi_key)) + _openapi_output[_openapi_key] = _encode(_openapi_item) + end + return _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/status"), _openapi_output, "encoding Status"; direction = :neutral) +end + +function _form_fields(_openapi_value::Status) + _openapi_output = Pair{String,Any}[] + append!(_openapi_output, collect(_openapi_value.additional_properties)) + return _openapi_output +end + +@doc " UnhealthyResponse\n\n- `error`: The error message" +Base.@kwdef struct UnhealthyResponse + error::String + additional_properties::Dict{String,Any} = Dict{String,Any}() +end +_decode(::Type{UnhealthyResponse}, value) = _decode(UnhealthyResponse, value, true) +function _decode(::Type{UnhealthyResponse}, _openapi_raw, _openapi_validate::Bool) + _openapi_validate && _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/unhealthyResponse"), _openapi_raw, "decoding UnhealthyResponse"; direction = :neutral) + _openapi_object = _object(_openapi_raw, "UnhealthyResponse") + _openapi_field_error = _decode(String, _required(_openapi_object, "error", "UnhealthyResponse"), _openapi_validate) + _openapi_additional_properties = Dict{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_object + String(_openapi_key) in ("error",) && continue + _openapi_additional_properties[String(_openapi_key)] = _decode(Any, _openapi_item, _openapi_validate) + end + return UnhealthyResponse(; error = _openapi_field_error, additional_properties = _openapi_additional_properties) +end +function _encode(_openapi_value::UnhealthyResponse) + _openapi_output = JSON.Object{String,Any}() + _openapi_value.error isa Absent || (_openapi_output["error"] = _encode(_openapi_value.error)) + for (_openapi_key, _openapi_item) in _openapi_value.additional_properties + haskey(_openapi_output, _openapi_key) && throw(ArgumentError("additional property conflicts with declared field: " * _openapi_key)) + _openapi_output[_openapi_key] = _encode(_openapi_item) + end + return _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/schemas/unhealthyResponse"), _openapi_output, "encoding UnhealthyResponse"; direction = :neutral) +end + +function _form_fields(_openapi_value::UnhealthyResponse) + _openapi_output = Pair{String,Any}[] + _openapi_value.error isa Absent || push!(_openapi_output, "error" => _openapi_value.error) + append!(_openapi_output, collect(_openapi_value.additional_properties)) + return _openapi_output +end + +Base.@kwdef struct GetdocumentInput + additional_properties::Dict{String,Any} = Dict{String,Any}() +end +_decode(::Type{GetdocumentInput}, value) = _decode(GetdocumentInput, value, true) +function _decode(::Type{GetdocumentInput}, _openapi_raw, _openapi_validate::Bool) + _openapi_validate && _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/inputParameter/schema"), _openapi_raw, "decoding GetdocumentInput"; direction = :neutral) + _openapi_object = _object(_openapi_raw, "GetdocumentInput") + _openapi_additional_properties = Dict{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_object + String(_openapi_key) in () && continue + _openapi_additional_properties[String(_openapi_key)] = _decode(Any, _openapi_item, _openapi_validate) + end + return GetdocumentInput(; additional_properties = _openapi_additional_properties) +end +function _encode(_openapi_value::GetdocumentInput) + _openapi_output = JSON.Object{String,Any}() + for (_openapi_key, _openapi_item) in _openapi_value.additional_properties + haskey(_openapi_output, _openapi_key) && throw(ArgumentError("additional property conflicts with declared field: " * _openapi_key)) + _openapi_output[_openapi_key] = _encode(_openapi_item) + end + return _validate_schema(_SPEC, (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/inputParameter/schema"), _openapi_output, "encoding GetdocumentInput"; direction = :neutral) +end + +function _form_fields(_openapi_value::GetdocumentInput) + _openapi_output = Pair{String,Any}[] + append!(_openapi_output, collect(_openapi_value.additional_properties)) + return _openapi_output +end + +const _OP_simplequery = ( + id = "simpleQuery", + method = "POST", + path = "/", + parameters = ((arg = :pretty, name = "pretty", type = Union{Absent,Bool}, location = :query, style = :form, explode = true, allow_reserved = false, shape = :scalar, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/prettyParameter/schema"), content = (), required = false),), + request = (required = true, media = ((media_type = "application/json", type = InputSchema, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/paths/~1/post/requestBody/content/application~1json/schema"), encodings = (), fields = ()),)), + responses = ( + (selector = "200", media = ((media_type = "application/json", type = SimpleQuerySuccessResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/simpleQuerySuccessResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + (selector = "400", media = ((media_type = "application/json", type = ServerErrorResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/badRequestResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + (selector = "404", media = ((media_type = "application/json", type = ServerErrorResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/notFoundResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + (selector = "500", media = ((media_type = "application/json", type = ServerErrorResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/serverErrorResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + ), + security = (), + servers = ((name = nothing, url = "http://localhost:8181", base = "", variables = ()),), +) + +@doc " simplequery(...)\n\nExecute a simple query.\n\n`POST /`\n\n- `pretty`: If true, response will be in a human-readable format.\n- `body`: The input document (in JSON format)" +function simplequery(body::InputSchema; pretty::Union{Absent,Bool} = ABSENT, client::Runtime.Client = DEFAULT_CLIENT, content_type::Union{Nothing,AbstractString} = nothing, accept::Union{Nothing,AbstractString} = nothing, with_http_info::Bool = false, request_headers = Pair{String,String}[], request_options::NamedTuple = NamedTuple(), stream_to::Union{Nothing,Channel} = nothing) + _openapi_values = Dict{Symbol,Any}() + _openapi_values[:pretty] = pretty + return _request(client, _OP_simplequery, _openapi_values; body = body, content_type, accept, with_http_info, request_headers, request_options, stream_to) +end + +const _OP_gethealth = ( + id = "getHealth", + method = "GET", + path = "/health", + parameters = ((arg = :bundles, name = "bundles", type = Union{Absent,Bool}, location = :query, style = :form, explode = true, allow_reserved = false, shape = :scalar, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/bundlesParameter/schema"), content = (), required = false),(arg = :plugins, name = "plugins", type = Union{Absent,Bool}, location = :query, style = :form, explode = true, allow_reserved = false, shape = :scalar, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/pluginsParameter/schema"), content = (), required = false),(arg = :exclude_plugin, name = "exclude-plugin", type = Union{Absent,String}, location = :query, style = :form, explode = true, allow_reserved = false, shape = :scalar, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/excludePluginsParameter/schema"), content = (), required = false)), + request = nothing, + responses = ( + (selector = "200", media = ((media_type = "application/json", type = HealthyResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/healthyResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + (selector = "500", media = ((media_type = "application/json", type = UnhealthyResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/unhealthyResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + ), + security = (), + servers = ((name = nothing, url = "http://localhost:8181", base = "", variables = ()),), +) + +@doc " gethealth(...)\n\nHealth\n\n`GET /health`\n\n- `bundles`: Reports on bundle activation status (useful for 'ready' checks at startup).\n\nThis includes any discovery bundles or bundles defined in the loaded discovery configuration.\n- `plugins`: Reports on plugin status\n- `exclude_plugin`: String parameter to exclude a plugin from status checks.\nCan be added multiple times. Does nothing if plugins is not true.\nThis parameter is useful for special use cases where a plugin depends on the server being fully initialized before it can fully initialize itself.\nExclude the specified plugin from the response." +function gethealth(; bundles::Union{Absent,Bool} = ABSENT, plugins::Union{Absent,Bool} = ABSENT, exclude_plugin::Union{Absent,String} = ABSENT, client::Runtime.Client = DEFAULT_CLIENT, content_type::Union{Nothing,AbstractString} = nothing, accept::Union{Nothing,AbstractString} = nothing, with_http_info::Bool = false, request_headers = Pair{String,String}[], request_options::NamedTuple = NamedTuple(), stream_to::Union{Nothing,Channel} = nothing) + _openapi_values = Dict{Symbol,Any}() + _openapi_values[:bundles] = bundles + _openapi_values[:plugins] = plugins + _openapi_values[:exclude_plugin] = exclude_plugin + return _request(client, _OP_gethealth, _openapi_values; body = ABSENT, content_type, accept, with_http_info, request_headers, request_options, stream_to) +end + +const _OP_getdocumentfromwebhook = ( + id = "getDocumentFromWebhook", + method = "POST", + path = "/v0/data/{path}", + parameters = ((arg = :path, name = "path", type = String, location = :path, style = :simple, explode = false, allow_reserved = true, shape = :scalar, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/pathParameter/schema"), content = (), required = true),(arg = :pretty, name = "pretty", type = Union{Absent,Bool}, location = :query, style = :form, explode = true, allow_reserved = false, shape = :scalar, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/prettyParameter/schema"), content = (), required = false)), + request = (required = true, media = ((media_type = "application/json", type = InputSchema, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/paths/~1v0~1data~1{path}/post/requestBody/content/application~1json/schema"), encodings = (), fields = ()),)), + responses = ( + (selector = "200", media = ((media_type = "application/json", type = GetDocumentSuccessResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/getDocumentSuccessResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + (selector = "400", media = ((media_type = "application/json", type = ServerErrorResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/badRequestResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + (selector = "500", media = ((media_type = "application/json", type = ServerErrorResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/serverErrorResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + ), + security = (), + servers = ((name = nothing, url = "http://localhost:8181", base = "", variables = ()),), +) + +@doc " getdocumentfromwebhook(...)\n\nGet a document from a webhook.\n\n`POST /v0/data/{path}`\n\n- `path`: A backslash (/) delimited path to access values inside object and array documents. If the path points to an array, the server will attempt to convert the array index to an integer. If the path element cannot be converted to an integer, the server will respond with 404.\n- `pretty`: If true, response will be in a human-readable format.\n- `body`: The input document (in JSON format)" +function getdocumentfromwebhook(path::String, body::InputSchema; pretty::Union{Absent,Bool} = ABSENT, client::Runtime.Client = DEFAULT_CLIENT, content_type::Union{Nothing,AbstractString} = nothing, accept::Union{Nothing,AbstractString} = nothing, with_http_info::Bool = false, request_headers = Pair{String,String}[], request_options::NamedTuple = NamedTuple(), stream_to::Union{Nothing,Channel} = nothing) + _openapi_values = Dict{Symbol,Any}() + _openapi_values[:path] = path + _openapi_values[:pretty] = pretty + return _request(client, _OP_getdocumentfromwebhook, _openapi_values; body = body, content_type, accept, with_http_info, request_headers, request_options, stream_to) +end + +const _OP_postcompile = ( + id = "postCompile", + method = "POST", + path = "/v1/compile", + parameters = ((arg = :pretty, name = "pretty", type = Union{Absent,Bool}, location = :query, style = :form, explode = true, allow_reserved = false, shape = :scalar, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/prettyParameter/schema"), content = (), required = false),(arg = :explain, name = "explain", type = Union{Absent,ExplainMode}, location = :query, style = :form, explode = true, allow_reserved = false, shape = :scalar, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/explainParameter/schema"), content = (), required = false),(arg = :metrics, name = "metrics", type = Union{Absent,Bool}, location = :query, style = :form, explode = true, allow_reserved = false, shape = :scalar, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/metricsParameter/schema"), content = (), required = false),(arg = :instrument, name = "instrument", type = Union{Absent,Bool}, location = :query, style = :form, explode = true, allow_reserved = false, shape = :scalar, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/instrumentParameter/schema"), content = (), required = false)), + request = (required = false, media = ((media_type = "application/json", type = PartialQuerySchema, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/paths/~1v1~1compile/post/requestBody/content/application~1json/schema"), encodings = (), fields = ()),)), + responses = ( + (selector = "200", media = ((media_type = "application/json", type = CompileSuccessResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/compileSuccessResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + (selector = "400", media = ((media_type = "application/json", type = ServerErrorResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/badRequestResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + (selector = "500", media = ((media_type = "application/json", type = ServerErrorResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/serverErrorResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + ), + security = (), + servers = ((name = nothing, url = "http://localhost:8181", base = "", variables = ()),), +) + +@doc " postcompile(...)\n\nPartially evaluate a query.\n\n`POST /v1/compile`\n\n- `pretty`: If true, response will be in a human-readable format.\n- `explain`: If set to *full*, response will include query explanations in addition to the result.\n- `metrics`: If true, compiler performance metrics will be returned in the response.\n- `instrument`: If true, response will return additional performance metrics in addition to the result and the standard metrics.\n\n**Caution:** This can add significant overhead to query evaluation. The recommendation is to only use this parameter if you are debugging a performance problem.\n- `body`: The query (in JSON format)" +function postcompile(; pretty::Union{Absent,Bool} = ABSENT, explain::Union{Absent,ExplainMode} = ABSENT, metrics::Union{Absent,Bool} = ABSENT, instrument::Union{Absent,Bool} = ABSENT, body::Union{Absent,PartialQuerySchema} = ABSENT, client::Runtime.Client = DEFAULT_CLIENT, content_type::Union{Nothing,AbstractString} = nothing, accept::Union{Nothing,AbstractString} = nothing, with_http_info::Bool = false, request_headers = Pair{String,String}[], request_options::NamedTuple = NamedTuple(), stream_to::Union{Nothing,Channel} = nothing) + _openapi_values = Dict{Symbol,Any}() + _openapi_values[:pretty] = pretty + _openapi_values[:explain] = explain + _openapi_values[:metrics] = metrics + _openapi_values[:instrument] = instrument + return _request(client, _OP_postcompile, _openapi_values; body = body, content_type, accept, with_http_info, request_headers, request_options, stream_to) +end + +const _OP_getconfig = ( + id = "getConfig", + method = "GET", + path = "/v1/config", + parameters = ((arg = :pretty, name = "pretty", type = Union{Absent,Bool}, location = :query, style = :form, explode = true, allow_reserved = false, shape = :scalar, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/prettyParameter/schema"), content = (), required = false),), + request = nothing, + responses = ( + (selector = "200", media = ((media_type = "application/json", type = ActiveConfiguration, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/getConfigSuccessResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + (selector = "500", media = ((media_type = "application/json", type = ServerErrorResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/serverErrorResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + ), + security = (), + servers = ((name = nothing, url = "http://localhost:8181", base = "", variables = ()),), +) + +@doc " getconfig(...)\n\nGet configurations\n\n`GET /v1/config`\n\n- `pretty`: If true, response will be in a human-readable format." +function getconfig(; pretty::Union{Absent,Bool} = ABSENT, client::Runtime.Client = DEFAULT_CLIENT, content_type::Union{Nothing,AbstractString} = nothing, accept::Union{Nothing,AbstractString} = nothing, with_http_info::Bool = false, request_headers = Pair{String,String}[], request_options::NamedTuple = NamedTuple(), stream_to::Union{Nothing,Channel} = nothing) + _openapi_values = Dict{Symbol,Any}() + _openapi_values[:pretty] = pretty + return _request(client, _OP_getconfig, _openapi_values; body = ABSENT, content_type, accept, with_http_info, request_headers, request_options, stream_to) +end + +const _OP_deletedocument = ( + id = "deleteDocument", + method = "DELETE", + path = "/v1/data/{path}", + parameters = ((arg = :path, name = "path", type = String, location = :path, style = :simple, explode = false, allow_reserved = true, shape = :scalar, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/pathParameter/schema"), content = (), required = true),(arg = :metrics, name = "metrics", type = Union{Absent,Bool}, location = :query, style = :form, explode = true, allow_reserved = false, shape = :scalar, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/metricsParameter/schema"), content = (), required = false)), + request = nothing, + responses = ( + (selector = "200", media = ((media_type = "application/json", type = DeleteDocumentSuccessResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/deleteDocumentSuccessResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + (selector = "204", media = (), headers = ()), + (selector = "304", media = (), headers = ()), + (selector = "400", media = ((media_type = "application/json", type = ServerErrorResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/badRequestResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + (selector = "404", media = ((media_type = "application/json", type = ServerErrorResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/writeConflictResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + (selector = "500", media = ((media_type = "application/json", type = ServerErrorResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/serverErrorResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + ), + security = (), + servers = ((name = nothing, url = "http://localhost:8181", base = "", variables = ()),), +) + +@doc " deletedocument(...)\n\nDelete a document\n\n`DELETE /v1/data/{path}`\n\n- `path`: A backslash (/) delimited path to access values inside object and array documents. If the path points to an array, the server will attempt to convert the array index to an integer. If the path element cannot be converted to an integer, the server will respond with 404.\n- `metrics`: If true, compiler performance metrics will be returned in the response." +function deletedocument(path::String; metrics::Union{Absent,Bool} = ABSENT, client::Runtime.Client = DEFAULT_CLIENT, content_type::Union{Nothing,AbstractString} = nothing, accept::Union{Nothing,AbstractString} = nothing, with_http_info::Bool = false, request_headers = Pair{String,String}[], request_options::NamedTuple = NamedTuple(), stream_to::Union{Nothing,Channel} = nothing) + _openapi_values = Dict{Symbol,Any}() + _openapi_values[:path] = path + _openapi_values[:metrics] = metrics + return _request(client, _OP_deletedocument, _openapi_values; body = ABSENT, content_type, accept, with_http_info, request_headers, request_options, stream_to) +end + +const _OP_getdocument = ( + id = "getDocument", + method = "GET", + path = "/v1/data/{path}", + parameters = ((arg = :path, name = "path", type = String, location = :path, style = :simple, explode = false, allow_reserved = true, shape = :scalar, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/pathParameter/schema"), content = (), required = true),(arg = :input, name = "input", type = Union{Absent,GetdocumentInput}, location = :query, style = :form, explode = true, allow_reserved = false, shape = :object, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/inputParameter/schema"), content = (), required = false),(arg = :pretty, name = "pretty", type = Union{Absent,Bool}, location = :query, style = :form, explode = true, allow_reserved = false, shape = :scalar, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/prettyParameter/schema"), content = (), required = false),(arg = :provenance, name = "provenance", type = Union{Absent,Bool}, location = :query, style = :form, explode = true, allow_reserved = false, shape = :scalar, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/provenanceParameter/schema"), content = (), required = false),(arg = :explain, name = "explain", type = Union{Absent,ExplainMode}, location = :query, style = :form, explode = true, allow_reserved = false, shape = :scalar, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/explainParameter/schema"), content = (), required = false),(arg = :metrics, name = "metrics", type = Union{Absent,Bool}, location = :query, style = :form, explode = true, allow_reserved = false, shape = :scalar, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/metricsParameter/schema"), content = (), required = false),(arg = :instrument, name = "instrument", type = Union{Absent,Bool}, location = :query, style = :form, explode = true, allow_reserved = false, shape = :scalar, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/instrumentParameter/schema"), content = (), required = false),(arg = :strict_builtin_errors, name = "strict-builtin-errors", type = Union{Absent,Bool}, location = :query, style = :form, explode = true, allow_reserved = false, shape = :scalar, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/strictBuiltInErrorParameter/schema"), content = (), required = false)), + request = nothing, + responses = ( + (selector = "200", media = ((media_type = "application/json", type = GetDocumentSuccessResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/getDocumentSuccessResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + (selector = "400", media = ((media_type = "application/json", type = ServerErrorResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/badRequestResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + (selector = "500", media = ((media_type = "application/json", type = ServerErrorResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/serverErrorResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + ), + security = (), + servers = ((name = nothing, url = "http://localhost:8181", base = "", variables = ()),), +) + +@doc " getdocument(...)\n\nGet a document\n\n`GET /v1/data/{path}`\n\n- `path`: A backslash (/) delimited path to access values inside object and array documents. If the path points to an array, the server will attempt to convert the array index to an integer. If the path element cannot be converted to an integer, the server will respond with 404.\n- `input`: Provide the text for an [input document](https://www.openpolicyagent.org/docs/latest/kubernetes-primer/#input-document) in JSON format\n- `pretty`: If true, response will be in a human-readable format.\n- `provenance`: If true, response will include build and version information in addition to the result.\n- `explain`: If set to *full*, response will include query explanations in addition to the result.\n- `metrics`: If true, compiler performance metrics will be returned in the response.\n- `instrument`: If true, response will return additional performance metrics in addition to the result and the standard metrics.\n\n**Caution:** This can add significant overhead to query evaluation. The recommendation is to only use this parameter if you are debugging a performance problem.\n- `strict_builtin_errors`: Treat built-in function call errors as fatal and return an error immediately." +function getdocument(path::String; input::Union{Absent,GetdocumentInput} = ABSENT, pretty::Union{Absent,Bool} = ABSENT, provenance::Union{Absent,Bool} = ABSENT, explain::Union{Absent,ExplainMode} = ABSENT, metrics::Union{Absent,Bool} = ABSENT, instrument::Union{Absent,Bool} = ABSENT, strict_builtin_errors::Union{Absent,Bool} = ABSENT, client::Runtime.Client = DEFAULT_CLIENT, content_type::Union{Nothing,AbstractString} = nothing, accept::Union{Nothing,AbstractString} = nothing, with_http_info::Bool = false, request_headers = Pair{String,String}[], request_options::NamedTuple = NamedTuple(), stream_to::Union{Nothing,Channel} = nothing) + _openapi_values = Dict{Symbol,Any}() + _openapi_values[:path] = path + _openapi_values[:input] = input + _openapi_values[:pretty] = pretty + _openapi_values[:provenance] = provenance + _openapi_values[:explain] = explain + _openapi_values[:metrics] = metrics + _openapi_values[:instrument] = instrument + _openapi_values[:strict_builtin_errors] = strict_builtin_errors + return _request(client, _OP_getdocument, _openapi_values; body = ABSENT, content_type, accept, with_http_info, request_headers, request_options, stream_to) +end + +const _OP_patchdocument = ( + id = "patchDocument", + method = "PATCH", + path = "/v1/data/{path}", + parameters = ((arg = :path, name = "path", type = String, location = :path, style = :simple, explode = false, allow_reserved = true, shape = :scalar, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/pathParameter/schema"), content = (), required = true),), + request = (required = true, media = ((media_type = "application/json-patch+json", type = Vector{PatchOperation}, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/paths/~1v1~1data~1{path}/patch/requestBody/content/application~1json-patch+json/schema"), encodings = (), fields = ()),)), + responses = ( + (selector = "204", media = (), headers = ()), + (selector = "304", media = (), headers = ()), + (selector = "400", media = ((media_type = "application/json", type = ServerErrorResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/badRequestResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + (selector = "404", media = ((media_type = "application/json", type = ServerErrorResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/writeConflictResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + (selector = "500", media = ((media_type = "application/json", type = ServerErrorResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/serverErrorResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + ), + security = (), + servers = ((name = nothing, url = "http://localhost:8181", base = "", variables = ()),), +) + +@doc " patchdocument(...)\n\nPatch a document\n\n`PATCH /v1/data/{path}`\n\n- `path`: A backslash (/) delimited path to access values inside object and array documents. If the path points to an array, the server will attempt to convert the array index to an integer. If the path element cannot be converted to an integer, the server will respond with 404.\n- `body`: The patch operation in `application/json-patch+json` format" +function patchdocument(path::String, body::Vector{PatchOperation}; client::Runtime.Client = DEFAULT_CLIENT, content_type::Union{Nothing,AbstractString} = nothing, accept::Union{Nothing,AbstractString} = nothing, with_http_info::Bool = false, request_headers = Pair{String,String}[], request_options::NamedTuple = NamedTuple(), stream_to::Union{Nothing,Channel} = nothing) + _openapi_values = Dict{Symbol,Any}() + _openapi_values[:path] = path + return _request(client, _OP_patchdocument, _openapi_values; body = body, content_type, accept, with_http_info, request_headers, request_options, stream_to) +end + +const _OP_getdocumentwithpath = ( + id = "getDocumentWithPath", + method = "POST", + path = "/v1/data/{path}", + parameters = ((arg = :path, name = "path", type = String, location = :path, style = :simple, explode = false, allow_reserved = true, shape = :scalar, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/pathParameter/schema"), content = (), required = true),(arg = :pretty, name = "pretty", type = Union{Absent,Bool}, location = :query, style = :form, explode = true, allow_reserved = false, shape = :scalar, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/prettyParameter/schema"), content = (), required = false),(arg = :provenance, name = "provenance", type = Union{Absent,Bool}, location = :query, style = :form, explode = true, allow_reserved = false, shape = :scalar, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/provenanceParameter/schema"), content = (), required = false),(arg = :explain, name = "explain", type = Union{Absent,ExplainMode}, location = :query, style = :form, explode = true, allow_reserved = false, shape = :scalar, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/explainParameter/schema"), content = (), required = false),(arg = :metrics, name = "metrics", type = Union{Absent,Bool}, location = :query, style = :form, explode = true, allow_reserved = false, shape = :scalar, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/metricsParameter/schema"), content = (), required = false),(arg = :instrument, name = "instrument", type = Union{Absent,Bool}, location = :query, style = :form, explode = true, allow_reserved = false, shape = :scalar, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/instrumentParameter/schema"), content = (), required = false),(arg = :strict_builtin_errors, name = "strict-builtin-errors", type = Union{Absent,Bool}, location = :query, style = :form, explode = true, allow_reserved = false, shape = :scalar, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/strictBuiltInErrorParameter/schema"), content = (), required = false)), + request = (required = true, media = ((media_type = "application/json", type = InputSchema, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/paths/~1v1~1data~1{path}/post/requestBody/content/application~1json/schema"), encodings = (), fields = ()),)), + responses = ( + (selector = "200", media = ((media_type = "application/json", type = GetDocumentSuccessResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/getDocumentSuccessResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + (selector = "400", media = ((media_type = "application/json", type = ServerErrorResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/badRequestResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + (selector = "500", media = ((media_type = "application/json", type = ServerErrorResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/serverErrorResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + ), + security = (), + servers = ((name = nothing, url = "http://localhost:8181", base = "", variables = ()),), +) + +@doc " getdocumentwithpath(...)\n\nGet a document that required an input\n\n`POST /v1/data/{path}`\n\n- `path`: A backslash (/) delimited path to access values inside object and array documents. If the path points to an array, the server will attempt to convert the array index to an integer. If the path element cannot be converted to an integer, the server will respond with 404.\n- `pretty`: If true, response will be in a human-readable format.\n- `provenance`: If true, response will include build and version information in addition to the result.\n- `explain`: If set to *full*, response will include query explanations in addition to the result.\n- `metrics`: If true, compiler performance metrics will be returned in the response.\n- `instrument`: If true, response will return additional performance metrics in addition to the result and the standard metrics.\n\n**Caution:** This can add significant overhead to query evaluation. The recommendation is to only use this parameter if you are debugging a performance problem.\n- `strict_builtin_errors`: Treat built-in function call errors as fatal and return an error immediately.\n- `body`: The input document (in JSON format)" +function getdocumentwithpath(path::String, body::InputSchema; pretty::Union{Absent,Bool} = ABSENT, provenance::Union{Absent,Bool} = ABSENT, explain::Union{Absent,ExplainMode} = ABSENT, metrics::Union{Absent,Bool} = ABSENT, instrument::Union{Absent,Bool} = ABSENT, strict_builtin_errors::Union{Absent,Bool} = ABSENT, client::Runtime.Client = DEFAULT_CLIENT, content_type::Union{Nothing,AbstractString} = nothing, accept::Union{Nothing,AbstractString} = nothing, with_http_info::Bool = false, request_headers = Pair{String,String}[], request_options::NamedTuple = NamedTuple(), stream_to::Union{Nothing,Channel} = nothing) + _openapi_values = Dict{Symbol,Any}() + _openapi_values[:path] = path + _openapi_values[:pretty] = pretty + _openapi_values[:provenance] = provenance + _openapi_values[:explain] = explain + _openapi_values[:metrics] = metrics + _openapi_values[:instrument] = instrument + _openapi_values[:strict_builtin_errors] = strict_builtin_errors + return _request(client, _OP_getdocumentwithpath, _openapi_values; body = body, content_type, accept, with_http_info, request_headers, request_options, stream_to) +end + +const _OP_createdocument = ( + id = "createDocument", + method = "PUT", + path = "/v1/data/{path}", + parameters = ((arg = :path, name = "path", type = String, location = :path, style = :simple, explode = false, allow_reserved = true, shape = :scalar, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/pathParameter/schema"), content = (), required = true),(arg = :metrics, name = "metrics", type = Union{Absent,Bool}, location = :query, style = :form, explode = true, allow_reserved = false, shape = :scalar, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/metricsParameter/schema"), content = (), required = false)), + request = (required = true, media = ((media_type = "application/json", type = Any, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/paths/~1v1~1data~1{path}/put/requestBody/content/application~1json/schema"), encodings = (), fields = ()),)), + responses = ( + (selector = "200", media = ((media_type = "application/json", type = CreateDocumentSuccessResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/createDocumentSuccessResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + (selector = "204", media = (), headers = ()), + (selector = "304", media = (), headers = ()), + (selector = "400", media = ((media_type = "application/json", type = ServerErrorResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/badRequestResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + (selector = "404", media = ((media_type = "application/json", type = ServerErrorResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/writeConflictResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + (selector = "500", media = ((media_type = "application/json", type = ServerErrorResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/serverErrorResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + ), + security = (), + servers = ((name = nothing, url = "http://localhost:8181", base = "", variables = ()),), +) + +@doc " createdocument(...)\n\nCreate or overwrite a document.\n\n`PUT /v1/data/{path}`\n\n- `path`: A backslash (/) delimited path to access values inside object and array documents. If the path points to an array, the server will attempt to convert the array index to an integer. If the path element cannot be converted to an integer, the server will respond with 404.\n- `metrics`: If true, compiler performance metrics will be returned in the response.\n- `body`: The document to create or overwrite (in JSON format)" +function createdocument(path::String, body::Any; metrics::Union{Absent,Bool} = ABSENT, client::Runtime.Client = DEFAULT_CLIENT, content_type::Union{Nothing,AbstractString} = nothing, accept::Union{Nothing,AbstractString} = nothing, with_http_info::Bool = false, request_headers = Pair{String,String}[], request_options::NamedTuple = NamedTuple(), stream_to::Union{Nothing,Channel} = nothing) + _openapi_values = Dict{Symbol,Any}() + _openapi_values[:path] = path + _openapi_values[:metrics] = metrics + return _request(client, _OP_createdocument, _openapi_values; body = body, content_type, accept, with_http_info, request_headers, request_options, stream_to) +end + +const _OP_getpolicies = ( + id = "getPolicies", + method = "GET", + path = "/v1/policies", + parameters = ((arg = :pretty, name = "pretty", type = Union{Absent,Bool}, location = :query, style = :form, explode = true, allow_reserved = false, shape = :scalar, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/prettyParameter/schema"), content = (), required = false),), + request = nothing, + responses = ( + (selector = "200", media = ((media_type = "application/json", type = GetPolicyListSuccessResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/listPoliciesSuccessResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + (selector = "500", media = ((media_type = "application/json", type = ServerErrorResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/serverErrorResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + ), + security = (), + servers = ((name = nothing, url = "http://localhost:8181", base = "", variables = ()),), +) + +@doc " getpolicies(...)\n\nList policies\n\n`GET /v1/policies`\n\n- `pretty`: If true, response will be in a human-readable format." +function getpolicies(; pretty::Union{Absent,Bool} = ABSENT, client::Runtime.Client = DEFAULT_CLIENT, content_type::Union{Nothing,AbstractString} = nothing, accept::Union{Nothing,AbstractString} = nothing, with_http_info::Bool = false, request_headers = Pair{String,String}[], request_options::NamedTuple = NamedTuple(), stream_to::Union{Nothing,Channel} = nothing) + _openapi_values = Dict{Symbol,Any}() + _openapi_values[:pretty] = pretty + return _request(client, _OP_getpolicies, _openapi_values; body = ABSENT, content_type, accept, with_http_info, request_headers, request_options, stream_to) +end + +const _OP_deletepolicymodule = ( + id = "deletePolicyModule", + method = "DELETE", + path = "/v1/policies/{id}", + parameters = ((arg = :id, name = "id", type = String, location = :path, style = :simple, explode = false, allow_reserved = false, shape = :scalar, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/idParameter/schema"), content = (), required = true),(arg = :pretty, name = "pretty", type = Union{Absent,Bool}, location = :query, style = :form, explode = true, allow_reserved = false, shape = :scalar, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/prettyParameter/schema"), content = (), required = false),(arg = :metrics, name = "metrics", type = Union{Absent,Bool}, location = :query, style = :form, explode = true, allow_reserved = false, shape = :scalar, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/metricsParameter/schema"), content = (), required = false)), + request = nothing, + responses = ( + (selector = "200", media = ((media_type = "application/json", type = DeletePolicySuccessResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/deletePolicySuccessResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + (selector = "400", media = ((media_type = "application/json", type = ServerErrorResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/badRequestResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + (selector = "404", media = ((media_type = "application/json", type = ServerErrorResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/notFoundResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + (selector = "500", media = ((media_type = "application/json", type = ServerErrorResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/serverErrorResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + ), + security = (), + servers = ((name = nothing, url = "http://localhost:8181", base = "", variables = ()),), +) + +@doc " deletepolicymodule(...)\n\nDelete a policy module\n\n`DELETE /v1/policies/{id}`\n\n- `id`: The name of a policy module\n- `pretty`: If true, response will be in a human-readable format.\n- `metrics`: If true, compiler performance metrics will be returned in the response." +function deletepolicymodule(id::String; pretty::Union{Absent,Bool} = ABSENT, metrics::Union{Absent,Bool} = ABSENT, client::Runtime.Client = DEFAULT_CLIENT, content_type::Union{Nothing,AbstractString} = nothing, accept::Union{Nothing,AbstractString} = nothing, with_http_info::Bool = false, request_headers = Pair{String,String}[], request_options::NamedTuple = NamedTuple(), stream_to::Union{Nothing,Channel} = nothing) + _openapi_values = Dict{Symbol,Any}() + _openapi_values[:id] = id + _openapi_values[:pretty] = pretty + _openapi_values[:metrics] = metrics + return _request(client, _OP_deletepolicymodule, _openapi_values; body = ABSENT, content_type, accept, with_http_info, request_headers, request_options, stream_to) +end + +const _OP_getpolicymodule = ( + id = "getPolicyModule", + method = "GET", + path = "/v1/policies/{id}", + parameters = ((arg = :id, name = "id", type = String, location = :path, style = :simple, explode = false, allow_reserved = false, shape = :scalar, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/idParameter/schema"), content = (), required = true),(arg = :pretty, name = "pretty", type = Union{Absent,Bool}, location = :query, style = :form, explode = true, allow_reserved = false, shape = :scalar, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/prettyParameter/schema"), content = (), required = false)), + request = nothing, + responses = ( + (selector = "200", media = ((media_type = "application/json", type = GetPolicyModuleSuccessResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/getPolicyModuleSuccessResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + (selector = "404", media = ((media_type = "application/json", type = ServerErrorResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/notFoundResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + (selector = "500", media = ((media_type = "application/json", type = ServerErrorResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/serverErrorResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + ), + security = (), + servers = ((name = nothing, url = "http://localhost:8181", base = "", variables = ()),), +) + +@doc " getpolicymodule(...)\n\nGet a policy module\n\n`GET /v1/policies/{id}`\n\n- `id`: The name of a policy module\n- `pretty`: If true, response will be in a human-readable format." +function getpolicymodule(id::String; pretty::Union{Absent,Bool} = ABSENT, client::Runtime.Client = DEFAULT_CLIENT, content_type::Union{Nothing,AbstractString} = nothing, accept::Union{Nothing,AbstractString} = nothing, with_http_info::Bool = false, request_headers = Pair{String,String}[], request_options::NamedTuple = NamedTuple(), stream_to::Union{Nothing,Channel} = nothing) + _openapi_values = Dict{Symbol,Any}() + _openapi_values[:id] = id + _openapi_values[:pretty] = pretty + return _request(client, _OP_getpolicymodule, _openapi_values; body = ABSENT, content_type, accept, with_http_info, request_headers, request_options, stream_to) +end + +const _OP_putpolicymodule = ( + id = "putPolicyModule", + method = "PUT", + path = "/v1/policies/{id}", + parameters = ((arg = :id, name = "id", type = String, location = :path, style = :simple, explode = false, allow_reserved = false, shape = :scalar, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/idParameter/schema"), content = (), required = true),(arg = :pretty, name = "pretty", type = Union{Absent,Bool}, location = :query, style = :form, explode = true, allow_reserved = false, shape = :scalar, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/prettyParameter/schema"), content = (), required = false),(arg = :metrics, name = "metrics", type = Union{Absent,Bool}, location = :query, style = :form, explode = true, allow_reserved = false, shape = :scalar, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/metricsParameter/schema"), content = (), required = false)), + request = (required = true, media = ((media_type = "text/plain", type = String, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/paths/~1v1~1policies~1{id}/put/requestBody/content/text~1plain/schema"), encodings = (), fields = ()),)), + responses = ( + (selector = "200", media = ((media_type = "application/json", type = PutPolicySuccessResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/putPolicySuccessResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + (selector = "400", media = ((media_type = "application/json", type = ServerErrorResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/badRequestResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + (selector = "500", media = ((media_type = "application/json", type = ServerErrorResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/serverErrorResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + ), + security = (), + servers = ((name = nothing, url = "http://localhost:8181", base = "", variables = ()),), +) + +@doc " putpolicymodule(...)\n\nCreate or update a policy module\n\n`PUT /v1/policies/{id}`\n\n- `id`: The name of a policy module\n- `pretty`: If true, response will be in a human-readable format.\n- `metrics`: If true, compiler performance metrics will be returned in the response." +function putpolicymodule(id::String, body::String; pretty::Union{Absent,Bool} = ABSENT, metrics::Union{Absent,Bool} = ABSENT, client::Runtime.Client = DEFAULT_CLIENT, content_type::Union{Nothing,AbstractString} = nothing, accept::Union{Nothing,AbstractString} = nothing, with_http_info::Bool = false, request_headers = Pair{String,String}[], request_options::NamedTuple = NamedTuple(), stream_to::Union{Nothing,Channel} = nothing) + _openapi_values = Dict{Symbol,Any}() + _openapi_values[:id] = id + _openapi_values[:pretty] = pretty + _openapi_values[:metrics] = metrics + return _request(client, _OP_putpolicymodule, _openapi_values; body = body, content_type, accept, with_http_info, request_headers, request_options, stream_to) +end + +const _OP_queryget = ( + id = "queryGet", + method = "GET", + path = "/v1/query", + parameters = ((arg = :pretty, name = "pretty", type = Union{Absent,Bool}, location = :query, style = :form, explode = true, allow_reserved = false, shape = :scalar, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/prettyParameter/schema"), content = (), required = false),(arg = :explain, name = "explain", type = Union{Absent,ExplainMode}, location = :query, style = :form, explode = true, allow_reserved = false, shape = :scalar, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/explainParameter/schema"), content = (), required = false),(arg = :metrics, name = "metrics", type = Union{Absent,Bool}, location = :query, style = :form, explode = true, allow_reserved = false, shape = :scalar, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/metricsParameter/schema"), content = (), required = false),(arg = :q, name = "q", type = String, location = :query, style = :form, explode = true, allow_reserved = false, shape = :scalar, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/queryParameterGet/schema"), content = (), required = true)), + request = nothing, + responses = ( + (selector = "200", media = ((media_type = "application/json", type = GetDocumentSuccessResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/getDocumentSuccessResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + (selector = "400", media = ((media_type = "application/json", type = ServerErrorResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/badRequestResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + (selector = "404", media = ((media_type = "application/json", type = ServerErrorResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/notFoundResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + (selector = "500", media = ((media_type = "application/json", type = ServerErrorResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/serverErrorResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + (selector = "501", media = ((media_type = "application/json", type = ServerErrorResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/streamingNotImplementedErrorResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + ), + security = (), + servers = ((name = nothing, url = "http://localhost:8181", base = "", variables = ()),), +) + +@doc " queryget(...)\n\nExecute an ad-hoc query and return bindings for variables found in the query.\n\n`GET /v1/query`\n\n- `pretty`: If true, response will be in a human-readable format.\n- `explain`: If set to *full*, response will include query explanations in addition to the result.\n- `metrics`: If true, compiler performance metrics will be returned in the response.\n- `q`: The ad-hoc query to execute. OPA will parse, compile, and execute the query represented by the parameter value. The value MUST be URL encoded. Only used in GET method. For POST method the query is sent as part of the request body and this parameter is not used." +function queryget(; q::String, pretty::Union{Absent,Bool} = ABSENT, explain::Union{Absent,ExplainMode} = ABSENT, metrics::Union{Absent,Bool} = ABSENT, client::Runtime.Client = DEFAULT_CLIENT, content_type::Union{Nothing,AbstractString} = nothing, accept::Union{Nothing,AbstractString} = nothing, with_http_info::Bool = false, request_headers = Pair{String,String}[], request_options::NamedTuple = NamedTuple(), stream_to::Union{Nothing,Channel} = nothing) + _openapi_values = Dict{Symbol,Any}() + _openapi_values[:pretty] = pretty + _openapi_values[:explain] = explain + _openapi_values[:metrics] = metrics + _openapi_values[:q] = q + return _request(client, _OP_queryget, _openapi_values; body = ABSENT, content_type, accept, with_http_info, request_headers, request_options, stream_to) +end + +const _OP_querypost = ( + id = "queryPost", + method = "POST", + path = "/v1/query", + parameters = ((arg = :pretty, name = "pretty", type = Union{Absent,Bool}, location = :query, style = :form, explode = true, allow_reserved = false, shape = :scalar, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/prettyParameter/schema"), content = (), required = false),(arg = :explain, name = "explain", type = Union{Absent,ExplainMode}, location = :query, style = :form, explode = true, allow_reserved = false, shape = :scalar, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/explainParameter/schema"), content = (), required = false),(arg = :metrics, name = "metrics", type = Union{Absent,Bool}, location = :query, style = :form, explode = true, allow_reserved = false, shape = :scalar, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/metricsParameter/schema"), content = (), required = false)), + request = (required = true, media = ((media_type = "application/json", type = QueryParameterPost, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/paths/~1v1~1query/post/requestBody/content/application~1json/schema"), encodings = (), fields = ()),)), + responses = ( + (selector = "200", media = ((media_type = "application/json", type = GetDocumentSuccessResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/getDocumentSuccessResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + (selector = "400", media = ((media_type = "application/json", type = ServerErrorResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/badRequestResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + (selector = "404", media = ((media_type = "application/json", type = ServerErrorResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/notFoundResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + (selector = "500", media = ((media_type = "application/json", type = ServerErrorResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/serverErrorResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + (selector = "501", media = ((media_type = "application/json", type = ServerErrorResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/streamingNotImplementedErrorResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + ), + security = (), + servers = ((name = nothing, url = "http://localhost:8181", base = "", variables = ()),), +) + +@doc " querypost(...)\n\nExecute an ad-hoc query and return bindings for variables found in the query.\n\n`POST /v1/query`\n\n- `pretty`: If true, response will be in a human-readable format.\n- `explain`: If set to *full*, response will include query explanations in addition to the result.\n- `metrics`: If true, compiler performance metrics will be returned in the response.\n- `body`: The query and input document (in JSON format)" +function querypost(body::QueryParameterPost; pretty::Union{Absent,Bool} = ABSENT, explain::Union{Absent,ExplainMode} = ABSENT, metrics::Union{Absent,Bool} = ABSENT, client::Runtime.Client = DEFAULT_CLIENT, content_type::Union{Nothing,AbstractString} = nothing, accept::Union{Nothing,AbstractString} = nothing, with_http_info::Bool = false, request_headers = Pair{String,String}[], request_options::NamedTuple = NamedTuple(), stream_to::Union{Nothing,Channel} = nothing) + _openapi_values = Dict{Symbol,Any}() + _openapi_values[:pretty] = pretty + _openapi_values[:explain] = explain + _openapi_values[:metrics] = metrics + return _request(client, _OP_querypost, _openapi_values; body = body, content_type, accept, with_http_info, request_headers, request_options, stream_to) +end + +const _OP_getstatus = ( + id = "getStatus", + method = "GET", + path = "/v1/status", + parameters = ((arg = :pretty, name = "pretty", type = Union{Absent,Bool}, location = :query, style = :form, explode = true, allow_reserved = false, shape = :scalar, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/parameters/prettyParameter/schema"), content = (), required = false),), + request = nothing, + responses = ( + (selector = "200", media = ((media_type = "application/json", type = Status, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/getStatusResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + (selector = "500", media = ((media_type = "application/json", type = ServerErrorResponse, schema = (resource = "https://openapi.invalid/schema/root-77324536bc407399a05f.json", pointer = "/components/responses/serverErrorResponse/content/application~1json/schema"), encodings = (), fields = ()),), headers = ()), + ), + security = (), + servers = ((name = nothing, url = "http://localhost:8181", base = "", variables = ()),), +) + +@doc " getstatus(...)\n\nGet status\n\n`GET /v1/status`\n\n- `pretty`: If true, response will be in a human-readable format." +function getstatus(; pretty::Union{Absent,Bool} = ABSENT, client::Runtime.Client = DEFAULT_CLIENT, content_type::Union{Nothing,AbstractString} = nothing, accept::Union{Nothing,AbstractString} = nothing, with_http_info::Bool = false, request_headers = Pair{String,String}[], request_options::NamedTuple = NamedTuple(), stream_to::Union{Nothing,Channel} = nothing) + _openapi_values = Dict{Symbol,Any}() + _openapi_values[:pretty] = pretty + return _request(client, _OP_getstatus, _openapi_values; body = ABSENT, content_type, accept, with_http_info, request_headers, request_options, stream_to) +end + +end # module OPAClient diff --git a/src/client/README.md b/src/client/README.md deleted file mode 100644 index d4382be..0000000 --- a/src/client/README.md +++ /dev/null @@ -1,83 +0,0 @@ -# Julia API client for Client - -OPA provides policy-based control for cloud native environments. -The REST API is a very common way to integrate with OPA. -There are [18 OPA Ecosystem projects](https://www.openpolicyagent.org/ecosystem/rest-api-integration) - many -of which are open source - built on the REST API which might serve as inspiration. You may also want to -review the [integration documentation](https://www.openpolicyagent.org/docs/latest/integration) for other -options to build on OPA by embedding functionality directly into your application. - -## Overview -This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://openapis.org) from a remote server, you can easily generate an API client. - -- API version: 0.57.0 -- Build package: org.openapitools.codegen.languages.JuliaClientCodegen -For more information, please visit [https://github.com/open-policy-agent/opa](https://github.com/open-policy-agent/opa) - - -## Installation -Place the Julia files generated under the `src` folder in your Julia project. Include Client.jl in the project code. -It would include the module named Client. - -Documentation is generated as markdown files under the `docs` folder. You can include them in your project documentation. -Documentation is also embedded in Julia which can be used with a Julia specific documentation generator. - -## API Endpoints - -Class | Method ------------- | ------------- -*CompileApi* | [**post_compile**](docs/CompileApi.md#post_compile)
**POST** /v1/compile
Partially evaluate a query. -*ConfigApi* | [**get_config**](docs/ConfigApi.md#get_config)
**GET** /v1/config
Get configurations -*DataApi* | [**create_document**](docs/DataApi.md#create_document)
**PUT** /v1/data/{path}
Create or overwrite a document. -*DataApi* | [**delete_document**](docs/DataApi.md#delete_document)
**DELETE** /v1/data/{path}
Delete a document -*DataApi* | [**get_document**](docs/DataApi.md#get_document)
**GET** /v1/data/{path}
Get a document -*DataApi* | [**get_document_from_webhook**](docs/DataApi.md#get_document_from_webhook)
**POST** /v0/data/{path}
Get a document from a webhook. -*DataApi* | [**get_document_with_path**](docs/DataApi.md#get_document_with_path)
**POST** /v1/data/{path}
Get a document that required an input -*DataApi* | [**patch_document**](docs/DataApi.md#patch_document)
**PATCH** /v1/data/{path}
Patch a document -*HealthApi* | [**get_health**](docs/HealthApi.md#get_health)
**GET** /health
Health -*PolicyApi* | [**delete_policy_module**](docs/PolicyApi.md#delete_policy_module)
**DELETE** /v1/policies/{id}
Delete a policy module -*PolicyApi* | [**get_policies**](docs/PolicyApi.md#get_policies)
**GET** /v1/policies
List policies -*PolicyApi* | [**get_policy_module**](docs/PolicyApi.md#get_policy_module)
**GET** /v1/policies/{id}
Get a policy module -*PolicyApi* | [**put_policy_module**](docs/PolicyApi.md#put_policy_module)
**PUT** /v1/policies/{id}
Create or update a policy module -*QueryApi* | [**query_get**](docs/QueryApi.md#query_get)
**GET** /v1/query
Execute an ad-hoc query and return bindings for variables found in the query. -*QueryApi* | [**query_post**](docs/QueryApi.md#query_post)
**POST** /v1/query
Execute an ad-hoc query and return bindings for variables found in the query. -*QueryApi* | [**simple_query**](docs/QueryApi.md#simple_query)
**POST** /
Execute a simple query. -*StatusApi* | [**get_status**](docs/StatusApi.md#get_status)
**GET** /v1/status
Get status - - -## Models - - - [CompileSuccessResponse](docs/CompileSuccessResponse.md) - - [CreateDocumentSuccessResponse](docs/CreateDocumentSuccessResponse.md) - - [DeleteDocumentSuccessResponse](docs/DeleteDocumentSuccessResponse.md) - - [ErrorDetail](docs/ErrorDetail.md) - - [ErrorLocation](docs/ErrorLocation.md) - - [GetDocumentSuccessResponse](docs/GetDocumentSuccessResponse.md) - - [GetPolicyListSuccessResponse](docs/GetPolicyListSuccessResponse.md) - - [GetPolicyModuleSuccessResponse](docs/GetPolicyModuleSuccessResponse.md) - - [PartialQuerySchema](docs/PartialQuerySchema.md) - - [PatchOperation](docs/PatchOperation.md) - - [Policy](docs/Policy.md) - - [PolicyAst](docs/PolicyAst.md) - - [PolicyAstPackage](docs/PolicyAstPackage.md) - - [PolicyAstPackagePathInner](docs/PolicyAstPackagePathInner.md) - - [PolicyAstRulesInner](docs/PolicyAstRulesInner.md) - - [PolicyAstRulesInnerBodyInner](docs/PolicyAstRulesInnerBodyInner.md) - - [PolicyAstRulesInnerHead](docs/PolicyAstRulesInnerHead.md) - - [PolicyAstRulesInnerHeadKey](docs/PolicyAstRulesInnerHeadKey.md) - - [Provenance](docs/Provenance.md) - - [PutPolicySuccessResponse](docs/PutPolicySuccessResponse.md) - - [QueryParameterPost](docs/QueryParameterPost.md) - - [ServerErrorResponse](docs/ServerErrorResponse.md) - - [UnhealthyResponse](docs/UnhealthyResponse.md) - - - -## Authorization -Endpoints do not require authorization. - - -## Author - - - diff --git a/src/client/docs/CompileApi.md b/src/client/docs/CompileApi.md deleted file mode 100644 index 55c8e1e..0000000 --- a/src/client/docs/CompileApi.md +++ /dev/null @@ -1,48 +0,0 @@ -# CompileApi - -All URIs are relative to *http://localhost:8181* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**post_compile**](CompileApi.md#post_compile) | **POST** /v1/compile | Partially evaluate a query. - - -# **post_compile** -> post_compile(_api::CompileApi; pretty=nothing, explain=nothing, metrics=nothing, instrument=nothing, partial_query_schema=nothing, _mediaType=nothing) -> CompileSuccessResponse, OpenAPI.Clients.ApiResponse
-> post_compile(_api::CompileApi, response_stream::Channel; pretty=nothing, explain=nothing, metrics=nothing, instrument=nothing, partial_query_schema=nothing, _mediaType=nothing) -> Channel{ CompileSuccessResponse }, OpenAPI.Clients.ApiResponse - -Partially evaluate a query. - -The Compile API allows you to partially evaluate Rego queries and obtain a simplified version of the policy. This is most useful when building integrations where policy logic is to be translated and evaluated in another environment.
For example, [this post](https://blog.openpolicyagent.org/write-policy-in-opa-enforce-policy-in-sql-d9d24db93bf4) on the OPA blog shows how SQL can be generated based on Compile API output. For more details on Partial Evaluation in OPA, please refer to [this blog post](https://blog.openpolicyagent.org/partial-evaluation-162750eaf422).
The example below assumes that OPA has been given the following policy (use `PUT /v1/policies/{path}`):
 package example allow {   input.subject.clearance_level >= data.reports[_].clearance_level } 

Compile API **request body** so that it contain the following fields:
FieldTypeRequiredDescription
querystringYesThe query to partially evaluate and compile.
inputanyNoThe input document to use during partial evaluation (default: undefined).
optionsobject[string, any]NoAdditional options to use during partial evaluation. Only disableInlining option is supported. (default: undefined).
unknownsarray[string]NoThe terms to treat as unknown during partial evaluation (default: [\"input\"]]).

For example:
{ \"query\": \"data.example.allow == true\", \"input\": { \"subject\": { \"clearance_level\": 4 } }, \"unknowns\": [ \"data.reports\" ] }
Unconditional Results from Partial Evaluation When you partially evaluate a query with the Compile API, OPA returns a new set of queries and supporting policies. However, in some cases, the result of Partial Evaluation is a conclusive, unconditional answer.
See [the guidance](https://www.openpolicyagent.org/docs/latest/rest-api/#unconditional-results-from-partial-evaluation) for details. - -### Required Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **_api** | **CompileApi** | API context | - -### Optional Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **pretty** | **Bool**| If true, response will be in a human-readable format. | [default to nothing] - **explain** | **String**| If set to *full*, response will include query explanations in addition to the result. | [default to nothing] - **metrics** | **Bool**| If true, compiler performance metrics will be returned in the response. | [default to nothing] - **instrument** | **Bool**| If true, response will return additional performance metrics in addition to the result and the standard metrics. **Caution:** This can add significant overhead to query evaluation. The recommendation is to only use this parameter if you are debugging a performance problem. | [default to nothing] - **partial_query_schema** | [**PartialQuerySchema**](PartialQuerySchema.md)| The query (in JSON format) | - -### Return type - -[**CompileSuccessResponse**](CompileSuccessResponse.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md) - diff --git a/src/client/docs/CompileSuccessResponse.md b/src/client/docs/CompileSuccessResponse.md deleted file mode 100644 index 272c703..0000000 --- a/src/client/docs/CompileSuccessResponse.md +++ /dev/null @@ -1,14 +0,0 @@ -# CompileSuccessResponse - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**result** | **Any** | | [optional] [default to nothing] -**provenance** | [***Provenance**](Provenance.md) | | [optional] [default to nothing] -**metrics** | **Dict{String, Any}** | | [optional] [default to nothing] - - -[[Back to Model list]](../README.md#models) [[Back to API list]](../README.md#api-endpoints) [[Back to README]](../README.md) - - diff --git a/src/client/docs/ConfigApi.md b/src/client/docs/ConfigApi.md deleted file mode 100644 index 05b8be1..0000000 --- a/src/client/docs/ConfigApi.md +++ /dev/null @@ -1,44 +0,0 @@ -# ConfigApi - -All URIs are relative to *http://localhost:8181* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**get_config**](ConfigApi.md#get_config) | **GET** /v1/config | Get configurations - - -# **get_config** -> get_config(_api::ConfigApi; pretty=nothing, _mediaType=nothing) -> Dict{String, Any}, OpenAPI.Clients.ApiResponse
-> get_config(_api::ConfigApi, response_stream::Channel; pretty=nothing, _mediaType=nothing) -> Channel{ Dict{String, Any} }, OpenAPI.Clients.ApiResponse - -Get configurations - -The /config API endpoint returns OPA's active configuration. When the discovery feature is enabled, this API can be used to fetch the discovered configuration in the last evaluated discovery bundle. The credentials field in the Services configuration and the private_key and key fields in the Keys configuration will be omitted from the API response. - -### Required Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **_api** | **ConfigApi** | API context | - -### Optional Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **pretty** | **Bool**| If true, response will be in a human-readable format. | [default to nothing] - -### Return type - -**Dict{String, Any}** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md) - diff --git a/src/client/docs/CreateDocumentSuccessResponse.md b/src/client/docs/CreateDocumentSuccessResponse.md deleted file mode 100644 index 59e51e9..0000000 --- a/src/client/docs/CreateDocumentSuccessResponse.md +++ /dev/null @@ -1,12 +0,0 @@ -# CreateDocumentSuccessResponse - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**metrics** | **Dict{String, Any}** | | [optional] [default to nothing] - - -[[Back to Model list]](../README.md#models) [[Back to API list]](../README.md#api-endpoints) [[Back to README]](../README.md) - - diff --git a/src/client/docs/DataApi.md b/src/client/docs/DataApi.md deleted file mode 100644 index 268259c..0000000 --- a/src/client/docs/DataApi.md +++ /dev/null @@ -1,239 +0,0 @@ -# DataApi - -All URIs are relative to *http://localhost:8181* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**create_document**](DataApi.md#create_document) | **PUT** /v1/data/{path} | Create or overwrite a document. -[**delete_document**](DataApi.md#delete_document) | **DELETE** /v1/data/{path} | Delete a document -[**get_document**](DataApi.md#get_document) | **GET** /v1/data/{path} | Get a document -[**get_document_from_webhook**](DataApi.md#get_document_from_webhook) | **POST** /v0/data/{path} | Get a document from a webhook. -[**get_document_with_path**](DataApi.md#get_document_with_path) | **POST** /v1/data/{path} | Get a document that required an input -[**patch_document**](DataApi.md#patch_document) | **PATCH** /v1/data/{path} | Patch a document - - -# **create_document** -> create_document(_api::DataApi, path::String, request_body::Dict{String, Any}; metrics=nothing, _mediaType=nothing) -> CreateDocumentSuccessResponse, OpenAPI.Clients.ApiResponse
-> create_document(_api::DataApi, response_stream::Channel, path::String, request_body::Dict{String, Any}; metrics=nothing, _mediaType=nothing) -> Channel{ CreateDocumentSuccessResponse }, OpenAPI.Clients.ApiResponse - -Create or overwrite a document. - -If the path does not refer to an existing document, the server will attempt to create all of the necessary containing documents. This behavior is similar in principle to the Unix command mkdir -p. The server will respect the If-None-Match header if it is set to *. In this case, the server will not overwrite an existing document located at the path. - -### Required Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **_api** | **DataApi** | API context | -**path** | **String**| A backslash (/) delimited path to access values inside object and array documents. If the path points to an array, the server will attempt to convert the array index to an integer. If the path element cannot be converted to an integer, the server will respond with 404. | [default to nothing] -**request_body** | [**Dict{String, Any}**](Any.md)| The document to create or overwrite (in JSON format) | - -### Optional Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **metrics** | **Bool**| If true, compiler performance metrics will be returned in the response. | [default to nothing] - -### Return type - -[**CreateDocumentSuccessResponse**](CreateDocumentSuccessResponse.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md) - -# **delete_document** -> delete_document(_api::DataApi, path::String; metrics=nothing, _mediaType=nothing) -> DeleteDocumentSuccessResponse, OpenAPI.Clients.ApiResponse
-> delete_document(_api::DataApi, response_stream::Channel, path::String; metrics=nothing, _mediaType=nothing) -> Channel{ DeleteDocumentSuccessResponse }, OpenAPI.Clients.ApiResponse - -Delete a document - -The server processes the DELETE method as if the client had sent a PATCH request containing a single remove operation. - -### Required Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **_api** | **DataApi** | API context | -**path** | **String**| A backslash (/) delimited path to access values inside object and array documents. If the path points to an array, the server will attempt to convert the array index to an integer. If the path element cannot be converted to an integer, the server will respond with 404. | [default to nothing] - -### Optional Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **metrics** | **Bool**| If true, compiler performance metrics will be returned in the response. | [default to nothing] - -### Return type - -[**DeleteDocumentSuccessResponse**](DeleteDocumentSuccessResponse.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md) - -# **get_document** -> get_document(_api::DataApi, path::String; input=nothing, pretty=nothing, provenance=nothing, explain=nothing, metrics=nothing, instrument=nothing, strict_builtin_errors=nothing, _mediaType=nothing) -> GetDocumentSuccessResponse, OpenAPI.Clients.ApiResponse
-> get_document(_api::DataApi, response_stream::Channel, path::String; input=nothing, pretty=nothing, provenance=nothing, explain=nothing, metrics=nothing, instrument=nothing, strict_builtin_errors=nothing, _mediaType=nothing) -> Channel{ GetDocumentSuccessResponse }, OpenAPI.Clients.ApiResponse - -Get a document - -This API endpoint returns the document specified by `path`. The path separator is used to access values inside object and array documents. If the path indexes into an array, the server will attempt to convert the array index to an integer. If the path element cannot be converted to an integer, the server will respond with 404. The server will return a *bad request* (400) response if either: - The query requires an input document and you do not provide it - You provide the input document but the query has already defined it. - -### Required Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **_api** | **DataApi** | API context | -**path** | **String**| A backslash (/) delimited path to access values inside object and array documents. If the path points to an array, the server will attempt to convert the array index to an integer. If the path element cannot be converted to an integer, the server will respond with 404. | [default to nothing] - -### Optional Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **input** | [**Dict{String, Any}**](Any.md)| Provide the text for an [input document](https://www.openpolicyagent.org/docs/latest/kubernetes-primer/#input-document) in JSON format | [default to nothing] - **pretty** | **Bool**| If true, response will be in a human-readable format. | [default to nothing] - **provenance** | **Bool**| If true, response will include build and version information in addition to the result. | [default to nothing] - **explain** | **String**| If set to *full*, response will include query explanations in addition to the result. | [default to nothing] - **metrics** | **Bool**| If true, compiler performance metrics will be returned in the response. | [default to nothing] - **instrument** | **Bool**| If true, response will return additional performance metrics in addition to the result and the standard metrics. **Caution:** This can add significant overhead to query evaluation. The recommendation is to only use this parameter if you are debugging a performance problem. | [default to nothing] - **strict_builtin_errors** | **Bool**| Treat built-in function call errors as fatal and return an error immediately. | [default to nothing] - -### Return type - -[**GetDocumentSuccessResponse**](GetDocumentSuccessResponse.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md) - -# **get_document_from_webhook** -> get_document_from_webhook(_api::DataApi, path::String, request_body::Dict{String, Any}; pretty=nothing, _mediaType=nothing) -> GetDocumentSuccessResponse, OpenAPI.Clients.ApiResponse
-> get_document_from_webhook(_api::DataApi, response_stream::Channel, path::String, request_body::Dict{String, Any}; pretty=nothing, _mediaType=nothing) -> Channel{ GetDocumentSuccessResponse }, OpenAPI.Clients.ApiResponse - -Get a document from a webhook. - -Use this API if you are enforcing policy decisions via webhooks that have pre-defined request/response formats. Note, the API path prefix is /v0 instead of /v1. The request message body defines the content of the The input Document. The request message body may be empty. The path separator is used to access values inside object and array documents. - -### Required Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **_api** | **DataApi** | API context | -**path** | **String**| A backslash (/) delimited path to access values inside object and array documents. If the path points to an array, the server will attempt to convert the array index to an integer. If the path element cannot be converted to an integer, the server will respond with 404. | [default to nothing] -**request_body** | [**Dict{String, Any}**](Any.md)| The input document (in JSON format) | - -### Optional Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **pretty** | **Bool**| If true, response will be in a human-readable format. | [default to nothing] - -### Return type - -[**GetDocumentSuccessResponse**](GetDocumentSuccessResponse.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md) - -# **get_document_with_path** -> get_document_with_path(_api::DataApi, path::String, request_body::Dict{String, Any}; pretty=nothing, provenance=nothing, explain=nothing, metrics=nothing, instrument=nothing, strict_builtin_errors=nothing, _mediaType=nothing) -> GetDocumentSuccessResponse, OpenAPI.Clients.ApiResponse
-> get_document_with_path(_api::DataApi, response_stream::Channel, path::String, request_body::Dict{String, Any}; pretty=nothing, provenance=nothing, explain=nothing, metrics=nothing, instrument=nothing, strict_builtin_errors=nothing, _mediaType=nothing) -> Channel{ GetDocumentSuccessResponse }, OpenAPI.Clients.ApiResponse - -Get a document that required an input - -The request body contains an object that specifies a value for the input document. The path separator is used to access values inside object and array documents. If the path indexes into an array, the server will attempt to convert the array index to an integer. If the path element cannot be converted to an integer, the server will respond with 404. The server will return a *bad request* (400) response if either: - The query requires an input document and you do not provide it - You provided an input document but the query has already defined it. - -### Required Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **_api** | **DataApi** | API context | -**path** | **String**| A backslash (/) delimited path to access values inside object and array documents. If the path points to an array, the server will attempt to convert the array index to an integer. If the path element cannot be converted to an integer, the server will respond with 404. | [default to nothing] -**request_body** | [**Dict{String, Any}**](Any.md)| The input document (in JSON format) | - -### Optional Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **pretty** | **Bool**| If true, response will be in a human-readable format. | [default to nothing] - **provenance** | **Bool**| If true, response will include build and version information in addition to the result. | [default to nothing] - **explain** | **String**| If set to *full*, response will include query explanations in addition to the result. | [default to nothing] - **metrics** | **Bool**| If true, compiler performance metrics will be returned in the response. | [default to nothing] - **instrument** | **Bool**| If true, response will return additional performance metrics in addition to the result and the standard metrics. **Caution:** This can add significant overhead to query evaluation. The recommendation is to only use this parameter if you are debugging a performance problem. | [default to nothing] - **strict_builtin_errors** | **Bool**| Treat built-in function call errors as fatal and return an error immediately. | [default to nothing] - -### Return type - -[**GetDocumentSuccessResponse**](GetDocumentSuccessResponse.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md) - -# **patch_document** -> patch_document(_api::DataApi, path::String, patch_operation::Vector{PatchOperation}; _mediaType=nothing) -> Nothing, OpenAPI.Clients.ApiResponse
-> patch_document(_api::DataApi, response_stream::Channel, path::String, patch_operation::Vector{PatchOperation}; _mediaType=nothing) -> Channel{ Nothing }, OpenAPI.Clients.ApiResponse - -Patch a document - -Update a document. The patch operation is specified in the request body. - -### Required Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **_api** | **DataApi** | API context | -**path** | **String**| A backslash (/) delimited path to access values inside object and array documents. If the path points to an array, the server will attempt to convert the array index to an integer. If the path element cannot be converted to an integer, the server will respond with 404. | [default to nothing] -**patch_operation** | [**Vector{PatchOperation}**](PatchOperation.md)| The patch operation in `application/json-patch+json` format | - -### Return type - -Nothing - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json-patch+json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md) - diff --git a/src/client/docs/DeleteDocumentSuccessResponse.md b/src/client/docs/DeleteDocumentSuccessResponse.md deleted file mode 100644 index f221927..0000000 --- a/src/client/docs/DeleteDocumentSuccessResponse.md +++ /dev/null @@ -1,12 +0,0 @@ -# DeleteDocumentSuccessResponse - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**metrics** | **Dict{String, Any}** | | [optional] [default to nothing] - - -[[Back to Model list]](../README.md#models) [[Back to API list]](../README.md#api-endpoints) [[Back to README]](../README.md) - - diff --git a/src/client/docs/ErrorDetail.md b/src/client/docs/ErrorDetail.md deleted file mode 100644 index a0957f4..0000000 --- a/src/client/docs/ErrorDetail.md +++ /dev/null @@ -1,14 +0,0 @@ -# ErrorDetail - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**code** | **String** | The error code name | [default to nothing] -**message** | **String** | A general description of the error | [default to nothing] -**location** | [***ErrorLocation**](ErrorLocation.md) | | [optional] [default to nothing] - - -[[Back to Model list]](../README.md#models) [[Back to API list]](../README.md#api-endpoints) [[Back to README]](../README.md) - - diff --git a/src/client/docs/ErrorLocation.md b/src/client/docs/ErrorLocation.md deleted file mode 100644 index 3bf102e..0000000 --- a/src/client/docs/ErrorLocation.md +++ /dev/null @@ -1,14 +0,0 @@ -# ErrorLocation - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**file** | **String** | The policy module name that generated the error | [optional] [default to nothing] -**row** | **Float64** | The line number in the policy module where the error occurred | [optional] [default to nothing] -**col** | **Float64** | The column in the policy module where the error occurred | [optional] [default to nothing] - - -[[Back to Model list]](../README.md#models) [[Back to API list]](../README.md#api-endpoints) [[Back to README]](../README.md) - - diff --git a/src/client/docs/GetDocumentSuccessResponse.md b/src/client/docs/GetDocumentSuccessResponse.md deleted file mode 100644 index b032608..0000000 --- a/src/client/docs/GetDocumentSuccessResponse.md +++ /dev/null @@ -1,14 +0,0 @@ -# GetDocumentSuccessResponse - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**result** | **Any** | The result of the query. Can be whatever type the query returns - bool, number, string, array, json. | [optional] [default to nothing] -**decision_id** | **String** | | [optional] [default to nothing] -**metrics** | **Dict{String, Any}** | | [optional] [default to nothing] - - -[[Back to Model list]](../README.md#models) [[Back to API list]](../README.md#api-endpoints) [[Back to README]](../README.md) - - diff --git a/src/client/docs/GetPolicyListSuccessResponse.md b/src/client/docs/GetPolicyListSuccessResponse.md deleted file mode 100644 index c1650c9..0000000 --- a/src/client/docs/GetPolicyListSuccessResponse.md +++ /dev/null @@ -1,12 +0,0 @@ -# GetPolicyListSuccessResponse - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**result** | [**Vector{Policy}**](Policy.md) | | [default to nothing] - - -[[Back to Model list]](../README.md#models) [[Back to API list]](../README.md#api-endpoints) [[Back to README]](../README.md) - - diff --git a/src/client/docs/GetPolicyModuleSuccessResponse.md b/src/client/docs/GetPolicyModuleSuccessResponse.md deleted file mode 100644 index b8cb7b9..0000000 --- a/src/client/docs/GetPolicyModuleSuccessResponse.md +++ /dev/null @@ -1,12 +0,0 @@ -# GetPolicyModuleSuccessResponse - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**result** | [***Policy**](Policy.md) | | [default to nothing] - - -[[Back to Model list]](../README.md#models) [[Back to API list]](../README.md#api-endpoints) [[Back to README]](../README.md) - - diff --git a/src/client/docs/HealthApi.md b/src/client/docs/HealthApi.md deleted file mode 100644 index d5bb7d2..0000000 --- a/src/client/docs/HealthApi.md +++ /dev/null @@ -1,46 +0,0 @@ -# HealthApi - -All URIs are relative to *http://localhost:8181* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**get_health**](HealthApi.md#get_health) | **GET** /health | Health - - -# **get_health** -> get_health(_api::HealthApi; bundles=nothing, plugins=nothing, exclude_plugin=nothing, _mediaType=nothing) -> Nothing, OpenAPI.Clients.ApiResponse
-> get_health(_api::HealthApi, response_stream::Channel; bundles=nothing, plugins=nothing, exclude_plugin=nothing, _mediaType=nothing) -> Channel{ Nothing }, OpenAPI.Clients.ApiResponse - -Health - -This API endpoint verifies that the server is operational. The response from the server is either 200 or 500: - **200** - OPA service is healthy. If `bundles` is true, then all configured bundles have been activated. If `plugins` is true, then all plugins are in an 'OK' state. - **500** - OPA service is *not* healthy. If `bundles` is true, at least one of configured bundles has not yet been activated. If `plugins` is true, at least one plugins is in a 'not OK' state. --- **Note** This check is only for initial bundle activation. Subsequent downloads will not affect the health check. Use the **status** endpoint (in the (management API)[management.html]) for more fine-grained bundle status monitoring. --- - -### Required Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **_api** | **HealthApi** | API context | - -### Optional Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **bundles** | **Bool**| Reports on bundle activation status (useful for 'ready' checks at startup). This includes any discovery bundles or bundles defined in the loaded discovery configuration. | [default to nothing] - **plugins** | **Bool**| Reports on plugin status | [default to nothing] - **exclude_plugin** | **String**| String parameter to exclude a plugin from status checks. Can be added multiple times. Does nothing if plugins is not true. This parameter is useful for special use cases where a plugin depends on the server being fully initialized before it can fully initialize itself. Exclude the specified plugin from the response. | [default to nothing] - -### Return type - -Nothing - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md) - diff --git a/src/client/docs/PartialQuerySchema.md b/src/client/docs/PartialQuerySchema.md deleted file mode 100644 index b06e277..0000000 --- a/src/client/docs/PartialQuerySchema.md +++ /dev/null @@ -1,15 +0,0 @@ -# PartialQuerySchema - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**query** | **String** | The query to partially evaluate and compile. | [optional] [default to nothing] -**input** | **Any** | The input document to use during partial evaluation | [optional] [default to nothing] -**options** | **Any** | Additional options to use during partial evaluation. Only disableInlining option is supported. | [optional] [default to nothing] -**unknowns** | **Vector{String}** | The terms to treat as unknown during partial evaluation. | [optional] [default to nothing] - - -[[Back to Model list]](../README.md#models) [[Back to API list]](../README.md#api-endpoints) [[Back to README]](../README.md) - - diff --git a/src/client/docs/PatchOperation.md b/src/client/docs/PatchOperation.md deleted file mode 100644 index 5ba471b..0000000 --- a/src/client/docs/PatchOperation.md +++ /dev/null @@ -1,15 +0,0 @@ -# PatchOperation - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**op** | **String** | | [optional] [default to nothing] -**path** | **String** | | [optional] [default to nothing] -**from** | **String** | | [optional] [default to nothing] -**value** | **Any** | | [optional] [default to nothing] - - -[[Back to Model list]](../README.md#models) [[Back to API list]](../README.md#api-endpoints) [[Back to README]](../README.md) - - diff --git a/src/client/docs/Policy.md b/src/client/docs/Policy.md deleted file mode 100644 index a42bf8b..0000000 --- a/src/client/docs/Policy.md +++ /dev/null @@ -1,14 +0,0 @@ -# Policy - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **String** | The name of a policy module | [optional] [default to nothing] -**raw** | **String** | A string representation of the full Rego policy | [optional] [default to nothing] -**ast** | [***PolicyAst**](PolicyAst.md) | | [optional] [default to nothing] - - -[[Back to Model list]](../README.md#models) [[Back to API list]](../README.md#api-endpoints) [[Back to README]](../README.md) - - diff --git a/src/client/docs/PolicyApi.md b/src/client/docs/PolicyApi.md deleted file mode 100644 index 1ab7557..0000000 --- a/src/client/docs/PolicyApi.md +++ /dev/null @@ -1,158 +0,0 @@ -# PolicyApi - -All URIs are relative to *http://localhost:8181* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**delete_policy_module**](PolicyApi.md#delete_policy_module) | **DELETE** /v1/policies/{id} | Delete a policy module -[**get_policies**](PolicyApi.md#get_policies) | **GET** /v1/policies | List policies -[**get_policy_module**](PolicyApi.md#get_policy_module) | **GET** /v1/policies/{id} | Get a policy module -[**put_policy_module**](PolicyApi.md#put_policy_module) | **PUT** /v1/policies/{id} | Create or update a policy module - - -# **delete_policy_module** -> delete_policy_module(_api::PolicyApi, id::String; pretty=nothing, metrics=nothing, _mediaType=nothing) -> Nothing, OpenAPI.Clients.ApiResponse
-> delete_policy_module(_api::PolicyApi, response_stream::Channel, id::String; pretty=nothing, metrics=nothing, _mediaType=nothing) -> Channel{ Nothing }, OpenAPI.Clients.ApiResponse - -Delete a policy module - -This API endpoint removes an existing policy module from the server - -### Required Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **_api** | **PolicyApi** | API context | -**id** | **String**| The name of a policy module | [default to nothing] - -### Optional Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **pretty** | **Bool**| If true, response will be in a human-readable format. | [default to nothing] - **metrics** | **Bool**| If true, compiler performance metrics will be returned in the response. | [default to nothing] - -### Return type - -Nothing - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md) - -# **get_policies** -> get_policies(_api::PolicyApi; pretty=nothing, _mediaType=nothing) -> GetPolicyListSuccessResponse, OpenAPI.Clients.ApiResponse
-> get_policies(_api::PolicyApi, response_stream::Channel; pretty=nothing, _mediaType=nothing) -> Channel{ GetPolicyListSuccessResponse }, OpenAPI.Clients.ApiResponse - -List policies - -This API endpoint responds with a list of all policy modules on the server (result response) - -### Required Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **_api** | **PolicyApi** | API context | - -### Optional Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **pretty** | **Bool**| If true, response will be in a human-readable format. | [default to nothing] - -### Return type - -[**GetPolicyListSuccessResponse**](GetPolicyListSuccessResponse.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md) - -# **get_policy_module** -> get_policy_module(_api::PolicyApi, id::String; pretty=nothing, _mediaType=nothing) -> GetPolicyModuleSuccessResponse, OpenAPI.Clients.ApiResponse
-> get_policy_module(_api::PolicyApi, response_stream::Channel, id::String; pretty=nothing, _mediaType=nothing) -> Channel{ GetPolicyModuleSuccessResponse }, OpenAPI.Clients.ApiResponse - -Get a policy module - -This API endpoint returns the details of the specified policy module (`{id}`) - -### Required Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **_api** | **PolicyApi** | API context | -**id** | **String**| The name of a policy module | [default to nothing] - -### Optional Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **pretty** | **Bool**| If true, response will be in a human-readable format. | [default to nothing] - -### Return type - -[**GetPolicyModuleSuccessResponse**](GetPolicyModuleSuccessResponse.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md) - -# **put_policy_module** -> put_policy_module(_api::PolicyApi, id::String, body::String; pretty=nothing, metrics=nothing, _mediaType=nothing) -> PutPolicySuccessResponse, OpenAPI.Clients.ApiResponse
-> put_policy_module(_api::PolicyApi, response_stream::Channel, id::String, body::String; pretty=nothing, metrics=nothing, _mediaType=nothing) -> Channel{ PutPolicySuccessResponse }, OpenAPI.Clients.ApiResponse - -Create or update a policy module - -- If the policy module does not exist, it is created. - If the policy module already exists, it is replaced. If the policy module isn't correctly defined, a *bad request* (400) response is returned. ### Example policy module ```yaml package opa.examples import data.servers import data.networks import data.ports public_servers[server] { some k, m server := servers[_] server.ports[_] == ports[k].id ports[k].networks[_] == networks[m].id networks[m].public == true } ``` - -### Required Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **_api** | **PolicyApi** | API context | -**id** | **String**| The name of a policy module | [default to nothing] -**body** | **String**| | - -### Optional Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **pretty** | **Bool**| If true, response will be in a human-readable format. | [default to nothing] - **metrics** | **Bool**| If true, compiler performance metrics will be returned in the response. | [default to nothing] - -### Return type - -[**PutPolicySuccessResponse**](PutPolicySuccessResponse.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: text/plain - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md) - diff --git a/src/client/docs/PolicyAst.md b/src/client/docs/PolicyAst.md deleted file mode 100644 index c6cba78..0000000 --- a/src/client/docs/PolicyAst.md +++ /dev/null @@ -1,13 +0,0 @@ -# PolicyAst - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**package** | [***PolicyAstPackage**](PolicyAstPackage.md) | | [optional] [default to nothing] -**rules** | [**Vector{PolicyAstRulesInner}**](PolicyAstRulesInner.md) | When OPA evaluates a rule, it generates the content of a [virtual documents](https://www.openpolicyagent.org/docs/latest/philosophy/#the-opa-document-model) | [optional] [default to nothing] - - -[[Back to Model list]](../README.md#models) [[Back to API list]](../README.md#api-endpoints) [[Back to README]](../README.md) - - diff --git a/src/client/docs/PolicyAstPackage.md b/src/client/docs/PolicyAstPackage.md deleted file mode 100644 index 88cda5c..0000000 --- a/src/client/docs/PolicyAstPackage.md +++ /dev/null @@ -1,12 +0,0 @@ -# PolicyAstPackage - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**path** | [**Vector{PolicyAstPackagePathInner}**](PolicyAstPackagePathInner.md) | The path to the package | [optional] [default to nothing] - - -[[Back to Model list]](../README.md#models) [[Back to API list]](../README.md#api-endpoints) [[Back to README]](../README.md) - - diff --git a/src/client/docs/PolicyAstPackagePathInner.md b/src/client/docs/PolicyAstPackagePathInner.md deleted file mode 100644 index 33b9ff8..0000000 --- a/src/client/docs/PolicyAstPackagePathInner.md +++ /dev/null @@ -1,13 +0,0 @@ -# PolicyAstPackagePathInner - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**type** | **String** | The type of the path operation | [optional] [default to nothing] -**value** | **String** | The path variable | [optional] [default to nothing] - - -[[Back to Model list]](../README.md#models) [[Back to API list]](../README.md#api-endpoints) [[Back to README]](../README.md) - - diff --git a/src/client/docs/PolicyAstRulesInner.md b/src/client/docs/PolicyAstRulesInner.md deleted file mode 100644 index 561401d..0000000 --- a/src/client/docs/PolicyAstRulesInner.md +++ /dev/null @@ -1,13 +0,0 @@ -# PolicyAstRulesInner - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**head** | [***PolicyAstRulesInnerHead**](PolicyAstRulesInnerHead.md) | | [optional] [default to nothing] -**body** | [**Vector{PolicyAstRulesInnerBodyInner}**](PolicyAstRulesInnerBodyInner.md) | A list of the terms in this rule | [optional] [default to nothing] - - -[[Back to Model list]](../README.md#models) [[Back to API list]](../README.md#api-endpoints) [[Back to README]](../README.md) - - diff --git a/src/client/docs/PolicyAstRulesInnerBodyInner.md b/src/client/docs/PolicyAstRulesInnerBodyInner.md deleted file mode 100644 index d9a3f49..0000000 --- a/src/client/docs/PolicyAstRulesInnerBodyInner.md +++ /dev/null @@ -1,13 +0,0 @@ -# PolicyAstRulesInnerBodyInner - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**index** | **Float64** | The location of this term in the list (starts at 0) | [optional] [default to nothing] -**terms** | **Any** | The type/value pairing for this term | [optional] [default to nothing] - - -[[Back to Model list]](../README.md#models) [[Back to API list]](../README.md#api-endpoints) [[Back to README]](../README.md) - - diff --git a/src/client/docs/PolicyAstRulesInnerHead.md b/src/client/docs/PolicyAstRulesInnerHead.md deleted file mode 100644 index 98fd067..0000000 --- a/src/client/docs/PolicyAstRulesInnerHead.md +++ /dev/null @@ -1,13 +0,0 @@ -# PolicyAstRulesInnerHead - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**name** | **String** | The head of the rule | [optional] [default to nothing] -**key** | [***PolicyAstRulesInnerHeadKey**](PolicyAstRulesInnerHeadKey.md) | | [optional] [default to nothing] - - -[[Back to Model list]](../README.md#models) [[Back to API list]](../README.md#api-endpoints) [[Back to README]](../README.md) - - diff --git a/src/client/docs/PolicyAstRulesInnerHeadKey.md b/src/client/docs/PolicyAstRulesInnerHeadKey.md deleted file mode 100644 index 919834d..0000000 --- a/src/client/docs/PolicyAstRulesInnerHeadKey.md +++ /dev/null @@ -1,13 +0,0 @@ -# PolicyAstRulesInnerHeadKey - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**type** | **String** | The type of the head | [optional] [default to nothing] -**value** | **String** | The value of the head | [optional] [default to nothing] - - -[[Back to Model list]](../README.md#models) [[Back to API list]](../README.md#api-endpoints) [[Back to README]](../README.md) - - diff --git a/src/client/docs/Provenance.md b/src/client/docs/Provenance.md deleted file mode 100644 index 1e60b3f..0000000 --- a/src/client/docs/Provenance.md +++ /dev/null @@ -1,16 +0,0 @@ -# Provenance - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**version** | **String** | The version of this OPA instance | [optional] [default to nothing] -**build_commit** | **String** | The Git commit id of this OPA build. | [optional] [default to nothing] -**build_timestamp** | **String** | When this OPA instance was built (in [ISO8601 format](https://www.w3.org/TR/NOTE-datetime)) | [optional] [default to nothing] -**build_hostname** | **String** | The hostname where this instance was built. | [optional] [default to nothing] -**bundles** | **Dict{String, Any}** | A set of key-value pairs describing each bundle activated on the server. | [optional] [default to nothing] - - -[[Back to Model list]](../README.md#models) [[Back to API list]](../README.md#api-endpoints) [[Back to README]](../README.md) - - diff --git a/src/client/docs/PutPolicySuccessResponse.md b/src/client/docs/PutPolicySuccessResponse.md deleted file mode 100644 index 6214fa8..0000000 --- a/src/client/docs/PutPolicySuccessResponse.md +++ /dev/null @@ -1,12 +0,0 @@ -# PutPolicySuccessResponse - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**metrics** | **Dict{String, Any}** | | [optional] [default to nothing] - - -[[Back to Model list]](../README.md#models) [[Back to API list]](../README.md#api-endpoints) [[Back to README]](../README.md) - - diff --git a/src/client/docs/QueryApi.md b/src/client/docs/QueryApi.md deleted file mode 100644 index eac6da7..0000000 --- a/src/client/docs/QueryApi.md +++ /dev/null @@ -1,123 +0,0 @@ -# QueryApi - -All URIs are relative to *http://localhost:8181* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**query_get**](QueryApi.md#query_get) | **GET** /v1/query | Execute an ad-hoc query and return bindings for variables found in the query. -[**query_post**](QueryApi.md#query_post) | **POST** /v1/query | Execute an ad-hoc query and return bindings for variables found in the query. -[**simple_query**](QueryApi.md#simple_query) | **POST** / | Execute a simple query. - - -# **query_get** -> query_get(_api::QueryApi, q::String; pretty=nothing, explain=nothing, metrics=nothing, _mediaType=nothing) -> GetDocumentSuccessResponse, OpenAPI.Clients.ApiResponse
-> query_get(_api::QueryApi, response_stream::Channel, q::String; pretty=nothing, explain=nothing, metrics=nothing, _mediaType=nothing) -> Channel{ GetDocumentSuccessResponse }, OpenAPI.Clients.ApiResponse - -Execute an ad-hoc query and return bindings for variables found in the query. - -For queries that have large JSON values it is recommended to use the POST method with the query included as the POST body - -### Required Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **_api** | **QueryApi** | API context | -**q** | **String**| The ad-hoc query to execute. OPA will parse, compile, and execute the query represented by the parameter value. The value MUST be URL encoded. Only used in GET method. For POST method the query is sent as part of the request body and this parameter is not used. | [default to nothing] - -### Optional Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **pretty** | **Bool**| If true, response will be in a human-readable format. | [default to nothing] - **explain** | **String**| If set to *full*, response will include query explanations in addition to the result. | [default to nothing] - **metrics** | **Bool**| If true, compiler performance metrics will be returned in the response. | [default to nothing] - -### Return type - -[**GetDocumentSuccessResponse**](GetDocumentSuccessResponse.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md) - -# **query_post** -> query_post(_api::QueryApi, query_parameter_post::QueryParameterPost; pretty=nothing, explain=nothing, metrics=nothing, _mediaType=nothing) -> GetDocumentSuccessResponse, OpenAPI.Clients.ApiResponse
-> query_post(_api::QueryApi, response_stream::Channel, query_parameter_post::QueryParameterPost; pretty=nothing, explain=nothing, metrics=nothing, _mediaType=nothing) -> Channel{ GetDocumentSuccessResponse }, OpenAPI.Clients.ApiResponse - -Execute an ad-hoc query and return bindings for variables found in the query. - -Query included as the POST body. E.g.: ``` { \"query\": \"input.servers[i].ports[_] = \\\"p2\\\"; input.servers[i].name = name\", \"input\": { \"servers\": [ ... ], } } ``` - -### Required Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **_api** | **QueryApi** | API context | -**query_parameter_post** | [**QueryParameterPost**](QueryParameterPost.md)| The query and input document (in JSON format) | - -### Optional Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **pretty** | **Bool**| If true, response will be in a human-readable format. | [default to nothing] - **explain** | **String**| If set to *full*, response will include query explanations in addition to the result. | [default to nothing] - **metrics** | **Bool**| If true, compiler performance metrics will be returned in the response. | [default to nothing] - -### Return type - -[**GetDocumentSuccessResponse**](GetDocumentSuccessResponse.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md) - -# **simple_query** -> simple_query(_api::QueryApi, request_body::Dict{String, Any}; pretty=nothing, _mediaType=nothing) -> Dict{String, Any}, OpenAPI.Clients.ApiResponse
-> simple_query(_api::QueryApi, response_stream::Channel, request_body::Dict{String, Any}; pretty=nothing, _mediaType=nothing) -> Channel{ Dict{String, Any} }, OpenAPI.Clients.ApiResponse - -Execute a simple query. - -OPA serves POST requests without a URL path by querying for the document at path `/data/system/main`. The content of that document defines the response entirely. - -### Required Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **_api** | **QueryApi** | API context | -**request_body** | [**Dict{String, Any}**](Any.md)| The input document (in JSON format) | - -### Optional Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **pretty** | **Bool**| If true, response will be in a human-readable format. | [default to nothing] - -### Return type - -**Dict{String, Any}** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md) - diff --git a/src/client/docs/QueryParameterPost.md b/src/client/docs/QueryParameterPost.md deleted file mode 100644 index b133a71..0000000 --- a/src/client/docs/QueryParameterPost.md +++ /dev/null @@ -1,13 +0,0 @@ -# QueryParameterPost - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**query** | **String** | The ad-hoc query to execute. OPA will parse, compile, and execute the query represented by the parameter value. The value MUST be URL encoded. Only used in GET method. For POST method the query is sent as part of the request body and this parameter is not used. | [optional] [default to nothing] -**input** | **Dict{String, Any}** | The input document (in JSON format) | [optional] [default to nothing] - - -[[Back to Model list]](../README.md#models) [[Back to API list]](../README.md#api-endpoints) [[Back to README]](../README.md) - - diff --git a/src/client/docs/ServerErrorResponse.md b/src/client/docs/ServerErrorResponse.md deleted file mode 100644 index a83eb57..0000000 --- a/src/client/docs/ServerErrorResponse.md +++ /dev/null @@ -1,14 +0,0 @@ -# ServerErrorResponse - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**code** | **String** | The error code name | [default to nothing] -**message** | **String** | A general description of the error | [default to nothing] -**errors** | [**Vector{ErrorDetail}**](ErrorDetail.md) | Errors that may have been generated during the parse, compile, or installation of a policy module | [optional] [default to nothing] - - -[[Back to Model list]](../README.md#models) [[Back to API list]](../README.md#api-endpoints) [[Back to README]](../README.md) - - diff --git a/src/client/docs/StatusApi.md b/src/client/docs/StatusApi.md deleted file mode 100644 index 14bfee0..0000000 --- a/src/client/docs/StatusApi.md +++ /dev/null @@ -1,44 +0,0 @@ -# StatusApi - -All URIs are relative to *http://localhost:8181* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**get_status**](StatusApi.md#get_status) | **GET** /v1/status | Get status - - -# **get_status** -> get_status(_api::StatusApi; pretty=nothing, _mediaType=nothing) -> Dict{String, Any}, OpenAPI.Clients.ApiResponse
-> get_status(_api::StatusApi, response_stream::Channel; pretty=nothing, _mediaType=nothing) -> Channel{ Dict{String, Any} }, OpenAPI.Clients.ApiResponse - -Get status - -The /status API endpoint returns the status of the OPA server. This includes the status of the bundles and plugins. - -### Required Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **_api** | **StatusApi** | API context | - -### Optional Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **pretty** | **Bool**| If true, response will be in a human-readable format. | [default to nothing] - -### Return type - -**Dict{String, Any}** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md) - diff --git a/src/client/docs/UnhealthyResponse.md b/src/client/docs/UnhealthyResponse.md deleted file mode 100644 index 70e1b5f..0000000 --- a/src/client/docs/UnhealthyResponse.md +++ /dev/null @@ -1,12 +0,0 @@ -# UnhealthyResponse - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**error** | **String** | The error message | [default to nothing] - - -[[Back to Model list]](../README.md#models) [[Back to API list]](../README.md#api-endpoints) [[Back to README]](../README.md) - - diff --git a/src/client/src/Client.jl b/src/client/src/Client.jl deleted file mode 100644 index b8bbd36..0000000 --- a/src/client/src/Client.jl +++ /dev/null @@ -1,22 +0,0 @@ -# This file was generated by the Julia OpenAPI Code Generator -# Do not modify this file directly. Modify the OpenAPI specification instead. - -module Client - -using Dates, TimeZones -using OpenAPI -using OpenAPI.Clients - -const API_VERSION = "0.57.0" - -include("modelincludes.jl") - -include("apis/api_CompileApi.jl") -include("apis/api_ConfigApi.jl") -include("apis/api_DataApi.jl") -include("apis/api_HealthApi.jl") -include("apis/api_PolicyApi.jl") -include("apis/api_QueryApi.jl") -include("apis/api_StatusApi.jl") - -end # module Client diff --git a/src/client/src/apis/api_CompileApi.jl b/src/client/src/apis/api_CompileApi.jl deleted file mode 100644 index fdecb26..0000000 --- a/src/client/src/apis/api_CompileApi.jl +++ /dev/null @@ -1,54 +0,0 @@ -# This file was generated by the Julia OpenAPI Code Generator -# Do not modify this file directly. Modify the OpenAPI specification instead. - -struct CompileApi <: OpenAPI.APIClientImpl - client::OpenAPI.Clients.Client -end - -""" -The default API base path for APIs in `CompileApi`. -This can be used to construct the `OpenAPI.Clients.Client` instance. -""" -basepath(::Type{ CompileApi }) = "http://localhost:8181" - -const _returntypes_post_compile_CompileApi = Dict{Regex,Type}( - Regex("^" * replace("200", "x"=>".") * "\$") => CompileSuccessResponse, - Regex("^" * replace("400", "x"=>".") * "\$") => ServerErrorResponse, - Regex("^" * replace("500", "x"=>".") * "\$") => ServerErrorResponse, -) - -function _oacinternal_post_compile(_api::CompileApi; pretty=nothing, explain=nothing, metrics=nothing, instrument=nothing, partial_query_schema=nothing, _mediaType=nothing) - _ctx = OpenAPI.Clients.Ctx(_api.client, "POST", _returntypes_post_compile_CompileApi, "/v1/compile", [], partial_query_schema) - OpenAPI.Clients.set_param(_ctx.query, "pretty", pretty) # type Bool - OpenAPI.Clients.set_param(_ctx.query, "explain", explain) # type String - OpenAPI.Clients.set_param(_ctx.query, "metrics", metrics) # type Bool - OpenAPI.Clients.set_param(_ctx.query, "instrument", instrument) # type Bool - OpenAPI.Clients.set_header_accept(_ctx, ["application/json", ]) - OpenAPI.Clients.set_header_content_type(_ctx, (_mediaType === nothing) ? ["application/json", ] : [_mediaType]) - return _ctx -end - -@doc raw"""Partially evaluate a query. - -The Compile API allows you to partially evaluate Rego queries and obtain a simplified version of the policy. This is most useful when building integrations where policy logic is to be translated and evaluated in another environment.
For example, [this post](https://blog.openpolicyagent.org/write-policy-in-opa-enforce-policy-in-sql-d9d24db93bf4) on the OPA blog shows how SQL can be generated based on Compile API output. For more details on Partial Evaluation in OPA, please refer to [this blog post](https://blog.openpolicyagent.org/partial-evaluation-162750eaf422).
The example below assumes that OPA has been given the following policy (use `PUT /v1/policies/{path}`):
 package example allow {   input.subject.clearance_level >= data.reports[_].clearance_level } 

Compile API **request body** so that it contain the following fields:
FieldTypeRequiredDescription
querystringYesThe query to partially evaluate and compile.
inputanyNoThe input document to use during partial evaluation (default: undefined).
optionsobject[string, any]NoAdditional options to use during partial evaluation. Only disableInlining option is supported. (default: undefined).
unknownsarray[string]NoThe terms to treat as unknown during partial evaluation (default: [\"input\"]]).

For example:
{ \"query\": \"data.example.allow == true\", \"input\": { \"subject\": { \"clearance_level\": 4 } }, \"unknowns\": [ \"data.reports\" ] }
Unconditional Results from Partial Evaluation When you partially evaluate a query with the Compile API, OPA returns a new set of queries and supporting policies. However, in some cases, the result of Partial Evaluation is a conclusive, unconditional answer.
See [the guidance](https://www.openpolicyagent.org/docs/latest/rest-api/#unconditional-results-from-partial-evaluation) for details. - -Params: -- pretty::Bool -- explain::String -- metrics::Bool -- instrument::Bool -- partial_query_schema::PartialQuerySchema - -Return: CompileSuccessResponse, OpenAPI.Clients.ApiResponse -""" -function post_compile(_api::CompileApi; pretty=nothing, explain=nothing, metrics=nothing, instrument=nothing, partial_query_schema=nothing, _mediaType=nothing) - _ctx = _oacinternal_post_compile(_api; pretty=pretty, explain=explain, metrics=metrics, instrument=instrument, partial_query_schema=partial_query_schema, _mediaType=_mediaType) - return OpenAPI.Clients.exec(_ctx) -end - -function post_compile(_api::CompileApi, response_stream::Channel; pretty=nothing, explain=nothing, metrics=nothing, instrument=nothing, partial_query_schema=nothing, _mediaType=nothing) - _ctx = _oacinternal_post_compile(_api; pretty=pretty, explain=explain, metrics=metrics, instrument=instrument, partial_query_schema=partial_query_schema, _mediaType=_mediaType) - return OpenAPI.Clients.exec(_ctx, response_stream) -end - -export post_compile diff --git a/src/client/src/apis/api_ConfigApi.jl b/src/client/src/apis/api_ConfigApi.jl deleted file mode 100644 index 2364a56..0000000 --- a/src/client/src/apis/api_ConfigApi.jl +++ /dev/null @@ -1,46 +0,0 @@ -# This file was generated by the Julia OpenAPI Code Generator -# Do not modify this file directly. Modify the OpenAPI specification instead. - -struct ConfigApi <: OpenAPI.APIClientImpl - client::OpenAPI.Clients.Client -end - -""" -The default API base path for APIs in `ConfigApi`. -This can be used to construct the `OpenAPI.Clients.Client` instance. -""" -basepath(::Type{ ConfigApi }) = "http://localhost:8181" - -const _returntypes_get_config_ConfigApi = Dict{Regex,Type}( - Regex("^" * replace("200", "x"=>".") * "\$") => Dict{String, Any}, - Regex("^" * replace("500", "x"=>".") * "\$") => ServerErrorResponse, -) - -function _oacinternal_get_config(_api::ConfigApi; pretty=nothing, _mediaType=nothing) - _ctx = OpenAPI.Clients.Ctx(_api.client, "GET", _returntypes_get_config_ConfigApi, "/v1/config", []) - OpenAPI.Clients.set_param(_ctx.query, "pretty", pretty) # type Bool - OpenAPI.Clients.set_header_accept(_ctx, ["application/json", ]) - OpenAPI.Clients.set_header_content_type(_ctx, (_mediaType === nothing) ? [] : [_mediaType]) - return _ctx -end - -@doc raw"""Get configurations - -The /config API endpoint returns OPA's active configuration. When the discovery feature is enabled, this API can be used to fetch the discovered configuration in the last evaluated discovery bundle. The credentials field in the Services configuration and the private_key and key fields in the Keys configuration will be omitted from the API response. - -Params: -- pretty::Bool - -Return: Dict{String, Any}, OpenAPI.Clients.ApiResponse -""" -function get_config(_api::ConfigApi; pretty=nothing, _mediaType=nothing) - _ctx = _oacinternal_get_config(_api; pretty=pretty, _mediaType=_mediaType) - return OpenAPI.Clients.exec(_ctx) -end - -function get_config(_api::ConfigApi, response_stream::Channel; pretty=nothing, _mediaType=nothing) - _ctx = _oacinternal_get_config(_api; pretty=pretty, _mediaType=_mediaType) - return OpenAPI.Clients.exec(_ctx, response_stream) -end - -export get_config diff --git a/src/client/src/apis/api_DataApi.jl b/src/client/src/apis/api_DataApi.jl deleted file mode 100644 index 410e474..0000000 --- a/src/client/src/apis/api_DataApi.jl +++ /dev/null @@ -1,261 +0,0 @@ -# This file was generated by the Julia OpenAPI Code Generator -# Do not modify this file directly. Modify the OpenAPI specification instead. - -struct DataApi <: OpenAPI.APIClientImpl - client::OpenAPI.Clients.Client -end - -""" -The default API base path for APIs in `DataApi`. -This can be used to construct the `OpenAPI.Clients.Client` instance. -""" -basepath(::Type{ DataApi }) = "http://localhost:8181" - -const _returntypes_create_document_DataApi = Dict{Regex,Type}( - Regex("^" * replace("200", "x"=>".") * "\$") => CreateDocumentSuccessResponse, - Regex("^" * replace("204", "x"=>".") * "\$") => Nothing, - Regex("^" * replace("304", "x"=>".") * "\$") => Nothing, - Regex("^" * replace("400", "x"=>".") * "\$") => ServerErrorResponse, - Regex("^" * replace("404", "x"=>".") * "\$") => ServerErrorResponse, - Regex("^" * replace("500", "x"=>".") * "\$") => ServerErrorResponse, -) - -function _oacinternal_create_document(_api::DataApi, path::String, request_body::Dict{String, Any}; metrics=nothing, _mediaType=nothing) - _ctx = OpenAPI.Clients.Ctx(_api.client, "PUT", _returntypes_create_document_DataApi, "/v1/data/{path}", [], request_body) - OpenAPI.Clients.set_param(_ctx.path, "path", path) # type String - OpenAPI.Clients.set_param(_ctx.query, "metrics", metrics) # type Bool - OpenAPI.Clients.set_header_accept(_ctx, ["application/json", ]) - OpenAPI.Clients.set_header_content_type(_ctx, (_mediaType === nothing) ? ["application/json", ] : [_mediaType]) - return _ctx -end - -@doc raw"""Create or overwrite a document. - -If the path does not refer to an existing document, the server will attempt to create all of the necessary containing documents. This behavior is similar in principle to the Unix command mkdir -p. The server will respect the If-None-Match header if it is set to *. In this case, the server will not overwrite an existing document located at the path. - -Params: -- path::String (required) -- request_body::Dict{String, Any} (required) -- metrics::Bool - -Return: CreateDocumentSuccessResponse, OpenAPI.Clients.ApiResponse -""" -function create_document(_api::DataApi, path::String, request_body::Dict{String, Any}; metrics=nothing, _mediaType=nothing) - _ctx = _oacinternal_create_document(_api, path, request_body; metrics=metrics, _mediaType=_mediaType) - return OpenAPI.Clients.exec(_ctx) -end - -function create_document(_api::DataApi, response_stream::Channel, path::String, request_body::Dict{String, Any}; metrics=nothing, _mediaType=nothing) - _ctx = _oacinternal_create_document(_api, path, request_body; metrics=metrics, _mediaType=_mediaType) - return OpenAPI.Clients.exec(_ctx, response_stream) -end - -const _returntypes_delete_document_DataApi = Dict{Regex,Type}( - Regex("^" * replace("200", "x"=>".") * "\$") => DeleteDocumentSuccessResponse, - Regex("^" * replace("204", "x"=>".") * "\$") => Nothing, - Regex("^" * replace("304", "x"=>".") * "\$") => Nothing, - Regex("^" * replace("400", "x"=>".") * "\$") => ServerErrorResponse, - Regex("^" * replace("404", "x"=>".") * "\$") => ServerErrorResponse, - Regex("^" * replace("500", "x"=>".") * "\$") => ServerErrorResponse, -) - -function _oacinternal_delete_document(_api::DataApi, path::String; metrics=nothing, _mediaType=nothing) - _ctx = OpenAPI.Clients.Ctx(_api.client, "DELETE", _returntypes_delete_document_DataApi, "/v1/data/{path}", []) - OpenAPI.Clients.set_param(_ctx.path, "path", path) # type String - OpenAPI.Clients.set_param(_ctx.query, "metrics", metrics) # type Bool - OpenAPI.Clients.set_header_accept(_ctx, ["application/json", ]) - OpenAPI.Clients.set_header_content_type(_ctx, (_mediaType === nothing) ? [] : [_mediaType]) - return _ctx -end - -@doc raw"""Delete a document - -The server processes the DELETE method as if the client had sent a PATCH request containing a single remove operation. - -Params: -- path::String (required) -- metrics::Bool - -Return: DeleteDocumentSuccessResponse, OpenAPI.Clients.ApiResponse -""" -function delete_document(_api::DataApi, path::String; metrics=nothing, _mediaType=nothing) - _ctx = _oacinternal_delete_document(_api, path; metrics=metrics, _mediaType=_mediaType) - return OpenAPI.Clients.exec(_ctx) -end - -function delete_document(_api::DataApi, response_stream::Channel, path::String; metrics=nothing, _mediaType=nothing) - _ctx = _oacinternal_delete_document(_api, path; metrics=metrics, _mediaType=_mediaType) - return OpenAPI.Clients.exec(_ctx, response_stream) -end - -const _returntypes_get_document_DataApi = Dict{Regex,Type}( - Regex("^" * replace("200", "x"=>".") * "\$") => GetDocumentSuccessResponse, - Regex("^" * replace("400", "x"=>".") * "\$") => ServerErrorResponse, - Regex("^" * replace("500", "x"=>".") * "\$") => ServerErrorResponse, -) - -function _oacinternal_get_document(_api::DataApi, path::String; input=nothing, pretty=nothing, provenance=nothing, explain=nothing, metrics=nothing, instrument=nothing, strict_builtin_errors=nothing, _mediaType=nothing) - _ctx = OpenAPI.Clients.Ctx(_api.client, "GET", _returntypes_get_document_DataApi, "/v1/data/{path}", []) - OpenAPI.Clients.set_param(_ctx.path, "path", path) # type String - OpenAPI.Clients.set_param(_ctx.query, "input", input) # type Dict{String, Any} - OpenAPI.Clients.set_param(_ctx.query, "pretty", pretty) # type Bool - OpenAPI.Clients.set_param(_ctx.query, "provenance", provenance) # type Bool - OpenAPI.Clients.set_param(_ctx.query, "explain", explain) # type String - OpenAPI.Clients.set_param(_ctx.query, "metrics", metrics) # type Bool - OpenAPI.Clients.set_param(_ctx.query, "instrument", instrument) # type Bool - OpenAPI.Clients.set_param(_ctx.query, "strict-builtin-errors", strict_builtin_errors) # type Bool - OpenAPI.Clients.set_header_accept(_ctx, ["application/json", ]) - OpenAPI.Clients.set_header_content_type(_ctx, (_mediaType === nothing) ? [] : [_mediaType]) - return _ctx -end - -@doc raw"""Get a document - -This API endpoint returns the document specified by `path`. The path separator is used to access values inside object and array documents. If the path indexes into an array, the server will attempt to convert the array index to an integer. If the path element cannot be converted to an integer, the server will respond with 404. The server will return a *bad request* (400) response if either: - The query requires an input document and you do not provide it - You provide the input document but the query has already defined it. - -Params: -- path::String (required) -- input::Dict{String, Any} -- pretty::Bool -- provenance::Bool -- explain::String -- metrics::Bool -- instrument::Bool -- strict_builtin_errors::Bool - -Return: GetDocumentSuccessResponse, OpenAPI.Clients.ApiResponse -""" -function get_document(_api::DataApi, path::String; input=nothing, pretty=nothing, provenance=nothing, explain=nothing, metrics=nothing, instrument=nothing, strict_builtin_errors=nothing, _mediaType=nothing) - _ctx = _oacinternal_get_document(_api, path; input=input, pretty=pretty, provenance=provenance, explain=explain, metrics=metrics, instrument=instrument, strict_builtin_errors=strict_builtin_errors, _mediaType=_mediaType) - return OpenAPI.Clients.exec(_ctx) -end - -function get_document(_api::DataApi, response_stream::Channel, path::String; input=nothing, pretty=nothing, provenance=nothing, explain=nothing, metrics=nothing, instrument=nothing, strict_builtin_errors=nothing, _mediaType=nothing) - _ctx = _oacinternal_get_document(_api, path; input=input, pretty=pretty, provenance=provenance, explain=explain, metrics=metrics, instrument=instrument, strict_builtin_errors=strict_builtin_errors, _mediaType=_mediaType) - return OpenAPI.Clients.exec(_ctx, response_stream) -end - -const _returntypes_get_document_from_webhook_DataApi = Dict{Regex,Type}( - Regex("^" * replace("200", "x"=>".") * "\$") => GetDocumentSuccessResponse, - Regex("^" * replace("400", "x"=>".") * "\$") => ServerErrorResponse, - Regex("^" * replace("500", "x"=>".") * "\$") => ServerErrorResponse, -) - -function _oacinternal_get_document_from_webhook(_api::DataApi, path::String, request_body::Dict{String, Any}; pretty=nothing, _mediaType=nothing) - _ctx = OpenAPI.Clients.Ctx(_api.client, "POST", _returntypes_get_document_from_webhook_DataApi, "/v0/data/{path}", [], request_body) - OpenAPI.Clients.set_param(_ctx.path, "path", path) # type String - OpenAPI.Clients.set_param(_ctx.query, "pretty", pretty) # type Bool - OpenAPI.Clients.set_header_accept(_ctx, ["application/json", ]) - OpenAPI.Clients.set_header_content_type(_ctx, (_mediaType === nothing) ? ["application/json", ] : [_mediaType]) - return _ctx -end - -@doc raw"""Get a document from a webhook. - -Use this API if you are enforcing policy decisions via webhooks that have pre-defined request/response formats. Note, the API path prefix is /v0 instead of /v1. The request message body defines the content of the The input Document. The request message body may be empty. The path separator is used to access values inside object and array documents. - -Params: -- path::String (required) -- request_body::Dict{String, Any} (required) -- pretty::Bool - -Return: GetDocumentSuccessResponse, OpenAPI.Clients.ApiResponse -""" -function get_document_from_webhook(_api::DataApi, path::String, request_body::Dict{String, Any}; pretty=nothing, _mediaType=nothing) - _ctx = _oacinternal_get_document_from_webhook(_api, path, request_body; pretty=pretty, _mediaType=_mediaType) - return OpenAPI.Clients.exec(_ctx) -end - -function get_document_from_webhook(_api::DataApi, response_stream::Channel, path::String, request_body::Dict{String, Any}; pretty=nothing, _mediaType=nothing) - _ctx = _oacinternal_get_document_from_webhook(_api, path, request_body; pretty=pretty, _mediaType=_mediaType) - return OpenAPI.Clients.exec(_ctx, response_stream) -end - -const _returntypes_get_document_with_path_DataApi = Dict{Regex,Type}( - Regex("^" * replace("200", "x"=>".") * "\$") => GetDocumentSuccessResponse, - Regex("^" * replace("400", "x"=>".") * "\$") => ServerErrorResponse, - Regex("^" * replace("500", "x"=>".") * "\$") => ServerErrorResponse, -) - -function _oacinternal_get_document_with_path(_api::DataApi, path::String, request_body::Dict{String, Any}; pretty=nothing, provenance=nothing, explain=nothing, metrics=nothing, instrument=nothing, strict_builtin_errors=nothing, _mediaType=nothing) - _ctx = OpenAPI.Clients.Ctx(_api.client, "POST", _returntypes_get_document_with_path_DataApi, "/v1/data/{path}", [], request_body) - OpenAPI.Clients.set_param(_ctx.path, "path", path) # type String - OpenAPI.Clients.set_param(_ctx.query, "pretty", pretty) # type Bool - OpenAPI.Clients.set_param(_ctx.query, "provenance", provenance) # type Bool - OpenAPI.Clients.set_param(_ctx.query, "explain", explain) # type String - OpenAPI.Clients.set_param(_ctx.query, "metrics", metrics) # type Bool - OpenAPI.Clients.set_param(_ctx.query, "instrument", instrument) # type Bool - OpenAPI.Clients.set_param(_ctx.query, "strict-builtin-errors", strict_builtin_errors) # type Bool - OpenAPI.Clients.set_header_accept(_ctx, ["application/json", ]) - OpenAPI.Clients.set_header_content_type(_ctx, (_mediaType === nothing) ? ["application/json", ] : [_mediaType]) - return _ctx -end - -@doc raw"""Get a document that required an input - -The request body contains an object that specifies a value for the input document. The path separator is used to access values inside object and array documents. If the path indexes into an array, the server will attempt to convert the array index to an integer. If the path element cannot be converted to an integer, the server will respond with 404. The server will return a *bad request* (400) response if either: - The query requires an input document and you do not provide it - You provided an input document but the query has already defined it. - -Params: -- path::String (required) -- request_body::Dict{String, Any} (required) -- pretty::Bool -- provenance::Bool -- explain::String -- metrics::Bool -- instrument::Bool -- strict_builtin_errors::Bool - -Return: GetDocumentSuccessResponse, OpenAPI.Clients.ApiResponse -""" -function get_document_with_path(_api::DataApi, path::String, request_body::Dict{String, Any}; pretty=nothing, provenance=nothing, explain=nothing, metrics=nothing, instrument=nothing, strict_builtin_errors=nothing, _mediaType=nothing) - _ctx = _oacinternal_get_document_with_path(_api, path, request_body; pretty=pretty, provenance=provenance, explain=explain, metrics=metrics, instrument=instrument, strict_builtin_errors=strict_builtin_errors, _mediaType=_mediaType) - return OpenAPI.Clients.exec(_ctx) -end - -function get_document_with_path(_api::DataApi, response_stream::Channel, path::String, request_body::Dict{String, Any}; pretty=nothing, provenance=nothing, explain=nothing, metrics=nothing, instrument=nothing, strict_builtin_errors=nothing, _mediaType=nothing) - _ctx = _oacinternal_get_document_with_path(_api, path, request_body; pretty=pretty, provenance=provenance, explain=explain, metrics=metrics, instrument=instrument, strict_builtin_errors=strict_builtin_errors, _mediaType=_mediaType) - return OpenAPI.Clients.exec(_ctx, response_stream) -end - -const _returntypes_patch_document_DataApi = Dict{Regex,Type}( - Regex("^" * replace("204", "x"=>".") * "\$") => Nothing, - Regex("^" * replace("304", "x"=>".") * "\$") => Nothing, - Regex("^" * replace("400", "x"=>".") * "\$") => ServerErrorResponse, - Regex("^" * replace("404", "x"=>".") * "\$") => ServerErrorResponse, - Regex("^" * replace("500", "x"=>".") * "\$") => ServerErrorResponse, -) - -function _oacinternal_patch_document(_api::DataApi, path::String, patch_operation::Vector{PatchOperation}; _mediaType=nothing) - _ctx = OpenAPI.Clients.Ctx(_api.client, "PATCH", _returntypes_patch_document_DataApi, "/v1/data/{path}", [], patch_operation) - OpenAPI.Clients.set_param(_ctx.path, "path", path) # type String - OpenAPI.Clients.set_header_accept(_ctx, ["application/json", ]) - OpenAPI.Clients.set_header_content_type(_ctx, (_mediaType === nothing) ? ["application/json-patch+json", ] : [_mediaType]) - return _ctx -end - -@doc raw"""Patch a document - -Update a document. The patch operation is specified in the request body. - -Params: -- path::String (required) -- patch_operation::Vector{PatchOperation} (required) - -Return: Nothing, OpenAPI.Clients.ApiResponse -""" -function patch_document(_api::DataApi, path::String, patch_operation::Vector{PatchOperation}; _mediaType=nothing) - _ctx = _oacinternal_patch_document(_api, path, patch_operation; _mediaType=_mediaType) - return OpenAPI.Clients.exec(_ctx) -end - -function patch_document(_api::DataApi, response_stream::Channel, path::String, patch_operation::Vector{PatchOperation}; _mediaType=nothing) - _ctx = _oacinternal_patch_document(_api, path, patch_operation; _mediaType=_mediaType) - return OpenAPI.Clients.exec(_ctx, response_stream) -end - -export create_document -export delete_document -export get_document -export get_document_from_webhook -export get_document_with_path -export patch_document diff --git a/src/client/src/apis/api_HealthApi.jl b/src/client/src/apis/api_HealthApi.jl deleted file mode 100644 index 5d7a0aa..0000000 --- a/src/client/src/apis/api_HealthApi.jl +++ /dev/null @@ -1,50 +0,0 @@ -# This file was generated by the Julia OpenAPI Code Generator -# Do not modify this file directly. Modify the OpenAPI specification instead. - -struct HealthApi <: OpenAPI.APIClientImpl - client::OpenAPI.Clients.Client -end - -""" -The default API base path for APIs in `HealthApi`. -This can be used to construct the `OpenAPI.Clients.Client` instance. -""" -basepath(::Type{ HealthApi }) = "http://localhost:8181" - -const _returntypes_get_health_HealthApi = Dict{Regex,Type}( - Regex("^" * replace("200", "x"=>".") * "\$") => Nothing, - Regex("^" * replace("500", "x"=>".") * "\$") => UnhealthyResponse, -) - -function _oacinternal_get_health(_api::HealthApi; bundles=nothing, plugins=nothing, exclude_plugin=nothing, _mediaType=nothing) - _ctx = OpenAPI.Clients.Ctx(_api.client, "GET", _returntypes_get_health_HealthApi, "/health", []) - OpenAPI.Clients.set_param(_ctx.query, "bundles", bundles) # type Bool - OpenAPI.Clients.set_param(_ctx.query, "plugins", plugins) # type Bool - OpenAPI.Clients.set_param(_ctx.query, "exclude-plugin", exclude_plugin) # type String - OpenAPI.Clients.set_header_accept(_ctx, ["application/json", ]) - OpenAPI.Clients.set_header_content_type(_ctx, (_mediaType === nothing) ? [] : [_mediaType]) - return _ctx -end - -@doc raw"""Health - -This API endpoint verifies that the server is operational. The response from the server is either 200 or 500: - **200** - OPA service is healthy. If `bundles` is true, then all configured bundles have been activated. If `plugins` is true, then all plugins are in an 'OK' state. - **500** - OPA service is *not* healthy. If `bundles` is true, at least one of configured bundles has not yet been activated. If `plugins` is true, at least one plugins is in a 'not OK' state. --- **Note** This check is only for initial bundle activation. Subsequent downloads will not affect the health check. Use the **status** endpoint (in the (management API)[management.html]) for more fine-grained bundle status monitoring. --- - -Params: -- bundles::Bool -- plugins::Bool -- exclude_plugin::String - -Return: Nothing, OpenAPI.Clients.ApiResponse -""" -function get_health(_api::HealthApi; bundles=nothing, plugins=nothing, exclude_plugin=nothing, _mediaType=nothing) - _ctx = _oacinternal_get_health(_api; bundles=bundles, plugins=plugins, exclude_plugin=exclude_plugin, _mediaType=_mediaType) - return OpenAPI.Clients.exec(_ctx) -end - -function get_health(_api::HealthApi, response_stream::Channel; bundles=nothing, plugins=nothing, exclude_plugin=nothing, _mediaType=nothing) - _ctx = _oacinternal_get_health(_api; bundles=bundles, plugins=plugins, exclude_plugin=exclude_plugin, _mediaType=_mediaType) - return OpenAPI.Clients.exec(_ctx, response_stream) -end - -export get_health diff --git a/src/client/src/apis/api_PolicyApi.jl b/src/client/src/apis/api_PolicyApi.jl deleted file mode 100644 index e746fdb..0000000 --- a/src/client/src/apis/api_PolicyApi.jl +++ /dev/null @@ -1,160 +0,0 @@ -# This file was generated by the Julia OpenAPI Code Generator -# Do not modify this file directly. Modify the OpenAPI specification instead. - -struct PolicyApi <: OpenAPI.APIClientImpl - client::OpenAPI.Clients.Client -end - -""" -The default API base path for APIs in `PolicyApi`. -This can be used to construct the `OpenAPI.Clients.Client` instance. -""" -basepath(::Type{ PolicyApi }) = "http://localhost:8181" - -const _returntypes_delete_policy_module_PolicyApi = Dict{Regex,Type}( - Regex("^" * replace("200", "x"=>".") * "\$") => Nothing, - Regex("^" * replace("400", "x"=>".") * "\$") => ServerErrorResponse, - Regex("^" * replace("404", "x"=>".") * "\$") => ServerErrorResponse, - Regex("^" * replace("500", "x"=>".") * "\$") => ServerErrorResponse, -) - -function _oacinternal_delete_policy_module(_api::PolicyApi, id::String; pretty=nothing, metrics=nothing, _mediaType=nothing) - _ctx = OpenAPI.Clients.Ctx(_api.client, "DELETE", _returntypes_delete_policy_module_PolicyApi, "/v1/policies/{id}", []) - OpenAPI.Clients.set_param(_ctx.path, "id", id) # type String - OpenAPI.Clients.set_param(_ctx.query, "pretty", pretty) # type Bool - OpenAPI.Clients.set_param(_ctx.query, "metrics", metrics) # type Bool - OpenAPI.Clients.set_header_accept(_ctx, ["application/json", ]) - OpenAPI.Clients.set_header_content_type(_ctx, (_mediaType === nothing) ? [] : [_mediaType]) - return _ctx -end - -@doc raw"""Delete a policy module - -This API endpoint removes an existing policy module from the server - -Params: -- id::String (required) -- pretty::Bool -- metrics::Bool - -Return: Nothing, OpenAPI.Clients.ApiResponse -""" -function delete_policy_module(_api::PolicyApi, id::String; pretty=nothing, metrics=nothing, _mediaType=nothing) - _ctx = _oacinternal_delete_policy_module(_api, id; pretty=pretty, metrics=metrics, _mediaType=_mediaType) - return OpenAPI.Clients.exec(_ctx) -end - -function delete_policy_module(_api::PolicyApi, response_stream::Channel, id::String; pretty=nothing, metrics=nothing, _mediaType=nothing) - _ctx = _oacinternal_delete_policy_module(_api, id; pretty=pretty, metrics=metrics, _mediaType=_mediaType) - return OpenAPI.Clients.exec(_ctx, response_stream) -end - -const _returntypes_get_policies_PolicyApi = Dict{Regex,Type}( - Regex("^" * replace("200", "x"=>".") * "\$") => GetPolicyListSuccessResponse, - Regex("^" * replace("500", "x"=>".") * "\$") => ServerErrorResponse, -) - -function _oacinternal_get_policies(_api::PolicyApi; pretty=nothing, _mediaType=nothing) - _ctx = OpenAPI.Clients.Ctx(_api.client, "GET", _returntypes_get_policies_PolicyApi, "/v1/policies", []) - OpenAPI.Clients.set_param(_ctx.query, "pretty", pretty) # type Bool - OpenAPI.Clients.set_header_accept(_ctx, ["application/json", ]) - OpenAPI.Clients.set_header_content_type(_ctx, (_mediaType === nothing) ? [] : [_mediaType]) - return _ctx -end - -@doc raw"""List policies - -This API endpoint responds with a list of all policy modules on the server (result response) - -Params: -- pretty::Bool - -Return: GetPolicyListSuccessResponse, OpenAPI.Clients.ApiResponse -""" -function get_policies(_api::PolicyApi; pretty=nothing, _mediaType=nothing) - _ctx = _oacinternal_get_policies(_api; pretty=pretty, _mediaType=_mediaType) - return OpenAPI.Clients.exec(_ctx) -end - -function get_policies(_api::PolicyApi, response_stream::Channel; pretty=nothing, _mediaType=nothing) - _ctx = _oacinternal_get_policies(_api; pretty=pretty, _mediaType=_mediaType) - return OpenAPI.Clients.exec(_ctx, response_stream) -end - -const _returntypes_get_policy_module_PolicyApi = Dict{Regex,Type}( - Regex("^" * replace("200", "x"=>".") * "\$") => GetPolicyModuleSuccessResponse, - Regex("^" * replace("404", "x"=>".") * "\$") => ServerErrorResponse, - Regex("^" * replace("500", "x"=>".") * "\$") => ServerErrorResponse, -) - -function _oacinternal_get_policy_module(_api::PolicyApi, id::String; pretty=nothing, _mediaType=nothing) - _ctx = OpenAPI.Clients.Ctx(_api.client, "GET", _returntypes_get_policy_module_PolicyApi, "/v1/policies/{id}", []) - OpenAPI.Clients.set_param(_ctx.path, "id", id) # type String - OpenAPI.Clients.set_param(_ctx.query, "pretty", pretty) # type Bool - OpenAPI.Clients.set_header_accept(_ctx, ["application/json", ]) - OpenAPI.Clients.set_header_content_type(_ctx, (_mediaType === nothing) ? [] : [_mediaType]) - return _ctx -end - -@doc raw"""Get a policy module - -This API endpoint returns the details of the specified policy module (`{id}`) - -Params: -- id::String (required) -- pretty::Bool - -Return: GetPolicyModuleSuccessResponse, OpenAPI.Clients.ApiResponse -""" -function get_policy_module(_api::PolicyApi, id::String; pretty=nothing, _mediaType=nothing) - _ctx = _oacinternal_get_policy_module(_api, id; pretty=pretty, _mediaType=_mediaType) - return OpenAPI.Clients.exec(_ctx) -end - -function get_policy_module(_api::PolicyApi, response_stream::Channel, id::String; pretty=nothing, _mediaType=nothing) - _ctx = _oacinternal_get_policy_module(_api, id; pretty=pretty, _mediaType=_mediaType) - return OpenAPI.Clients.exec(_ctx, response_stream) -end - -const _returntypes_put_policy_module_PolicyApi = Dict{Regex,Type}( - Regex("^" * replace("200", "x"=>".") * "\$") => PutPolicySuccessResponse, - Regex("^" * replace("400", "x"=>".") * "\$") => ServerErrorResponse, - Regex("^" * replace("500", "x"=>".") * "\$") => ServerErrorResponse, -) - -function _oacinternal_put_policy_module(_api::PolicyApi, id::String, body::String; pretty=nothing, metrics=nothing, _mediaType=nothing) - _ctx = OpenAPI.Clients.Ctx(_api.client, "PUT", _returntypes_put_policy_module_PolicyApi, "/v1/policies/{id}", [], body) - OpenAPI.Clients.set_param(_ctx.path, "id", id) # type String - OpenAPI.Clients.set_param(_ctx.query, "pretty", pretty) # type Bool - OpenAPI.Clients.set_param(_ctx.query, "metrics", metrics) # type Bool - OpenAPI.Clients.set_header_accept(_ctx, ["application/json", ]) - OpenAPI.Clients.set_header_content_type(_ctx, (_mediaType === nothing) ? ["text/plain", ] : [_mediaType]) - return _ctx -end - -@doc raw"""Create or update a policy module - -- If the policy module does not exist, it is created. - If the policy module already exists, it is replaced. If the policy module isn't correctly defined, a *bad request* (400) response is returned. ### Example policy module ```yaml package opa.examples import data.servers import data.networks import data.ports public_servers[server] { some k, m server := servers[_] server.ports[_] == ports[k].id ports[k].networks[_] == networks[m].id networks[m].public == true } ``` - -Params: -- id::String (required) -- body::String (required) -- pretty::Bool -- metrics::Bool - -Return: PutPolicySuccessResponse, OpenAPI.Clients.ApiResponse -""" -function put_policy_module(_api::PolicyApi, id::String, body::String; pretty=nothing, metrics=nothing, _mediaType=nothing) - _ctx = _oacinternal_put_policy_module(_api, id, body; pretty=pretty, metrics=metrics, _mediaType=_mediaType) - return OpenAPI.Clients.exec(_ctx) -end - -function put_policy_module(_api::PolicyApi, response_stream::Channel, id::String, body::String; pretty=nothing, metrics=nothing, _mediaType=nothing) - _ctx = _oacinternal_put_policy_module(_api, id, body; pretty=pretty, metrics=metrics, _mediaType=_mediaType) - return OpenAPI.Clients.exec(_ctx, response_stream) -end - -export delete_policy_module -export get_policies -export get_policy_module -export put_policy_module diff --git a/src/client/src/apis/api_QueryApi.jl b/src/client/src/apis/api_QueryApi.jl deleted file mode 100644 index 584aa7b..0000000 --- a/src/client/src/apis/api_QueryApi.jl +++ /dev/null @@ -1,132 +0,0 @@ -# This file was generated by the Julia OpenAPI Code Generator -# Do not modify this file directly. Modify the OpenAPI specification instead. - -struct QueryApi <: OpenAPI.APIClientImpl - client::OpenAPI.Clients.Client -end - -""" -The default API base path for APIs in `QueryApi`. -This can be used to construct the `OpenAPI.Clients.Client` instance. -""" -basepath(::Type{ QueryApi }) = "http://localhost:8181" - -const _returntypes_query_get_QueryApi = Dict{Regex,Type}( - Regex("^" * replace("200", "x"=>".") * "\$") => GetDocumentSuccessResponse, - Regex("^" * replace("400", "x"=>".") * "\$") => ServerErrorResponse, - Regex("^" * replace("404", "x"=>".") * "\$") => ServerErrorResponse, - Regex("^" * replace("500", "x"=>".") * "\$") => ServerErrorResponse, - Regex("^" * replace("501", "x"=>".") * "\$") => ServerErrorResponse, -) - -function _oacinternal_query_get(_api::QueryApi, q::String; pretty=nothing, explain=nothing, metrics=nothing, _mediaType=nothing) - _ctx = OpenAPI.Clients.Ctx(_api.client, "GET", _returntypes_query_get_QueryApi, "/v1/query", []) - OpenAPI.Clients.set_param(_ctx.query, "pretty", pretty) # type Bool - OpenAPI.Clients.set_param(_ctx.query, "explain", explain) # type String - OpenAPI.Clients.set_param(_ctx.query, "metrics", metrics) # type Bool - OpenAPI.Clients.set_param(_ctx.query, "q", q) # type String - OpenAPI.Clients.set_header_accept(_ctx, ["application/json", ]) - OpenAPI.Clients.set_header_content_type(_ctx, (_mediaType === nothing) ? [] : [_mediaType]) - return _ctx -end - -@doc raw"""Execute an ad-hoc query and return bindings for variables found in the query. - -For queries that have large JSON values it is recommended to use the POST method with the query included as the POST body - -Params: -- q::String (required) -- pretty::Bool -- explain::String -- metrics::Bool - -Return: GetDocumentSuccessResponse, OpenAPI.Clients.ApiResponse -""" -function query_get(_api::QueryApi, q::String; pretty=nothing, explain=nothing, metrics=nothing, _mediaType=nothing) - _ctx = _oacinternal_query_get(_api, q; pretty=pretty, explain=explain, metrics=metrics, _mediaType=_mediaType) - return OpenAPI.Clients.exec(_ctx) -end - -function query_get(_api::QueryApi, response_stream::Channel, q::String; pretty=nothing, explain=nothing, metrics=nothing, _mediaType=nothing) - _ctx = _oacinternal_query_get(_api, q; pretty=pretty, explain=explain, metrics=metrics, _mediaType=_mediaType) - return OpenAPI.Clients.exec(_ctx, response_stream) -end - -const _returntypes_query_post_QueryApi = Dict{Regex,Type}( - Regex("^" * replace("200", "x"=>".") * "\$") => GetDocumentSuccessResponse, - Regex("^" * replace("400", "x"=>".") * "\$") => ServerErrorResponse, - Regex("^" * replace("404", "x"=>".") * "\$") => ServerErrorResponse, - Regex("^" * replace("500", "x"=>".") * "\$") => ServerErrorResponse, - Regex("^" * replace("501", "x"=>".") * "\$") => ServerErrorResponse, -) - -function _oacinternal_query_post(_api::QueryApi, query_parameter_post::QueryParameterPost; pretty=nothing, explain=nothing, metrics=nothing, _mediaType=nothing) - _ctx = OpenAPI.Clients.Ctx(_api.client, "POST", _returntypes_query_post_QueryApi, "/v1/query", [], query_parameter_post) - OpenAPI.Clients.set_param(_ctx.query, "pretty", pretty) # type Bool - OpenAPI.Clients.set_param(_ctx.query, "explain", explain) # type String - OpenAPI.Clients.set_param(_ctx.query, "metrics", metrics) # type Bool - OpenAPI.Clients.set_header_accept(_ctx, ["application/json", ]) - OpenAPI.Clients.set_header_content_type(_ctx, (_mediaType === nothing) ? ["application/json", ] : [_mediaType]) - return _ctx -end - -@doc raw"""Execute an ad-hoc query and return bindings for variables found in the query. - -Query included as the POST body. E.g.: ``` { \"query\": \"input.servers[i].ports[_] = \\\"p2\\\"; input.servers[i].name = name\", \"input\": { \"servers\": [ ... ], } } ``` - -Params: -- query_parameter_post::QueryParameterPost (required) -- pretty::Bool -- explain::String -- metrics::Bool - -Return: GetDocumentSuccessResponse, OpenAPI.Clients.ApiResponse -""" -function query_post(_api::QueryApi, query_parameter_post::QueryParameterPost; pretty=nothing, explain=nothing, metrics=nothing, _mediaType=nothing) - _ctx = _oacinternal_query_post(_api, query_parameter_post; pretty=pretty, explain=explain, metrics=metrics, _mediaType=_mediaType) - return OpenAPI.Clients.exec(_ctx) -end - -function query_post(_api::QueryApi, response_stream::Channel, query_parameter_post::QueryParameterPost; pretty=nothing, explain=nothing, metrics=nothing, _mediaType=nothing) - _ctx = _oacinternal_query_post(_api, query_parameter_post; pretty=pretty, explain=explain, metrics=metrics, _mediaType=_mediaType) - return OpenAPI.Clients.exec(_ctx, response_stream) -end - -const _returntypes_simple_query_QueryApi = Dict{Regex,Type}( - Regex("^" * replace("200", "x"=>".") * "\$") => Dict{String, Any}, - Regex("^" * replace("400", "x"=>".") * "\$") => ServerErrorResponse, - Regex("^" * replace("404", "x"=>".") * "\$") => ServerErrorResponse, - Regex("^" * replace("500", "x"=>".") * "\$") => ServerErrorResponse, -) - -function _oacinternal_simple_query(_api::QueryApi, request_body::Dict{String, Any}; pretty=nothing, _mediaType=nothing) - _ctx = OpenAPI.Clients.Ctx(_api.client, "POST", _returntypes_simple_query_QueryApi, "/", [], request_body) - OpenAPI.Clients.set_param(_ctx.query, "pretty", pretty) # type Bool - OpenAPI.Clients.set_header_accept(_ctx, ["application/json", ]) - OpenAPI.Clients.set_header_content_type(_ctx, (_mediaType === nothing) ? ["application/json", ] : [_mediaType]) - return _ctx -end - -@doc raw"""Execute a simple query. - -OPA serves POST requests without a URL path by querying for the document at path `/data/system/main`. The content of that document defines the response entirely. - -Params: -- request_body::Dict{String, Any} (required) -- pretty::Bool - -Return: Dict{String, Any}, OpenAPI.Clients.ApiResponse -""" -function simple_query(_api::QueryApi, request_body::Dict{String, Any}; pretty=nothing, _mediaType=nothing) - _ctx = _oacinternal_simple_query(_api, request_body; pretty=pretty, _mediaType=_mediaType) - return OpenAPI.Clients.exec(_ctx) -end - -function simple_query(_api::QueryApi, response_stream::Channel, request_body::Dict{String, Any}; pretty=nothing, _mediaType=nothing) - _ctx = _oacinternal_simple_query(_api, request_body; pretty=pretty, _mediaType=_mediaType) - return OpenAPI.Clients.exec(_ctx, response_stream) -end - -export query_get -export query_post -export simple_query diff --git a/src/client/src/apis/api_StatusApi.jl b/src/client/src/apis/api_StatusApi.jl deleted file mode 100644 index 8bb88ea..0000000 --- a/src/client/src/apis/api_StatusApi.jl +++ /dev/null @@ -1,46 +0,0 @@ -# This file was generated by the Julia OpenAPI Code Generator -# Do not modify this file directly. Modify the OpenAPI specification instead. - -struct StatusApi <: OpenAPI.APIClientImpl - client::OpenAPI.Clients.Client -end - -""" -The default API base path for APIs in `StatusApi`. -This can be used to construct the `OpenAPI.Clients.Client` instance. -""" -basepath(::Type{ StatusApi }) = "http://localhost:8181" - -const _returntypes_get_status_StatusApi = Dict{Regex,Type}( - Regex("^" * replace("200", "x"=>".") * "\$") => Dict{String, Any}, - Regex("^" * replace("500", "x"=>".") * "\$") => ServerErrorResponse, -) - -function _oacinternal_get_status(_api::StatusApi; pretty=nothing, _mediaType=nothing) - _ctx = OpenAPI.Clients.Ctx(_api.client, "GET", _returntypes_get_status_StatusApi, "/v1/status", []) - OpenAPI.Clients.set_param(_ctx.query, "pretty", pretty) # type Bool - OpenAPI.Clients.set_header_accept(_ctx, ["application/json", ]) - OpenAPI.Clients.set_header_content_type(_ctx, (_mediaType === nothing) ? [] : [_mediaType]) - return _ctx -end - -@doc raw"""Get status - -The /status API endpoint returns the status of the OPA server. This includes the status of the bundles and plugins. - -Params: -- pretty::Bool - -Return: Dict{String, Any}, OpenAPI.Clients.ApiResponse -""" -function get_status(_api::StatusApi; pretty=nothing, _mediaType=nothing) - _ctx = _oacinternal_get_status(_api; pretty=pretty, _mediaType=_mediaType) - return OpenAPI.Clients.exec(_ctx) -end - -function get_status(_api::StatusApi, response_stream::Channel; pretty=nothing, _mediaType=nothing) - _ctx = _oacinternal_get_status(_api; pretty=pretty, _mediaType=_mediaType) - return OpenAPI.Clients.exec(_ctx, response_stream) -end - -export get_status diff --git a/src/client/src/modelincludes.jl b/src/client/src/modelincludes.jl deleted file mode 100644 index 6942290..0000000 --- a/src/client/src/modelincludes.jl +++ /dev/null @@ -1,26 +0,0 @@ -# This file was generated by the Julia OpenAPI Code Generator -# Do not modify this file directly. Modify the OpenAPI specification instead. - -include("models/model_CompileSuccessResponse.jl") -include("models/model_CreateDocumentSuccessResponse.jl") -include("models/model_DeleteDocumentSuccessResponse.jl") -include("models/model_ErrorDetail.jl") -include("models/model_ErrorLocation.jl") -include("models/model_GetDocumentSuccessResponse.jl") -include("models/model_GetPolicyListSuccessResponse.jl") -include("models/model_GetPolicyModuleSuccessResponse.jl") -include("models/model_PartialQuerySchema.jl") -include("models/model_PatchOperation.jl") -include("models/model_Policy.jl") -include("models/model_PolicyAst.jl") -include("models/model_PolicyAstPackage.jl") -include("models/model_PolicyAstPackagePathInner.jl") -include("models/model_PolicyAstRulesInner.jl") -include("models/model_PolicyAstRulesInnerBodyInner.jl") -include("models/model_PolicyAstRulesInnerHead.jl") -include("models/model_PolicyAstRulesInnerHeadKey.jl") -include("models/model_Provenance.jl") -include("models/model_PutPolicySuccessResponse.jl") -include("models/model_QueryParameterPost.jl") -include("models/model_ServerErrorResponse.jl") -include("models/model_UnhealthyResponse.jl") diff --git a/src/client/src/models/model_CompileSuccessResponse.jl b/src/client/src/models/model_CompileSuccessResponse.jl deleted file mode 100644 index d042385..0000000 --- a/src/client/src/models/model_CompileSuccessResponse.jl +++ /dev/null @@ -1,38 +0,0 @@ -# This file was generated by the Julia OpenAPI Code Generator -# Do not modify this file directly. Modify the OpenAPI specification instead. - - -@doc raw"""compileSuccessResponse - - CompileSuccessResponse(; - result=nothing, - provenance=nothing, - metrics=nothing, - ) - - - result::Any - - provenance::Provenance - - metrics::Dict{String, Any} -""" -Base.@kwdef mutable struct CompileSuccessResponse <: OpenAPI.APIModel - result::Union{Nothing, Any} = nothing - provenance = nothing # spec type: Union{ Nothing, Provenance } - metrics::Union{Nothing, Dict{String, Any}} = nothing - - function CompileSuccessResponse(result, provenance, metrics, ) - OpenAPI.validate_property(CompileSuccessResponse, Symbol("result"), result) - OpenAPI.validate_property(CompileSuccessResponse, Symbol("provenance"), provenance) - OpenAPI.validate_property(CompileSuccessResponse, Symbol("metrics"), metrics) - return new(result, provenance, metrics, ) - end -end # type CompileSuccessResponse - -const _property_types_CompileSuccessResponse = Dict{Symbol,String}(Symbol("result")=>"Any", Symbol("provenance")=>"Provenance", Symbol("metrics")=>"Dict{String, Any}", ) -OpenAPI.property_type(::Type{ CompileSuccessResponse }, name::Symbol) = Union{Nothing,eval(Base.Meta.parse(_property_types_CompileSuccessResponse[name]))} - -function check_required(o::CompileSuccessResponse) - true -end - -function OpenAPI.validate_property(::Type{ CompileSuccessResponse }, name::Symbol, val) -end diff --git a/src/client/src/models/model_CreateDocumentSuccessResponse.jl b/src/client/src/models/model_CreateDocumentSuccessResponse.jl deleted file mode 100644 index 0183e32..0000000 --- a/src/client/src/models/model_CreateDocumentSuccessResponse.jl +++ /dev/null @@ -1,30 +0,0 @@ -# This file was generated by the Julia OpenAPI Code Generator -# Do not modify this file directly. Modify the OpenAPI specification instead. - - -@doc raw"""createDocumentSuccessResponse - - CreateDocumentSuccessResponse(; - metrics=nothing, - ) - - - metrics::Dict{String, Any} -""" -Base.@kwdef mutable struct CreateDocumentSuccessResponse <: OpenAPI.APIModel - metrics::Union{Nothing, Dict{String, Any}} = nothing - - function CreateDocumentSuccessResponse(metrics, ) - OpenAPI.validate_property(CreateDocumentSuccessResponse, Symbol("metrics"), metrics) - return new(metrics, ) - end -end # type CreateDocumentSuccessResponse - -const _property_types_CreateDocumentSuccessResponse = Dict{Symbol,String}(Symbol("metrics")=>"Dict{String, Any}", ) -OpenAPI.property_type(::Type{ CreateDocumentSuccessResponse }, name::Symbol) = Union{Nothing,eval(Base.Meta.parse(_property_types_CreateDocumentSuccessResponse[name]))} - -function check_required(o::CreateDocumentSuccessResponse) - true -end - -function OpenAPI.validate_property(::Type{ CreateDocumentSuccessResponse }, name::Symbol, val) -end diff --git a/src/client/src/models/model_DeleteDocumentSuccessResponse.jl b/src/client/src/models/model_DeleteDocumentSuccessResponse.jl deleted file mode 100644 index 98f030d..0000000 --- a/src/client/src/models/model_DeleteDocumentSuccessResponse.jl +++ /dev/null @@ -1,30 +0,0 @@ -# This file was generated by the Julia OpenAPI Code Generator -# Do not modify this file directly. Modify the OpenAPI specification instead. - - -@doc raw"""deleteDocumentSuccessResponse - - DeleteDocumentSuccessResponse(; - metrics=nothing, - ) - - - metrics::Dict{String, Any} -""" -Base.@kwdef mutable struct DeleteDocumentSuccessResponse <: OpenAPI.APIModel - metrics::Union{Nothing, Dict{String, Any}} = nothing - - function DeleteDocumentSuccessResponse(metrics, ) - OpenAPI.validate_property(DeleteDocumentSuccessResponse, Symbol("metrics"), metrics) - return new(metrics, ) - end -end # type DeleteDocumentSuccessResponse - -const _property_types_DeleteDocumentSuccessResponse = Dict{Symbol,String}(Symbol("metrics")=>"Dict{String, Any}", ) -OpenAPI.property_type(::Type{ DeleteDocumentSuccessResponse }, name::Symbol) = Union{Nothing,eval(Base.Meta.parse(_property_types_DeleteDocumentSuccessResponse[name]))} - -function check_required(o::DeleteDocumentSuccessResponse) - true -end - -function OpenAPI.validate_property(::Type{ DeleteDocumentSuccessResponse }, name::Symbol, val) -end diff --git a/src/client/src/models/model_ErrorDetail.jl b/src/client/src/models/model_ErrorDetail.jl deleted file mode 100644 index 66307a9..0000000 --- a/src/client/src/models/model_ErrorDetail.jl +++ /dev/null @@ -1,46 +0,0 @@ -# This file was generated by the Julia OpenAPI Code Generator -# Do not modify this file directly. Modify the OpenAPI specification instead. - - -@doc raw"""errorDetail - - ErrorDetail(; - code=nothing, - message=nothing, - location=nothing, - ) - - - code::String : The error code name - - message::String : A general description of the error - - location::ErrorLocation -""" -Base.@kwdef mutable struct ErrorDetail <: OpenAPI.APIModel - code::Union{Nothing, String} = nothing - message::Union{Nothing, String} = nothing - location = nothing # spec type: Union{ Nothing, ErrorLocation } - - function ErrorDetail(code, message, location, ) - OpenAPI.validate_property(ErrorDetail, Symbol("code"), code) - OpenAPI.validate_property(ErrorDetail, Symbol("message"), message) - OpenAPI.validate_property(ErrorDetail, Symbol("location"), location) - return new(code, message, location, ) - end -end # type ErrorDetail - -const _property_types_ErrorDetail = Dict{Symbol,String}(Symbol("code")=>"String", Symbol("message")=>"String", Symbol("location")=>"ErrorLocation", ) -OpenAPI.property_type(::Type{ ErrorDetail }, name::Symbol) = Union{Nothing,eval(Base.Meta.parse(_property_types_ErrorDetail[name]))} - -function check_required(o::ErrorDetail) - o.code === nothing && (return false) - o.message === nothing && (return false) - true -end - -function OpenAPI.validate_property(::Type{ ErrorDetail }, name::Symbol, val) - if name === Symbol("code") - OpenAPI.validate_param(name, "ErrorDetail", :minLength, val, 1) - end - if name === Symbol("message") - OpenAPI.validate_param(name, "ErrorDetail", :minLength, val, 1) - end -end diff --git a/src/client/src/models/model_ErrorLocation.jl b/src/client/src/models/model_ErrorLocation.jl deleted file mode 100644 index fca3268..0000000 --- a/src/client/src/models/model_ErrorLocation.jl +++ /dev/null @@ -1,38 +0,0 @@ -# This file was generated by the Julia OpenAPI Code Generator -# Do not modify this file directly. Modify the OpenAPI specification instead. - - -@doc raw"""errorLocation - - ErrorLocation(; - file=nothing, - row=nothing, - col=nothing, - ) - - - file::String : The policy module name that generated the error - - row::Float64 : The line number in the policy module where the error occurred - - col::Float64 : The column in the policy module where the error occurred -""" -Base.@kwdef mutable struct ErrorLocation <: OpenAPI.APIModel - file::Union{Nothing, String} = nothing - row::Union{Nothing, Float64} = nothing - col::Union{Nothing, Float64} = nothing - - function ErrorLocation(file, row, col, ) - OpenAPI.validate_property(ErrorLocation, Symbol("file"), file) - OpenAPI.validate_property(ErrorLocation, Symbol("row"), row) - OpenAPI.validate_property(ErrorLocation, Symbol("col"), col) - return new(file, row, col, ) - end -end # type ErrorLocation - -const _property_types_ErrorLocation = Dict{Symbol,String}(Symbol("file")=>"String", Symbol("row")=>"Float64", Symbol("col")=>"Float64", ) -OpenAPI.property_type(::Type{ ErrorLocation }, name::Symbol) = Union{Nothing,eval(Base.Meta.parse(_property_types_ErrorLocation[name]))} - -function check_required(o::ErrorLocation) - true -end - -function OpenAPI.validate_property(::Type{ ErrorLocation }, name::Symbol, val) -end diff --git a/src/client/src/models/model_GetDocumentSuccessResponse.jl b/src/client/src/models/model_GetDocumentSuccessResponse.jl deleted file mode 100644 index 931ac50..0000000 --- a/src/client/src/models/model_GetDocumentSuccessResponse.jl +++ /dev/null @@ -1,38 +0,0 @@ -# This file was generated by the Julia OpenAPI Code Generator -# Do not modify this file directly. Modify the OpenAPI specification instead. - - -@doc raw"""getDocumentSuccessResponse - - GetDocumentSuccessResponse(; - result=nothing, - decision_id=nothing, - metrics=nothing, - ) - - - result::Any : The result of the query. Can be whatever type the query returns - bool, number, string, array, json. - - decision_id::String - - metrics::Dict{String, Any} -""" -Base.@kwdef mutable struct GetDocumentSuccessResponse <: OpenAPI.APIModel - result::Union{Nothing, Any} = nothing - decision_id::Union{Nothing, String} = nothing - metrics::Union{Nothing, Dict{String, Any}} = nothing - - function GetDocumentSuccessResponse(result, decision_id, metrics, ) - OpenAPI.validate_property(GetDocumentSuccessResponse, Symbol("result"), result) - OpenAPI.validate_property(GetDocumentSuccessResponse, Symbol("decision_id"), decision_id) - OpenAPI.validate_property(GetDocumentSuccessResponse, Symbol("metrics"), metrics) - return new(result, decision_id, metrics, ) - end -end # type GetDocumentSuccessResponse - -const _property_types_GetDocumentSuccessResponse = Dict{Symbol,String}(Symbol("result")=>"Any", Symbol("decision_id")=>"String", Symbol("metrics")=>"Dict{String, Any}", ) -OpenAPI.property_type(::Type{ GetDocumentSuccessResponse }, name::Symbol) = Union{Nothing,eval(Base.Meta.parse(_property_types_GetDocumentSuccessResponse[name]))} - -function check_required(o::GetDocumentSuccessResponse) - true -end - -function OpenAPI.validate_property(::Type{ GetDocumentSuccessResponse }, name::Symbol, val) -end diff --git a/src/client/src/models/model_GetPolicyListSuccessResponse.jl b/src/client/src/models/model_GetPolicyListSuccessResponse.jl deleted file mode 100644 index 438e680..0000000 --- a/src/client/src/models/model_GetPolicyListSuccessResponse.jl +++ /dev/null @@ -1,31 +0,0 @@ -# This file was generated by the Julia OpenAPI Code Generator -# Do not modify this file directly. Modify the OpenAPI specification instead. - - -@doc raw"""getPolicyListSuccessResponse - - GetPolicyListSuccessResponse(; - result=nothing, - ) - - - result::Vector{Policy} -""" -Base.@kwdef mutable struct GetPolicyListSuccessResponse <: OpenAPI.APIModel - result::Union{Nothing, Vector} = nothing # spec type: Union{ Nothing, Vector{Policy} } - - function GetPolicyListSuccessResponse(result, ) - OpenAPI.validate_property(GetPolicyListSuccessResponse, Symbol("result"), result) - return new(result, ) - end -end # type GetPolicyListSuccessResponse - -const _property_types_GetPolicyListSuccessResponse = Dict{Symbol,String}(Symbol("result")=>"Vector{Policy}", ) -OpenAPI.property_type(::Type{ GetPolicyListSuccessResponse }, name::Symbol) = Union{Nothing,eval(Base.Meta.parse(_property_types_GetPolicyListSuccessResponse[name]))} - -function check_required(o::GetPolicyListSuccessResponse) - o.result === nothing && (return false) - true -end - -function OpenAPI.validate_property(::Type{ GetPolicyListSuccessResponse }, name::Symbol, val) -end diff --git a/src/client/src/models/model_GetPolicyModuleSuccessResponse.jl b/src/client/src/models/model_GetPolicyModuleSuccessResponse.jl deleted file mode 100644 index 49cc694..0000000 --- a/src/client/src/models/model_GetPolicyModuleSuccessResponse.jl +++ /dev/null @@ -1,31 +0,0 @@ -# This file was generated by the Julia OpenAPI Code Generator -# Do not modify this file directly. Modify the OpenAPI specification instead. - - -@doc raw"""getPolicyModuleSuccessResponse - - GetPolicyModuleSuccessResponse(; - result=nothing, - ) - - - result::Policy -""" -Base.@kwdef mutable struct GetPolicyModuleSuccessResponse <: OpenAPI.APIModel - result = nothing # spec type: Union{ Nothing, Policy } - - function GetPolicyModuleSuccessResponse(result, ) - OpenAPI.validate_property(GetPolicyModuleSuccessResponse, Symbol("result"), result) - return new(result, ) - end -end # type GetPolicyModuleSuccessResponse - -const _property_types_GetPolicyModuleSuccessResponse = Dict{Symbol,String}(Symbol("result")=>"Policy", ) -OpenAPI.property_type(::Type{ GetPolicyModuleSuccessResponse }, name::Symbol) = Union{Nothing,eval(Base.Meta.parse(_property_types_GetPolicyModuleSuccessResponse[name]))} - -function check_required(o::GetPolicyModuleSuccessResponse) - o.result === nothing && (return false) - true -end - -function OpenAPI.validate_property(::Type{ GetPolicyModuleSuccessResponse }, name::Symbol, val) -end diff --git a/src/client/src/models/model_PartialQuerySchema.jl b/src/client/src/models/model_PartialQuerySchema.jl deleted file mode 100644 index b3e9f38..0000000 --- a/src/client/src/models/model_PartialQuerySchema.jl +++ /dev/null @@ -1,42 +0,0 @@ -# This file was generated by the Julia OpenAPI Code Generator -# Do not modify this file directly. Modify the OpenAPI specification instead. - - -@doc raw"""partialQuerySchema - - PartialQuerySchema(; - query=nothing, - input=nothing, - options=nothing, - unknowns=nothing, - ) - - - query::String : The query to partially evaluate and compile. - - input::Any : The input document to use during partial evaluation - - options::Any : Additional options to use during partial evaluation. Only disableInlining option is supported. - - unknowns::Vector{String} : The terms to treat as unknown during partial evaluation. -""" -Base.@kwdef mutable struct PartialQuerySchema <: OpenAPI.APIModel - query::Union{Nothing, String} = nothing - input::Union{Nothing, Any} = nothing - options::Union{Nothing, Any} = nothing - unknowns::Union{Nothing, Vector{String}} = nothing - - function PartialQuerySchema(query, input, options, unknowns, ) - OpenAPI.validate_property(PartialQuerySchema, Symbol("query"), query) - OpenAPI.validate_property(PartialQuerySchema, Symbol("input"), input) - OpenAPI.validate_property(PartialQuerySchema, Symbol("options"), options) - OpenAPI.validate_property(PartialQuerySchema, Symbol("unknowns"), unknowns) - return new(query, input, options, unknowns, ) - end -end # type PartialQuerySchema - -const _property_types_PartialQuerySchema = Dict{Symbol,String}(Symbol("query")=>"String", Symbol("input")=>"Any", Symbol("options")=>"Any", Symbol("unknowns")=>"Vector{String}", ) -OpenAPI.property_type(::Type{ PartialQuerySchema }, name::Symbol) = Union{Nothing,eval(Base.Meta.parse(_property_types_PartialQuerySchema[name]))} - -function check_required(o::PartialQuerySchema) - true -end - -function OpenAPI.validate_property(::Type{ PartialQuerySchema }, name::Symbol, val) -end diff --git a/src/client/src/models/model_PatchOperation.jl b/src/client/src/models/model_PatchOperation.jl deleted file mode 100644 index 933c9f3..0000000 --- a/src/client/src/models/model_PatchOperation.jl +++ /dev/null @@ -1,45 +0,0 @@ -# This file was generated by the Julia OpenAPI Code Generator -# Do not modify this file directly. Modify the OpenAPI specification instead. - - -@doc raw"""patchOperation - - PatchOperation(; - op=nothing, - path=nothing, - from=nothing, - value=nothing, - ) - - - op::String - - path::String - - from::String - - value::Any -""" -Base.@kwdef mutable struct PatchOperation <: OpenAPI.APIModel - op::Union{Nothing, String} = nothing - path::Union{Nothing, String} = nothing - from::Union{Nothing, String} = nothing - value::Union{Nothing, Any} = nothing - - function PatchOperation(op, path, from, value, ) - OpenAPI.validate_property(PatchOperation, Symbol("op"), op) - OpenAPI.validate_property(PatchOperation, Symbol("path"), path) - OpenAPI.validate_property(PatchOperation, Symbol("from"), from) - OpenAPI.validate_property(PatchOperation, Symbol("value"), value) - return new(op, path, from, value, ) - end -end # type PatchOperation - -const _property_types_PatchOperation = Dict{Symbol,String}(Symbol("op")=>"String", Symbol("path")=>"String", Symbol("from")=>"String", Symbol("value")=>"Any", ) -OpenAPI.property_type(::Type{ PatchOperation }, name::Symbol) = Union{Nothing,eval(Base.Meta.parse(_property_types_PatchOperation[name]))} - -function check_required(o::PatchOperation) - true -end - -function OpenAPI.validate_property(::Type{ PatchOperation }, name::Symbol, val) - if name === Symbol("op") - OpenAPI.validate_param(name, "PatchOperation", :enum, val, ["add", "remove", "replace", "move", "copy", "test"]) - end -end diff --git a/src/client/src/models/model_Policy.jl b/src/client/src/models/model_Policy.jl deleted file mode 100644 index a120074..0000000 --- a/src/client/src/models/model_Policy.jl +++ /dev/null @@ -1,45 +0,0 @@ -# This file was generated by the Julia OpenAPI Code Generator -# Do not modify this file directly. Modify the OpenAPI specification instead. - - -@doc raw"""policy -A policy module - - Policy(; - id=nothing, - raw=nothing, - ast=nothing, - ) - - - id::String : The name of a policy module - - raw::String : A string representation of the full Rego policy - - ast::PolicyAst -""" -Base.@kwdef mutable struct Policy <: OpenAPI.APIModel - id::Union{Nothing, String} = nothing - raw::Union{Nothing, String} = nothing - ast = nothing # spec type: Union{ Nothing, PolicyAst } - - function Policy(id, raw, ast, ) - OpenAPI.validate_property(Policy, Symbol("id"), id) - OpenAPI.validate_property(Policy, Symbol("raw"), raw) - OpenAPI.validate_property(Policy, Symbol("ast"), ast) - return new(id, raw, ast, ) - end -end # type Policy - -const _property_types_Policy = Dict{Symbol,String}(Symbol("id")=>"String", Symbol("raw")=>"String", Symbol("ast")=>"PolicyAst", ) -OpenAPI.property_type(::Type{ Policy }, name::Symbol) = Union{Nothing,eval(Base.Meta.parse(_property_types_Policy[name]))} - -function check_required(o::Policy) - true -end - -function OpenAPI.validate_property(::Type{ Policy }, name::Symbol, val) - if name === Symbol("id") - OpenAPI.validate_param(name, "Policy", :minLength, val, 1) - end - if name === Symbol("raw") - OpenAPI.validate_param(name, "Policy", :minLength, val, 1) - end -end diff --git a/src/client/src/models/model_PolicyAst.jl b/src/client/src/models/model_PolicyAst.jl deleted file mode 100644 index ed7cdae..0000000 --- a/src/client/src/models/model_PolicyAst.jl +++ /dev/null @@ -1,38 +0,0 @@ -# This file was generated by the Julia OpenAPI Code Generator -# Do not modify this file directly. Modify the OpenAPI specification instead. - - -@doc raw"""policy_ast -The types for declarations and runtime objects passed to your implementation. This consists of an abstract syntax tree (AST) of policy modules, package and import declarations, rules, expressions, and terms. - - PolicyAst(; - package=nothing, - rules=nothing, - ) - - - package::PolicyAstPackage - - rules::Vector{PolicyAstRulesInner} : When OPA evaluates a rule, it generates the content of a [virtual documents](https://www.openpolicyagent.org/docs/latest/philosophy/#the-opa-document-model) -""" -Base.@kwdef mutable struct PolicyAst <: OpenAPI.APIModel - package = nothing # spec type: Union{ Nothing, PolicyAstPackage } - rules::Union{Nothing, Vector} = nothing # spec type: Union{ Nothing, Vector{PolicyAstRulesInner} } - - function PolicyAst(package, rules, ) - OpenAPI.validate_property(PolicyAst, Symbol("package"), package) - OpenAPI.validate_property(PolicyAst, Symbol("rules"), rules) - return new(package, rules, ) - end -end # type PolicyAst - -const _property_types_PolicyAst = Dict{Symbol,String}(Symbol("package")=>"PolicyAstPackage", Symbol("rules")=>"Vector{PolicyAstRulesInner}", ) -OpenAPI.property_type(::Type{ PolicyAst }, name::Symbol) = Union{Nothing,eval(Base.Meta.parse(_property_types_PolicyAst[name]))} - -function check_required(o::PolicyAst) - true -end - -function OpenAPI.validate_property(::Type{ PolicyAst }, name::Symbol, val) - if name === Symbol("rules") - OpenAPI.validate_param(name, "PolicyAst", :uniqueItems, val, true) - end -end diff --git a/src/client/src/models/model_PolicyAstPackage.jl b/src/client/src/models/model_PolicyAstPackage.jl deleted file mode 100644 index b4bb262..0000000 --- a/src/client/src/models/model_PolicyAstPackage.jl +++ /dev/null @@ -1,30 +0,0 @@ -# This file was generated by the Julia OpenAPI Code Generator -# Do not modify this file directly. Modify the OpenAPI specification instead. - - -@doc raw"""policy_ast_package - - PolicyAstPackage(; - path=nothing, - ) - - - path::Vector{PolicyAstPackagePathInner} : The path to the package -""" -Base.@kwdef mutable struct PolicyAstPackage <: OpenAPI.APIModel - path::Union{Nothing, Vector} = nothing # spec type: Union{ Nothing, Vector{PolicyAstPackagePathInner} } - - function PolicyAstPackage(path, ) - OpenAPI.validate_property(PolicyAstPackage, Symbol("path"), path) - return new(path, ) - end -end # type PolicyAstPackage - -const _property_types_PolicyAstPackage = Dict{Symbol,String}(Symbol("path")=>"Vector{PolicyAstPackagePathInner}", ) -OpenAPI.property_type(::Type{ PolicyAstPackage }, name::Symbol) = Union{Nothing,eval(Base.Meta.parse(_property_types_PolicyAstPackage[name]))} - -function check_required(o::PolicyAstPackage) - true -end - -function OpenAPI.validate_property(::Type{ PolicyAstPackage }, name::Symbol, val) -end diff --git a/src/client/src/models/model_PolicyAstPackagePathInner.jl b/src/client/src/models/model_PolicyAstPackagePathInner.jl deleted file mode 100644 index 4487fc2..0000000 --- a/src/client/src/models/model_PolicyAstPackagePathInner.jl +++ /dev/null @@ -1,34 +0,0 @@ -# This file was generated by the Julia OpenAPI Code Generator -# Do not modify this file directly. Modify the OpenAPI specification instead. - - -@doc raw"""policy_ast_package_path_inner - - PolicyAstPackagePathInner(; - type=nothing, - value=nothing, - ) - - - type::String : The type of the path operation - - value::String : The path variable -""" -Base.@kwdef mutable struct PolicyAstPackagePathInner <: OpenAPI.APIModel - type::Union{Nothing, String} = nothing - value::Union{Nothing, String} = nothing - - function PolicyAstPackagePathInner(type, value, ) - OpenAPI.validate_property(PolicyAstPackagePathInner, Symbol("type"), type) - OpenAPI.validate_property(PolicyAstPackagePathInner, Symbol("value"), value) - return new(type, value, ) - end -end # type PolicyAstPackagePathInner - -const _property_types_PolicyAstPackagePathInner = Dict{Symbol,String}(Symbol("type")=>"String", Symbol("value")=>"String", ) -OpenAPI.property_type(::Type{ PolicyAstPackagePathInner }, name::Symbol) = Union{Nothing,eval(Base.Meta.parse(_property_types_PolicyAstPackagePathInner[name]))} - -function check_required(o::PolicyAstPackagePathInner) - true -end - -function OpenAPI.validate_property(::Type{ PolicyAstPackagePathInner }, name::Symbol, val) -end diff --git a/src/client/src/models/model_PolicyAstRulesInner.jl b/src/client/src/models/model_PolicyAstRulesInner.jl deleted file mode 100644 index ae321d5..0000000 --- a/src/client/src/models/model_PolicyAstRulesInner.jl +++ /dev/null @@ -1,34 +0,0 @@ -# This file was generated by the Julia OpenAPI Code Generator -# Do not modify this file directly. Modify the OpenAPI specification instead. - - -@doc raw"""policy_ast_rules_inner - - PolicyAstRulesInner(; - head=nothing, - body=nothing, - ) - - - head::PolicyAstRulesInnerHead - - body::Vector{PolicyAstRulesInnerBodyInner} : A list of the terms in this rule -""" -Base.@kwdef mutable struct PolicyAstRulesInner <: OpenAPI.APIModel - head = nothing # spec type: Union{ Nothing, PolicyAstRulesInnerHead } - body::Union{Nothing, Vector} = nothing # spec type: Union{ Nothing, Vector{PolicyAstRulesInnerBodyInner} } - - function PolicyAstRulesInner(head, body, ) - OpenAPI.validate_property(PolicyAstRulesInner, Symbol("head"), head) - OpenAPI.validate_property(PolicyAstRulesInner, Symbol("body"), body) - return new(head, body, ) - end -end # type PolicyAstRulesInner - -const _property_types_PolicyAstRulesInner = Dict{Symbol,String}(Symbol("head")=>"PolicyAstRulesInnerHead", Symbol("body")=>"Vector{PolicyAstRulesInnerBodyInner}", ) -OpenAPI.property_type(::Type{ PolicyAstRulesInner }, name::Symbol) = Union{Nothing,eval(Base.Meta.parse(_property_types_PolicyAstRulesInner[name]))} - -function check_required(o::PolicyAstRulesInner) - true -end - -function OpenAPI.validate_property(::Type{ PolicyAstRulesInner }, name::Symbol, val) -end diff --git a/src/client/src/models/model_PolicyAstRulesInnerBodyInner.jl b/src/client/src/models/model_PolicyAstRulesInnerBodyInner.jl deleted file mode 100644 index 2581259..0000000 --- a/src/client/src/models/model_PolicyAstRulesInnerBodyInner.jl +++ /dev/null @@ -1,34 +0,0 @@ -# This file was generated by the Julia OpenAPI Code Generator -# Do not modify this file directly. Modify the OpenAPI specification instead. - - -@doc raw"""policy_ast_rules_inner_body_inner - - PolicyAstRulesInnerBodyInner(; - index=nothing, - terms=nothing, - ) - - - index::Float64 : The location of this term in the list (starts at 0) - - terms::Any : The type/value pairing for this term -""" -Base.@kwdef mutable struct PolicyAstRulesInnerBodyInner <: OpenAPI.APIModel - index::Union{Nothing, Float64} = nothing - terms::Union{Nothing, Any} = nothing - - function PolicyAstRulesInnerBodyInner(index, terms, ) - OpenAPI.validate_property(PolicyAstRulesInnerBodyInner, Symbol("index"), index) - OpenAPI.validate_property(PolicyAstRulesInnerBodyInner, Symbol("terms"), terms) - return new(index, terms, ) - end -end # type PolicyAstRulesInnerBodyInner - -const _property_types_PolicyAstRulesInnerBodyInner = Dict{Symbol,String}(Symbol("index")=>"Float64", Symbol("terms")=>"Any", ) -OpenAPI.property_type(::Type{ PolicyAstRulesInnerBodyInner }, name::Symbol) = Union{Nothing,eval(Base.Meta.parse(_property_types_PolicyAstRulesInnerBodyInner[name]))} - -function check_required(o::PolicyAstRulesInnerBodyInner) - true -end - -function OpenAPI.validate_property(::Type{ PolicyAstRulesInnerBodyInner }, name::Symbol, val) -end diff --git a/src/client/src/models/model_PolicyAstRulesInnerHead.jl b/src/client/src/models/model_PolicyAstRulesInnerHead.jl deleted file mode 100644 index ba0ad30..0000000 --- a/src/client/src/models/model_PolicyAstRulesInnerHead.jl +++ /dev/null @@ -1,34 +0,0 @@ -# This file was generated by the Julia OpenAPI Code Generator -# Do not modify this file directly. Modify the OpenAPI specification instead. - - -@doc raw"""policy_ast_rules_inner_head - - PolicyAstRulesInnerHead(; - name=nothing, - key=nothing, - ) - - - name::String : The head of the rule - - key::PolicyAstRulesInnerHeadKey -""" -Base.@kwdef mutable struct PolicyAstRulesInnerHead <: OpenAPI.APIModel - name::Union{Nothing, String} = nothing - key = nothing # spec type: Union{ Nothing, PolicyAstRulesInnerHeadKey } - - function PolicyAstRulesInnerHead(name, key, ) - OpenAPI.validate_property(PolicyAstRulesInnerHead, Symbol("name"), name) - OpenAPI.validate_property(PolicyAstRulesInnerHead, Symbol("key"), key) - return new(name, key, ) - end -end # type PolicyAstRulesInnerHead - -const _property_types_PolicyAstRulesInnerHead = Dict{Symbol,String}(Symbol("name")=>"String", Symbol("key")=>"PolicyAstRulesInnerHeadKey", ) -OpenAPI.property_type(::Type{ PolicyAstRulesInnerHead }, name::Symbol) = Union{Nothing,eval(Base.Meta.parse(_property_types_PolicyAstRulesInnerHead[name]))} - -function check_required(o::PolicyAstRulesInnerHead) - true -end - -function OpenAPI.validate_property(::Type{ PolicyAstRulesInnerHead }, name::Symbol, val) -end diff --git a/src/client/src/models/model_PolicyAstRulesInnerHeadKey.jl b/src/client/src/models/model_PolicyAstRulesInnerHeadKey.jl deleted file mode 100644 index 3165e6d..0000000 --- a/src/client/src/models/model_PolicyAstRulesInnerHeadKey.jl +++ /dev/null @@ -1,35 +0,0 @@ -# This file was generated by the Julia OpenAPI Code Generator -# Do not modify this file directly. Modify the OpenAPI specification instead. - - -@doc raw"""policy_ast_rules_inner_head_key -The type/value pairing for this rule's head - - PolicyAstRulesInnerHeadKey(; - type=nothing, - value=nothing, - ) - - - type::String : The type of the head - - value::String : The value of the head -""" -Base.@kwdef mutable struct PolicyAstRulesInnerHeadKey <: OpenAPI.APIModel - type::Union{Nothing, String} = nothing - value::Union{Nothing, String} = nothing - - function PolicyAstRulesInnerHeadKey(type, value, ) - OpenAPI.validate_property(PolicyAstRulesInnerHeadKey, Symbol("type"), type) - OpenAPI.validate_property(PolicyAstRulesInnerHeadKey, Symbol("value"), value) - return new(type, value, ) - end -end # type PolicyAstRulesInnerHeadKey - -const _property_types_PolicyAstRulesInnerHeadKey = Dict{Symbol,String}(Symbol("type")=>"String", Symbol("value")=>"String", ) -OpenAPI.property_type(::Type{ PolicyAstRulesInnerHeadKey }, name::Symbol) = Union{Nothing,eval(Base.Meta.parse(_property_types_PolicyAstRulesInnerHeadKey[name]))} - -function check_required(o::PolicyAstRulesInnerHeadKey) - true -end - -function OpenAPI.validate_property(::Type{ PolicyAstRulesInnerHeadKey }, name::Symbol, val) -end diff --git a/src/client/src/models/model_Provenance.jl b/src/client/src/models/model_Provenance.jl deleted file mode 100644 index b5b09a6..0000000 --- a/src/client/src/models/model_Provenance.jl +++ /dev/null @@ -1,46 +0,0 @@ -# This file was generated by the Julia OpenAPI Code Generator -# Do not modify this file directly. Modify the OpenAPI specification instead. - - -@doc raw"""provenance - - Provenance(; - version=nothing, - build_commit=nothing, - build_timestamp=nothing, - build_hostname=nothing, - bundles=nothing, - ) - - - version::String : The version of this OPA instance - - build_commit::String : The Git commit id of this OPA build. - - build_timestamp::String : When this OPA instance was built (in [ISO8601 format](https://www.w3.org/TR/NOTE-datetime)) - - build_hostname::String : The hostname where this instance was built. - - bundles::Dict{String, Any} : A set of key-value pairs describing each bundle activated on the server. -""" -Base.@kwdef mutable struct Provenance <: OpenAPI.APIModel - version::Union{Nothing, String} = nothing - build_commit::Union{Nothing, String} = nothing - build_timestamp::Union{Nothing, String} = nothing - build_hostname::Union{Nothing, String} = nothing - bundles::Union{Nothing, Dict{String, Any}} = nothing - - function Provenance(version, build_commit, build_timestamp, build_hostname, bundles, ) - OpenAPI.validate_property(Provenance, Symbol("version"), version) - OpenAPI.validate_property(Provenance, Symbol("build_commit"), build_commit) - OpenAPI.validate_property(Provenance, Symbol("build_timestamp"), build_timestamp) - OpenAPI.validate_property(Provenance, Symbol("build_hostname"), build_hostname) - OpenAPI.validate_property(Provenance, Symbol("bundles"), bundles) - return new(version, build_commit, build_timestamp, build_hostname, bundles, ) - end -end # type Provenance - -const _property_types_Provenance = Dict{Symbol,String}(Symbol("version")=>"String", Symbol("build_commit")=>"String", Symbol("build_timestamp")=>"String", Symbol("build_hostname")=>"String", Symbol("bundles")=>"Dict{String, Any}", ) -OpenAPI.property_type(::Type{ Provenance }, name::Symbol) = Union{Nothing,eval(Base.Meta.parse(_property_types_Provenance[name]))} - -function check_required(o::Provenance) - true -end - -function OpenAPI.validate_property(::Type{ Provenance }, name::Symbol, val) -end diff --git a/src/client/src/models/model_PutPolicySuccessResponse.jl b/src/client/src/models/model_PutPolicySuccessResponse.jl deleted file mode 100644 index 5e98102..0000000 --- a/src/client/src/models/model_PutPolicySuccessResponse.jl +++ /dev/null @@ -1,30 +0,0 @@ -# This file was generated by the Julia OpenAPI Code Generator -# Do not modify this file directly. Modify the OpenAPI specification instead. - - -@doc raw"""putPolicySuccessResponse - - PutPolicySuccessResponse(; - metrics=nothing, - ) - - - metrics::Dict{String, Any} -""" -Base.@kwdef mutable struct PutPolicySuccessResponse <: OpenAPI.APIModel - metrics::Union{Nothing, Dict{String, Any}} = nothing - - function PutPolicySuccessResponse(metrics, ) - OpenAPI.validate_property(PutPolicySuccessResponse, Symbol("metrics"), metrics) - return new(metrics, ) - end -end # type PutPolicySuccessResponse - -const _property_types_PutPolicySuccessResponse = Dict{Symbol,String}(Symbol("metrics")=>"Dict{String, Any}", ) -OpenAPI.property_type(::Type{ PutPolicySuccessResponse }, name::Symbol) = Union{Nothing,eval(Base.Meta.parse(_property_types_PutPolicySuccessResponse[name]))} - -function check_required(o::PutPolicySuccessResponse) - true -end - -function OpenAPI.validate_property(::Type{ PutPolicySuccessResponse }, name::Symbol, val) -end diff --git a/src/client/src/models/model_QueryParameterPost.jl b/src/client/src/models/model_QueryParameterPost.jl deleted file mode 100644 index 756e434..0000000 --- a/src/client/src/models/model_QueryParameterPost.jl +++ /dev/null @@ -1,34 +0,0 @@ -# This file was generated by the Julia OpenAPI Code Generator -# Do not modify this file directly. Modify the OpenAPI specification instead. - - -@doc raw"""queryParameterPost - - QueryParameterPost(; - query=nothing, - input=nothing, - ) - - - query::String : The ad-hoc query to execute. OPA will parse, compile, and execute the query represented by the parameter value. The value MUST be URL encoded. Only used in GET method. For POST method the query is sent as part of the request body and this parameter is not used. - - input::Dict{String, Any} : The input document (in JSON format) -""" -Base.@kwdef mutable struct QueryParameterPost <: OpenAPI.APIModel - query::Union{Nothing, String} = nothing - input::Union{Nothing, Dict{String, Any}} = nothing - - function QueryParameterPost(query, input, ) - OpenAPI.validate_property(QueryParameterPost, Symbol("query"), query) - OpenAPI.validate_property(QueryParameterPost, Symbol("input"), input) - return new(query, input, ) - end -end # type QueryParameterPost - -const _property_types_QueryParameterPost = Dict{Symbol,String}(Symbol("query")=>"String", Symbol("input")=>"Dict{String, Any}", ) -OpenAPI.property_type(::Type{ QueryParameterPost }, name::Symbol) = Union{Nothing,eval(Base.Meta.parse(_property_types_QueryParameterPost[name]))} - -function check_required(o::QueryParameterPost) - true -end - -function OpenAPI.validate_property(::Type{ QueryParameterPost }, name::Symbol, val) -end diff --git a/src/client/src/models/model_ServerErrorResponse.jl b/src/client/src/models/model_ServerErrorResponse.jl deleted file mode 100644 index 246b7e5..0000000 --- a/src/client/src/models/model_ServerErrorResponse.jl +++ /dev/null @@ -1,49 +0,0 @@ -# This file was generated by the Julia OpenAPI Code Generator -# Do not modify this file directly. Modify the OpenAPI specification instead. - - -@doc raw"""serverErrorResponse - - ServerErrorResponse(; - code=nothing, - message=nothing, - errors=nothing, - ) - - - code::String : The error code name - - message::String : A general description of the error - - errors::Vector{ErrorDetail} : Errors that may have been generated during the parse, compile, or installation of a policy module -""" -Base.@kwdef mutable struct ServerErrorResponse <: OpenAPI.APIModel - code::Union{Nothing, String} = nothing - message::Union{Nothing, String} = nothing - errors::Union{Nothing, Vector} = nothing # spec type: Union{ Nothing, Vector{ErrorDetail} } - - function ServerErrorResponse(code, message, errors, ) - OpenAPI.validate_property(ServerErrorResponse, Symbol("code"), code) - OpenAPI.validate_property(ServerErrorResponse, Symbol("message"), message) - OpenAPI.validate_property(ServerErrorResponse, Symbol("errors"), errors) - return new(code, message, errors, ) - end -end # type ServerErrorResponse - -const _property_types_ServerErrorResponse = Dict{Symbol,String}(Symbol("code")=>"String", Symbol("message")=>"String", Symbol("errors")=>"Vector{ErrorDetail}", ) -OpenAPI.property_type(::Type{ ServerErrorResponse }, name::Symbol) = Union{Nothing,eval(Base.Meta.parse(_property_types_ServerErrorResponse[name]))} - -function check_required(o::ServerErrorResponse) - o.code === nothing && (return false) - o.message === nothing && (return false) - true -end - -function OpenAPI.validate_property(::Type{ ServerErrorResponse }, name::Symbol, val) - if name === Symbol("code") - OpenAPI.validate_param(name, "ServerErrorResponse", :minLength, val, 1) - end - if name === Symbol("message") - OpenAPI.validate_param(name, "ServerErrorResponse", :minLength, val, 1) - end - if name === Symbol("errors") - OpenAPI.validate_param(name, "ServerErrorResponse", :uniqueItems, val, true) - end -end diff --git a/src/client/src/models/model_UnhealthyResponse.jl b/src/client/src/models/model_UnhealthyResponse.jl deleted file mode 100644 index 6e4df77..0000000 --- a/src/client/src/models/model_UnhealthyResponse.jl +++ /dev/null @@ -1,31 +0,0 @@ -# This file was generated by the Julia OpenAPI Code Generator -# Do not modify this file directly. Modify the OpenAPI specification instead. - - -@doc raw"""unhealthyResponse - - UnhealthyResponse(; - error=nothing, - ) - - - error::String : The error message -""" -Base.@kwdef mutable struct UnhealthyResponse <: OpenAPI.APIModel - error::Union{Nothing, String} = nothing - - function UnhealthyResponse(error, ) - OpenAPI.validate_property(UnhealthyResponse, Symbol("error"), error) - return new(error, ) - end -end # type UnhealthyResponse - -const _property_types_UnhealthyResponse = Dict{Symbol,String}(Symbol("error")=>"String", ) -OpenAPI.property_type(::Type{ UnhealthyResponse }, name::Symbol) = Union{Nothing,eval(Base.Meta.parse(_property_types_UnhealthyResponse[name]))} - -function check_required(o::UnhealthyResponse) - o.error === nothing && (return false) - true -end - -function OpenAPI.validate_property(::Type{ UnhealthyResponse }, name::Symbol, val) -end diff --git a/test/runtests.jl b/test/runtests.jl index 9b4f43c..b8921e0 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,7 +1,5 @@ using OpenPolicyAgent using OpenPolicyAgent_jll -using OpenAPI -using JSON using HTTP using Test import OpenPolicyAgent: CLI, Client, ASTWalker @@ -44,29 +42,43 @@ function test_version_help() end end -function test_data_api(openapi_client) - opa_client = OpenPolicyAgent.Client.DataApi(openapi_client) +# Runs `f`, which is expected to fail with a documented error status, and returns +# the `ApiError` so the caller can inspect the status and the decoded body. +function api_error(f) + try + f() + catch ex + isa(ex, Client.ApiError) && return ex + rethrow() + end + error("expected an ApiError") +end +const EXPLAIN_FULL = Client.ExplainMode("full") + +function test_data_api(client) # run only if not windows if !Sys.iswindows() # TODO: check why this fails on windows - response, _http_resp = OpenPolicyAgent.Client.get_document(opa_client, policy_path(); pretty=true, provenance=true, explain=true, metrics=true, instrument=true); + response = Client.getdocument(policy_path(); pretty=true, provenance=true, explain=EXPLAIN_FULL, metrics=true, instrument=true, client) + @test isa(response, Client.GetDocumentSuccessResponse) @test response.result == false - @test query_user(opa_client, "bob") == true + @test query_user(client, "bob") == true end - response, _http_resp = OpenPolicyAgent.Client.create_document(opa_client, "servers", EXAMPLE_QUERY_INPUT; metrics=true) - @test isa(response, OpenPolicyAgent.Client.CreateDocumentSuccessResponse) - @test response.metrics["timer_rego_input_parse_ns"] >= 0 + response = Client.createdocument("servers", EXAMPLE_QUERY_INPUT; metrics=true, client) + @test isa(response, Client.CreateDocumentSuccessResponse) + @test response.metrics.additional_properties["timer_rego_input_parse_ns"] >= 0 - patch_op = OpenPolicyAgent.Client.PatchOperation(; op="add", path="/servers/0/ports/-", value="p4") - response, _http_resp = OpenPolicyAgent.Client.patch_document(opa_client, "servers", [patch_op]) + patch_op = Client.PatchOperation(; op=Client.PatchOperationOp("add"), path="/servers/0/ports/-", value="p4") + response = Client.patchdocument("servers", [patch_op]; client) @test isa(response, Nothing) - response, _http_resp = OpenPolicyAgent.Client.get_document(opa_client, "servers") - @test isa(response, OpenPolicyAgent.Client.GetDocumentSuccessResponse) + response = Client.getdocument("servers"; client) + @test isa(response, Client.GetDocumentSuccessResponse) result = response.result + @test isa(result, AbstractDict) servers = result["servers"] @test isa(servers, Vector) @test length(servers) == 2 @@ -74,16 +86,22 @@ function test_data_api(openapi_client) @test servers[2]["name"] in ("app", "dev") @test Set(servers[1]["ports"]) == Set(["p1", "p2", "p3", "p4"]) # p4 was added via the patch operation - response, _http_resp = OpenPolicyAgent.Client.delete_document(opa_client, "servers"; metrics=true) - @test isa(response, OpenPolicyAgent.Client.DeleteDocumentSuccessResponse) - @test response.metrics["timer_server_handler_ns"] >= 0 + # the full response is available with `with_http_info` + http_resp = Client.getdocument("servers"; with_http_info=true, client) + @test isa(http_resp, Client.ApiResponse) + @test http_resp.status == 200 + @test isa(http_resp.body, Client.GetDocumentSuccessResponse) + + response = Client.deletedocument("servers"; metrics=true, client) + @test isa(response, Client.DeleteDocumentSuccessResponse) + @test response.metrics.additional_properties["timer_server_handler_ns"] >= 0 end -function test_config_api(openapi_client) - opa_client = OpenPolicyAgent.Client.ConfigApi(openapi_client) - result_dict, _http_resp = OpenPolicyAgent.Client.get_config(opa_client; pretty=true) +function test_config_api(client) + config = Client.getconfig(; pretty=true, client) + @test isa(config, Client.ActiveConfiguration) - @test isa(result_dict, Dict{String,Any}) + result_dict = config.additional_properties @test haskey(result_dict, "result") result = result_dict["result"] @@ -103,98 +121,84 @@ function test_config_api(openapi_client) @test bundle_keys["bundle_key"]["algorithm"] == "HS512" end -function test_status_api(openapi_client) - opa_client = OpenPolicyAgent.Client.StatusApi(openapi_client) - result, _http_resp = OpenPolicyAgent.Client.get_status(opa_client; pretty=true) - +function test_status_api(client) # status plugin is not enabled by default # https://github.com/open-policy-agent/opa/issues/4297 - @test isa(result, OpenPolicyAgent.Client.ServerErrorResponse) - @test result.code == "internal_error" - @test result.message == "status plugin not enabled" + # A documented error status is raised as an `ApiError` carrying the decoded body. + ex = api_error(() -> Client.getstatus(; pretty=true, client)) + @test ex.status == 500 + @test isa(ex.decoded, Client.ServerErrorResponse) + @test ex.decoded.code == "internal_error" + @test ex.decoded.message == "status plugin not enabled" end -function test_health_api(openapi_client) - opa_client = OpenPolicyAgent.Client.HealthApi(openapi_client) - result, _http_resp = OpenPolicyAgent.Client.get_health(opa_client; bundles=true, plugins=true) - @test isa(result, Nothing) +function test_health_api(client) + result = Client.gethealth(; bundles=true, plugins=true, client) + @test isa(result, Client.HealthyResponse) end -function test_policy_api(openapi_client) - opa_client = OpenPolicyAgent.Client.PolicyApi(openapi_client) - result, _http_resp = OpenPolicyAgent.Client.get_policies(opa_client; pretty=true) - @test isa(result, OpenPolicyAgent.Client.GetPolicyListSuccessResponse) - @test isa(result.result, Vector{OpenPolicyAgent.Client.Policy}) +function test_policy_api(client) + result = Client.getpolicies(; pretty=true, client) + @test isa(result, Client.GetPolicyListSuccessResponse) + @test isa(result.result, Vector{Client.Policy}) @test !isempty(result.result) policy_id = result.result[1].id - result, _http_resp = OpenPolicyAgent.Client.get_policy_module(opa_client, policy_id; pretty=true) - @test isa(result, OpenPolicyAgent.Client.GetPolicyModuleSuccessResponse) - @test isa(result.result, OpenPolicyAgent.Client.Policy) + result = Client.getpolicymodule(policy_id; pretty=true, client) + @test isa(result, Client.GetPolicyModuleSuccessResponse) + @test isa(result.result, Client.Policy) @test result.result.id == policy_id example_policy_id = "example1" - result, _http_resp = OpenPolicyAgent.Client.put_policy_module(opa_client, example_policy_id, EXAMPLE_POLICY; pretty=true, metrics=true) - @test isa(result, OpenPolicyAgent.Client.PutPolicySuccessResponse) - @test isa(result.metrics, Dict{String,Any}) - @test result.metrics["timer_rego_module_parse_ns"] >= 0 - - result, _http_resp = OpenPolicyAgent.Client.get_policies(opa_client; pretty=true) - @test isa(result.result, Vector{OpenPolicyAgent.Client.Policy}) - has_example_policy = false - for policy in result.result - if policy.id == example_policy_id - has_example_policy = true - break - end - end - @test has_example_policy - - result, _http_resp = OpenPolicyAgent.Client.delete_policy_module(opa_client, policy_id; pretty=true) - @test isa(result, OpenPolicyAgent.Client.ServerErrorResponse) - @test result.code == "invalid_parameter" - - result, _http_resp = OpenPolicyAgent.Client.delete_policy_module(opa_client, example_policy_id; pretty=true) - @test isa(result, Nothing) - - result, _http_resp = OpenPolicyAgent.Client.get_policies(opa_client; pretty=true) - has_example_policy = false - for policy in result.result - if policy.id == example_policy_id - has_example_policy = true - break - end - end - @test !has_example_policy + result = Client.putpolicymodule(example_policy_id, EXAMPLE_POLICY; pretty=true, metrics=true, client) + @test isa(result, Client.PutPolicySuccessResponse) + @test isa(result.metrics, Client.PutPolicySuccessResponseMetrics) + @test result.metrics.additional_properties["timer_rego_module_parse_ns"] >= 0 + + result = Client.getpolicies(; pretty=true, client) + @test isa(result.result, Vector{Client.Policy}) + @test any(policy -> policy.id == example_policy_id, result.result) + + # policies that came from a bundle cannot be deleted through the API + ex = api_error(() -> Client.deletepolicymodule(policy_id; pretty=true, client)) + @test ex.status == 400 + @test isa(ex.decoded, Client.ServerErrorResponse) + @test ex.decoded.code == "invalid_parameter" + + result = Client.deletepolicymodule(example_policy_id; pretty=true, client) + @test isa(result, Client.DeletePolicySuccessResponse) + + result = Client.getpolicies(; pretty=true, client) + @test !any(policy -> policy.id == example_policy_id, result.result) end -function test_compile_api(openapi_client) - policy_client = OpenPolicyAgent.Client.PolicyApi(openapi_client) - compile_client = OpenPolicyAgent.Client.CompileApi(openapi_client) - +function test_compile_api(client) for partial_compile_case in PARTIAL_COMPILE_CASES # create the test policy to evaluate the query on - result, _http_resp = OpenPolicyAgent.Client.put_policy_module(policy_client, "example", partial_compile_case.policy) - @test isa(result, OpenPolicyAgent.Client.PutPolicySuccessResponse) + result = Client.putpolicymodule("example", partial_compile_case.policy; client) + @test isa(result, Client.PutPolicySuccessResponse) try - partial_query_schema = OpenPolicyAgent.Client.PartialQuerySchema(; + partial_query_schema = Client.PartialQuerySchema(; query = partial_compile_case.query, input = partial_compile_case.input, options = partial_compile_case.options, unknowns = partial_compile_case.unknowns, ) - response, _http_resp = OpenPolicyAgent.Client.post_compile(compile_client; - partial_query_schema = partial_query_schema, - pretty=true, - explain=true, - metrics=true, - instrument=true + response = Client.postcompile(; + body = partial_query_schema, + pretty = true, + explain = EXPLAIN_FULL, + metrics = true, + instrument = true, + client, ) - @test isa(response, OpenPolicyAgent.Client.CompileSuccessResponse) - @test !isnothing(response.metrics) && (response.metrics["timer_rego_partial_eval_ns"] >= 0) + @test isa(response, Client.CompileSuccessResponse) + @test isa(response.metrics, Client.CompileSuccessResponseMetrics) + @test response.metrics.additional_properties["timer_rego_partial_eval_ns"] >= 0 result = response.result + @test isa(result, AbstractDict) if partial_compile_case.sql !== "false" @test !isnothing(result["queries"]) && length(result["queries"]) >= 1 end @@ -215,28 +219,27 @@ function test_compile_api(openapi_client) end finally # delete the test policy - result, _http_resp = OpenPolicyAgent.Client.delete_policy_module(policy_client, "example"; pretty=true) - @test isa(result, Nothing) + result = Client.deletepolicymodule("example"; pretty=true, client) + @test isa(result, Client.DeletePolicySuccessResponse) end end end -function test_query_api(openapi_client) - query_client = OpenPolicyAgent.Client.QueryApi(openapi_client) - response, _http_resp = OpenPolicyAgent.Client.query_get(query_client, EXAMPLE_QUERY; pretty=true, explain=true, metrics=true) +function test_query_api(client) + response = Client.queryget(; q=EXAMPLE_QUERY, pretty=true, explain=EXPLAIN_FULL, metrics=true, client) - @test isa(response, OpenPolicyAgent.Client.GetDocumentSuccessResponse) + @test isa(response, Client.GetDocumentSuccessResponse) metrics = response.metrics - @test isa(metrics, Dict{String,Any}) - @test metrics["timer_rego_query_eval_ns"] >= 0 + @test isa(metrics, Client.GetDocumentSuccessResponseMetrics) + @test metrics.additional_properties["timer_rego_query_eval_ns"] >= 0 - query_param = OpenPolicyAgent.Client.QueryParameterPost(; query=EXAMPLE_QUERY, input=EXAMPLE_QUERY_INPUT) - response, _http_resp = OpenPolicyAgent.Client.query_post(query_client, query_param; pretty=true, explain=true, metrics=true) + query_param = Client.QueryParameterPost(; query=EXAMPLE_QUERY, input=EXAMPLE_QUERY_INPUT) + response = Client.querypost(query_param; pretty=true, explain=EXPLAIN_FULL, metrics=true, client) - @test isa(response, OpenPolicyAgent.Client.GetDocumentSuccessResponse) + @test isa(response, Client.GetDocumentSuccessResponse) metrics = response.metrics - @test isa(metrics, Dict{String,Any}) - @test metrics["timer_rego_query_eval_ns"] >= 0 + @test isa(metrics, Client.GetDocumentSuccessResponseMetrics) + @test metrics.additional_properties["timer_rego_query_eval_ns"] >= 0 result = response.result @test isa(result, Vector) @test length(result) == 2 @@ -280,27 +283,27 @@ function runtests() @test !istaskdone(opa_server.monitor_task[]) # create the client - openapi_client = OpenAPI.Clients.Client("http://localhost:8181"; escape_path_params=false) + client = Client.Client("http://localhost:8181") @testset "Data API" begin - test_data_api(openapi_client) + test_data_api(client) end @testset "Config API" begin - test_config_api(openapi_client) + test_config_api(client) end @testset "Status API" begin - test_status_api(openapi_client) + test_status_api(client) end @testset "Health API" begin - test_health_api(openapi_client) + test_health_api(client) end @testset "Policy API" begin - test_policy_api(openapi_client) + test_policy_api(client) end @testset "Compile API" begin - test_compile_api(openapi_client) + test_compile_api(client) end @testset "Query API" begin - test_query_api(openapi_client) + test_query_api(client) end finally @info("Stopping OPA server") @@ -320,12 +323,12 @@ function runtests() @test !istaskdone(opa_server.monitor_task[]) # create the client - openapi_client = OpenAPI.Clients.Client("http://localhost:8181"; escape_path_params=false) + client = Client.Client("http://localhost:8181") @testset "Status API" begin - test_status_api(openapi_client) + test_status_api(client) end @testset "Health API" begin - test_health_api(openapi_client) + test_health_api(client) end finally @info("Stopping OPA server") diff --git a/test/test_utils.jl b/test/test_utils.jl index dee6aac..ce8e16e 100644 --- a/test/test_utils.jl +++ b/test/test_utils.jl @@ -68,8 +68,8 @@ function policy_path() return joinpath(policy_package, rule_name) end -function query_user(opa_client, username) - request_body = Dict{String,Any}("input" => Dict{String,Any}("name" => username)) - response, http_resp = OpenPolicyAgent.Client.get_document_with_path(opa_client, policy_path(), request_body; pretty=true, provenance=true, explain=true, metrics=true, instrument=true); +function query_user(client, username) + request_body = Client.InputSchema(; input = Dict{String,Any}("name" => username)) + response = Client.getdocumentwithpath(policy_path(), request_body; pretty=true, provenance=true, explain=EXPLAIN_FULL, metrics=true, instrument=true, client) return response.result end