From 576f3e8096b8e4880923f096830b3e6f27ec2ddc Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 4 Aug 2026 02:09:11 +0000 Subject: [PATCH 01/16] chore(internal): codegen related update --- scripts/upload-artifacts | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/upload-artifacts b/scripts/upload-artifacts index 10f3c705..5c1fbefc 100755 --- a/scripts/upload-artifacts +++ b/scripts/upload-artifacts @@ -91,6 +91,7 @@ generate_instructions() { Maven Repo +

Stainless SDK Maven Repository

From aa54ceb20bdd0634c88e29c55b8c189b014b21b4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 14 Aug 2026 05:01:35 +0000 Subject: [PATCH 02/16] fix(docs): link the javadoc badge so the version stays current after release --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d8bbe81e..7ecfe780 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Maven Central](https://img.shields.io/maven-central/v/com.openlayer.api/openlayer-java)](https://central.sonatype.com/artifact/com.openlayer.api/openlayer-java/0.10.0) -[![javadoc](https://javadoc.io/badge2/com.openlayer.api/openlayer-java/0.10.0/javadoc.svg)](https://javadoc.io/doc/com.openlayer.api/openlayer-java/0.10.0) +[![javadoc](https://javadoc.io/badge2/com.openlayer.api/openlayer-java/javadoc.svg)](https://javadoc.io/doc/com.openlayer.api/openlayer-java/0.10.0) From 2733a53794639dddf53420c065bf91f09297d9c2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 18 Aug 2026 04:13:02 +0000 Subject: [PATCH 03/16] chore(internal): codegen related update --- openlayer-java-core/build.gradle.kts | 1 + 1 file changed, 1 insertion(+) diff --git a/openlayer-java-core/build.gradle.kts b/openlayer-java-core/build.gradle.kts index 396e8396..7655ccfd 100644 --- a/openlayer-java-core/build.gradle.kts +++ b/openlayer-java-core/build.gradle.kts @@ -38,4 +38,5 @@ dependencies { testImplementation("org.mockito:mockito-core:5.14.2") testImplementation("org.mockito:mockito-junit-jupiter:5.14.2") testImplementation("org.mockito.kotlin:mockito-kotlin:4.1.0") + testImplementation("org.slf4j:slf4j-nop:1.7.36") } From 3460d6cfa3b95eabb956c5af0feaa7102287b59c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 20 Aug 2026 04:24:14 +0000 Subject: [PATCH 04/16] chore(internal): allow the mock server port to be set with STAINLESS_MOCK_PORT --- scripts/mock | 13 ++++++++++--- scripts/test | 12 +++++++++--- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/scripts/mock b/scripts/mock index feebe5ed..984e1c00 100755 --- a/scripts/mock +++ b/scripts/mock @@ -4,6 +4,11 @@ set -e cd "$(dirname "$0")/.." +if [ "$1" == "--install" ]; then + npm exec --package=@stdy/cli@0.22.1 -- steady --version + exit 0 +fi + if [[ -n "$1" && "$1" != '--'* ]]; then URL="$1" shift @@ -20,16 +25,18 @@ fi echo "==> Starting mock server with URL ${URL}" # Run steady mock on the given spec +MOCK_PORT="${STAINLESS_MOCK_PORT:-4010}" + if [ "$1" == "--daemon" ]; then # Pre-install the package so the download doesn't eat into the startup timeout npm exec --package=@stdy/cli@0.22.1 -- steady --version - npm exec --package=@stdy/cli@0.22.1 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=comma --validator-form-array-format=comma --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL" &> .stdy.log & + npm exec --package=@stdy/cli@0.22.1 -- steady --host 127.0.0.1 -p "$MOCK_PORT" --validator-query-array-format=comma --validator-form-array-format=comma --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL" &> .stdy.log & # Wait for server to come online via health endpoint (max 30s) echo -n "Waiting for server" attempts=0 - while ! curl --silent --fail "http://127.0.0.1:4010/_x-steady/health" >/dev/null 2>&1; do + while ! curl --silent --fail "http://127.0.0.1:$MOCK_PORT/_x-steady/health" >/dev/null 2>&1; do if ! kill -0 $! 2>/dev/null; then echo cat .stdy.log @@ -48,5 +55,5 @@ if [ "$1" == "--daemon" ]; then echo else - npm exec --package=@stdy/cli@0.22.1 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=comma --validator-form-array-format=comma --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL" + npm exec --package=@stdy/cli@0.22.1 -- steady --host 127.0.0.1 -p "$MOCK_PORT" --validator-query-array-format=comma --validator-form-array-format=comma --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL" fi diff --git a/scripts/test b/scripts/test index 7d7f08e3..29eb2fa9 100755 --- a/scripts/test +++ b/scripts/test @@ -9,8 +9,10 @@ GREEN='\033[0;32m' YELLOW='\033[0;33m' NC='\033[0m' # No Color +MOCK_PORT="${STAINLESS_MOCK_PORT:-4010}" + function steady_is_running() { - curl --silent "http://127.0.0.1:4010/_x-steady/health" >/dev/null 2>&1 + curl --silent "http://127.0.0.1:$MOCK_PORT/_x-steady/health" >/dev/null 2>&1 } kill_server_on_port() { @@ -27,7 +29,7 @@ function is_overriding_api_base_url() { if ! is_overriding_api_base_url && ! steady_is_running ; then # When we exit this script, make sure to kill the background mock server process - trap 'kill_server_on_port 4010' EXIT + trap 'kill_server_on_port "$MOCK_PORT"' EXIT # Start the dev server ./scripts/mock --daemon @@ -43,7 +45,7 @@ elif ! steady_is_running ; then echo -e "To run the server, pass in the path or url of your OpenAPI" echo -e "spec to the steady command:" echo - echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.22.1 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-query-array-format=comma --validator-form-array-format=comma --validator-query-object-format=brackets --validator-form-object-format=brackets${NC}" + echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.22.1 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p $MOCK_PORT --validator-query-array-format=comma --validator-form-array-format=comma --validator-query-object-format=brackets --validator-form-object-format=brackets${NC}" echo exit 1 @@ -52,5 +54,9 @@ else echo fi +if [ -n "${STAINLESS_MOCK_PORT:-}" ] && ! is_overriding_api_base_url ; then + export TEST_API_BASE_URL="http://127.0.0.1:$MOCK_PORT" +fi + echo "==> Running tests" ./gradlew test "$@" From 013d4a6692e44912d1a0b5e1000545aa241ec2ac Mon Sep 17 00:00:00 2001 From: Jon Harrell <4829245+jharrell@users.noreply.github.com> Date: Tue, 25 Aug 2026 09:06:47 -0500 Subject: [PATCH 05/16] feat: initial stlc build Stainless-Generated-From: 129181c0add10a6b9836d1a03dc2824d83abbdd7 --- .github/workflows/release-please.yml | 20 ++++++++++++++++++ .stats.yml | 2 -- README.md | 2 +- examples/.keep | 4 ---- openlayer-java-core/build.gradle.kts | 1 + openlayer-java-example/build.gradle.kts | 3 ++- release-please-config.json | 4 ++-- scripts/mock | 28 ++++++++++++++++--------- scripts/test | 12 ++++++++--- scripts/upload-artifacts | 1 + 10 files changed, 54 insertions(+), 23 deletions(-) create mode 100644 .github/workflows/release-please.yml delete mode 100644 examples/.keep diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 00000000..e9c93560 --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,20 @@ +name: Release Please +on: + push: + branches: + - main + +permissions: + contents: write + pull-requests: write + +jobs: + release-please: + if: github.repository == 'openlayer-ai/openlayer-java' + runs-on: ubuntu-latest + + steps: + - uses: googleapis/release-please-action@5c625bfb5d1ff62eadeeb3772007f7f66fdcf071 # v4.4.1 + id: release + with: + token: ${{ secrets.RELEASE_PLEASE_TOKEN }} diff --git a/.stats.yml b/.stats.yml index 60080a09..e8ba8c9f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,3 +1 @@ configured_endpoints: 32 -openapi_spec_hash: 72e2dd8871904fe6c130d1c81b033d5a -config_hash: f75dd97d47c446f8fdc8bcb36f445eea diff --git a/README.md b/README.md index d8bbe81e..7ecfe780 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Maven Central](https://img.shields.io/maven-central/v/com.openlayer.api/openlayer-java)](https://central.sonatype.com/artifact/com.openlayer.api/openlayer-java/0.10.0) -[![javadoc](https://javadoc.io/badge2/com.openlayer.api/openlayer-java/0.10.0/javadoc.svg)](https://javadoc.io/doc/com.openlayer.api/openlayer-java/0.10.0) +[![javadoc](https://javadoc.io/badge2/com.openlayer.api/openlayer-java/javadoc.svg)](https://javadoc.io/doc/com.openlayer.api/openlayer-java/0.10.0) diff --git a/examples/.keep b/examples/.keep deleted file mode 100644 index d8c73e93..00000000 --- a/examples/.keep +++ /dev/null @@ -1,4 +0,0 @@ -File generated from our OpenAPI spec by Stainless. - -This directory can be used to store example files demonstrating usage of this SDK. -It is ignored by Stainless code generation and its content (other than this keep file) won't be touched. \ No newline at end of file diff --git a/openlayer-java-core/build.gradle.kts b/openlayer-java-core/build.gradle.kts index 396e8396..7655ccfd 100644 --- a/openlayer-java-core/build.gradle.kts +++ b/openlayer-java-core/build.gradle.kts @@ -38,4 +38,5 @@ dependencies { testImplementation("org.mockito:mockito-core:5.14.2") testImplementation("org.mockito:mockito-junit-jupiter:5.14.2") testImplementation("org.mockito.kotlin:mockito-kotlin:4.1.0") + testImplementation("org.slf4j:slf4j-nop:1.7.36") } diff --git a/openlayer-java-example/build.gradle.kts b/openlayer-java-example/build.gradle.kts index 150fb60e..1fa6ecb0 100644 --- a/openlayer-java-example/build.gradle.kts +++ b/openlayer-java-example/build.gradle.kts @@ -8,7 +8,8 @@ repositories { } dependencies { - implementation(project(":openlayer-java")) + implementation(project(":openlayer-java-core")) + implementation(project(":openlayer-java-client-okhttp")) } tasks.withType().configureEach { diff --git a/release-please-config.json b/release-please-config.json index 8f987198..0a47df51 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -2,11 +2,11 @@ "packages": { ".": {} }, - "$schema": "https://raw.githubusercontent.com/stainless-api/release-please/main/schemas/config.json", + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", "include-v-in-tag": true, "include-component-in-tag": false, "versioning": "prerelease", - "prerelease": true, + "prerelease": false, "bump-minor-pre-major": true, "bump-patch-for-minor-pre-major": false, "pull-request-header": "Automated Release PR", diff --git a/scripts/mock b/scripts/mock index feebe5ed..474f5a99 100755 --- a/scripts/mock +++ b/scripts/mock @@ -4,32 +4,40 @@ set -e cd "$(dirname "$0")/.." +if [ "$1" == "--install" ]; then + npm exec --package=@stdy/cli@0.22.1 -- steady --version + exit 0 +fi + if [[ -n "$1" && "$1" != '--'* ]]; then URL="$1" shift +elif [ -n "$STAINLESS_OPENAPI_SPEC_URL" ]; then + URL="$STAINLESS_OPENAPI_SPEC_URL" else - URL="$(grep 'openapi_spec_url' .stats.yml | cut -d' ' -f2)" -fi - -# Check if the URL is empty -if [ -z "$URL" ]; then - echo "Error: No OpenAPI spec path/url provided or found in .stats.yml" - exit 1 + # Embedded OpenAPI spec (base64-encoded, gzipped) + EMBEDDED_SPEC="H4sIAAAAAAAAE+19i1cbObL3v6Lbe78DzLXNmyTeZXdJYGa5AwmXx8y3X+Ajwi3bvWl3e/oB8XL8v99TpUdL3ep229gECHvOngltPUpSqar0U1Xp3gmHLKBDz2k7m6211qbTcLygGzrte6cTBgntJPBPNqCe77SdOB0Owyj5O1Ty6YhFrU44cBpOQAfMaTuf5Gen4aQRVOgnyTBur64aFVadccNxWdyJvGHihYHTdvZODkk3jIgXJCyincQLeuTOS/ok6TOimiUxi25Z1HIaTuIlvtEl2Ts5dBrOLYti3uR6a81pON+aftjD4ZgEwddWx2c0uvESJMoc03jccHhvsdP+nK9Nh17LHNLtupMf06c0IsModMkN7XxlgeuMr6DNThp5yQgbvWE0YtFemvSd9ucr+HlIk34M1K7ehdHXeEg7LF69V/8+dMfwY4/hqsTpYECjkdN2TlkSeeyWEUpUWXIzIl4Sk8N9mK9wyCIKhB26Thsa+F2Wez86dAu0T25wSCM6YImcn/+MWNdpO39a7YSDY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VH/GZ3aWbWoCOzU2rZtG0gE527Q8jrS4fRuaP1PXaNnP2nzoHs+iPq3bXPy8tT1z5tqctzSFNDirgxBfg+7AraXm6RTogai1dtTCZA8XOuIp6bqUvWlvv21vLFb+oOCZki5jxiQLTr+v9kVVcsOSO8YCMUk0cE2qluE5ALiLjlknDNx4JfdI6vabndbm1vqD5JWoyYVvXDERKLPkFqvvv1Lm5q+rxsN9kWYKsZ+ON0QHIekEbqHls4aowr9gW10tQqTaZ2K+QtXax1prbWM78/ecuR9RP9/VBNba2F5rYXoxqzwocVMX+dXQxUBte6haZCrqugjxUf9Ek7nKxXXGPsXembrLMU+K7p6Gd3VuXE01oe4jr6Pw7tpQGlZvoXykf746QnAx66SRl4zOwCgWRyZGIxbtga9o1gOkHpO2MzqjYKHCLL3HzzlfE9Jn1BU2C8jpMBqQL6LkX3An/PVLQ+QV/SI/gBMths5kLi17J4fkKxu1yBlj5PPPXuDyEuL71bLMj3Z3d5fLj+aGnXhVtdSkgSvx6ni16wVuExpq0qHX/MpGK8jDgxDjdzjvg8fMZYCXCv8LIf3XxbcJAgA=" + SPEC_TMPFILE="$(mktemp)" + trap 'rm -f "$SPEC_TMPFILE"' EXIT + echo "$EMBEDDED_SPEC" | base64 --decode | gunzip > "$SPEC_TMPFILE" + URL="$SPEC_TMPFILE" fi echo "==> Starting mock server with URL ${URL}" # Run steady mock on the given spec +MOCK_PORT="${STAINLESS_MOCK_PORT:-4010}" + if [ "$1" == "--daemon" ]; then # Pre-install the package so the download doesn't eat into the startup timeout npm exec --package=@stdy/cli@0.22.1 -- steady --version - npm exec --package=@stdy/cli@0.22.1 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=comma --validator-form-array-format=comma --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL" &> .stdy.log & + npm exec --package=@stdy/cli@0.22.1 -- steady --host 127.0.0.1 -p "$MOCK_PORT" --validator-query-array-format=comma --validator-form-array-format=comma --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL" &> .stdy.log & # Wait for server to come online via health endpoint (max 30s) echo -n "Waiting for server" attempts=0 - while ! curl --silent --fail "http://127.0.0.1:4010/_x-steady/health" >/dev/null 2>&1; do + while ! curl --silent --fail "http://127.0.0.1:$MOCK_PORT/_x-steady/health" >/dev/null 2>&1; do if ! kill -0 $! 2>/dev/null; then echo cat .stdy.log @@ -48,5 +56,5 @@ if [ "$1" == "--daemon" ]; then echo else - npm exec --package=@stdy/cli@0.22.1 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=comma --validator-form-array-format=comma --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL" + npm exec --package=@stdy/cli@0.22.1 -- steady --host 127.0.0.1 -p "$MOCK_PORT" --validator-query-array-format=comma --validator-form-array-format=comma --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL" fi diff --git a/scripts/test b/scripts/test index 7d7f08e3..29eb2fa9 100755 --- a/scripts/test +++ b/scripts/test @@ -9,8 +9,10 @@ GREEN='\033[0;32m' YELLOW='\033[0;33m' NC='\033[0m' # No Color +MOCK_PORT="${STAINLESS_MOCK_PORT:-4010}" + function steady_is_running() { - curl --silent "http://127.0.0.1:4010/_x-steady/health" >/dev/null 2>&1 + curl --silent "http://127.0.0.1:$MOCK_PORT/_x-steady/health" >/dev/null 2>&1 } kill_server_on_port() { @@ -27,7 +29,7 @@ function is_overriding_api_base_url() { if ! is_overriding_api_base_url && ! steady_is_running ; then # When we exit this script, make sure to kill the background mock server process - trap 'kill_server_on_port 4010' EXIT + trap 'kill_server_on_port "$MOCK_PORT"' EXIT # Start the dev server ./scripts/mock --daemon @@ -43,7 +45,7 @@ elif ! steady_is_running ; then echo -e "To run the server, pass in the path or url of your OpenAPI" echo -e "spec to the steady command:" echo - echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.22.1 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-query-array-format=comma --validator-form-array-format=comma --validator-query-object-format=brackets --validator-form-object-format=brackets${NC}" + echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.22.1 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p $MOCK_PORT --validator-query-array-format=comma --validator-form-array-format=comma --validator-query-object-format=brackets --validator-form-object-format=brackets${NC}" echo exit 1 @@ -52,5 +54,9 @@ else echo fi +if [ -n "${STAINLESS_MOCK_PORT:-}" ] && ! is_overriding_api_base_url ; then + export TEST_API_BASE_URL="http://127.0.0.1:$MOCK_PORT" +fi + echo "==> Running tests" ./gradlew test "$@" diff --git a/scripts/upload-artifacts b/scripts/upload-artifacts index 10f3c705..5c1fbefc 100755 --- a/scripts/upload-artifacts +++ b/scripts/upload-artifacts @@ -91,6 +91,7 @@ generate_instructions() { Maven Repo +

Stainless SDK Maven Repository

From dae544a6273a7f4b1229de293b1c3d2054f09dd0 Mon Sep 17 00:00:00 2001 From: Jon Harrell <4829245+jharrell@users.noreply.github.com> Date: Tue, 25 Aug 2026 09:19:13 -0500 Subject: [PATCH 06/16] ci: add stlc promote and back-sync workflows --- .github/workflows/stlc-promote.yml | 80 ++++++++++ .github/workflows/stlc-sync.yml | 225 +++++++++++++++++++++++++++++ 2 files changed, 305 insertions(+) create mode 100644 .github/workflows/stlc-promote.yml create mode 100644 .github/workflows/stlc-sync.yml diff --git a/.github/workflows/stlc-promote.yml b/.github/workflows/stlc-promote.yml new file mode 100644 index 00000000..4b212ec8 --- /dev/null +++ b/.github/workflows/stlc-promote.yml @@ -0,0 +1,80 @@ +# NOTE(stlc migration, 2026-08-25): repo names below point at the +# stainless-sdks placeholder repos used to validate the migration. +# At cutover, replace: +# - the production repo with openlayer-ai/openlayer-java +# - the staging/config repo owner with your own org after transfer +name: Promote SDKs + +# Promote staging to production by fast-forwarding production main up to staging, +# preserving SHAs so the trunks stay identical and linear (nothing to heal on the +# next stlc build). Manual dispatch by design: a maintainer promotes the accumulated +# batch to cut a release; release-please then opens its version PR on production. +on: + workflow_dispatch: {} + +permissions: + contents: read + +jobs: + promote: + # Runner comes from the STLC_RUNNER repo/org variable when set; defaults to GitHub-hosted. + runs-on: ${{ vars.STLC_RUNNER || 'ubuntu-latest' }} + if: github.repository == 'stainless-sdks/openlayer-java-staging' + # Optional gate: add required reviewers to this environment to approve each + # promote. With none it only scopes secrets and adds no gate. Remove if unused. + environment: production + env: + PRODUCTION_REPO: stainless-sdks/openlayer-java-prod + GH_TOKEN: ${{ secrets.PRODUCTION_REPO_TOKEN }} + steps: + - name: Check out staging + uses: actions/checkout@v6 + with: + fetch-depth: 0 + persist-credentials: false + + - name: Fetch production main + run: | + git remote add production \ + "https://x-access-token:${GH_TOKEN}@github.com/${PRODUCTION_REPO}.git" + git fetch production main + + - name: Check whether production already has staging's content + id: diff + run: | + # After a release, production has release-please commits staging lacks, so compare trees. + MERGED=$(git merge-tree --write-tree production/main origin/main) || MERGED=conflict + PRODUCTION_TREE=$(git rev-parse 'production/main^{tree}') + if [ "$MERGED" = "$PRODUCTION_TREE" ]; then + echo "Production already contains staging's content. Nothing to promote." + echo "synced=true" >> "$GITHUB_OUTPUT" + else + echo "synced=false" >> "$GITHUB_OUTPUT" + fi + + - name: Promote staging to production (fast-forward) + if: steps.diff.outputs.synced == 'false' + run: | + # Refuse unless production is an ancestor of staging: otherwise the trunks + # have forked (production advanced without a back-sync) and FF is unsafe. + if ! git merge-base --is-ancestor production/main origin/main; then + echo "::error title=Promote blocked::production/main is not an ancestor of staging main. Back-sync production into staging first." + exit 1 + fi + git push production origin/main:refs/heads/main + echo "Fast-forwarded production/main to staging/main." + + - name: Alert on failure + if: failure() + env: + ALERT_WEBHOOK_URL: ${{ secrets.STLC_ALERT_WEBHOOK_URL }} + run: | + run_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" + msg="stlc promote failed in ${{ github.repository }}. A stalled promote or back-sync lets custom-code tracking drift, which later builds refuse on — investigate before the next build. Run: $run_url" + echo "::error title=stlc workflow failed::$msg" + { echo "### ⚠️ stlc workflow failed"; echo ""; echo "$msg"; } >> "$GITHUB_STEP_SUMMARY" + if [ -n "${ALERT_WEBHOOK_URL:-}" ]; then + curl -sS -X POST -H 'Content-Type: application/json' \ + -d "$(jq -n --arg text "$msg" '{text:$text}')" "$ALERT_WEBHOOK_URL" \ + || echo "::warning::Alert webhook POST failed" + fi diff --git a/.github/workflows/stlc-sync.yml b/.github/workflows/stlc-sync.yml new file mode 100644 index 00000000..2051d379 --- /dev/null +++ b/.github/workflows/stlc-sync.yml @@ -0,0 +1,225 @@ +# NOTE(stlc migration, 2026-08-25): repo names below point at the +# stainless-sdks placeholder repos used to validate the migration. +# At cutover, replace: +# - the production repo with openlayer-ai/openlayer-java +# - the staging/config repo owner with your own org after transfer +name: Sync SDK repos + +# Keeps the staging and production trunks in sync and the config repo's +# tracking files fresh. Each job self-routes by repo + event, so this one file +# can live in both repos and only the right job runs. The dispatch jobs are +# eager-only (the polls cover them) and no-op when their token isn't set. +on: + schedule: + # back-sync poll: a cheap pure-git check, twice hourly so an unsynced production + # change (e.g. a community PR between releases) can't hold codegen for long. + - cron: '7,37 * * * *' + workflow_dispatch: {} + repository_dispatch: + types: [prod-released] + release: + types: [published] + push: + # main only. stlc preview/integrated/codegen branches never push to main. + branches: [main] + +jobs: + back-sync: + # Fast-forward production main back onto staging so the trunks stay identical. + # Runner comes from the STLC_RUNNER repo/org variable when set; defaults to GitHub-hosted. + runs-on: ${{ vars.STLC_RUNNER || 'ubuntu-latest' }} + if: >- + github.repository == 'stainless-sdks/openlayer-java-staging' && + (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'repository_dispatch') + permissions: + contents: write + concurrency: + group: stlc-back-sync + cancel-in-progress: true + env: + PRODUCTION_REPO: stainless-sdks/openlayer-java-prod + steps: + - name: Check out staging + uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Fetch production main + env: + PRODUCTION_REPO_TOKEN: ${{ secrets.PRODUCTION_REPO_TOKEN }} + run: | + # Public production reads with no credential; a private production + # repo needs PRODUCTION_REPO_TOKEN (the same token the promote uses). + if [ -n "${PRODUCTION_REPO_TOKEN:-}" ]; then + git remote add production "https://x-access-token:${PRODUCTION_REPO_TOKEN}@github.com/${PRODUCTION_REPO}.git" + else + git remote add production "https://github.com/${PRODUCTION_REPO}.git" + fi + # actions/checkout persists this repo's token as an auth header, which + # outranks the remote URL credential; blank it for this fetch only. + git -c "http.https://github.com/.extraheader=" fetch production main + + - name: Check whether production has content staging lacks + id: diff + run: | + # Content compare: would merging production into staging change its tree? + # If not, staging already has production's content (release-please commits). + MERGED=$(git merge-tree --write-tree origin/main production/main) || MERGED=conflict + STAGING_TREE=$(git rev-parse 'origin/main^{tree}') + if [ "$MERGED" = "$STAGING_TREE" ]; then + echo "Staging already has production's content. Nothing to pull back." + echo "behind=false" >> "$GITHUB_OUTPUT" + else + echo "behind=true" >> "$GITHUB_OUTPUT" + fi + + - name: Sync production to staging (fast-forward) + if: steps.diff.outputs.behind == 'true' + run: | + # Refuse unless staging is an ancestor of production: otherwise the + # trunks have forked and a fast-forward would be unsafe. + if ! git merge-base --is-ancestor origin/main production/main; then + echo "::error title=Back-sync blocked::staging main is not an ancestor of production/main." + exit 1 + fi + git push origin production/main:refs/heads/main + echo "Fast-forwarded staging/main to production/main." + + - name: Alert on failure + if: failure() + env: + ALERT_WEBHOOK_URL: ${{ secrets.STLC_ALERT_WEBHOOK_URL }} + run: | + run_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" + msg="stlc back-sync (sync from production) failed in ${{ github.repository }}. A stalled back-sync lets custom-code tracking drift, which later builds refuse on — investigate before the next build. Run: $run_url" + echo "::error title=stlc workflow failed::$msg" + { echo "### ⚠️ stlc workflow failed"; echo ""; echo "$msg"; } >> "$GITHUB_STEP_SUMMARY" + if [ -n "${ALERT_WEBHOOK_URL:-}" ]; then + curl -sS -X POST -H 'Content-Type: application/json' \ + -d "$(jq -n --arg text "$msg" '{text:$text}')" "$ALERT_WEBHOOK_URL" \ + || echo "::warning::Alert webhook POST failed" + fi + + notify-back-sync: + # On a published release, tell staging to back-sync now instead of waiting for + # the poll. Dispatch-only: it cannot write production or staging contents. + runs-on: ${{ vars.STLC_RUNNER || 'ubuntu-latest' }} + if: >- + github.repository == 'stainless-sdks/openlayer-java-prod' && + (github.event_name == 'release' || github.event_name == 'workflow_dispatch') + permissions: + contents: read + env: + STAGING_REPO: stainless-sdks/openlayer-java-staging + steps: + - name: Dispatch back-sync to staging + env: + DISPATCH_TOKEN: ${{ secrets.STAGING_DISPATCH_TOKEN }} + REF_NAME: ${{ github.ref_name }} + run: | + set -euo pipefail + + if [ -z "${DISPATCH_TOKEN:-}" ]; then + echo "::notice::STAGING_DISPATCH_TOKEN not configured — skipping the eager back-sync notify. The staging repo's twice-hourly poll covers this." + exit 0 + fi + + payload=$(jq -n --arg ref "$REF_NAME" '{event_type:"prod-released",client_payload:{ref:$ref}}') + code=$(curl -sS -o /tmp/dispatch.txt -w '%{http_code}' -X POST \ + -H "Authorization: Bearer ${DISPATCH_TOKEN}" \ + -H "Accept: application/vnd.github+json" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + "https://api.github.com/repos/${STAGING_REPO}/dispatches" \ + -d "$payload") + if [ "$code" = "204" ]; then + echo "Back-sync dispatched to ${STAGING_REPO}." + else + echo "Dispatch failed (HTTP $code)" >&2; cat /tmp/dispatch.txt >&2; exit 1 + fi + + - name: Alert on failure + if: failure() + env: + ALERT_WEBHOOK_URL: ${{ secrets.STLC_ALERT_WEBHOOK_URL }} + run: | + run_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" + msg="stlc release back-sync trigger failed in ${{ github.repository }} — the staging repo was NOT notified to back-sync this release (likely an expired STAGING_DISPATCH_TOKEN). Staging catches up on its next poll, but verify the token. Run: $run_url" + echo "::error title=stlc workflow failed::$msg" + { echo "### ⚠️ stlc workflow failed"; echo ""; echo "$msg"; } >> "$GITHUB_STEP_SUMMARY" + if [ -n "${ALERT_WEBHOOK_URL:-}" ]; then + curl -sS -X POST -H 'Content-Type: application/json' \ + -d "$(jq -n --arg text "$msg" '{text:$text}')" "$ALERT_WEBHOOK_URL" \ + || echo "::warning::Alert webhook POST failed" + fi + + seal-dispatch: + # When out-of-band custom code lands on staging main, tell the config repo to + # re-seal now instead of waiting for its scheduled sync. The loop guards skip + # stlc's own pushes, so the bot's commits can't trigger a re-seal loop. + runs-on: ${{ vars.STLC_RUNNER || 'ubuntu-latest' }} + if: >- + github.repository == 'stainless-sdks/openlayer-java-staging' && + github.event_name == 'push' + permissions: + contents: read + concurrency: + group: seal-dispatch-${{ github.ref }} + cancel-in-progress: false + env: + CONFIG_REPO: stainless-sdks/openlayer-config + steps: + - name: Loop-guard and send re-seal dispatch + env: + DISPATCH_TOKEN: ${{ secrets.CONFIG_DISPATCH_TOKEN }} + HEAD_MSG: ${{ github.event.head_commit.message }} + HEAD_AUTHOR_NAME: ${{ github.event.head_commit.author.name }} + SHA: ${{ github.sha }} + REPO: ${{ github.repository }} + run: | + set -euo pipefail + + # Loop guard 1: skip the stlc "Build SDK" squash commit (Stainless-Generated-From trailer). + if printf '%s' "$HEAD_MSG" | grep -q 'Stainless-Generated-From'; then + echo "Head commit is an stlc build — skipping re-seal dispatch." + exit 0 + fi + + # Loop guard 2: skip stlc-bot commits (e.g. a regeneration commit). + if [ "$HEAD_AUTHOR_NAME" = "stlc-bot" ]; then + echo "Head commit authored by stlc-bot — skipping re-seal dispatch." + exit 0 + fi + + if [ -z "${DISPATCH_TOKEN:-}" ]; then + echo "::notice::CONFIG_DISPATCH_TOKEN not configured — skipping the eager re-seal. The config repo's scheduled sync covers this." + exit 0 + fi + + payload=$(jq -n --arg sha "$SHA" --arg repo "$REPO" \ + '{event_type:"seal-custom-code",client_payload:{target:"all",sha:$sha,repo:$repo}}') + code=$(curl -sS -o /tmp/dispatch.txt -w '%{http_code}' -X POST \ + -H "Authorization: Bearer ${DISPATCH_TOKEN}" \ + -H "Accept: application/vnd.github+json" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + "https://api.github.com/repos/${CONFIG_REPO}/dispatches" \ + -d "$payload") + if [ "$code" = "204" ]; then + echo "Re-seal dispatched to ${CONFIG_REPO}." + else + echo "Dispatch failed (HTTP $code)" >&2; cat /tmp/dispatch.txt >&2; exit 1 + fi + + - name: Alert on failure + if: failure() + env: + ALERT_WEBHOOK_URL: ${{ secrets.STLC_ALERT_WEBHOOK_URL }} + run: | + run_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" + msg="stlc seal-dispatch failed in ${{ github.repository }} — the config repo was NOT notified to re-seal (likely an expired CONFIG_DISPATCH_TOKEN). The config repo's scheduled sync is the backstop, but verify the token. Run: $run_url" + echo "::error title=stlc workflow failed::$msg" + { echo "### ⚠️ stlc workflow failed"; echo ""; echo "$msg"; } >> "$GITHUB_STEP_SUMMARY" + if [ -n "${ALERT_WEBHOOK_URL:-}" ]; then + curl -sS -X POST -H 'Content-Type: application/json' \ + -d "$(jq -n --arg text "$msg" '{text:$text}')" "$ALERT_WEBHOOK_URL" \ + || echo "::warning::Alert webhook POST failed" + fi From 2cd45118be15cd53549202857e3675a939e8f33a Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Tue, 25 Aug 2026 17:55:29 +0000 Subject: [PATCH 07/16] feat(stlc): add stlc workspace and CI automation Stainless-Generated-From: 81b14ec50109111ba0147804538449c883544a98 --- scripts/mock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/mock b/scripts/mock index 474f5a99..099a4c9c 100755 --- a/scripts/mock +++ b/scripts/mock @@ -16,7 +16,7 @@ elif [ -n "$STAINLESS_OPENAPI_SPEC_URL" ]; then URL="$STAINLESS_OPENAPI_SPEC_URL" else # Embedded OpenAPI spec (base64-encoded, gzipped) - EMBEDDED_SPEC="H4sIAAAAAAAAE+19i1cbObL3v6Lbe78DzLXNmyTeZXdJYGa5AwmXx8y3X+Ajwi3bvWl3e/oB8XL8v99TpUdL3ep229gECHvOngltPUpSqar0U1Xp3gmHLKBDz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 'rm -f "$SPEC_TMPFILE"' EXIT echo "$EMBEDDED_SPEC" | base64 --decode | gunzip > "$SPEC_TMPFILE" From cc6b2fe9e219a7907bdb324f2e46ddf3cebd858e Mon Sep 17 00:00:00 2001 From: Jon Harrell <4829245+jharrell@users.noreply.github.com> Date: Thu, 27 Aug 2026 09:38:39 -0500 Subject: [PATCH 08/16] chore(ci): point stlc workflows at openlayer-ai --- .github/workflows/stlc-promote.yml | 11 ++++------- .github/workflows/stlc-sync.yml | 19 ++++++++----------- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/.github/workflows/stlc-promote.yml b/.github/workflows/stlc-promote.yml index 4b212ec8..80b41044 100644 --- a/.github/workflows/stlc-promote.yml +++ b/.github/workflows/stlc-promote.yml @@ -1,8 +1,5 @@ -# NOTE(stlc migration, 2026-08-25): repo names below point at the -# stainless-sdks placeholder repos used to validate the migration. -# At cutover, replace: -# - the production repo with openlayer-ai/openlayer-java -# - the staging/config repo owner with your own org after transfer +# NOTE(stlc migration): repo names below are set for openlayer-ai. CONFIG_REPO is +# left as a TODO -- set it to your config repo, then re-seal with `stlc build --push`. name: Promote SDKs # Promote staging to production by fast-forwarding production main up to staging, @@ -19,12 +16,12 @@ jobs: promote: # Runner comes from the STLC_RUNNER repo/org variable when set; defaults to GitHub-hosted. runs-on: ${{ vars.STLC_RUNNER || 'ubuntu-latest' }} - if: github.repository == 'stainless-sdks/openlayer-java-staging' + if: github.repository == 'openlayer-ai/openlayer-java-staging' # Optional gate: add required reviewers to this environment to approve each # promote. With none it only scopes secrets and adds no gate. Remove if unused. environment: production env: - PRODUCTION_REPO: stainless-sdks/openlayer-java-prod + PRODUCTION_REPO: openlayer-ai/openlayer-java GH_TOKEN: ${{ secrets.PRODUCTION_REPO_TOKEN }} steps: - name: Check out staging diff --git a/.github/workflows/stlc-sync.yml b/.github/workflows/stlc-sync.yml index 2051d379..fc0fb8e0 100644 --- a/.github/workflows/stlc-sync.yml +++ b/.github/workflows/stlc-sync.yml @@ -1,8 +1,5 @@ -# NOTE(stlc migration, 2026-08-25): repo names below point at the -# stainless-sdks placeholder repos used to validate the migration. -# At cutover, replace: -# - the production repo with openlayer-ai/openlayer-java -# - the staging/config repo owner with your own org after transfer +# NOTE(stlc migration): repo names below are set for openlayer-ai. CONFIG_REPO is +# left as a TODO -- set it to your config repo, then re-seal with `stlc build --push`. name: Sync SDK repos # Keeps the staging and production trunks in sync and the config repo's @@ -29,7 +26,7 @@ jobs: # Runner comes from the STLC_RUNNER repo/org variable when set; defaults to GitHub-hosted. runs-on: ${{ vars.STLC_RUNNER || 'ubuntu-latest' }} if: >- - github.repository == 'stainless-sdks/openlayer-java-staging' && + github.repository == 'openlayer-ai/openlayer-java-staging' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'repository_dispatch') permissions: contents: write @@ -37,7 +34,7 @@ jobs: group: stlc-back-sync cancel-in-progress: true env: - PRODUCTION_REPO: stainless-sdks/openlayer-java-prod + PRODUCTION_REPO: openlayer-ai/openlayer-java steps: - name: Check out staging uses: actions/checkout@v6 @@ -105,12 +102,12 @@ jobs: # the poll. Dispatch-only: it cannot write production or staging contents. runs-on: ${{ vars.STLC_RUNNER || 'ubuntu-latest' }} if: >- - github.repository == 'stainless-sdks/openlayer-java-prod' && + github.repository == 'openlayer-ai/openlayer-java' && (github.event_name == 'release' || github.event_name == 'workflow_dispatch') permissions: contents: read env: - STAGING_REPO: stainless-sdks/openlayer-java-staging + STAGING_REPO: openlayer-ai/openlayer-java-staging steps: - name: Dispatch back-sync to staging env: @@ -158,7 +155,7 @@ jobs: # stlc's own pushes, so the bot's commits can't trigger a re-seal loop. runs-on: ${{ vars.STLC_RUNNER || 'ubuntu-latest' }} if: >- - github.repository == 'stainless-sdks/openlayer-java-staging' && + github.repository == 'openlayer-ai/openlayer-java-staging' && github.event_name == 'push' permissions: contents: read @@ -166,7 +163,7 @@ jobs: group: seal-dispatch-${{ github.ref }} cancel-in-progress: false env: - CONFIG_REPO: stainless-sdks/openlayer-config + CONFIG_REPO: TODO-set-to-your-config-repo # e.g. openlayer-ai/openlayer-config steps: - name: Loop-guard and send re-seal dispatch env: From 558246d6f68f8f8fa61a230d86994af5eccda02c Mon Sep 17 00:00:00 2001 From: Vinicius Mello Date: Thu, 3 Sep 2026 13:00:36 -0300 Subject: [PATCH 09/16] Build SDK Stainless-Generated-From: 7286f84b91b4f8f61a6ae4262c9d59367397d26b --- scripts/mock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/mock b/scripts/mock index 099a4c9c..474f5a99 100755 --- a/scripts/mock +++ b/scripts/mock @@ -16,7 +16,7 @@ elif [ -n "$STAINLESS_OPENAPI_SPEC_URL" ]; then URL="$STAINLESS_OPENAPI_SPEC_URL" else # Embedded OpenAPI spec (base64-encoded, gzipped) - EMBEDDED_SPEC="H4sIAAAAAAAAA+19i1cbObL3v6Lbe78DzLXNmyTeZXdJYGa5AwmXx8y3X+Ajwi3bvWl3e/oB8XL8v99TpUdL3ep229gECHvOngltPUpSqar0U1Xp3gmHLKBDz2k7m6211qbTcLygGzrte6cTBgntJPBPNqCe77SdOB0Owyj5O1Ty6YhFrU44cBpOQAfMaTuf5Gen4aQRVOgnyTBur64aFVadccNxWdyJvGHihYHTdvZODkk3jIgXJCyincQLeuTOS/ok6TOimiUxi25Z1HIaTuIlvtEl2Ts5dBrOLYti3uR6a81pON+aftjD4ZgEwddWx2c0uvESJMoc03jccHhvsdP+nK9Nh17LHNLtupMf06c0IsModMkN7XxlgeuMr6DNThp5yQgbvWE0YtFemvSd9ucr+HlIk34M1K7ehdHXeEg7LF69V/8+dMfwY4/hqsTpYECjkdN2TlkSeeyWEUpUWXIzIl4Sk8N9mK9wyCIKhB26Thsa+F2Wez86dAu0T25wSCM6YImcn/+MWNdpO39a7YSDYRiwIIlXsyKr2ghwGiIWD8MgZjjWjbU1+E+eAl6CfPoVugNmZAEOmw6HvtfBwaz+K4bC907c6bMBhX/ZCOG/xqtqzM54PEYe7N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NnP2nzoHs+iPq3bXPy8tT1z5tqctzSFNDirgxBfg+7AraXm6RTogai1dtTCZA8XOuIp6bqUvWlvv21vLFb+oOCZki5jxiQLTr+v9kVVcsOSO8YCMUk0cE2qluE5ALiLjlknDNx4JfdI6vabndbm1vqD5JWoyYVvXDERKLPkFqvvv1Lm5q+rxsN9kWYKsZ+ON0QHIekEbqHls4aowr9gW10tQqTaZ2K+QtXax1prbWM78/ecuR9RP9/VBNba2F5rYXoxqzwocVMX+dXQxUBte6haZCrqugjxUf9Ek7nKxXXGPsXembrLMU+K7p6Gd3VuXE01oe4jr6Pw7tpQGlZvoXykf746QnAx66SRl4zOwCgWRyZGIxbtga9o1gOkHpO2MzqjYKHCLL3HzzlfE9Jn1BU2C8jpMBqQL6LkX3An/PVLQ+QV/SI/gBMths5kLi17J4fkKxu1yBlj5PPPXuDyEuL71bLMj3Z3d5fLj+aGnXhVtdSkgSvx6ni16wVuExpq0qHX/MpGK8jDgxDjdzjvg8fMZYCXCv8LIf3XxbcJAgA=" SPEC_TMPFILE="$(mktemp)" trap 'rm -f "$SPEC_TMPFILE"' EXIT echo "$EMBEDDED_SPEC" | base64 --decode | gunzip > "$SPEC_TMPFILE" From 3f92890a84d9e9df6e1f672359d7eabd88682284 Mon Sep 17 00:00:00 2001 From: Vinicius Mello Date: Thu, 3 Sep 2026 13:12:36 -0300 Subject: [PATCH 10/16] ci(stlc): route promote/sync workflows to the openlayer-ai repo names The transferred staging repos live at openlayer-ai/openlayer--staging-new, but the shipped stlc-promote.yml / stlc-sync.yml gates named openlayer--staging (and openlayer-typescript-staging for TS), so every job was being skipped silently. Point the `github.repository ==` gates and STAGING_REPO at the real slugs and set CONFIG_REPO to the stlc config repo. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01XwEaNPPVYspSLwxPo3yquG --- .github/workflows/stlc-promote.yml | 4 +--- .github/workflows/stlc-sync.yml | 10 ++++------ 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/.github/workflows/stlc-promote.yml b/.github/workflows/stlc-promote.yml index 80b41044..808cccc5 100644 --- a/.github/workflows/stlc-promote.yml +++ b/.github/workflows/stlc-promote.yml @@ -1,5 +1,3 @@ -# NOTE(stlc migration): repo names below are set for openlayer-ai. CONFIG_REPO is -# left as a TODO -- set it to your config repo, then re-seal with `stlc build --push`. name: Promote SDKs # Promote staging to production by fast-forwarding production main up to staging, @@ -16,7 +14,7 @@ jobs: promote: # Runner comes from the STLC_RUNNER repo/org variable when set; defaults to GitHub-hosted. runs-on: ${{ vars.STLC_RUNNER || 'ubuntu-latest' }} - if: github.repository == 'openlayer-ai/openlayer-java-staging' + if: github.repository == 'openlayer-ai/openlayer-java-staging-new' # Optional gate: add required reviewers to this environment to approve each # promote. With none it only scopes secrets and adds no gate. Remove if unused. environment: production diff --git a/.github/workflows/stlc-sync.yml b/.github/workflows/stlc-sync.yml index fc0fb8e0..d2d586b3 100644 --- a/.github/workflows/stlc-sync.yml +++ b/.github/workflows/stlc-sync.yml @@ -1,5 +1,3 @@ -# NOTE(stlc migration): repo names below are set for openlayer-ai. CONFIG_REPO is -# left as a TODO -- set it to your config repo, then re-seal with `stlc build --push`. name: Sync SDK repos # Keeps the staging and production trunks in sync and the config repo's @@ -26,7 +24,7 @@ jobs: # Runner comes from the STLC_RUNNER repo/org variable when set; defaults to GitHub-hosted. runs-on: ${{ vars.STLC_RUNNER || 'ubuntu-latest' }} if: >- - github.repository == 'openlayer-ai/openlayer-java-staging' && + github.repository == 'openlayer-ai/openlayer-java-staging-new' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'repository_dispatch') permissions: contents: write @@ -107,7 +105,7 @@ jobs: permissions: contents: read env: - STAGING_REPO: openlayer-ai/openlayer-java-staging + STAGING_REPO: openlayer-ai/openlayer-java-staging-new steps: - name: Dispatch back-sync to staging env: @@ -155,7 +153,7 @@ jobs: # stlc's own pushes, so the bot's commits can't trigger a re-seal loop. runs-on: ${{ vars.STLC_RUNNER || 'ubuntu-latest' }} if: >- - github.repository == 'openlayer-ai/openlayer-java-staging' && + github.repository == 'openlayer-ai/openlayer-java-staging-new' && github.event_name == 'push' permissions: contents: read @@ -163,7 +161,7 @@ jobs: group: seal-dispatch-${{ github.ref }} cancel-in-progress: false env: - CONFIG_REPO: TODO-set-to-your-config-repo # e.g. openlayer-ai/openlayer-config + CONFIG_REPO: openlayer-ai/openlayer-public-api steps: - name: Loop-guard and send re-seal dispatch env: From 4c46263ca504a15ca4879c049c15f69a43bdfb97 Mon Sep 17 00:00:00 2001 From: Vinicius Mello Date: Thu, 3 Sep 2026 15:02:36 -0300 Subject: [PATCH 11/16] ci(stlc): route promote/sync workflows to the renamed staging repos MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The staging repos were renamed openlayer--staging-new → openlayer--staging (legacy mirrors moved to -staging-old). Update the `github.repository ==` gates and STAGING_REPO accordingly so promote, back-sync and seal-dispatch keep running. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01XwEaNPPVYspSLwxPo3yquG --- .github/workflows/stlc-promote.yml | 2 +- .github/workflows/stlc-sync.yml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/stlc-promote.yml b/.github/workflows/stlc-promote.yml index 808cccc5..0c8f57a5 100644 --- a/.github/workflows/stlc-promote.yml +++ b/.github/workflows/stlc-promote.yml @@ -14,7 +14,7 @@ jobs: promote: # Runner comes from the STLC_RUNNER repo/org variable when set; defaults to GitHub-hosted. runs-on: ${{ vars.STLC_RUNNER || 'ubuntu-latest' }} - if: github.repository == 'openlayer-ai/openlayer-java-staging-new' + if: github.repository == 'openlayer-ai/openlayer-java-staging' # Optional gate: add required reviewers to this environment to approve each # promote. With none it only scopes secrets and adds no gate. Remove if unused. environment: production diff --git a/.github/workflows/stlc-sync.yml b/.github/workflows/stlc-sync.yml index d2d586b3..751210b1 100644 --- a/.github/workflows/stlc-sync.yml +++ b/.github/workflows/stlc-sync.yml @@ -24,7 +24,7 @@ jobs: # Runner comes from the STLC_RUNNER repo/org variable when set; defaults to GitHub-hosted. runs-on: ${{ vars.STLC_RUNNER || 'ubuntu-latest' }} if: >- - github.repository == 'openlayer-ai/openlayer-java-staging-new' && + github.repository == 'openlayer-ai/openlayer-java-staging' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'repository_dispatch') permissions: contents: write @@ -105,7 +105,7 @@ jobs: permissions: contents: read env: - STAGING_REPO: openlayer-ai/openlayer-java-staging-new + STAGING_REPO: openlayer-ai/openlayer-java-staging steps: - name: Dispatch back-sync to staging env: @@ -153,7 +153,7 @@ jobs: # stlc's own pushes, so the bot's commits can't trigger a re-seal loop. runs-on: ${{ vars.STLC_RUNNER || 'ubuntu-latest' }} if: >- - github.repository == 'openlayer-ai/openlayer-java-staging-new' && + github.repository == 'openlayer-ai/openlayer-java-staging' && github.event_name == 'push' permissions: contents: read From b1d58670595651deeff9addf5a6c2a2c9bdda072 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Thu, 3 Sep 2026 22:01:01 +0000 Subject: [PATCH 12/16] Build SDK Stainless-Generated-From: 39bef380b74dea5e4d728931c000440338a60806 --- scripts/mock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/mock b/scripts/mock index 474f5a99..099a4c9c 100755 --- a/scripts/mock +++ b/scripts/mock @@ -16,7 +16,7 @@ elif [ -n "$STAINLESS_OPENAPI_SPEC_URL" ]; then URL="$STAINLESS_OPENAPI_SPEC_URL" else # Embedded OpenAPI spec (base64-encoded, gzipped) - EMBEDDED_SPEC="H4sIAAAAAAAAE+19i1cbObL3v6Lbe78DzLXNmyTeZXdJYGa5AwmXx8y3X+Ajwi3bvWl3e/oB8XL8v99TpUdL3ep229gECHvOngltPUpSqar0U1Xp3gmHLKBDz2k7m6211qbTcLygGzrte6cTBgntJPBPNqCe77SdOB0Owyj5O1Ty6YhFrU44cBpOQAfMaTuf5Gen4a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48936b0b408e13e150eaea39d115d680dd48b4a Mon Sep 17 00:00:00 2001 From: Vinicius Mello Date: Wed, 9 Sep 2026 12:33:57 -0300 Subject: [PATCH 13/16] ci(stlc): promote via pull request; back-sync fast-forwards to descendants Production `main` is protected (PR + review) and should stay that way, so the promote no longer force-pushes main. It pushes staging's tip to `stlc/promote` on the production repo and opens/refreshes a PR listing the commits; the PR is the human review gate before publishing and must be merged with a merge commit. Back-sync now also fast-forwards when production is a strict descendant of staging with an identical tree (the merged promote PR), so codegen isn't held between the promote merge and the release commit. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01WL7jhZTnnSYDo5vECWpXUw --- .github/workflows/stlc-promote.yml | 42 ++++++++++++++++++++++++------ .github/workflows/stlc-sync.yml | 8 +++++- 2 files changed, 41 insertions(+), 9 deletions(-) diff --git a/.github/workflows/stlc-promote.yml b/.github/workflows/stlc-promote.yml index 0c8f57a5..4c65a7e6 100644 --- a/.github/workflows/stlc-promote.yml +++ b/.github/workflows/stlc-promote.yml @@ -1,9 +1,12 @@ name: Promote SDKs -# Promote staging to production by fast-forwarding production main up to staging, -# preserving SHAs so the trunks stay identical and linear (nothing to heal on the -# next stlc build). Manual dispatch by design: a maintainer promotes the accumulated -# batch to cut a release; release-please then opens its version PR on production. +# Promote staging to production by opening a pull request on the production repo +# whose head is staging main (pushed to the `stlc/promote` branch). Production `main` +# stays fully protected; the PR is the human review gate before publishing. It must +# be merged with a MERGE COMMIT (never squash/rebase) so the trunks keep shared +# history; back-sync then fast-forwards staging to the merge commit. Manual dispatch +# by design: a maintainer promotes the accumulated batch to cut a release; +# release-please then opens its version PR on production. on: workflow_dispatch: {} @@ -47,17 +50,40 @@ jobs: echo "synced=false" >> "$GITHUB_OUTPUT" fi - - name: Promote staging to production (fast-forward) + - name: Promote staging to production (pull request) if: steps.diff.outputs.synced == 'false' + env: + PROMOTE_BRANCH: stlc/promote run: | # Refuse unless production is an ancestor of staging: otherwise the trunks - # have forked (production advanced without a back-sync) and FF is unsafe. + # have forked (production advanced without a back-sync) and the PR would be + # a real merge. Back-sync production into staging first. if ! git merge-base --is-ancestor production/main origin/main; then echo "::error title=Promote blocked::production/main is not an ancestor of staging main. Back-sync production into staging first." exit 1 fi - git push production origin/main:refs/heads/main - echo "Fast-forwarded production/main to staging/main." + # Publish staging's tip as a branch on production and open (or refresh) the + # promote PR. `main` is protected on production; the PR is the review gate. + git push --force production "origin/main:refs/heads/${PROMOTE_BRANCH}" + tip=$(git rev-parse --short origin/main) + { + echo "Promotes \`${PRODUCTION_REPO}\` \`main\` to the staging trunk (\`${tip}\`)." + echo + echo "**Merge with a merge commit — do not squash or rebase.** Squashing rewrites the commits and forks the trunks; the next back-sync and promote refuse until repaired by hand." + echo + echo "After merging, release-please opens the version PR on this repo; merging that one tags and publishes." + echo + echo "### Commits" + git log --format='- %h %s' production/main..origin/main + } > /tmp/promote-body.md + existing=$(gh pr list -R "$PRODUCTION_REPO" --head "$PROMOTE_BRANCH" --state open --json number --jq '.[0].number // empty') + if [ -n "$existing" ]; then + gh pr edit "$existing" -R "$PRODUCTION_REPO" --title "Promote staging to production (${tip})" --body-file /tmp/promote-body.md + echo "Refreshed promote PR #${existing} on ${PRODUCTION_REPO}." + else + gh pr create -R "$PRODUCTION_REPO" --base main --head "$PROMOTE_BRANCH" \ + --title "Promote staging to production (${tip})" --body-file /tmp/promote-body.md + fi - name: Alert on failure if: failure() diff --git a/.github/workflows/stlc-sync.yml b/.github/workflows/stlc-sync.yml index 751210b1..2f363a51 100644 --- a/.github/workflows/stlc-sync.yml +++ b/.github/workflows/stlc-sync.yml @@ -61,7 +61,13 @@ jobs: # If not, staging already has production's content (release-please commits). MERGED=$(git merge-tree --write-tree origin/main production/main) || MERGED=conflict STAGING_TREE=$(git rev-parse 'origin/main^{tree}') - if [ "$MERGED" = "$STAGING_TREE" ]; then + if [ "$(git rev-parse origin/main)" != "$(git rev-parse production/main)" ] \ + && git merge-base --is-ancestor origin/main production/main; then + # Production is a strict descendant of staging — e.g. the merged promote PR + # (a merge commit with an identical tree) or a release commit. Fast-forward + # even when the trees match, so the trunks share history and codegen isn't held. + echo "behind=true" >> "$GITHUB_OUTPUT" + elif [ "$MERGED" = "$STAGING_TREE" ]; then echo "Staging already has production's content. Nothing to pull back." echo "behind=false" >> "$GITHUB_OUTPUT" else From 205f1061a29e08b17c77a068eb66c0b92f35b4a8 Mon Sep 17 00:00:00 2001 From: Vinicius Mello Date: Wed, 9 Sep 2026 21:13:10 -0300 Subject: [PATCH 14/16] ci(stlc): back-sync pushes staging main as the automation identity Staging main is getting a pull-request rule whose only bypass is the automation's repository role. The back-sync job pushed with GITHUB_TOKEN, which cannot be a bypass actor (GitHub Actions is not an org-owned app), so push with PRODUCTION_REPO_TOKEN (the service account) instead. Token pushes also trigger seal-dispatch, so the config repo re-seals immediately after a back-sync rather than at the next scheduled run. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_017oDfpQ4KpmpTzYm2fZ9eaL --- .github/workflows/stlc-sync.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/stlc-sync.yml b/.github/workflows/stlc-sync.yml index 2f363a51..850faf9e 100644 --- a/.github/workflows/stlc-sync.yml +++ b/.github/workflows/stlc-sync.yml @@ -76,6 +76,8 @@ jobs: - name: Sync production to staging (fast-forward) if: steps.diff.outputs.behind == 'true' + env: + PUSH_TOKEN: ${{ secrets.PRODUCTION_REPO_TOKEN }} run: | # Refuse unless staging is an ancestor of production: otherwise the # trunks have forked and a fast-forward would be unsafe. @@ -83,7 +85,17 @@ jobs: echo "::error title=Back-sync blocked::staging main is not an ancestor of production/main." exit 1 fi - git push origin production/main:refs/heads/main + # Push as the automation identity (PRODUCTION_REPO_TOKEN), not GITHUB_TOKEN: + # staging main requires a pull request for humans and only the automation's + # repository role bypasses that rule. A token push (unlike GITHUB_TOKEN) also + # triggers seal-dispatch, so the config repo re-seals right away instead of + # at the next scheduled sync. Blank the persisted GITHUB_TOKEN header first. + if [ -n "${PUSH_TOKEN:-}" ]; then + git -c "http.https://github.com/.extraheader=" push \ + "https://x-access-token:${PUSH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" production/main:refs/heads/main + else + git push origin production/main:refs/heads/main + fi echo "Fast-forwarded staging/main to production/main." - name: Alert on failure From 2f0277293687b9ee4094cccbda250e1bddd1dec4 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Mon, 21 Sep 2026 05:14:49 +0000 Subject: [PATCH 15/16] docs(closes OPEN-9410): expose the governance framework endpoints Stainless-Generated-From: 44bcbc25bd2ffab3a47ee5b7834b5c799cfe15b6 --- .../inferencepipelines/InferencePipelineRetrieveResponse.kt | 6 ------ .../inferencepipelines/InferencePipelineUpdateResponse.kt | 6 ------ .../openlayer/api/models/projects/ProjectCreateParams.kt | 6 ------ .../openlayer/api/models/projects/ProjectCreateResponse.kt | 6 ------ .../openlayer/api/models/projects/ProjectListResponse.kt | 6 ------ .../openlayer/api/models/projects/ProjectUpdateResponse.kt | 6 ------ .../inferencepipelines/InferencePipelineCreateParams.kt | 6 ------ .../inferencepipelines/InferencePipelineCreateResponse.kt | 6 ------ .../inferencepipelines/InferencePipelineListResponse.kt | 6 ------ scripts/mock | 2 +- 10 files changed, 1 insertion(+), 55 deletions(-) diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveResponse.kt index 4c9e736e..ff2f6bfc 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineRetrieveResponse.kt @@ -7987,8 +7987,6 @@ private constructor( @JvmField val API = of("api") - @JvmField val NULL = of("null") - @JvmStatic fun of(value: String) = Source(JsonField.of(value)) } @@ -7996,7 +7994,6 @@ private constructor( enum class Known { WEB, API, - NULL, } /** @@ -8011,7 +8008,6 @@ private constructor( enum class Value { WEB, API, - NULL, /** * An enum member indicating that [Source] was instantiated with an unknown value. */ @@ -8029,7 +8025,6 @@ private constructor( when (this) { WEB -> Value.WEB API -> Value.API - NULL -> Value.NULL else -> Value._UNKNOWN } @@ -8046,7 +8041,6 @@ private constructor( when (this) { WEB -> Known.WEB API -> Known.API - NULL -> Known.NULL else -> throw OpenlayerInvalidDataException("Unknown Source: $value") } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateResponse.kt index 193ba8a9..3ad90222 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/inferencepipelines/InferencePipelineUpdateResponse.kt @@ -7987,8 +7987,6 @@ private constructor( @JvmField val API = of("api") - @JvmField val NULL = of("null") - @JvmStatic fun of(value: String) = Source(JsonField.of(value)) } @@ -7996,7 +7994,6 @@ private constructor( enum class Known { WEB, API, - NULL, } /** @@ -8011,7 +8008,6 @@ private constructor( enum class Value { WEB, API, - NULL, /** * An enum member indicating that [Source] was instantiated with an unknown value. */ @@ -8029,7 +8025,6 @@ private constructor( when (this) { WEB -> Value.WEB API -> Value.API - NULL -> Value.NULL else -> Value._UNKNOWN } @@ -8046,7 +8041,6 @@ private constructor( when (this) { WEB -> Known.WEB API -> Known.API - NULL -> Known.NULL else -> throw OpenlayerInvalidDataException("Unknown Source: $value") } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateParams.kt index 950cd7f8..afe97d7a 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateParams.kt @@ -2080,8 +2080,6 @@ private constructor( @JvmField val API = of("api") - @JvmField val NULL = of("null") - @JvmStatic fun of(value: String) = Source(JsonField.of(value)) } @@ -2089,7 +2087,6 @@ private constructor( enum class Known { WEB, API, - NULL, } /** @@ -2104,7 +2101,6 @@ private constructor( enum class Value { WEB, API, - NULL, /** An enum member indicating that [Source] was instantiated with an unknown value. */ _UNKNOWN, } @@ -2120,7 +2116,6 @@ private constructor( when (this) { WEB -> Value.WEB API -> Value.API - NULL -> Value.NULL else -> Value._UNKNOWN } @@ -2137,7 +2132,6 @@ private constructor( when (this) { WEB -> Known.WEB API -> Known.API - NULL -> Known.NULL else -> throw OpenlayerInvalidDataException("Unknown Source: $value") } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateResponse.kt index 3ca748e3..6e47cabf 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectCreateResponse.kt @@ -1155,8 +1155,6 @@ private constructor( @JvmField val API = of("api") - @JvmField val NULL = of("null") - @JvmStatic fun of(value: String) = Source(JsonField.of(value)) } @@ -1164,7 +1162,6 @@ private constructor( enum class Known { WEB, API, - NULL, } /** @@ -1179,7 +1176,6 @@ private constructor( enum class Value { WEB, API, - NULL, /** An enum member indicating that [Source] was instantiated with an unknown value. */ _UNKNOWN, } @@ -1195,7 +1191,6 @@ private constructor( when (this) { WEB -> Value.WEB API -> Value.API - NULL -> Value.NULL else -> Value._UNKNOWN } @@ -1212,7 +1207,6 @@ private constructor( when (this) { WEB -> Known.WEB API -> Known.API - NULL -> Known.NULL else -> throw OpenlayerInvalidDataException("Unknown Source: $value") } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListResponse.kt index 6949d350..6a1ed5fa 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectListResponse.kt @@ -1348,8 +1348,6 @@ private constructor( @JvmField val API = of("api") - @JvmField val NULL = of("null") - @JvmStatic fun of(value: String) = Source(JsonField.of(value)) } @@ -1357,7 +1355,6 @@ private constructor( enum class Known { WEB, API, - NULL, } /** @@ -1372,7 +1369,6 @@ private constructor( enum class Value { WEB, API, - NULL, /** * An enum member indicating that [Source] was instantiated with an unknown value. */ @@ -1390,7 +1386,6 @@ private constructor( when (this) { WEB -> Value.WEB API -> Value.API - NULL -> Value.NULL else -> Value._UNKNOWN } @@ -1407,7 +1402,6 @@ private constructor( when (this) { WEB -> Known.WEB API -> Known.API - NULL -> Known.NULL else -> throw OpenlayerInvalidDataException("Unknown Source: $value") } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectUpdateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectUpdateResponse.kt index 097d8c84..e6d76465 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectUpdateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/ProjectUpdateResponse.kt @@ -1155,8 +1155,6 @@ private constructor( @JvmField val API = of("api") - @JvmField val NULL = of("null") - @JvmStatic fun of(value: String) = Source(JsonField.of(value)) } @@ -1164,7 +1162,6 @@ private constructor( enum class Known { WEB, API, - NULL, } /** @@ -1179,7 +1176,6 @@ private constructor( enum class Value { WEB, API, - NULL, /** An enum member indicating that [Source] was instantiated with an unknown value. */ _UNKNOWN, } @@ -1195,7 +1191,6 @@ private constructor( when (this) { WEB -> Value.WEB API -> Value.API - NULL -> Value.NULL else -> Value._UNKNOWN } @@ -1212,7 +1207,6 @@ private constructor( when (this) { WEB -> Known.WEB API -> Known.API - NULL -> Known.NULL else -> throw OpenlayerInvalidDataException("Unknown Source: $value") } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParams.kt index 67e82d3e..159e854b 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParams.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateParams.kt @@ -9017,8 +9017,6 @@ private constructor( @JvmField val API = of("api") - @JvmField val NULL = of("null") - @JvmStatic fun of(value: String) = Source(JsonField.of(value)) } @@ -9026,7 +9024,6 @@ private constructor( enum class Known { WEB, API, - NULL, } /** @@ -9041,7 +9038,6 @@ private constructor( enum class Value { WEB, API, - NULL, /** * An enum member indicating that [Source] was instantiated with an unknown value. */ @@ -9059,7 +9055,6 @@ private constructor( when (this) { WEB -> Value.WEB API -> Value.API - NULL -> Value.NULL else -> Value._UNKNOWN } @@ -9076,7 +9071,6 @@ private constructor( when (this) { WEB -> Known.WEB API -> Known.API - NULL -> Known.NULL else -> throw OpenlayerInvalidDataException("Unknown Source: $value") } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateResponse.kt index 142d37f4..f09c2452 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineCreateResponse.kt @@ -7987,8 +7987,6 @@ private constructor( @JvmField val API = of("api") - @JvmField val NULL = of("null") - @JvmStatic fun of(value: String) = Source(JsonField.of(value)) } @@ -7996,7 +7994,6 @@ private constructor( enum class Known { WEB, API, - NULL, } /** @@ -8011,7 +8008,6 @@ private constructor( enum class Value { WEB, API, - NULL, /** * An enum member indicating that [Source] was instantiated with an unknown value. */ @@ -8029,7 +8025,6 @@ private constructor( when (this) { WEB -> Value.WEB API -> Value.API - NULL -> Value.NULL else -> Value._UNKNOWN } @@ -8046,7 +8041,6 @@ private constructor( when (this) { WEB -> Known.WEB API -> Known.API - NULL -> Known.NULL else -> throw OpenlayerInvalidDataException("Unknown Source: $value") } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListResponse.kt index 6464f3ba..efac5577 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListResponse.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/projects/inferencepipelines/InferencePipelineListResponse.kt @@ -8345,8 +8345,6 @@ private constructor( @JvmField val API = of("api") - @JvmField val NULL = of("null") - @JvmStatic fun of(value: String) = Source(JsonField.of(value)) } @@ -8354,7 +8352,6 @@ private constructor( enum class Known { WEB, API, - NULL, } /** @@ -8369,7 +8366,6 @@ private constructor( enum class Value { WEB, API, - NULL, /** * An enum member indicating that [Source] was instantiated with an unknown * value. @@ -8388,7 +8384,6 @@ private constructor( when (this) { WEB -> Value.WEB API -> Value.API - NULL -> Value.NULL else -> Value._UNKNOWN } @@ -8405,7 +8400,6 @@ private constructor( when (this) { WEB -> Known.WEB API -> Known.API - NULL -> Known.NULL else -> throw OpenlayerInvalidDataException("Unknown Source: $value") } diff --git a/scripts/mock b/scripts/mock index 099a4c9c..4e11791c 100755 --- a/scripts/mock +++ b/scripts/mock @@ -16,7 +16,7 @@ elif [ -n "$STAINLESS_OPENAPI_SPEC_URL" ]; then URL="$STAINLESS_OPENAPI_SPEC_URL" else # Embedded OpenAP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HFQfyO08m5m7iSlyMTIcmomXWSxH7mwbxf2Ex4JaKkrGDIojQITXO1tbxLTq18WwyxS/rSc0j1qkTaG0iHhfZ1kUBF5IaUv+9MEobOA34HBChMsBJPIxBkJXp7o+CWwRACC0QqWpBwAUiV0zWJQ1R6YApXKd+IL0TS03GA5o9XuZ8KYu63nBheFHoVvGKdfIfH3l5HCA/Hnd3D7r+CCTLUAi7o72xgAyurT9owQdYKuB9laFsnu/ubMXtrjxc8XkNCXHISrOQ+5LY8TPIpg41nPlGkpha+/ZODp93j3l6FHCf9PzXVsihGvWAn0q5kSZDOLkD7JjX2jCYsOc1SO+chiP+qYA4SIGxUoj+/4NeFAvNkxKgvC5WM0P9lTG5ky/9Axuw/b1Ryyhv1BaghMIjVeGaefjiDWw1KDEY+vYb4T2whv/+8rXQU0+m0m9dT+LHHTQ7RDo18VaSS7wyCyO/AQB06CTpf2OwJslRjII9BJM4bTLEiwfDd/w/jmv3y0dYCAA==" SPEC_TMPFILE="$(mktemp)" trap 'rm -f "$SPEC_TMPFILE"' EXIT echo "$EMBEDDED_SPEC" | base64 --decode | gunzip > "$SPEC_TMPFILE" From 518719213a8e40ff931b03d1079f0760ed6689b3 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Mon, 21 Sep 2026 16:24:53 +0000 Subject: [PATCH 16/16] feat(governance): add the governance write endpoints and generate governance SDK methods Stainless-Generated-From: 0a6e7353594165268369b587f1ece87ddae1ce62 --- .stats.yml | 2 +- .../openlayer/api/client/OpenlayerClient.kt | 10 + .../api/client/OpenlayerClientAsync.kt | 10 + .../api/client/OpenlayerClientAsyncImpl.kt | 28 + .../api/client/OpenlayerClientImpl.kt | 28 + .../BackgroundTaskRetrieveParams.kt | 201 + .../BackgroundTaskRetrieveResponse.kt | 458 ++ .../frameworks/FrameworkCreateParams.kt | 1382 +++++ .../frameworks/FrameworkCreateResponse.kt | 2923 ++++++++++ .../frameworks/FrameworkExportParams.kt | 445 ++ .../frameworks/FrameworkExportResponse.kt | 241 + .../frameworks/FrameworkListParams.kt | 795 +++ .../FrameworkListProjectRuleStatsParams.kt | 490 ++ .../FrameworkListProjectRuleStatsResponse.kt | 2094 +++++++ .../frameworks/FrameworkListProjectsParams.kt | 250 + .../FrameworkListProjectsResponse.kt | 2319 ++++++++ .../frameworks/FrameworkListResponse.kt | 3174 ++++++++++ .../frameworks/FrameworkListRulesParams.kt | 249 + .../frameworks/FrameworkListRulesResponse.kt | 5145 +++++++++++++++++ .../frameworks/FrameworkRetrieveParams.kt | 194 + .../frameworks/FrameworkRetrieveResponse.kt | 2923 ++++++++++ .../frameworks/FrameworkUpdateParams.kt | 2056 +++++++ .../frameworks/FrameworkUpdateResponse.kt | 2923 ++++++++++ .../documents/DocumentListParams.kt | 249 + .../documents/DocumentListResponse.kt | 4383 ++++++++++++++ .../documents/DocumentRetrieveParams.kt | 222 + .../documents/DocumentRetrieveResponse.kt | 4106 +++++++++++++ .../sections/SectionListRulesParams.kt | 537 ++ .../sections/SectionListRulesResponse.kt | 5145 +++++++++++++++++ .../subsections/SubsectionListRulesParams.kt | 507 ++ .../SubsectionListRulesResponse.kt | 5145 +++++++++++++++++ .../RuleResultCreateEvidenceParams.kt | 725 +++ .../RuleResultCreateEvidenceResponse.kt | 530 ++ .../RuleResultListEvidenceParams.kt | 250 + .../RuleResultListEvidenceResponse.kt | 724 +++ .../ruleresults/RuleResultListParams.kt | 868 +++ .../ruleresults/RuleResultListResponse.kt | 2027 +++++++ .../ruleresults/RuleResultRetrieveParams.kt | 200 + .../ruleresults/RuleResultRetrieveResponse.kt | 1809 ++++++ .../ruleresults/RuleResultUpdateParams.kt | 1490 +++++ .../ruleresults/RuleResultUpdateResponse.kt | 1809 ++++++ .../governance/rules/RuleCreateParams.kt | 1870 ++++++ .../governance/rules/RuleCreateResponse.kt | 4821 +++++++++++++++ .../governance/rules/RuleDeleteParams.kt | 235 + .../models/governance/rules/RuleListParams.kt | 1316 +++++ .../governance/rules/RuleListResponse.kt | 5145 +++++++++++++++++ .../governance/rules/RuleRetrieveParams.kt | 189 + .../governance/rules/RuleRetrieveResponse.kt | 4821 +++++++++++++++ .../governance/rules/RuleUpdateParams.kt | 885 +++ .../governance/rules/RuleUpdateResponse.kt | 4821 +++++++++++++++ .../rulestats/RuleStatRetrieveParams.kt | 235 + .../rulestats/RuleStatRetrieveResponse.kt | 3874 +++++++++++++ .../governance/ruletags/RuleTagListParams.kt | 248 + .../ruletags/RuleTagListResponse.kt | 675 +++ .../PresignedUrlRetrieveParams.kt | 212 + .../PresignedUrlRetrieveResponse.kt | 181 + .../async/BackgroundTaskServiceAsync.kt | 128 + .../async/BackgroundTaskServiceAsyncImpl.kt | 91 + .../services/async/GovernanceServiceAsync.kt | 62 + .../async/GovernanceServiceAsyncImpl.kt | 94 + .../async/governance/FrameworkServiceAsync.kt | 756 +++ .../governance/FrameworkServiceAsyncImpl.kt | 425 ++ .../governance/RuleResultServiceAsync.kt | 483 ++ .../governance/RuleResultServiceAsyncImpl.kt | 260 + .../async/governance/RuleServiceAsync.kt | 430 ++ .../async/governance/RuleServiceAsyncImpl.kt | 254 + .../async/governance/RuleStatServiceAsync.kt | 126 + .../governance/RuleStatServiceAsyncImpl.kt | 89 + .../async/governance/RuleTagServiceAsync.kt | 123 + .../governance/RuleTagServiceAsyncImpl.kt | 89 + .../frameworks/DocumentServiceAsync.kt | 186 + .../frameworks/DocumentServiceAsyncImpl.kt | 136 + .../frameworks/SectionServiceAsync.kt | 102 + .../frameworks/SectionServiceAsyncImpl.kt | 95 + .../frameworks/SubsectionServiceAsync.kt | 104 + .../frameworks/SubsectionServiceAsyncImpl.kt | 95 + .../async/storage/PresignedUrlServiceAsync.kt | 38 + .../storage/PresignedUrlServiceAsyncImpl.kt | 39 + .../blocking/BackgroundTaskService.kt | 125 + .../blocking/BackgroundTaskServiceImpl.kt | 85 + .../services/blocking/GovernanceService.kt | 59 + .../blocking/GovernanceServiceImpl.kt | 90 + .../blocking/governance/FrameworkService.kt | 748 +++ .../governance/FrameworkServiceImpl.kt | 398 ++ .../blocking/governance/RuleResultService.kt | 483 ++ .../governance/RuleResultServiceImpl.kt | 244 + .../blocking/governance/RuleService.kt | 417 ++ .../blocking/governance/RuleServiceImpl.kt | 232 + .../blocking/governance/RuleStatService.kt | 120 + .../governance/RuleStatServiceImpl.kt | 85 + .../blocking/governance/RuleTagService.kt | 117 + .../blocking/governance/RuleTagServiceImpl.kt | 85 + .../governance/frameworks/DocumentService.kt | 180 + .../frameworks/DocumentServiceImpl.kt | 129 + .../governance/frameworks/SectionService.kt | 97 + .../frameworks/SectionServiceImpl.kt | 91 + .../frameworks/SubsectionService.kt | 102 + .../frameworks/SubsectionServiceImpl.kt | 91 + .../blocking/storage/PresignedUrlService.kt | 38 + .../storage/PresignedUrlServiceImpl.kt | 36 + .../BackgroundTaskRetrieveParamsTest.kt | 28 + .../BackgroundTaskRetrieveResponseTest.kt | 103 + .../frameworks/FrameworkCreateParamsTest.kt | 110 + .../frameworks/FrameworkCreateResponseTest.kt | 227 + .../frameworks/FrameworkExportParamsTest.kt | 52 + .../frameworks/FrameworkExportResponseTest.kt | 43 + .../frameworks/FrameworkListParamsTest.kt | 90 + ...FrameworkListProjectRuleStatsParamsTest.kt | 69 + ...ameworkListProjectRuleStatsResponseTest.kt | 172 + .../FrameworkListProjectsParamsTest.kt | 58 + .../FrameworkListProjectsResponseTest.kt | 173 + .../frameworks/FrameworkListResponseTest.kt | 235 + .../FrameworkListRulesParamsTest.kt | 58 + .../FrameworkListRulesResponseTest.kt | 333 ++ .../frameworks/FrameworkRetrieveParamsTest.kt | 28 + .../FrameworkRetrieveResponseTest.kt | 227 + .../frameworks/FrameworkUpdateParamsTest.kt | 144 + .../frameworks/FrameworkUpdateResponseTest.kt | 227 + .../documents/DocumentListParamsTest.kt | 54 + .../documents/DocumentListResponseTest.kt | 361 ++ .../documents/DocumentRetrieveParamsTest.kt | 31 + .../documents/DocumentRetrieveResponseTest.kt | 312 + .../sections/SectionListRulesParamsTest.kt | 80 + .../sections/SectionListRulesResponseTest.kt | 330 ++ .../SubsectionListRulesParamsTest.kt | 77 + .../SubsectionListRulesResponseTest.kt | 333 ++ .../RuleResultCreateEvidenceParamsTest.kt | 64 + .../RuleResultCreateEvidenceResponseTest.kt | 70 + .../RuleResultListEvidenceParamsTest.kt | 58 + .../RuleResultListEvidenceResponseTest.kt | 77 + .../ruleresults/RuleResultListParamsTest.kt | 90 + .../ruleresults/RuleResultListResponseTest.kt | 130 + .../RuleResultRetrieveParamsTest.kt | 28 + .../RuleResultRetrieveResponseTest.kt | 132 + .../ruleresults/RuleResultUpdateParamsTest.kt | 97 + .../RuleResultUpdateResponseTest.kt | 131 + .../governance/rules/RuleCreateParamsTest.kt | 109 + .../rules/RuleCreateResponseTest.kt | 287 + .../governance/rules/RuleDeleteParamsTest.kt | 24 + .../governance/rules/RuleListParamsTest.kt | 104 + .../governance/rules/RuleListResponseTest.kt | 312 + .../rules/RuleRetrieveParamsTest.kt | 24 + .../rules/RuleRetrieveResponseTest.kt | 288 + .../governance/rules/RuleUpdateParamsTest.kt | 66 + .../rules/RuleUpdateResponseTest.kt | 287 + .../rulestats/RuleStatRetrieveParamsTest.kt | 63 + .../rulestats/RuleStatRetrieveResponseTest.kt | 300 + .../ruletags/RuleTagListParamsTest.kt | 54 + .../ruletags/RuleTagListResponseTest.kt | 73 + .../PresignedUrlRetrieveParamsTest.kt | 25 + .../PresignedUrlRetrieveResponseTest.kt | 32 + .../async/BackgroundTaskServiceAsyncTest.kt | 28 + .../governance/FrameworkServiceAsyncTest.kt | 245 + .../governance/RuleResultServiceAsyncTest.kt | 145 + .../async/governance/RuleServiceAsyncTest.kt | 143 + .../governance/RuleStatServiceAsyncTest.kt | 35 + .../governance/RuleTagServiceAsyncTest.kt | 35 + .../frameworks/DocumentServiceAsyncTest.kt | 57 + .../frameworks/SectionServiceAsyncTest.kt | 40 + .../frameworks/SubsectionServiceAsyncTest.kt | 39 + .../storage/PresignedUrlServiceAsyncTest.kt | 19 + .../blocking/BackgroundTaskServiceTest.kt | 26 + .../governance/FrameworkServiceTest.kt | 237 + .../governance/RuleResultServiceTest.kt | 139 + .../blocking/governance/RuleServiceTest.kt | 137 + .../governance/RuleStatServiceTest.kt | 34 + .../blocking/governance/RuleTagServiceTest.kt | 34 + .../frameworks/DocumentServiceTest.kt | 55 + .../frameworks/SectionServiceTest.kt | 39 + .../frameworks/SubsectionServiceTest.kt | 38 + .../storage/PresignedUrlServiceTest.kt | 18 + .../api/proguard/ProGuardCompatibilityTest.kt | 2 + scripts/mock | 2 +- 173 files changed, 105276 insertions(+), 2 deletions(-) create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/backgroundtasks/BackgroundTaskRetrieveParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/backgroundtasks/BackgroundTaskRetrieveResponse.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkCreateParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkCreateResponse.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkExportParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkExportResponse.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListProjectRuleStatsParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListProjectRuleStatsResponse.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListProjectsParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListProjectsResponse.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListResponse.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListRulesParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListRulesResponse.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkRetrieveParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkRetrieveResponse.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkUpdateParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkUpdateResponse.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/documents/DocumentListParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/documents/DocumentListResponse.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/documents/DocumentRetrieveParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/documents/DocumentRetrieveResponse.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/sections/SectionListRulesParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/sections/SectionListRulesResponse.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/subsections/SubsectionListRulesParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/subsections/SubsectionListRulesResponse.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultCreateEvidenceParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultCreateEvidenceResponse.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultListEvidenceParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultListEvidenceResponse.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultListParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultListResponse.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultRetrieveParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultRetrieveResponse.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultUpdateParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultUpdateResponse.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/rules/RuleCreateParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/rules/RuleCreateResponse.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/rules/RuleDeleteParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/rules/RuleListParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/rules/RuleListResponse.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/rules/RuleRetrieveParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/rules/RuleRetrieveResponse.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/rules/RuleUpdateParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/rules/RuleUpdateResponse.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/rulestats/RuleStatRetrieveParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/rulestats/RuleStatRetrieveResponse.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/ruletags/RuleTagListParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/ruletags/RuleTagListResponse.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlRetrieveParams.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlRetrieveResponse.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/BackgroundTaskServiceAsync.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/BackgroundTaskServiceAsyncImpl.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/GovernanceServiceAsync.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/GovernanceServiceAsyncImpl.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/FrameworkServiceAsync.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/FrameworkServiceAsyncImpl.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/RuleResultServiceAsync.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/RuleResultServiceAsyncImpl.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/RuleServiceAsync.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/RuleServiceAsyncImpl.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/RuleStatServiceAsync.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/RuleStatServiceAsyncImpl.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/RuleTagServiceAsync.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/RuleTagServiceAsyncImpl.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/frameworks/DocumentServiceAsync.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/frameworks/DocumentServiceAsyncImpl.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/frameworks/SectionServiceAsync.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/frameworks/SectionServiceAsyncImpl.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/frameworks/SubsectionServiceAsync.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/frameworks/SubsectionServiceAsyncImpl.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/BackgroundTaskService.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/BackgroundTaskServiceImpl.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/GovernanceService.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/GovernanceServiceImpl.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/FrameworkService.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/FrameworkServiceImpl.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/RuleResultService.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/RuleResultServiceImpl.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/RuleService.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/RuleServiceImpl.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/RuleStatService.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/RuleStatServiceImpl.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/RuleTagService.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/RuleTagServiceImpl.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/frameworks/DocumentService.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/frameworks/DocumentServiceImpl.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/frameworks/SectionService.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/frameworks/SectionServiceImpl.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/frameworks/SubsectionService.kt create mode 100644 openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/frameworks/SubsectionServiceImpl.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/backgroundtasks/BackgroundTaskRetrieveParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/backgroundtasks/BackgroundTaskRetrieveResponseTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkCreateParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkCreateResponseTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkExportParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkExportResponseTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListProjectRuleStatsParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListProjectRuleStatsResponseTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListProjectsParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListProjectsResponseTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListResponseTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListRulesParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListRulesResponseTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkRetrieveParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkRetrieveResponseTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkUpdateParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkUpdateResponseTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/documents/DocumentListParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/documents/DocumentListResponseTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/documents/DocumentRetrieveParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/documents/DocumentRetrieveResponseTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/sections/SectionListRulesParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/sections/SectionListRulesResponseTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/subsections/SubsectionListRulesParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/subsections/SubsectionListRulesResponseTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultCreateEvidenceParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultCreateEvidenceResponseTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultListEvidenceParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultListEvidenceResponseTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultListParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultListResponseTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultRetrieveParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultRetrieveResponseTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultUpdateParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultUpdateResponseTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/rules/RuleCreateParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/rules/RuleCreateResponseTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/rules/RuleDeleteParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/rules/RuleListParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/rules/RuleListResponseTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/rules/RuleRetrieveParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/rules/RuleRetrieveResponseTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/rules/RuleUpdateParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/rules/RuleUpdateResponseTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/rulestats/RuleStatRetrieveParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/rulestats/RuleStatRetrieveResponseTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/ruletags/RuleTagListParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/ruletags/RuleTagListResponseTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlRetrieveParamsTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlRetrieveResponseTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/BackgroundTaskServiceAsyncTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/governance/FrameworkServiceAsyncTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/governance/RuleResultServiceAsyncTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/governance/RuleServiceAsyncTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/governance/RuleStatServiceAsyncTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/governance/RuleTagServiceAsyncTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/governance/frameworks/DocumentServiceAsyncTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/governance/frameworks/SectionServiceAsyncTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/governance/frameworks/SubsectionServiceAsyncTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/BackgroundTaskServiceTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/governance/FrameworkServiceTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/governance/RuleResultServiceTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/governance/RuleServiceTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/governance/RuleStatServiceTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/governance/RuleTagServiceTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/governance/frameworks/DocumentServiceTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/governance/frameworks/SectionServiceTest.kt create mode 100644 openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/governance/frameworks/SubsectionServiceTest.kt diff --git a/.stats.yml b/.stats.yml index e8ba8c9f..b4620cc9 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 32 +configured_endpoints: 58 diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClient.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClient.kt index 61c86d06..297c90db 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClient.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClient.kt @@ -3,7 +3,9 @@ package com.openlayer.api.client import com.openlayer.api.core.ClientOptions +import com.openlayer.api.services.blocking.BackgroundTaskService import com.openlayer.api.services.blocking.CommitService +import com.openlayer.api.services.blocking.GovernanceService import com.openlayer.api.services.blocking.InferencePipelineService import com.openlayer.api.services.blocking.ProjectService import com.openlayer.api.services.blocking.StorageService @@ -59,6 +61,10 @@ interface OpenlayerClient { fun tests(): TestService + fun backgroundTasks(): BackgroundTaskService + + fun governance(): GovernanceService + /** * Closes this client, relinquishing any underlying resources. * @@ -93,5 +99,9 @@ interface OpenlayerClient { fun storage(): StorageService.WithRawResponse fun tests(): TestService.WithRawResponse + + fun backgroundTasks(): BackgroundTaskService.WithRawResponse + + fun governance(): GovernanceService.WithRawResponse } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsync.kt index 960d3f89..69147691 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsync.kt @@ -3,7 +3,9 @@ package com.openlayer.api.client import com.openlayer.api.core.ClientOptions +import com.openlayer.api.services.async.BackgroundTaskServiceAsync import com.openlayer.api.services.async.CommitServiceAsync +import com.openlayer.api.services.async.GovernanceServiceAsync import com.openlayer.api.services.async.InferencePipelineServiceAsync import com.openlayer.api.services.async.ProjectServiceAsync import com.openlayer.api.services.async.StorageServiceAsync @@ -59,6 +61,10 @@ interface OpenlayerClientAsync { fun tests(): TestServiceAsync + fun backgroundTasks(): BackgroundTaskServiceAsync + + fun governance(): GovernanceServiceAsync + /** * Closes this client, relinquishing any underlying resources. * @@ -97,5 +103,9 @@ interface OpenlayerClientAsync { fun storage(): StorageServiceAsync.WithRawResponse fun tests(): TestServiceAsync.WithRawResponse + + fun backgroundTasks(): BackgroundTaskServiceAsync.WithRawResponse + + fun governance(): GovernanceServiceAsync.WithRawResponse } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsyncImpl.kt index 6c590e95..b831fefd 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientAsyncImpl.kt @@ -4,8 +4,12 @@ package com.openlayer.api.client import com.openlayer.api.core.ClientOptions import com.openlayer.api.core.getPackageVersion +import com.openlayer.api.services.async.BackgroundTaskServiceAsync +import com.openlayer.api.services.async.BackgroundTaskServiceAsyncImpl import com.openlayer.api.services.async.CommitServiceAsync import com.openlayer.api.services.async.CommitServiceAsyncImpl +import com.openlayer.api.services.async.GovernanceServiceAsync +import com.openlayer.api.services.async.GovernanceServiceAsyncImpl import com.openlayer.api.services.async.InferencePipelineServiceAsync import com.openlayer.api.services.async.InferencePipelineServiceAsyncImpl import com.openlayer.api.services.async.ProjectServiceAsync @@ -57,6 +61,14 @@ class OpenlayerClientAsyncImpl(private val clientOptions: ClientOptions) : Openl private val tests: TestServiceAsync by lazy { TestServiceAsyncImpl(clientOptionsWithUserAgent) } + private val backgroundTasks: BackgroundTaskServiceAsync by lazy { + BackgroundTaskServiceAsyncImpl(clientOptionsWithUserAgent) + } + + private val governance: GovernanceServiceAsync by lazy { + GovernanceServiceAsyncImpl(clientOptionsWithUserAgent) + } + override fun sync(): OpenlayerClient = sync override fun withRawResponse(): OpenlayerClientAsync.WithRawResponse = withRawResponse @@ -76,6 +88,10 @@ class OpenlayerClientAsyncImpl(private val clientOptions: ClientOptions) : Openl override fun tests(): TestServiceAsync = tests + override fun backgroundTasks(): BackgroundTaskServiceAsync = backgroundTasks + + override fun governance(): GovernanceServiceAsync = governance + override fun close() = clientOptions.close() class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : @@ -105,6 +121,14 @@ class OpenlayerClientAsyncImpl(private val clientOptions: ClientOptions) : Openl TestServiceAsyncImpl.WithRawResponseImpl(clientOptions) } + private val backgroundTasks: BackgroundTaskServiceAsync.WithRawResponse by lazy { + BackgroundTaskServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + private val governance: GovernanceServiceAsync.WithRawResponse by lazy { + GovernanceServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + override fun withOptions( modifier: Consumer ): OpenlayerClientAsync.WithRawResponse = @@ -124,5 +148,9 @@ class OpenlayerClientAsyncImpl(private val clientOptions: ClientOptions) : Openl override fun storage(): StorageServiceAsync.WithRawResponse = storage override fun tests(): TestServiceAsync.WithRawResponse = tests + + override fun backgroundTasks(): BackgroundTaskServiceAsync.WithRawResponse = backgroundTasks + + override fun governance(): GovernanceServiceAsync.WithRawResponse = governance } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientImpl.kt index b82d4996..fcfbd34f 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/client/OpenlayerClientImpl.kt @@ -4,8 +4,12 @@ package com.openlayer.api.client import com.openlayer.api.core.ClientOptions import com.openlayer.api.core.getPackageVersion +import com.openlayer.api.services.blocking.BackgroundTaskService +import com.openlayer.api.services.blocking.BackgroundTaskServiceImpl import com.openlayer.api.services.blocking.CommitService import com.openlayer.api.services.blocking.CommitServiceImpl +import com.openlayer.api.services.blocking.GovernanceService +import com.openlayer.api.services.blocking.GovernanceServiceImpl import com.openlayer.api.services.blocking.InferencePipelineService import com.openlayer.api.services.blocking.InferencePipelineServiceImpl import com.openlayer.api.services.blocking.ProjectService @@ -51,6 +55,14 @@ class OpenlayerClientImpl(private val clientOptions: ClientOptions) : OpenlayerC private val tests: TestService by lazy { TestServiceImpl(clientOptionsWithUserAgent) } + private val backgroundTasks: BackgroundTaskService by lazy { + BackgroundTaskServiceImpl(clientOptionsWithUserAgent) + } + + private val governance: GovernanceService by lazy { + GovernanceServiceImpl(clientOptionsWithUserAgent) + } + override fun async(): OpenlayerClientAsync = async override fun withRawResponse(): OpenlayerClient.WithRawResponse = withRawResponse @@ -70,6 +82,10 @@ class OpenlayerClientImpl(private val clientOptions: ClientOptions) : OpenlayerC override fun tests(): TestService = tests + override fun backgroundTasks(): BackgroundTaskService = backgroundTasks + + override fun governance(): GovernanceService = governance + override fun close() = clientOptions.close() class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : @@ -99,6 +115,14 @@ class OpenlayerClientImpl(private val clientOptions: ClientOptions) : OpenlayerC TestServiceImpl.WithRawResponseImpl(clientOptions) } + private val backgroundTasks: BackgroundTaskService.WithRawResponse by lazy { + BackgroundTaskServiceImpl.WithRawResponseImpl(clientOptions) + } + + private val governance: GovernanceService.WithRawResponse by lazy { + GovernanceServiceImpl.WithRawResponseImpl(clientOptions) + } + override fun withOptions( modifier: Consumer ): OpenlayerClient.WithRawResponse = @@ -118,5 +142,9 @@ class OpenlayerClientImpl(private val clientOptions: ClientOptions) : OpenlayerC override fun storage(): StorageService.WithRawResponse = storage override fun tests(): TestService.WithRawResponse = tests + + override fun backgroundTasks(): BackgroundTaskService.WithRawResponse = backgroundTasks + + override fun governance(): GovernanceService.WithRawResponse = governance } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/backgroundtasks/BackgroundTaskRetrieveParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/backgroundtasks/BackgroundTaskRetrieveParams.kt new file mode 100644 index 00000000..314e775a --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/backgroundtasks/BackgroundTaskRetrieveParams.kt @@ -0,0 +1,201 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.backgroundtasks + +import com.openlayer.api.core.Params +import com.openlayer.api.core.http.Headers +import com.openlayer.api.core.http.QueryParams +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * Retrieve a background task's status, progress and results. + * + * Endpoints that cannot answer within one request queue a task and hand back its id -- for example + * `POST /frameworks/{frameworkId}/export`. Poll this endpoint until `complete` is `true`, then read + * what the task produced from `outputs`. + */ +class BackgroundTaskRetrieveParams +private constructor( + private val taskId: String?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun taskId(): Optional = Optional.ofNullable(taskId) + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): BackgroundTaskRetrieveParams = builder().build() + + /** + * Returns a mutable builder for constructing an instance of [BackgroundTaskRetrieveParams]. + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BackgroundTaskRetrieveParams]. */ + class Builder internal constructor() { + + private var taskId: String? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(backgroundTaskRetrieveParams: BackgroundTaskRetrieveParams) = apply { + taskId = backgroundTaskRetrieveParams.taskId + additionalHeaders = backgroundTaskRetrieveParams.additionalHeaders.toBuilder() + additionalQueryParams = backgroundTaskRetrieveParams.additionalQueryParams.toBuilder() + } + + fun taskId(taskId: String?) = apply { this.taskId = taskId } + + /** Alias for calling [Builder.taskId] with `taskId.orElse(null)`. */ + fun taskId(taskId: Optional) = taskId(taskId.getOrNull()) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [BackgroundTaskRetrieveParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): BackgroundTaskRetrieveParams = + BackgroundTaskRetrieveParams( + taskId, + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _pathParam(index: Int): String = + when (index) { + 0 -> taskId ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is BackgroundTaskRetrieveParams && + taskId == other.taskId && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = Objects.hash(taskId, additionalHeaders, additionalQueryParams) + + override fun toString() = + "BackgroundTaskRetrieveParams{taskId=$taskId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/backgroundtasks/BackgroundTaskRetrieveResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/backgroundtasks/BackgroundTaskRetrieveResponse.kt new file mode 100644 index 00000000..199e6969 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/backgroundtasks/BackgroundTaskRetrieveResponse.kt @@ -0,0 +1,458 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.backgroundtasks + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.openlayer.api.core.ExcludeMissing +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonMissing +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.checkRequired +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.time.OffsetDateTime +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class BackgroundTaskRetrieveResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val id: JsonField, + private val complete: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val name: JsonField, + private val progress: JsonField, + private val error: JsonField, + private val outputs: JsonValue, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("complete") @ExcludeMissing complete: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("progress") @ExcludeMissing progress: JsonField = JsonMissing.of(), + @JsonProperty("error") @ExcludeMissing error: JsonField = JsonMissing.of(), + @JsonProperty("outputs") @ExcludeMissing outputs: JsonValue = JsonMissing.of(), + ) : this(id, complete, dateCreated, dateUpdated, name, progress, error, outputs, mutableMapOf()) + + /** + * The background task id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun id(): String = id.getRequired("id") + + /** + * Whether the task has finished. Check this before reading `outputs`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun complete(): Boolean = complete.getRequired("complete") + + /** + * When the task was queued. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** + * When the task last reported progress. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** + * The task's internal name, including the arguments it was queued with. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun name(): String = name.getRequired("name") + + /** + * How far along the task is, from 0 to 100. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun progress(): Float = progress.getRequired("progress") + + /** + * Why the task failed, or `null` if it has not failed. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun error(): Optional = error.getOptional("error") + + /** + * Whatever the task produced, keyed by name. `null` until the task completes. A framework + * export returns `storageUri` -- pass it to `GET /storage/presigned-url` to download the + * archive -- along with `filename`, `controlCount`, `evidenceCount` and `missingEvidenceCount`. + * + * This arbitrary value can be deserialized into a custom type using the `convert` method: + * ```java + * MyClass myObject = backgroundTaskRetrieveResponse.outputs().convert(MyClass.class); + * ``` + */ + @JsonProperty("outputs") @ExcludeMissing fun _outputs(): JsonValue = outputs + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [complete]. + * + * Unlike [complete], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("complete") @ExcludeMissing fun _complete(): JsonField = complete + + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [progress]. + * + * Unlike [progress], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("progress") @ExcludeMissing fun _progress(): JsonField = progress + + /** + * Returns the raw JSON value of [error]. + * + * Unlike [error], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("error") @ExcludeMissing fun _error(): JsonField = error + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [BackgroundTaskRetrieveResponse]. + * + * The following fields are required: + * ```java + * .id() + * .complete() + * .dateCreated() + * .dateUpdated() + * .name() + * .progress() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BackgroundTaskRetrieveResponse]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var complete: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var name: JsonField? = null + private var progress: JsonField? = null + private var error: JsonField = JsonMissing.of() + private var outputs: JsonValue = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(backgroundTaskRetrieveResponse: BackgroundTaskRetrieveResponse) = apply { + id = backgroundTaskRetrieveResponse.id + complete = backgroundTaskRetrieveResponse.complete + dateCreated = backgroundTaskRetrieveResponse.dateCreated + dateUpdated = backgroundTaskRetrieveResponse.dateUpdated + name = backgroundTaskRetrieveResponse.name + progress = backgroundTaskRetrieveResponse.progress + error = backgroundTaskRetrieveResponse.error + outputs = backgroundTaskRetrieveResponse.outputs + additionalProperties = + backgroundTaskRetrieveResponse.additionalProperties.toMutableMap() + } + + /** The background task id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** Whether the task has finished. Check this before reading `outputs`. */ + fun complete(complete: Boolean) = complete(JsonField.of(complete)) + + /** + * Sets [Builder.complete] to an arbitrary JSON value. + * + * You should usually call [Builder.complete] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun complete(complete: JsonField) = apply { this.complete = complete } + + /** When the task was queued. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** When the task last reported progress. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** The task's internal name, including the arguments it was queued with. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun name(name: JsonField) = apply { this.name = name } + + /** How far along the task is, from 0 to 100. */ + fun progress(progress: Float) = progress(JsonField.of(progress)) + + /** + * Sets [Builder.progress] to an arbitrary JSON value. + * + * You should usually call [Builder.progress] with a well-typed [Float] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun progress(progress: JsonField) = apply { this.progress = progress } + + /** Why the task failed, or `null` if it has not failed. */ + fun error(error: String?) = error(JsonField.ofNullable(error)) + + /** Alias for calling [Builder.error] with `error.orElse(null)`. */ + fun error(error: Optional) = error(error.getOrNull()) + + /** + * Sets [Builder.error] to an arbitrary JSON value. + * + * You should usually call [Builder.error] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun error(error: JsonField) = apply { this.error = error } + + /** + * Whatever the task produced, keyed by name. `null` until the task completes. A framework + * export returns `storageUri` -- pass it to `GET /storage/presigned-url` to download the + * archive -- along with `filename`, `controlCount`, `evidenceCount` and + * `missingEvidenceCount`. + */ + fun outputs(outputs: JsonValue) = apply { this.outputs = outputs } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [BackgroundTaskRetrieveResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .complete() + * .dateCreated() + * .dateUpdated() + * .name() + * .progress() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): BackgroundTaskRetrieveResponse = + BackgroundTaskRetrieveResponse( + checkRequired("id", id), + checkRequired("complete", complete), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("name", name), + checkRequired("progress", progress), + error, + outputs, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): BackgroundTaskRetrieveResponse = apply { + if (validated) { + return@apply + } + + id() + complete() + dateCreated() + dateUpdated() + name() + progress() + error() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (complete.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (progress.asKnown().isPresent) 1 else 0) + + (if (error.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is BackgroundTaskRetrieveResponse && + id == other.id && + complete == other.complete && + dateCreated == other.dateCreated && + dateUpdated == other.dateUpdated && + name == other.name && + progress == other.progress && + error == other.error && + outputs == other.outputs && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + complete, + dateCreated, + dateUpdated, + name, + progress, + error, + outputs, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BackgroundTaskRetrieveResponse{id=$id, complete=$complete, dateCreated=$dateCreated, dateUpdated=$dateUpdated, name=$name, progress=$progress, error=$error, outputs=$outputs, additionalProperties=$additionalProperties}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkCreateParams.kt new file mode 100644 index 00000000..662e5b9d --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkCreateParams.kt @@ -0,0 +1,1382 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.frameworks + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.openlayer.api.core.Enum +import com.openlayer.api.core.ExcludeMissing +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonMissing +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.Params +import com.openlayer.api.core.checkKnown +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.http.Headers +import com.openlayer.api.core.http.QueryParams +import com.openlayer.api.core.toImmutable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * Create a custom governance framework in a workspace. + * + * Use this to track compliance against an internal policy, or against a standard Openlayer does not + * ship as a built-in framework. A new framework starts with no rules -- add them from the Openlayer + * app, or map an existing rule to it. + * + * A framework is created disabled unless you pass `enabled: true`. While it is disabled its rules + * are not evaluated and do not count towards compliance. + */ +class FrameworkCreateParams +private constructor( + private val workspaceId: String?, + private val body: Body, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun workspaceId(): Optional = Optional.ofNullable(workspaceId) + + /** + * The framework name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun name(): String = body.name() + + /** + * A short description of the framework. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun description(): Optional = body.description() + + /** + * Whether the framework is active. Rules of a disabled framework are not evaluated and do not + * count towards compliance. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun enabled(): Optional = body.enabled() + + /** + * Determines which projects the framework applies to. An empty or `null` `match` array applies + * the framework to every project in the workspace. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun projectSelector(): Optional = body.projectSelector() + + /** + * Free-form labels on the framework. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun tags(): Optional> = body.tags() + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _name(): JsonField = body._name() + + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _description(): JsonField = body._description() + + /** + * Returns the raw JSON value of [enabled]. + * + * Unlike [enabled], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _enabled(): JsonField = body._enabled() + + /** + * Returns the raw JSON value of [projectSelector]. + * + * Unlike [projectSelector], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _projectSelector(): JsonField = body._projectSelector() + + /** + * Returns the raw JSON value of [tags]. + * + * Unlike [tags], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _tags(): JsonField> = body._tags() + + fun _additionalBodyProperties(): Map = body._additionalProperties() + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [FrameworkCreateParams]. + * + * The following fields are required: + * ```java + * .name() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [FrameworkCreateParams]. */ + class Builder internal constructor() { + + private var workspaceId: String? = null + private var body: Body.Builder = Body.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(frameworkCreateParams: FrameworkCreateParams) = apply { + workspaceId = frameworkCreateParams.workspaceId + body = frameworkCreateParams.body.toBuilder() + additionalHeaders = frameworkCreateParams.additionalHeaders.toBuilder() + additionalQueryParams = frameworkCreateParams.additionalQueryParams.toBuilder() + } + + fun workspaceId(workspaceId: String?) = apply { this.workspaceId = workspaceId } + + /** Alias for calling [Builder.workspaceId] with `workspaceId.orElse(null)`. */ + fun workspaceId(workspaceId: Optional) = workspaceId(workspaceId.getOrNull()) + + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [name] + * - [description] + * - [enabled] + * - [projectSelector] + * - [tags] + * - etc. + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + + /** The framework name. */ + fun name(name: String) = apply { body.name(name) } + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun name(name: JsonField) = apply { body.name(name) } + + /** A short description of the framework. */ + fun description(description: String?) = apply { body.description(description) } + + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ + fun description(description: Optional) = description(description.getOrNull()) + + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun description(description: JsonField) = apply { body.description(description) } + + /** + * Whether the framework is active. Rules of a disabled framework are not evaluated and do + * not count towards compliance. + */ + fun enabled(enabled: Boolean) = apply { body.enabled(enabled) } + + /** + * Sets [Builder.enabled] to an arbitrary JSON value. + * + * You should usually call [Builder.enabled] with a well-typed [Boolean] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun enabled(enabled: JsonField) = apply { body.enabled(enabled) } + + /** + * Determines which projects the framework applies to. An empty or `null` `match` array + * applies the framework to every project in the workspace. + */ + fun projectSelector(projectSelector: ProjectSelector?) = apply { + body.projectSelector(projectSelector) + } + + /** Alias for calling [Builder.projectSelector] with `projectSelector.orElse(null)`. */ + fun projectSelector(projectSelector: Optional) = + projectSelector(projectSelector.getOrNull()) + + /** + * Sets [Builder.projectSelector] to an arbitrary JSON value. + * + * You should usually call [Builder.projectSelector] with a well-typed [ProjectSelector] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun projectSelector(projectSelector: JsonField) = apply { + body.projectSelector(projectSelector) + } + + /** Free-form labels on the framework. */ + fun tags(tags: List) = apply { body.tags(tags) } + + /** + * Sets [Builder.tags] to an arbitrary JSON value. + * + * You should usually call [Builder.tags] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun tags(tags: JsonField>) = apply { body.tags(tags) } + + /** + * Adds a single [String] to [tags]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addTag(tag: String) = apply { body.addTag(tag) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [FrameworkCreateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .name() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): FrameworkCreateParams = + FrameworkCreateParams( + workspaceId, + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _body(): Body = body + + fun _pathParam(index: Int): String = + when (index) { + 0 -> workspaceId ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val name: JsonField, + private val description: JsonField, + private val enabled: JsonField, + private val projectSelector: JsonField, + private val tags: JsonField>, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + description: JsonField = JsonMissing.of(), + @JsonProperty("enabled") @ExcludeMissing enabled: JsonField = JsonMissing.of(), + @JsonProperty("projectSelector") + @ExcludeMissing + projectSelector: JsonField = JsonMissing.of(), + @JsonProperty("tags") @ExcludeMissing tags: JsonField> = JsonMissing.of(), + ) : this(name, description, enabled, projectSelector, tags, mutableMapOf()) + + /** + * The framework name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun name(): String = name.getRequired("name") + + /** + * A short description of the framework. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun description(): Optional = description.getOptional("description") + + /** + * Whether the framework is active. Rules of a disabled framework are not evaluated and do + * not count towards compliance. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun enabled(): Optional = enabled.getOptional("enabled") + + /** + * Determines which projects the framework applies to. An empty or `null` `match` array + * applies the framework to every project in the workspace. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun projectSelector(): Optional = + projectSelector.getOptional("projectSelector") + + /** + * Free-form labels on the framework. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun tags(): Optional> = tags.getOptional("tags") + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("description") + @ExcludeMissing + fun _description(): JsonField = description + + /** + * Returns the raw JSON value of [enabled]. + * + * Unlike [enabled], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("enabled") @ExcludeMissing fun _enabled(): JsonField = enabled + + /** + * Returns the raw JSON value of [projectSelector]. + * + * Unlike [projectSelector], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("projectSelector") + @ExcludeMissing + fun _projectSelector(): JsonField = projectSelector + + /** + * Returns the raw JSON value of [tags]. + * + * Unlike [tags], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("tags") @ExcludeMissing fun _tags(): JsonField> = tags + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Body]. + * + * The following fields are required: + * ```java + * .name() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var name: JsonField? = null + private var description: JsonField = JsonMissing.of() + private var enabled: JsonField = JsonMissing.of() + private var projectSelector: JsonField = JsonMissing.of() + private var tags: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + name = body.name + description = body.description + enabled = body.enabled + projectSelector = body.projectSelector + tags = body.tags.map { it.toMutableList() } + additionalProperties = body.additionalProperties.toMutableMap() + } + + /** The framework name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun name(name: JsonField) = apply { this.name = name } + + /** A short description of the framework. */ + fun description(description: String?) = description(JsonField.ofNullable(description)) + + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ + fun description(description: Optional) = description(description.getOrNull()) + + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun description(description: JsonField) = apply { + this.description = description + } + + /** + * Whether the framework is active. Rules of a disabled framework are not evaluated and + * do not count towards compliance. + */ + fun enabled(enabled: Boolean) = enabled(JsonField.of(enabled)) + + /** + * Sets [Builder.enabled] to an arbitrary JSON value. + * + * You should usually call [Builder.enabled] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun enabled(enabled: JsonField) = apply { this.enabled = enabled } + + /** + * Determines which projects the framework applies to. An empty or `null` `match` array + * applies the framework to every project in the workspace. + */ + fun projectSelector(projectSelector: ProjectSelector?) = + projectSelector(JsonField.ofNullable(projectSelector)) + + /** Alias for calling [Builder.projectSelector] with `projectSelector.orElse(null)`. */ + fun projectSelector(projectSelector: Optional) = + projectSelector(projectSelector.getOrNull()) + + /** + * Sets [Builder.projectSelector] to an arbitrary JSON value. + * + * You should usually call [Builder.projectSelector] with a well-typed [ProjectSelector] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun projectSelector(projectSelector: JsonField) = apply { + this.projectSelector = projectSelector + } + + /** Free-form labels on the framework. */ + fun tags(tags: List) = tags(JsonField.of(tags)) + + /** + * Sets [Builder.tags] to an arbitrary JSON value. + * + * You should usually call [Builder.tags] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun tags(tags: JsonField>) = apply { + this.tags = tags.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [tags]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addTag(tag: String) = apply { + tags = + (tags ?: JsonField.of(mutableListOf())).also { checkKnown("tags", it).add(tag) } + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .name() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Body = + Body( + checkRequired("name", name), + description, + enabled, + projectSelector, + (tags ?: JsonMissing.of()).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Body = apply { + if (validated) { + return@apply + } + + name() + description() + enabled() + projectSelector().ifPresent { it.validate() } + tags() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (name.asKnown().isPresent) 1 else 0) + + (if (description.asKnown().isPresent) 1 else 0) + + (if (enabled.asKnown().isPresent) 1 else 0) + + (projectSelector.asKnown().getOrNull()?.validity() ?: 0) + + (tags.asKnown().getOrNull()?.size ?: 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Body && + name == other.name && + description == other.description && + enabled == other.enabled && + projectSelector == other.projectSelector && + tags == other.tags && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(name, description, enabled, projectSelector, tags, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Body{name=$name, description=$description, enabled=$enabled, projectSelector=$projectSelector, tags=$tags, additionalProperties=$additionalProperties}" + } + + /** + * Determines which projects the framework applies to. An empty or `null` `match` array applies + * the framework to every project in the workspace. + */ + class ProjectSelector + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val match: JsonField>, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("match") @ExcludeMissing match: JsonField> = JsonMissing.of() + ) : this(match, mutableMapOf()) + + /** + * Match criteria, ANDed together. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun match(): Optional> = match.getOptional("match") + + /** + * Returns the raw JSON value of [match]. + * + * Unlike [match], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("match") @ExcludeMissing fun _match(): JsonField> = match + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [ProjectSelector]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ProjectSelector]. */ + class Builder internal constructor() { + + private var match: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(projectSelector: ProjectSelector) = apply { + match = projectSelector.match.map { it.toMutableList() } + additionalProperties = projectSelector.additionalProperties.toMutableMap() + } + + /** Match criteria, ANDed together. */ + fun match(match: List?) = match(JsonField.ofNullable(match)) + + /** Alias for calling [Builder.match] with `match.orElse(null)`. */ + fun match(match: Optional>) = match(match.getOrNull()) + + /** + * Sets [Builder.match] to an arbitrary JSON value. + * + * You should usually call [Builder.match] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun match(match: JsonField>) = apply { + this.match = match.map { it.toMutableList() } + } + + /** + * Adds a single [Match] to [Builder.match]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addMatch(match: Match) = apply { + this.match = + (this.match ?: JsonField.of(mutableListOf())).also { + checkKnown("match", it).add(match) + } + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ProjectSelector]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): ProjectSelector = + ProjectSelector( + (match ?: JsonMissing.of()).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): ProjectSelector = apply { + if (validated) { + return@apply + } + + match().ifPresent { it.forEach { it.validate() } } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (match.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + class Match + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val property: JsonField, + private val value: JsonValue, + private val operator: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("property") + @ExcludeMissing + property: JsonField = JsonMissing.of(), + @JsonProperty("value") @ExcludeMissing value: JsonValue = JsonMissing.of(), + @JsonProperty("operator") + @ExcludeMissing + operator: JsonField = JsonMissing.of(), + ) : this(property, value, operator, mutableMapOf()) + + /** + * The project property to match against. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun property(): Property = property.getRequired("property") + + /** + * The value to match against. Pass an array to match any of several values, or `null` + * to match projects where the property is unset. Omit it for `exists` and `notExists`. + * + * This arbitrary value can be deserialized into a custom type using the `convert` + * method: + * ```java + * MyClass myObject = match.value().convert(MyClass.class); + * ``` + */ + @JsonProperty("value") @ExcludeMissing fun _value(): JsonValue = value + + /** + * How to compare the project property with `value`. One of `equals`, `notEquals`, + * `contains`, `notContains`, `startsWith`, `endsWith`, `in`, `notIn`, `greaterThan`, + * `greaterThanOrEqual`, `lessThan`, `lessThanOrEqual`, `equalsIgnoreCase`, + * `containsIgnoreCase`, `matches`, `exists`, or `notExists`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun operator(): Optional = operator.getOptional("operator") + + /** + * Returns the raw JSON value of [property]. + * + * Unlike [property], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("property") + @ExcludeMissing + fun _property(): JsonField = property + + /** + * Returns the raw JSON value of [operator]. + * + * Unlike [operator], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("operator") @ExcludeMissing fun _operator(): JsonField = operator + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Match]. + * + * The following fields are required: + * ```java + * .property() + * .value() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Match]. */ + class Builder internal constructor() { + + private var property: JsonField? = null + private var value: JsonValue? = null + private var operator: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(match: Match) = apply { + property = match.property + value = match.value + operator = match.operator + additionalProperties = match.additionalProperties.toMutableMap() + } + + /** The project property to match against. */ + fun property(property: Property) = property(JsonField.of(property)) + + /** + * Sets [Builder.property] to an arbitrary JSON value. + * + * You should usually call [Builder.property] with a well-typed [Property] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun property(property: JsonField) = apply { this.property = property } + + /** + * The value to match against. Pass an array to match any of several values, or + * `null` to match projects where the property is unset. Omit it for `exists` and + * `notExists`. + */ + fun value(value: JsonValue) = apply { this.value = value } + + /** + * How to compare the project property with `value`. One of `equals`, `notEquals`, + * `contains`, `notContains`, `startsWith`, `endsWith`, `in`, `notIn`, + * `greaterThan`, `greaterThanOrEqual`, `lessThan`, `lessThanOrEqual`, + * `equalsIgnoreCase`, `containsIgnoreCase`, `matches`, `exists`, or `notExists`. + */ + fun operator(operator: String) = operator(JsonField.of(operator)) + + /** + * Sets [Builder.operator] to an arbitrary JSON value. + * + * You should usually call [Builder.operator] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun operator(operator: JsonField) = apply { this.operator = operator } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Match]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .property() + * .value() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Match = + Match( + checkRequired("property", property), + checkRequired("value", value), + operator, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Match = apply { + if (validated) { + return@apply + } + + property().validate() + operator() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (property.asKnown().getOrNull()?.validity() ?: 0) + + (if (operator.asKnown().isPresent) 1 else 0) + + /** The project property to match against. */ + class Property @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val TASK_TYPE = of("taskType") + + @JvmField val RISK_LEVEL = of("riskLevel") + + @JvmField val RISK_TOTAL_SCORE = of("riskTotalScore") + + @JvmField val NAME = of("name") + + @JvmField val OWNER_ID = of("ownerId") + + @JvmField val MODEL_TYPES = of("modelTypes") + + @JvmStatic fun of(value: String) = Property(JsonField.of(value)) + } + + /** An enum containing [Property]'s known values. */ + enum class Known { + TASK_TYPE, + RISK_LEVEL, + RISK_TOTAL_SCORE, + NAME, + OWNER_ID, + MODEL_TYPES, + } + + /** + * An enum containing [Property]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Property] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + TASK_TYPE, + RISK_LEVEL, + RISK_TOTAL_SCORE, + NAME, + OWNER_ID, + MODEL_TYPES, + /** + * An enum member indicating that [Property] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + TASK_TYPE -> Value.TASK_TYPE + RISK_LEVEL -> Value.RISK_LEVEL + RISK_TOTAL_SCORE -> Value.RISK_TOTAL_SCORE + NAME -> Value.NAME + OWNER_ID -> Value.OWNER_ID + MODEL_TYPES -> Value.MODEL_TYPES + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + TASK_TYPE -> Known.TASK_TYPE + RISK_LEVEL -> Known.RISK_LEVEL + RISK_TOTAL_SCORE -> Known.RISK_TOTAL_SCORE + NAME -> Known.NAME + OWNER_ID -> Known.OWNER_ID + MODEL_TYPES -> Known.MODEL_TYPES + else -> throw OpenlayerInvalidDataException("Unknown Property: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): Property = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Property && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Match && + property == other.property && + value == other.value && + operator == other.operator && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(property, value, operator, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Match{property=$property, value=$value, operator=$operator, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ProjectSelector && + match == other.match && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(match, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ProjectSelector{match=$match, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is FrameworkCreateParams && + workspaceId == other.workspaceId && + body == other.body && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = + Objects.hash(workspaceId, body, additionalHeaders, additionalQueryParams) + + override fun toString() = + "FrameworkCreateParams{workspaceId=$workspaceId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkCreateResponse.kt new file mode 100644 index 00000000..96800cca --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkCreateResponse.kt @@ -0,0 +1,2923 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.frameworks + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.openlayer.api.core.Enum +import com.openlayer.api.core.ExcludeMissing +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonMissing +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.checkKnown +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.toImmutable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.time.OffsetDateTime +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class FrameworkCreateResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val id: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val enabled: JsonField, + private val name: JsonField, + private val tags: JsonField>, + private val workspaceId: JsonField, + private val avatar: JsonField, + private val builtInSlug: JsonField, + private val creatorId: JsonField, + private val description: JsonField, + private val extendedDescription: JsonField, + private val href: JsonField, + private val immutable: JsonField, + private val projectSelector: JsonField, + private val ruleStats: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("enabled") @ExcludeMissing enabled: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("tags") @ExcludeMissing tags: JsonField> = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + @JsonProperty("avatar") @ExcludeMissing avatar: JsonField = JsonMissing.of(), + @JsonProperty("builtInSlug") + @ExcludeMissing + builtInSlug: JsonField = JsonMissing.of(), + @JsonProperty("creatorId") @ExcludeMissing creatorId: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + description: JsonField = JsonMissing.of(), + @JsonProperty("extendedDescription") + @ExcludeMissing + extendedDescription: JsonField = JsonMissing.of(), + @JsonProperty("href") @ExcludeMissing href: JsonField = JsonMissing.of(), + @JsonProperty("immutable") @ExcludeMissing immutable: JsonField = JsonMissing.of(), + @JsonProperty("projectSelector") + @ExcludeMissing + projectSelector: JsonField = JsonMissing.of(), + @JsonProperty("ruleStats") + @ExcludeMissing + ruleStats: JsonField = JsonMissing.of(), + ) : this( + id, + dateCreated, + dateUpdated, + enabled, + name, + tags, + workspaceId, + avatar, + builtInSlug, + creatorId, + description, + extendedDescription, + href, + immutable, + projectSelector, + ruleStats, + mutableMapOf(), + ) + + /** + * The framework id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun id(): String = id.getRequired("id") + + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** + * The last update date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** + * Whether the framework is active. Rules of a disabled framework are not evaluated and do not + * count towards compliance. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun enabled(): Boolean = enabled.getRequired("enabled") + + /** + * The framework name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun name(): String = name.getRequired("name") + + /** + * Free-form labels on the framework. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun tags(): List = tags.getRequired("tags") + + /** + * The id of the workspace the framework belongs to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun workspaceId(): String = workspaceId.getRequired("workspaceId") + + /** + * The icon shown for the framework. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun avatar(): Optional = avatar.getOptional("avatar") + + /** + * Identifies a framework that ships with Openlayer, for example `eu_ai_act`, `iso_42001`, + * `nist_ai_rmf`, or `traiga`. `null` for frameworks you create yourself. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun builtInSlug(): Optional = builtInSlug.getOptional("builtInSlug") + + /** + * The user who created the framework. `null` for built-in frameworks. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun creatorId(): Optional = creatorId.getOptional("creatorId") + + /** + * A short description of the framework. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun description(): Optional = description.getOptional("description") + + /** + * A longer, rich-text description, as a TipTap JSON document. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun extendedDescription(): Optional = + extendedDescription.getOptional("extendedDescription") + + /** + * A link to the external standard or regulation the framework is based on. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun href(): Optional = href.getOptional("href") + + /** + * Whether the framework definition is managed by Openlayer and cannot be edited. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun immutable(): Optional = immutable.getOptional("immutable") + + /** + * Determines which projects the framework applies to. An empty or `null` `match` array applies + * the framework to every project in the workspace. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun projectSelector(): Optional = + projectSelector.getOptional("projectSelector") + + /** + * Compliance roll-up for the framework. Present only on `GET + * /workspaces/{workspaceId}/frameworks` when the request sets `includeRuleStats=true`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun ruleStats(): Optional = ruleStats.getOptional("ruleStats") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** + * Returns the raw JSON value of [enabled]. + * + * Unlike [enabled], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("enabled") @ExcludeMissing fun _enabled(): JsonField = enabled + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [tags]. + * + * Unlike [tags], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("tags") @ExcludeMissing fun _tags(): JsonField> = tags + + /** + * Returns the raw JSON value of [workspaceId]. + * + * Unlike [workspaceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("workspaceId") @ExcludeMissing fun _workspaceId(): JsonField = workspaceId + + /** + * Returns the raw JSON value of [avatar]. + * + * Unlike [avatar], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("avatar") @ExcludeMissing fun _avatar(): JsonField = avatar + + /** + * Returns the raw JSON value of [builtInSlug]. + * + * Unlike [builtInSlug], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("builtInSlug") @ExcludeMissing fun _builtInSlug(): JsonField = builtInSlug + + /** + * Returns the raw JSON value of [creatorId]. + * + * Unlike [creatorId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("creatorId") @ExcludeMissing fun _creatorId(): JsonField = creatorId + + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description + + /** + * Returns the raw JSON value of [extendedDescription]. + * + * Unlike [extendedDescription], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("extendedDescription") + @ExcludeMissing + fun _extendedDescription(): JsonField = extendedDescription + + /** + * Returns the raw JSON value of [href]. + * + * Unlike [href], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("href") @ExcludeMissing fun _href(): JsonField = href + + /** + * Returns the raw JSON value of [immutable]. + * + * Unlike [immutable], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("immutable") @ExcludeMissing fun _immutable(): JsonField = immutable + + /** + * Returns the raw JSON value of [projectSelector]. + * + * Unlike [projectSelector], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("projectSelector") + @ExcludeMissing + fun _projectSelector(): JsonField = projectSelector + + /** + * Returns the raw JSON value of [ruleStats]. + * + * Unlike [ruleStats], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("ruleStats") @ExcludeMissing fun _ruleStats(): JsonField = ruleStats + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [FrameworkCreateResponse]. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateUpdated() + * .enabled() + * .name() + * .tags() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [FrameworkCreateResponse]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var enabled: JsonField? = null + private var name: JsonField? = null + private var tags: JsonField>? = null + private var workspaceId: JsonField? = null + private var avatar: JsonField = JsonMissing.of() + private var builtInSlug: JsonField = JsonMissing.of() + private var creatorId: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var extendedDescription: JsonField = JsonMissing.of() + private var href: JsonField = JsonMissing.of() + private var immutable: JsonField = JsonMissing.of() + private var projectSelector: JsonField = JsonMissing.of() + private var ruleStats: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(frameworkCreateResponse: FrameworkCreateResponse) = apply { + id = frameworkCreateResponse.id + dateCreated = frameworkCreateResponse.dateCreated + dateUpdated = frameworkCreateResponse.dateUpdated + enabled = frameworkCreateResponse.enabled + name = frameworkCreateResponse.name + tags = frameworkCreateResponse.tags.map { it.toMutableList() } + workspaceId = frameworkCreateResponse.workspaceId + avatar = frameworkCreateResponse.avatar + builtInSlug = frameworkCreateResponse.builtInSlug + creatorId = frameworkCreateResponse.creatorId + description = frameworkCreateResponse.description + extendedDescription = frameworkCreateResponse.extendedDescription + href = frameworkCreateResponse.href + immutable = frameworkCreateResponse.immutable + projectSelector = frameworkCreateResponse.projectSelector + ruleStats = frameworkCreateResponse.ruleStats + additionalProperties = frameworkCreateResponse.additionalProperties.toMutableMap() + } + + /** The framework id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The last update date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** + * Whether the framework is active. Rules of a disabled framework are not evaluated and do + * not count towards compliance. + */ + fun enabled(enabled: Boolean) = enabled(JsonField.of(enabled)) + + /** + * Sets [Builder.enabled] to an arbitrary JSON value. + * + * You should usually call [Builder.enabled] with a well-typed [Boolean] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun enabled(enabled: JsonField) = apply { this.enabled = enabled } + + /** The framework name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun name(name: JsonField) = apply { this.name = name } + + /** Free-form labels on the framework. */ + fun tags(tags: List) = tags(JsonField.of(tags)) + + /** + * Sets [Builder.tags] to an arbitrary JSON value. + * + * You should usually call [Builder.tags] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun tags(tags: JsonField>) = apply { + this.tags = tags.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [tags]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addTag(tag: String) = apply { + tags = (tags ?: JsonField.of(mutableListOf())).also { checkKnown("tags", it).add(tag) } + } + + /** The id of the workspace the framework belongs to. */ + fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) + + /** + * Sets [Builder.workspaceId] to an arbitrary JSON value. + * + * You should usually call [Builder.workspaceId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun workspaceId(workspaceId: JsonField) = apply { this.workspaceId = workspaceId } + + /** The icon shown for the framework. */ + fun avatar(avatar: Avatar?) = avatar(JsonField.ofNullable(avatar)) + + /** Alias for calling [Builder.avatar] with `avatar.orElse(null)`. */ + fun avatar(avatar: Optional) = avatar(avatar.getOrNull()) + + /** + * Sets [Builder.avatar] to an arbitrary JSON value. + * + * You should usually call [Builder.avatar] with a well-typed [Avatar] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun avatar(avatar: JsonField) = apply { this.avatar = avatar } + + /** + * Identifies a framework that ships with Openlayer, for example `eu_ai_act`, `iso_42001`, + * `nist_ai_rmf`, or `traiga`. `null` for frameworks you create yourself. + */ + fun builtInSlug(builtInSlug: String?) = builtInSlug(JsonField.ofNullable(builtInSlug)) + + /** Alias for calling [Builder.builtInSlug] with `builtInSlug.orElse(null)`. */ + fun builtInSlug(builtInSlug: Optional) = builtInSlug(builtInSlug.getOrNull()) + + /** + * Sets [Builder.builtInSlug] to an arbitrary JSON value. + * + * You should usually call [Builder.builtInSlug] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun builtInSlug(builtInSlug: JsonField) = apply { this.builtInSlug = builtInSlug } + + /** The user who created the framework. `null` for built-in frameworks. */ + fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) + + /** Alias for calling [Builder.creatorId] with `creatorId.orElse(null)`. */ + fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) + + /** + * Sets [Builder.creatorId] to an arbitrary JSON value. + * + * You should usually call [Builder.creatorId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } + + /** A short description of the framework. */ + fun description(description: String?) = description(JsonField.ofNullable(description)) + + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ + fun description(description: Optional) = description(description.getOrNull()) + + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun description(description: JsonField) = apply { this.description = description } + + /** A longer, rich-text description, as a TipTap JSON document. */ + fun extendedDescription(extendedDescription: ExtendedDescription?) = + extendedDescription(JsonField.ofNullable(extendedDescription)) + + /** + * Alias for calling [Builder.extendedDescription] with `extendedDescription.orElse(null)`. + */ + fun extendedDescription(extendedDescription: Optional) = + extendedDescription(extendedDescription.getOrNull()) + + /** + * Sets [Builder.extendedDescription] to an arbitrary JSON value. + * + * You should usually call [Builder.extendedDescription] with a well-typed + * [ExtendedDescription] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun extendedDescription(extendedDescription: JsonField) = apply { + this.extendedDescription = extendedDescription + } + + /** A link to the external standard or regulation the framework is based on. */ + fun href(href: String?) = href(JsonField.ofNullable(href)) + + /** Alias for calling [Builder.href] with `href.orElse(null)`. */ + fun href(href: Optional) = href(href.getOrNull()) + + /** + * Sets [Builder.href] to an arbitrary JSON value. + * + * You should usually call [Builder.href] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun href(href: JsonField) = apply { this.href = href } + + /** Whether the framework definition is managed by Openlayer and cannot be edited. */ + fun immutable(immutable: Boolean) = immutable(JsonField.of(immutable)) + + /** + * Sets [Builder.immutable] to an arbitrary JSON value. + * + * You should usually call [Builder.immutable] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun immutable(immutable: JsonField) = apply { this.immutable = immutable } + + /** + * Determines which projects the framework applies to. An empty or `null` `match` array + * applies the framework to every project in the workspace. + */ + fun projectSelector(projectSelector: ProjectSelector?) = + projectSelector(JsonField.ofNullable(projectSelector)) + + /** Alias for calling [Builder.projectSelector] with `projectSelector.orElse(null)`. */ + fun projectSelector(projectSelector: Optional) = + projectSelector(projectSelector.getOrNull()) + + /** + * Sets [Builder.projectSelector] to an arbitrary JSON value. + * + * You should usually call [Builder.projectSelector] with a well-typed [ProjectSelector] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun projectSelector(projectSelector: JsonField) = apply { + this.projectSelector = projectSelector + } + + /** + * Compliance roll-up for the framework. Present only on `GET + * /workspaces/{workspaceId}/frameworks` when the request sets `includeRuleStats=true`. + */ + fun ruleStats(ruleStats: RuleStats) = ruleStats(JsonField.of(ruleStats)) + + /** + * Sets [Builder.ruleStats] to an arbitrary JSON value. + * + * You should usually call [Builder.ruleStats] with a well-typed [RuleStats] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun ruleStats(ruleStats: JsonField) = apply { this.ruleStats = ruleStats } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [FrameworkCreateResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateUpdated() + * .enabled() + * .name() + * .tags() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): FrameworkCreateResponse = + FrameworkCreateResponse( + checkRequired("id", id), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("enabled", enabled), + checkRequired("name", name), + checkRequired("tags", tags).map { it.toImmutable() }, + checkRequired("workspaceId", workspaceId), + avatar, + builtInSlug, + creatorId, + description, + extendedDescription, + href, + immutable, + projectSelector, + ruleStats, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): FrameworkCreateResponse = apply { + if (validated) { + return@apply + } + + id() + dateCreated() + dateUpdated() + enabled() + name() + tags() + workspaceId() + avatar().ifPresent { it.validate() } + builtInSlug() + creatorId() + description() + extendedDescription().ifPresent { it.validate() } + href() + immutable() + projectSelector().ifPresent { it.validate() } + ruleStats().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (enabled.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (tags.asKnown().getOrNull()?.size ?: 0) + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + (avatar.asKnown().getOrNull()?.validity() ?: 0) + + (if (builtInSlug.asKnown().isPresent) 1 else 0) + + (if (creatorId.asKnown().isPresent) 1 else 0) + + (if (description.asKnown().isPresent) 1 else 0) + + (extendedDescription.asKnown().getOrNull()?.validity() ?: 0) + + (if (href.asKnown().isPresent) 1 else 0) + + (if (immutable.asKnown().isPresent) 1 else 0) + + (projectSelector.asKnown().getOrNull()?.validity() ?: 0) + + (ruleStats.asKnown().getOrNull()?.validity() ?: 0) + + /** The icon shown for the framework. */ + class Avatar + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val type: JsonField, + private val value: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("value") @ExcludeMissing value: JsonField = JsonMissing.of(), + ) : this(type, value, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun type(): Type = type.getRequired("type") + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun value(): String = value.getRequired("value") + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + /** + * Returns the raw JSON value of [value]. + * + * Unlike [value], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Avatar]. + * + * The following fields are required: + * ```java + * .type() + * .value() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Avatar]. */ + class Builder internal constructor() { + + private var type: JsonField? = null + private var value: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(avatar: Avatar) = apply { + type = avatar.type + value = avatar.value + additionalProperties = avatar.additionalProperties.toMutableMap() + } + + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun type(type: JsonField) = apply { this.type = type } + + fun value(value: String) = value(JsonField.of(value)) + + /** + * Sets [Builder.value] to an arbitrary JSON value. + * + * You should usually call [Builder.value] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun value(value: JsonField) = apply { this.value = value } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Avatar]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .type() + * .value() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Avatar = + Avatar( + checkRequired("type", type), + checkRequired("value", value), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Avatar = apply { + if (validated) { + return@apply + } + + type().validate() + value() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (type.asKnown().getOrNull()?.validity() ?: 0) + + (if (value.asKnown().isPresent) 1 else 0) + + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val EMOJI = of("emoji") + + @JvmField val IMAGE_URL = of("imageUrl") + + @JvmField val BUILTIN_IMAGE = of("builtinImage") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + EMOJI, + IMAGE_URL, + BUILTIN_IMAGE, + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + EMOJI, + IMAGE_URL, + BUILTIN_IMAGE, + /** An enum member indicating that [Type] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + EMOJI -> Value.EMOJI + IMAGE_URL -> Value.IMAGE_URL + BUILTIN_IMAGE -> Value.BUILTIN_IMAGE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + EMOJI -> Known.EMOJI + IMAGE_URL -> Known.IMAGE_URL + BUILTIN_IMAGE -> Known.BUILTIN_IMAGE + else -> throw OpenlayerInvalidDataException("Unknown Type: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Avatar && + type == other.type && + value == other.value && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(type, value, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Avatar{type=$type, value=$value, additionalProperties=$additionalProperties}" + } + + /** A longer, rich-text description, as a TipTap JSON document. */ + class ExtendedDescription + @JsonCreator + private constructor( + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [ExtendedDescription]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ExtendedDescription]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(extendedDescription: ExtendedDescription) = apply { + additionalProperties = extendedDescription.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ExtendedDescription]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): ExtendedDescription = + ExtendedDescription(additionalProperties.toImmutable()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): ExtendedDescription = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ExtendedDescription && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = "ExtendedDescription{additionalProperties=$additionalProperties}" + } + + /** + * Determines which projects the framework applies to. An empty or `null` `match` array applies + * the framework to every project in the workspace. + */ + class ProjectSelector + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val match: JsonField>, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("match") @ExcludeMissing match: JsonField> = JsonMissing.of() + ) : this(match, mutableMapOf()) + + /** + * Match criteria, ANDed together. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun match(): Optional> = match.getOptional("match") + + /** + * Returns the raw JSON value of [match]. + * + * Unlike [match], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("match") @ExcludeMissing fun _match(): JsonField> = match + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [ProjectSelector]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ProjectSelector]. */ + class Builder internal constructor() { + + private var match: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(projectSelector: ProjectSelector) = apply { + match = projectSelector.match.map { it.toMutableList() } + additionalProperties = projectSelector.additionalProperties.toMutableMap() + } + + /** Match criteria, ANDed together. */ + fun match(match: List?) = match(JsonField.ofNullable(match)) + + /** Alias for calling [Builder.match] with `match.orElse(null)`. */ + fun match(match: Optional>) = match(match.getOrNull()) + + /** + * Sets [Builder.match] to an arbitrary JSON value. + * + * You should usually call [Builder.match] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun match(match: JsonField>) = apply { + this.match = match.map { it.toMutableList() } + } + + /** + * Adds a single [Match] to [Builder.match]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addMatch(match: Match) = apply { + this.match = + (this.match ?: JsonField.of(mutableListOf())).also { + checkKnown("match", it).add(match) + } + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ProjectSelector]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): ProjectSelector = + ProjectSelector( + (match ?: JsonMissing.of()).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): ProjectSelector = apply { + if (validated) { + return@apply + } + + match().ifPresent { it.forEach { it.validate() } } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (match.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + class Match + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val property: JsonField, + private val value: JsonValue, + private val operator: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("property") + @ExcludeMissing + property: JsonField = JsonMissing.of(), + @JsonProperty("value") @ExcludeMissing value: JsonValue = JsonMissing.of(), + @JsonProperty("operator") + @ExcludeMissing + operator: JsonField = JsonMissing.of(), + ) : this(property, value, operator, mutableMapOf()) + + /** + * The project property to match against. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun property(): Property = property.getRequired("property") + + /** + * The value to match against. Pass an array to match any of several values, or `null` + * to match projects where the property is unset. Omit it for `exists` and `notExists`. + * + * This arbitrary value can be deserialized into a custom type using the `convert` + * method: + * ```java + * MyClass myObject = match.value().convert(MyClass.class); + * ``` + */ + @JsonProperty("value") @ExcludeMissing fun _value(): JsonValue = value + + /** + * How to compare the project property with `value`. One of `equals`, `notEquals`, + * `contains`, `notContains`, `startsWith`, `endsWith`, `in`, `notIn`, `greaterThan`, + * `greaterThanOrEqual`, `lessThan`, `lessThanOrEqual`, `equalsIgnoreCase`, + * `containsIgnoreCase`, `matches`, `exists`, or `notExists`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun operator(): Optional = operator.getOptional("operator") + + /** + * Returns the raw JSON value of [property]. + * + * Unlike [property], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("property") + @ExcludeMissing + fun _property(): JsonField = property + + /** + * Returns the raw JSON value of [operator]. + * + * Unlike [operator], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("operator") @ExcludeMissing fun _operator(): JsonField = operator + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Match]. + * + * The following fields are required: + * ```java + * .property() + * .value() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Match]. */ + class Builder internal constructor() { + + private var property: JsonField? = null + private var value: JsonValue? = null + private var operator: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(match: Match) = apply { + property = match.property + value = match.value + operator = match.operator + additionalProperties = match.additionalProperties.toMutableMap() + } + + /** The project property to match against. */ + fun property(property: Property) = property(JsonField.of(property)) + + /** + * Sets [Builder.property] to an arbitrary JSON value. + * + * You should usually call [Builder.property] with a well-typed [Property] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun property(property: JsonField) = apply { this.property = property } + + /** + * The value to match against. Pass an array to match any of several values, or + * `null` to match projects where the property is unset. Omit it for `exists` and + * `notExists`. + */ + fun value(value: JsonValue) = apply { this.value = value } + + /** + * How to compare the project property with `value`. One of `equals`, `notEquals`, + * `contains`, `notContains`, `startsWith`, `endsWith`, `in`, `notIn`, + * `greaterThan`, `greaterThanOrEqual`, `lessThan`, `lessThanOrEqual`, + * `equalsIgnoreCase`, `containsIgnoreCase`, `matches`, `exists`, or `notExists`. + */ + fun operator(operator: String) = operator(JsonField.of(operator)) + + /** + * Sets [Builder.operator] to an arbitrary JSON value. + * + * You should usually call [Builder.operator] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun operator(operator: JsonField) = apply { this.operator = operator } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Match]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .property() + * .value() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Match = + Match( + checkRequired("property", property), + checkRequired("value", value), + operator, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Match = apply { + if (validated) { + return@apply + } + + property().validate() + operator() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (property.asKnown().getOrNull()?.validity() ?: 0) + + (if (operator.asKnown().isPresent) 1 else 0) + + /** The project property to match against. */ + class Property @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val TASK_TYPE = of("taskType") + + @JvmField val RISK_LEVEL = of("riskLevel") + + @JvmField val RISK_TOTAL_SCORE = of("riskTotalScore") + + @JvmField val NAME = of("name") + + @JvmField val OWNER_ID = of("ownerId") + + @JvmField val MODEL_TYPES = of("modelTypes") + + @JvmStatic fun of(value: String) = Property(JsonField.of(value)) + } + + /** An enum containing [Property]'s known values. */ + enum class Known { + TASK_TYPE, + RISK_LEVEL, + RISK_TOTAL_SCORE, + NAME, + OWNER_ID, + MODEL_TYPES, + } + + /** + * An enum containing [Property]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Property] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + TASK_TYPE, + RISK_LEVEL, + RISK_TOTAL_SCORE, + NAME, + OWNER_ID, + MODEL_TYPES, + /** + * An enum member indicating that [Property] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + TASK_TYPE -> Value.TASK_TYPE + RISK_LEVEL -> Value.RISK_LEVEL + RISK_TOTAL_SCORE -> Value.RISK_TOTAL_SCORE + NAME -> Value.NAME + OWNER_ID -> Value.OWNER_ID + MODEL_TYPES -> Value.MODEL_TYPES + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + TASK_TYPE -> Known.TASK_TYPE + RISK_LEVEL -> Known.RISK_LEVEL + RISK_TOTAL_SCORE -> Known.RISK_TOTAL_SCORE + NAME -> Known.NAME + OWNER_ID -> Known.OWNER_ID + MODEL_TYPES -> Known.MODEL_TYPES + else -> throw OpenlayerInvalidDataException("Unknown Property: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): Property = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Property && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Match && + property == other.property && + value == other.value && + operator == other.operator && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(property, value, operator, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Match{property=$property, value=$value, operator=$operator, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ProjectSelector && + match == other.match && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(match, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ProjectSelector{match=$match, additionalProperties=$additionalProperties}" + } + + /** + * Compliance roll-up for the framework. Present only on `GET + * /workspaces/{workspaceId}/frameworks` when the request sets `includeRuleStats=true`. + */ + class RuleStats + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val projectCompletion: JsonField, + private val ruleResults: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("projectCompletion") + @ExcludeMissing + projectCompletion: JsonField = JsonMissing.of(), + @JsonProperty("ruleResults") + @ExcludeMissing + ruleResults: JsonField = JsonMissing.of(), + ) : this(projectCompletion, ruleResults, mutableMapOf()) + + /** + * How many of the framework's projects fall into each completion band, where a project's + * completion is the share of its rule results that are passing or skipped. Projects with no + * evaluated results count as `low`. + * + * Zeroed when the request carries `projectId`: the bands compare a framework's projects + * against each other, which says nothing about a single project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun projectCompletion(): ProjectCompletion = + projectCompletion.getRequired("projectCompletion") + + /** + * Rule result counts by status for this framework, matching what + * `/workspaces/{workspaceId}/rule-stats?frameworkId=` reports. Narrowed to a single + * project when the request also carries `projectId`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun ruleResults(): RuleResults = ruleResults.getRequired("ruleResults") + + /** + * Returns the raw JSON value of [projectCompletion]. + * + * Unlike [projectCompletion], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("projectCompletion") + @ExcludeMissing + fun _projectCompletion(): JsonField = projectCompletion + + /** + * Returns the raw JSON value of [ruleResults]. + * + * Unlike [ruleResults], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("ruleResults") + @ExcludeMissing + fun _ruleResults(): JsonField = ruleResults + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [RuleStats]. + * + * The following fields are required: + * ```java + * .projectCompletion() + * .ruleResults() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [RuleStats]. */ + class Builder internal constructor() { + + private var projectCompletion: JsonField? = null + private var ruleResults: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(ruleStats: RuleStats) = apply { + projectCompletion = ruleStats.projectCompletion + ruleResults = ruleStats.ruleResults + additionalProperties = ruleStats.additionalProperties.toMutableMap() + } + + /** + * How many of the framework's projects fall into each completion band, where a + * project's completion is the share of its rule results that are passing or skipped. + * Projects with no evaluated results count as `low`. + * + * Zeroed when the request carries `projectId`: the bands compare a framework's projects + * against each other, which says nothing about a single project. + */ + fun projectCompletion(projectCompletion: ProjectCompletion) = + projectCompletion(JsonField.of(projectCompletion)) + + /** + * Sets [Builder.projectCompletion] to an arbitrary JSON value. + * + * You should usually call [Builder.projectCompletion] with a well-typed + * [ProjectCompletion] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun projectCompletion(projectCompletion: JsonField) = apply { + this.projectCompletion = projectCompletion + } + + /** + * Rule result counts by status for this framework, matching what + * `/workspaces/{workspaceId}/rule-stats?frameworkId=` reports. Narrowed to a single + * project when the request also carries `projectId`. + */ + fun ruleResults(ruleResults: RuleResults) = ruleResults(JsonField.of(ruleResults)) + + /** + * Sets [Builder.ruleResults] to an arbitrary JSON value. + * + * You should usually call [Builder.ruleResults] with a well-typed [RuleResults] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun ruleResults(ruleResults: JsonField) = apply { + this.ruleResults = ruleResults + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [RuleStats]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .projectCompletion() + * .ruleResults() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): RuleStats = + RuleStats( + checkRequired("projectCompletion", projectCompletion), + checkRequired("ruleResults", ruleResults), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): RuleStats = apply { + if (validated) { + return@apply + } + + projectCompletion().validate() + ruleResults().validate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (projectCompletion.asKnown().getOrNull()?.validity() ?: 0) + + (ruleResults.asKnown().getOrNull()?.validity() ?: 0) + + /** + * How many of the framework's projects fall into each completion band, where a project's + * completion is the share of its rule results that are passing or skipped. Projects with no + * evaluated results count as `low`. + * + * Zeroed when the request carries `projectId`: the bands compare a framework's projects + * against each other, which says nothing about a single project. + */ + class ProjectCompletion + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val high: JsonField, + private val low: JsonField, + private val mid: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("high") @ExcludeMissing high: JsonField = JsonMissing.of(), + @JsonProperty("low") @ExcludeMissing low: JsonField = JsonMissing.of(), + @JsonProperty("mid") @ExcludeMissing mid: JsonField = JsonMissing.of(), + ) : this(high, low, mid, mutableMapOf()) + + /** + * Projects at 80% completion or above. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun high(): Long = high.getRequired("high") + + /** + * Projects below 20% completion. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun low(): Long = low.getRequired("low") + + /** + * Projects at or above 20% but below 80% completion. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun mid(): Long = mid.getRequired("mid") + + /** + * Returns the raw JSON value of [high]. + * + * Unlike [high], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("high") @ExcludeMissing fun _high(): JsonField = high + + /** + * Returns the raw JSON value of [low]. + * + * Unlike [low], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("low") @ExcludeMissing fun _low(): JsonField = low + + /** + * Returns the raw JSON value of [mid]. + * + * Unlike [mid], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("mid") @ExcludeMissing fun _mid(): JsonField = mid + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [ProjectCompletion]. + * + * The following fields are required: + * ```java + * .high() + * .low() + * .mid() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ProjectCompletion]. */ + class Builder internal constructor() { + + private var high: JsonField? = null + private var low: JsonField? = null + private var mid: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(projectCompletion: ProjectCompletion) = apply { + high = projectCompletion.high + low = projectCompletion.low + mid = projectCompletion.mid + additionalProperties = projectCompletion.additionalProperties.toMutableMap() + } + + /** Projects at 80% completion or above. */ + fun high(high: Long) = high(JsonField.of(high)) + + /** + * Sets [Builder.high] to an arbitrary JSON value. + * + * You should usually call [Builder.high] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun high(high: JsonField) = apply { this.high = high } + + /** Projects below 20% completion. */ + fun low(low: Long) = low(JsonField.of(low)) + + /** + * Sets [Builder.low] to an arbitrary JSON value. + * + * You should usually call [Builder.low] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun low(low: JsonField) = apply { this.low = low } + + /** Projects at or above 20% but below 80% completion. */ + fun mid(mid: Long) = mid(JsonField.of(mid)) + + /** + * Sets [Builder.mid] to an arbitrary JSON value. + * + * You should usually call [Builder.mid] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun mid(mid: JsonField) = apply { this.mid = mid } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ProjectCompletion]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .high() + * .low() + * .mid() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): ProjectCompletion = + ProjectCompletion( + checkRequired("high", high), + checkRequired("low", low), + checkRequired("mid", mid), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): ProjectCompletion = apply { + if (validated) { + return@apply + } + + high() + low() + mid() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (high.asKnown().isPresent) 1 else 0) + + (if (low.asKnown().isPresent) 1 else 0) + + (if (mid.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ProjectCompletion && + high == other.high && + low == other.low && + mid == other.mid && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(high, low, mid, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ProjectCompletion{high=$high, low=$low, mid=$mid, additionalProperties=$additionalProperties}" + } + + /** + * Rule result counts by status for this framework, matching what + * `/workspaces/{workspaceId}/rule-stats?frameworkId=` reports. Narrowed to a single + * project when the request also carries `projectId`. + */ + class RuleResults + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val total: JsonField, + private val totalDueSoon: JsonField, + private val totalError: JsonField, + private val totalFailing: JsonField, + private val totalPassing: JsonField, + private val totalPending: JsonField, + private val totalRunning: JsonField, + private val totalSkipped: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("total") @ExcludeMissing total: JsonField = JsonMissing.of(), + @JsonProperty("totalDueSoon") + @ExcludeMissing + totalDueSoon: JsonField = JsonMissing.of(), + @JsonProperty("totalError") + @ExcludeMissing + totalError: JsonField = JsonMissing.of(), + @JsonProperty("totalFailing") + @ExcludeMissing + totalFailing: JsonField = JsonMissing.of(), + @JsonProperty("totalPassing") + @ExcludeMissing + totalPassing: JsonField = JsonMissing.of(), + @JsonProperty("totalPending") + @ExcludeMissing + totalPending: JsonField = JsonMissing.of(), + @JsonProperty("totalRunning") + @ExcludeMissing + totalRunning: JsonField = JsonMissing.of(), + @JsonProperty("totalSkipped") + @ExcludeMissing + totalSkipped: JsonField = JsonMissing.of(), + ) : this( + total, + totalDueSoon, + totalError, + totalFailing, + totalPassing, + totalPending, + totalRunning, + totalSkipped, + mutableMapOf(), + ) + + /** + * The total number of rule results. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun total(): Long = total.getRequired("total") + + /** + * The number of rule results whose evidence is about to expire. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun totalDueSoon(): Long = totalDueSoon.getRequired("totalDueSoon") + + /** + * The number of rule results that errored during evaluation. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun totalError(): Long = totalError.getRequired("totalError") + + /** + * The number of failing rule results. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun totalFailing(): Long = totalFailing.getRequired("totalFailing") + + /** + * The number of passing rule results. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun totalPassing(): Long = totalPassing.getRequired("totalPassing") + + /** + * The number of rule results that have not been satisfied yet. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun totalPending(): Long = totalPending.getRequired("totalPending") + + /** + * The number of rule results currently being evaluated. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun totalRunning(): Long = totalRunning.getRequired("totalRunning") + + /** + * The number of skipped rule results. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun totalSkipped(): Long = totalSkipped.getRequired("totalSkipped") + + /** + * Returns the raw JSON value of [total]. + * + * Unlike [total], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("total") @ExcludeMissing fun _total(): JsonField = total + + /** + * Returns the raw JSON value of [totalDueSoon]. + * + * Unlike [totalDueSoon], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("totalDueSoon") + @ExcludeMissing + fun _totalDueSoon(): JsonField = totalDueSoon + + /** + * Returns the raw JSON value of [totalError]. + * + * Unlike [totalError], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("totalError") + @ExcludeMissing + fun _totalError(): JsonField = totalError + + /** + * Returns the raw JSON value of [totalFailing]. + * + * Unlike [totalFailing], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("totalFailing") + @ExcludeMissing + fun _totalFailing(): JsonField = totalFailing + + /** + * Returns the raw JSON value of [totalPassing]. + * + * Unlike [totalPassing], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("totalPassing") + @ExcludeMissing + fun _totalPassing(): JsonField = totalPassing + + /** + * Returns the raw JSON value of [totalPending]. + * + * Unlike [totalPending], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("totalPending") + @ExcludeMissing + fun _totalPending(): JsonField = totalPending + + /** + * Returns the raw JSON value of [totalRunning]. + * + * Unlike [totalRunning], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("totalRunning") + @ExcludeMissing + fun _totalRunning(): JsonField = totalRunning + + /** + * Returns the raw JSON value of [totalSkipped]. + * + * Unlike [totalSkipped], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("totalSkipped") + @ExcludeMissing + fun _totalSkipped(): JsonField = totalSkipped + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [RuleResults]. + * + * The following fields are required: + * ```java + * .total() + * .totalDueSoon() + * .totalError() + * .totalFailing() + * .totalPassing() + * .totalPending() + * .totalRunning() + * .totalSkipped() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [RuleResults]. */ + class Builder internal constructor() { + + private var total: JsonField? = null + private var totalDueSoon: JsonField? = null + private var totalError: JsonField? = null + private var totalFailing: JsonField? = null + private var totalPassing: JsonField? = null + private var totalPending: JsonField? = null + private var totalRunning: JsonField? = null + private var totalSkipped: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(ruleResults: RuleResults) = apply { + total = ruleResults.total + totalDueSoon = ruleResults.totalDueSoon + totalError = ruleResults.totalError + totalFailing = ruleResults.totalFailing + totalPassing = ruleResults.totalPassing + totalPending = ruleResults.totalPending + totalRunning = ruleResults.totalRunning + totalSkipped = ruleResults.totalSkipped + additionalProperties = ruleResults.additionalProperties.toMutableMap() + } + + /** The total number of rule results. */ + fun total(total: Long) = total(JsonField.of(total)) + + /** + * Sets [Builder.total] to an arbitrary JSON value. + * + * You should usually call [Builder.total] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun total(total: JsonField) = apply { this.total = total } + + /** The number of rule results whose evidence is about to expire. */ + fun totalDueSoon(totalDueSoon: Long) = totalDueSoon(JsonField.of(totalDueSoon)) + + /** + * Sets [Builder.totalDueSoon] to an arbitrary JSON value. + * + * You should usually call [Builder.totalDueSoon] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun totalDueSoon(totalDueSoon: JsonField) = apply { + this.totalDueSoon = totalDueSoon + } + + /** The number of rule results that errored during evaluation. */ + fun totalError(totalError: Long) = totalError(JsonField.of(totalError)) + + /** + * Sets [Builder.totalError] to an arbitrary JSON value. + * + * You should usually call [Builder.totalError] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun totalError(totalError: JsonField) = apply { this.totalError = totalError } + + /** The number of failing rule results. */ + fun totalFailing(totalFailing: Long) = totalFailing(JsonField.of(totalFailing)) + + /** + * Sets [Builder.totalFailing] to an arbitrary JSON value. + * + * You should usually call [Builder.totalFailing] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun totalFailing(totalFailing: JsonField) = apply { + this.totalFailing = totalFailing + } + + /** The number of passing rule results. */ + fun totalPassing(totalPassing: Long) = totalPassing(JsonField.of(totalPassing)) + + /** + * Sets [Builder.totalPassing] to an arbitrary JSON value. + * + * You should usually call [Builder.totalPassing] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun totalPassing(totalPassing: JsonField) = apply { + this.totalPassing = totalPassing + } + + /** The number of rule results that have not been satisfied yet. */ + fun totalPending(totalPending: Long) = totalPending(JsonField.of(totalPending)) + + /** + * Sets [Builder.totalPending] to an arbitrary JSON value. + * + * You should usually call [Builder.totalPending] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun totalPending(totalPending: JsonField) = apply { + this.totalPending = totalPending + } + + /** The number of rule results currently being evaluated. */ + fun totalRunning(totalRunning: Long) = totalRunning(JsonField.of(totalRunning)) + + /** + * Sets [Builder.totalRunning] to an arbitrary JSON value. + * + * You should usually call [Builder.totalRunning] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun totalRunning(totalRunning: JsonField) = apply { + this.totalRunning = totalRunning + } + + /** The number of skipped rule results. */ + fun totalSkipped(totalSkipped: Long) = totalSkipped(JsonField.of(totalSkipped)) + + /** + * Sets [Builder.totalSkipped] to an arbitrary JSON value. + * + * You should usually call [Builder.totalSkipped] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun totalSkipped(totalSkipped: JsonField) = apply { + this.totalSkipped = totalSkipped + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [RuleResults]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .total() + * .totalDueSoon() + * .totalError() + * .totalFailing() + * .totalPassing() + * .totalPending() + * .totalRunning() + * .totalSkipped() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): RuleResults = + RuleResults( + checkRequired("total", total), + checkRequired("totalDueSoon", totalDueSoon), + checkRequired("totalError", totalError), + checkRequired("totalFailing", totalFailing), + checkRequired("totalPassing", totalPassing), + checkRequired("totalPending", totalPending), + checkRequired("totalRunning", totalRunning), + checkRequired("totalSkipped", totalSkipped), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): RuleResults = apply { + if (validated) { + return@apply + } + + total() + totalDueSoon() + totalError() + totalFailing() + totalPassing() + totalPending() + totalRunning() + totalSkipped() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (total.asKnown().isPresent) 1 else 0) + + (if (totalDueSoon.asKnown().isPresent) 1 else 0) + + (if (totalError.asKnown().isPresent) 1 else 0) + + (if (totalFailing.asKnown().isPresent) 1 else 0) + + (if (totalPassing.asKnown().isPresent) 1 else 0) + + (if (totalPending.asKnown().isPresent) 1 else 0) + + (if (totalRunning.asKnown().isPresent) 1 else 0) + + (if (totalSkipped.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is RuleResults && + total == other.total && + totalDueSoon == other.totalDueSoon && + totalError == other.totalError && + totalFailing == other.totalFailing && + totalPassing == other.totalPassing && + totalPending == other.totalPending && + totalRunning == other.totalRunning && + totalSkipped == other.totalSkipped && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + total, + totalDueSoon, + totalError, + totalFailing, + totalPassing, + totalPending, + totalRunning, + totalSkipped, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "RuleResults{total=$total, totalDueSoon=$totalDueSoon, totalError=$totalError, totalFailing=$totalFailing, totalPassing=$totalPassing, totalPending=$totalPending, totalRunning=$totalRunning, totalSkipped=$totalSkipped, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is RuleStats && + projectCompletion == other.projectCompletion && + ruleResults == other.ruleResults && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(projectCompletion, ruleResults, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "RuleStats{projectCompletion=$projectCompletion, ruleResults=$ruleResults, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is FrameworkCreateResponse && + id == other.id && + dateCreated == other.dateCreated && + dateUpdated == other.dateUpdated && + enabled == other.enabled && + name == other.name && + tags == other.tags && + workspaceId == other.workspaceId && + avatar == other.avatar && + builtInSlug == other.builtInSlug && + creatorId == other.creatorId && + description == other.description && + extendedDescription == other.extendedDescription && + href == other.href && + immutable == other.immutable && + projectSelector == other.projectSelector && + ruleStats == other.ruleStats && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + dateCreated, + dateUpdated, + enabled, + name, + tags, + workspaceId, + avatar, + builtInSlug, + creatorId, + description, + extendedDescription, + href, + immutable, + projectSelector, + ruleStats, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "FrameworkCreateResponse{id=$id, dateCreated=$dateCreated, dateUpdated=$dateUpdated, enabled=$enabled, name=$name, tags=$tags, workspaceId=$workspaceId, avatar=$avatar, builtInSlug=$builtInSlug, creatorId=$creatorId, description=$description, extendedDescription=$extendedDescription, href=$href, immutable=$immutable, projectSelector=$projectSelector, ruleStats=$ruleStats, additionalProperties=$additionalProperties}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkExportParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkExportParams.kt new file mode 100644 index 00000000..f4eb59c5 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkExportParams.kt @@ -0,0 +1,445 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.frameworks + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.openlayer.api.core.ExcludeMissing +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonMissing +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.Params +import com.openlayer.api.core.http.Headers +import com.openlayer.api.core.http.QueryParams +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * Export a framework's evidence and progress as an audit-ready zip archive. + * + * The archive holds every evidence file uploaded against the framework's evidence-based rules, a + * markdown report of the framework's progress and the status of all its rules (broken down by + * documentation section when the framework has documents), and CSV manifests of rules and evidence + * with SHA-256 checksums. + * + * Send `projectId` to export one project's compliance with the framework. Omit it for the + * workspace-wide view across every project in the framework, including workspace-scoped rules. + * + * The export runs as a background task, so this returns `202` immediately. To collect the archive: + * 1. Poll `GET /background-tasks/{taskId}` with the returned `taskResultId` until `complete` is + * `true`. + * 2. Read `outputs.storageUri` off that task. + * 3. Exchange it for a download link at `GET /storage/presigned-url?storageUri=`. + * + * Rate limited to 2 requests per minute per framework. Asking for an export while an identical one + * is still queued returns that task rather than starting a second one. + */ +class FrameworkExportParams +private constructor( + private val frameworkId: String?, + private val body: Body, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun frameworkId(): Optional = Optional.ofNullable(frameworkId) + + /** + * Scope the export to this project. It must belong to the framework. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun projectId(): Optional = body.projectId() + + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _projectId(): JsonField = body._projectId() + + fun _additionalBodyProperties(): Map = body._additionalProperties() + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): FrameworkExportParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [FrameworkExportParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [FrameworkExportParams]. */ + class Builder internal constructor() { + + private var frameworkId: String? = null + private var body: Body.Builder = Body.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(frameworkExportParams: FrameworkExportParams) = apply { + frameworkId = frameworkExportParams.frameworkId + body = frameworkExportParams.body.toBuilder() + additionalHeaders = frameworkExportParams.additionalHeaders.toBuilder() + additionalQueryParams = frameworkExportParams.additionalQueryParams.toBuilder() + } + + fun frameworkId(frameworkId: String?) = apply { this.frameworkId = frameworkId } + + /** Alias for calling [Builder.frameworkId] with `frameworkId.orElse(null)`. */ + fun frameworkId(frameworkId: Optional) = frameworkId(frameworkId.getOrNull()) + + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [projectId] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + + /** Scope the export to this project. It must belong to the framework. */ + fun projectId(projectId: String?) = apply { body.projectId(projectId) } + + /** Alias for calling [Builder.projectId] with `projectId.orElse(null)`. */ + fun projectId(projectId: Optional) = projectId(projectId.getOrNull()) + + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun projectId(projectId: JsonField) = apply { body.projectId(projectId) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [FrameworkExportParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): FrameworkExportParams = + FrameworkExportParams( + frameworkId, + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _body(): Body = body + + fun _pathParam(index: Int): String = + when (index) { + 0 -> frameworkId ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val projectId: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("projectId") + @ExcludeMissing + projectId: JsonField = JsonMissing.of() + ) : this(projectId, mutableMapOf()) + + /** + * Scope the export to this project. It must belong to the framework. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun projectId(): Optional = projectId.getOptional("projectId") + + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("projectId") @ExcludeMissing fun _projectId(): JsonField = projectId + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Body]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var projectId: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + projectId = body.projectId + additionalProperties = body.additionalProperties.toMutableMap() + } + + /** Scope the export to this project. It must belong to the framework. */ + fun projectId(projectId: String?) = projectId(JsonField.ofNullable(projectId)) + + /** Alias for calling [Builder.projectId] with `projectId.orElse(null)`. */ + fun projectId(projectId: Optional) = projectId(projectId.getOrNull()) + + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun projectId(projectId: JsonField) = apply { this.projectId = projectId } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Body = Body(projectId, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Body = apply { + if (validated) { + return@apply + } + + projectId() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = (if (projectId.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Body && + projectId == other.projectId && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(projectId, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Body{projectId=$projectId, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is FrameworkExportParams && + frameworkId == other.frameworkId && + body == other.body && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = + Objects.hash(frameworkId, body, additionalHeaders, additionalQueryParams) + + override fun toString() = + "FrameworkExportParams{frameworkId=$frameworkId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkExportResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkExportResponse.kt new file mode 100644 index 00000000..97d14976 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkExportResponse.kt @@ -0,0 +1,241 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.frameworks + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.openlayer.api.core.ExcludeMissing +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonMissing +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.checkRequired +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.util.Collections +import java.util.Objects + +class FrameworkExportResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val taskResultId: JsonField, + private val taskResultUrl: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("taskResultId") + @ExcludeMissing + taskResultId: JsonField = JsonMissing.of(), + @JsonProperty("taskResultUrl") + @ExcludeMissing + taskResultUrl: JsonField = JsonMissing.of(), + ) : this(taskResultId, taskResultUrl, mutableMapOf()) + + /** + * The background task id, for `GET /background-tasks/{taskId}`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun taskResultId(): String = taskResultId.getRequired("taskResultId") + + /** + * The path to poll for this export's status and result. Already `/v1`-prefixed, so it is + * relative to the API host rather than to the `/v1` base url -- or just pass `taskResultId` to + * `GET /background-tasks/{taskId}`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun taskResultUrl(): String = taskResultUrl.getRequired("taskResultUrl") + + /** + * Returns the raw JSON value of [taskResultId]. + * + * Unlike [taskResultId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("taskResultId") + @ExcludeMissing + fun _taskResultId(): JsonField = taskResultId + + /** + * Returns the raw JSON value of [taskResultUrl]. + * + * Unlike [taskResultUrl], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("taskResultUrl") + @ExcludeMissing + fun _taskResultUrl(): JsonField = taskResultUrl + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [FrameworkExportResponse]. + * + * The following fields are required: + * ```java + * .taskResultId() + * .taskResultUrl() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [FrameworkExportResponse]. */ + class Builder internal constructor() { + + private var taskResultId: JsonField? = null + private var taskResultUrl: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(frameworkExportResponse: FrameworkExportResponse) = apply { + taskResultId = frameworkExportResponse.taskResultId + taskResultUrl = frameworkExportResponse.taskResultUrl + additionalProperties = frameworkExportResponse.additionalProperties.toMutableMap() + } + + /** The background task id, for `GET /background-tasks/{taskId}`. */ + fun taskResultId(taskResultId: String) = taskResultId(JsonField.of(taskResultId)) + + /** + * Sets [Builder.taskResultId] to an arbitrary JSON value. + * + * You should usually call [Builder.taskResultId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun taskResultId(taskResultId: JsonField) = apply { + this.taskResultId = taskResultId + } + + /** + * The path to poll for this export's status and result. Already `/v1`-prefixed, so it is + * relative to the API host rather than to the `/v1` base url -- or just pass `taskResultId` + * to `GET /background-tasks/{taskId}`. + */ + fun taskResultUrl(taskResultUrl: String) = taskResultUrl(JsonField.of(taskResultUrl)) + + /** + * Sets [Builder.taskResultUrl] to an arbitrary JSON value. + * + * You should usually call [Builder.taskResultUrl] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun taskResultUrl(taskResultUrl: JsonField) = apply { + this.taskResultUrl = taskResultUrl + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [FrameworkExportResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .taskResultId() + * .taskResultUrl() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): FrameworkExportResponse = + FrameworkExportResponse( + checkRequired("taskResultId", taskResultId), + checkRequired("taskResultUrl", taskResultUrl), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): FrameworkExportResponse = apply { + if (validated) { + return@apply + } + + taskResultId() + taskResultUrl() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (taskResultId.asKnown().isPresent) 1 else 0) + + (if (taskResultUrl.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is FrameworkExportResponse && + taskResultId == other.taskResultId && + taskResultUrl == other.taskResultUrl && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(taskResultId, taskResultUrl, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "FrameworkExportResponse{taskResultId=$taskResultId, taskResultUrl=$taskResultUrl, additionalProperties=$additionalProperties}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListParams.kt new file mode 100644 index 00000000..d71e5979 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListParams.kt @@ -0,0 +1,795 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.frameworks + +import com.fasterxml.jackson.annotation.JsonCreator +import com.openlayer.api.core.Enum +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.Params +import com.openlayer.api.core.http.Headers +import com.openlayer.api.core.http.QueryParams +import com.openlayer.api.core.toImmutable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * List the governance frameworks in a workspace. + * + * A framework is a set of rules -- drawn from a regulation, a standard, or your own internal policy + * -- that Openlayer tracks compliance against. Use this endpoint to find the framework you want to + * report on, then read its rules and rule results. + */ +class FrameworkListParams +private constructor( + private val workspaceId: String?, + private val asc: Boolean?, + private val completionOperator: CompletionOperator?, + private val completionValue: Long?, + private val enabled: Boolean?, + private val includeRuleStats: Boolean?, + private val page: Long?, + private val perPage: Long?, + private val projectId: String?, + private val searchQuery: String?, + private val sortColumn: SortColumn?, + private val tags: List?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun workspaceId(): Optional = Optional.ofNullable(workspaceId) + + /** Whether to sort in ascending order. */ + fun asc(): Optional = Optional.ofNullable(asc) + + /** + * How to compare each framework's completion percentage with `completionValue`. Must be sent + * together with `completionValue`. + */ + fun completionOperator(): Optional = Optional.ofNullable(completionOperator) + + /** The completion percentage to compare against, from 0 to 100. */ + fun completionValue(): Optional = Optional.ofNullable(completionValue) + + /** Only include frameworks that are enabled (or disabled). */ + fun enabled(): Optional = Optional.ofNullable(enabled) + + /** + * Whether to include a `ruleStats` object on each framework, with its rule result status counts + * and its per-project completion buckets. Computed over the returned page only. + */ + fun includeRuleStats(): Optional = Optional.ofNullable(includeRuleStats) + + /** The page to return in a paginated query. */ + fun page(): Optional = Optional.ofNullable(page) + + /** Maximum number of items to return per page. */ + fun perPage(): Optional = Optional.ofNullable(perPage) + + /** Only include items that apply to this project. */ + fun projectId(): Optional = Optional.ofNullable(projectId) + + /** Filter by a free-text search over names and descriptions. */ + fun searchQuery(): Optional = Optional.ofNullable(searchQuery) + + /** The column to sort on. */ + fun sortColumn(): Optional = Optional.ofNullable(sortColumn) + + /** Only include frameworks carrying all of these tags. */ + fun tags(): Optional> = Optional.ofNullable(tags) + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): FrameworkListParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [FrameworkListParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [FrameworkListParams]. */ + class Builder internal constructor() { + + private var workspaceId: String? = null + private var asc: Boolean? = null + private var completionOperator: CompletionOperator? = null + private var completionValue: Long? = null + private var enabled: Boolean? = null + private var includeRuleStats: Boolean? = null + private var page: Long? = null + private var perPage: Long? = null + private var projectId: String? = null + private var searchQuery: String? = null + private var sortColumn: SortColumn? = null + private var tags: MutableList? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(frameworkListParams: FrameworkListParams) = apply { + workspaceId = frameworkListParams.workspaceId + asc = frameworkListParams.asc + completionOperator = frameworkListParams.completionOperator + completionValue = frameworkListParams.completionValue + enabled = frameworkListParams.enabled + includeRuleStats = frameworkListParams.includeRuleStats + page = frameworkListParams.page + perPage = frameworkListParams.perPage + projectId = frameworkListParams.projectId + searchQuery = frameworkListParams.searchQuery + sortColumn = frameworkListParams.sortColumn + tags = frameworkListParams.tags?.toMutableList() + additionalHeaders = frameworkListParams.additionalHeaders.toBuilder() + additionalQueryParams = frameworkListParams.additionalQueryParams.toBuilder() + } + + fun workspaceId(workspaceId: String?) = apply { this.workspaceId = workspaceId } + + /** Alias for calling [Builder.workspaceId] with `workspaceId.orElse(null)`. */ + fun workspaceId(workspaceId: Optional) = workspaceId(workspaceId.getOrNull()) + + /** Whether to sort in ascending order. */ + fun asc(asc: Boolean?) = apply { this.asc = asc } + + /** + * Alias for [Builder.asc]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun asc(asc: Boolean) = asc(asc as Boolean?) + + /** Alias for calling [Builder.asc] with `asc.orElse(null)`. */ + fun asc(asc: Optional) = asc(asc.getOrNull()) + + /** + * How to compare each framework's completion percentage with `completionValue`. Must be + * sent together with `completionValue`. + */ + fun completionOperator(completionOperator: CompletionOperator?) = apply { + this.completionOperator = completionOperator + } + + /** + * Alias for calling [Builder.completionOperator] with `completionOperator.orElse(null)`. + */ + fun completionOperator(completionOperator: Optional) = + completionOperator(completionOperator.getOrNull()) + + /** The completion percentage to compare against, from 0 to 100. */ + fun completionValue(completionValue: Long?) = apply { + this.completionValue = completionValue + } + + /** + * Alias for [Builder.completionValue]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun completionValue(completionValue: Long) = completionValue(completionValue as Long?) + + /** Alias for calling [Builder.completionValue] with `completionValue.orElse(null)`. */ + fun completionValue(completionValue: Optional) = + completionValue(completionValue.getOrNull()) + + /** Only include frameworks that are enabled (or disabled). */ + fun enabled(enabled: Boolean?) = apply { this.enabled = enabled } + + /** + * Alias for [Builder.enabled]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun enabled(enabled: Boolean) = enabled(enabled as Boolean?) + + /** Alias for calling [Builder.enabled] with `enabled.orElse(null)`. */ + fun enabled(enabled: Optional) = enabled(enabled.getOrNull()) + + /** + * Whether to include a `ruleStats` object on each framework, with its rule result status + * counts and its per-project completion buckets. Computed over the returned page only. + */ + fun includeRuleStats(includeRuleStats: Boolean?) = apply { + this.includeRuleStats = includeRuleStats + } + + /** + * Alias for [Builder.includeRuleStats]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun includeRuleStats(includeRuleStats: Boolean) = + includeRuleStats(includeRuleStats as Boolean?) + + /** Alias for calling [Builder.includeRuleStats] with `includeRuleStats.orElse(null)`. */ + fun includeRuleStats(includeRuleStats: Optional) = + includeRuleStats(includeRuleStats.getOrNull()) + + /** The page to return in a paginated query. */ + fun page(page: Long?) = apply { this.page = page } + + /** + * Alias for [Builder.page]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun page(page: Long) = page(page as Long?) + + /** Alias for calling [Builder.page] with `page.orElse(null)`. */ + fun page(page: Optional) = page(page.getOrNull()) + + /** Maximum number of items to return per page. */ + fun perPage(perPage: Long?) = apply { this.perPage = perPage } + + /** + * Alias for [Builder.perPage]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun perPage(perPage: Long) = perPage(perPage as Long?) + + /** Alias for calling [Builder.perPage] with `perPage.orElse(null)`. */ + fun perPage(perPage: Optional) = perPage(perPage.getOrNull()) + + /** Only include items that apply to this project. */ + fun projectId(projectId: String?) = apply { this.projectId = projectId } + + /** Alias for calling [Builder.projectId] with `projectId.orElse(null)`. */ + fun projectId(projectId: Optional) = projectId(projectId.getOrNull()) + + /** Filter by a free-text search over names and descriptions. */ + fun searchQuery(searchQuery: String?) = apply { this.searchQuery = searchQuery } + + /** Alias for calling [Builder.searchQuery] with `searchQuery.orElse(null)`. */ + fun searchQuery(searchQuery: Optional) = searchQuery(searchQuery.getOrNull()) + + /** The column to sort on. */ + fun sortColumn(sortColumn: SortColumn?) = apply { this.sortColumn = sortColumn } + + /** Alias for calling [Builder.sortColumn] with `sortColumn.orElse(null)`. */ + fun sortColumn(sortColumn: Optional) = sortColumn(sortColumn.getOrNull()) + + /** Only include frameworks carrying all of these tags. */ + fun tags(tags: List?) = apply { this.tags = tags?.toMutableList() } + + /** Alias for calling [Builder.tags] with `tags.orElse(null)`. */ + fun tags(tags: Optional>) = tags(tags.getOrNull()) + + /** + * Adds a single [String] to [tags]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addTag(tag: String) = apply { tags = (tags ?: mutableListOf()).apply { add(tag) } } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [FrameworkListParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): FrameworkListParams = + FrameworkListParams( + workspaceId, + asc, + completionOperator, + completionValue, + enabled, + includeRuleStats, + page, + perPage, + projectId, + searchQuery, + sortColumn, + tags?.toImmutable(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _pathParam(index: Int): String = + when (index) { + 0 -> workspaceId ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + asc?.let { put("asc", it.toString()) } + completionOperator?.let { put("completionOperator", it.toString()) } + completionValue?.let { put("completionValue", it.toString()) } + enabled?.let { put("enabled", it.toString()) } + includeRuleStats?.let { put("includeRuleStats", it.toString()) } + page?.let { put("page", it.toString()) } + perPage?.let { put("perPage", it.toString()) } + projectId?.let { put("projectId", it) } + searchQuery?.let { put("searchQuery", it) } + sortColumn?.let { put("sortColumn", it.toString()) } + tags?.let { put("tags", it.joinToString(",")) } + putAll(additionalQueryParams) + } + .build() + + /** + * How to compare each framework's completion percentage with `completionValue`. Must be sent + * together with `completionValue`. + */ + class CompletionOperator + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val IS = of("is") + + @JvmField val GREATER = of(">") + + @JvmField val GREATER_OR_EQUALS = of(">=") + + @JvmField val LESS = of("<") + + @JvmField val LESS_OR_EQUALS = of("<=") + + @JvmField val NOT_EQUALS = of("!=") + + @JvmStatic fun of(value: String) = CompletionOperator(JsonField.of(value)) + } + + /** An enum containing [CompletionOperator]'s known values. */ + enum class Known { + IS, + GREATER, + GREATER_OR_EQUALS, + LESS, + LESS_OR_EQUALS, + NOT_EQUALS, + } + + /** + * An enum containing [CompletionOperator]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [CompletionOperator] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + IS, + GREATER, + GREATER_OR_EQUALS, + LESS, + LESS_OR_EQUALS, + NOT_EQUALS, + /** + * An enum member indicating that [CompletionOperator] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + IS -> Value.IS + GREATER -> Value.GREATER + GREATER_OR_EQUALS -> Value.GREATER_OR_EQUALS + LESS -> Value.LESS + LESS_OR_EQUALS -> Value.LESS_OR_EQUALS + NOT_EQUALS -> Value.NOT_EQUALS + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + IS -> Known.IS + GREATER -> Known.GREATER + GREATER_OR_EQUALS -> Known.GREATER_OR_EQUALS + LESS -> Known.LESS + LESS_OR_EQUALS -> Known.LESS_OR_EQUALS + NOT_EQUALS -> Known.NOT_EQUALS + else -> throw OpenlayerInvalidDataException("Unknown CompletionOperator: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): CompletionOperator = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is CompletionOperator && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** The column to sort on. */ + class SortColumn @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val NAME = of("name") + + @JvmField val ENABLED = of("enabled") + + @JvmField val DATE_CREATED = of("dateCreated") + + @JvmField val DATE_UPDATED = of("dateUpdated") + + @JvmField val OVERALL_COMPLETION = of("overallCompletion") + + @JvmField val PROJECT_COMPLETION_BUCKETS = of("projectCompletionBuckets") + + @JvmStatic fun of(value: String) = SortColumn(JsonField.of(value)) + } + + /** An enum containing [SortColumn]'s known values. */ + enum class Known { + NAME, + ENABLED, + DATE_CREATED, + DATE_UPDATED, + OVERALL_COMPLETION, + PROJECT_COMPLETION_BUCKETS, + } + + /** + * An enum containing [SortColumn]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [SortColumn] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + NAME, + ENABLED, + DATE_CREATED, + DATE_UPDATED, + OVERALL_COMPLETION, + PROJECT_COMPLETION_BUCKETS, + /** + * An enum member indicating that [SortColumn] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + NAME -> Value.NAME + ENABLED -> Value.ENABLED + DATE_CREATED -> Value.DATE_CREATED + DATE_UPDATED -> Value.DATE_UPDATED + OVERALL_COMPLETION -> Value.OVERALL_COMPLETION + PROJECT_COMPLETION_BUCKETS -> Value.PROJECT_COMPLETION_BUCKETS + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + NAME -> Known.NAME + ENABLED -> Known.ENABLED + DATE_CREATED -> Known.DATE_CREATED + DATE_UPDATED -> Known.DATE_UPDATED + OVERALL_COMPLETION -> Known.OVERALL_COMPLETION + PROJECT_COMPLETION_BUCKETS -> Known.PROJECT_COMPLETION_BUCKETS + else -> throw OpenlayerInvalidDataException("Unknown SortColumn: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): SortColumn = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SortColumn && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is FrameworkListParams && + workspaceId == other.workspaceId && + asc == other.asc && + completionOperator == other.completionOperator && + completionValue == other.completionValue && + enabled == other.enabled && + includeRuleStats == other.includeRuleStats && + page == other.page && + perPage == other.perPage && + projectId == other.projectId && + searchQuery == other.searchQuery && + sortColumn == other.sortColumn && + tags == other.tags && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = + Objects.hash( + workspaceId, + asc, + completionOperator, + completionValue, + enabled, + includeRuleStats, + page, + perPage, + projectId, + searchQuery, + sortColumn, + tags, + additionalHeaders, + additionalQueryParams, + ) + + override fun toString() = + "FrameworkListParams{workspaceId=$workspaceId, asc=$asc, completionOperator=$completionOperator, completionValue=$completionValue, enabled=$enabled, includeRuleStats=$includeRuleStats, page=$page, perPage=$perPage, projectId=$projectId, searchQuery=$searchQuery, sortColumn=$sortColumn, tags=$tags, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListProjectRuleStatsParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListProjectRuleStatsParams.kt new file mode 100644 index 00000000..d7ca5d36 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListProjectRuleStatsParams.kt @@ -0,0 +1,490 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.frameworks + +import com.fasterxml.jackson.annotation.JsonCreator +import com.openlayer.api.core.Enum +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.Params +import com.openlayer.api.core.http.Headers +import com.openlayer.api.core.http.QueryParams +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * Get a compliance roll-up for a framework, one row per project it applies to. + * + * Each row counts the project's rule results by status, so you can report on where a framework is + * complete and where it is not without fetching every individual rule result. + */ +class FrameworkListProjectRuleStatsParams +private constructor( + private val frameworkId: String?, + private val asc: Boolean?, + private val page: Long?, + private val perPage: Long?, + private val sortColumn: SortColumn?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun frameworkId(): Optional = Optional.ofNullable(frameworkId) + + /** Whether to sort in ascending order. */ + fun asc(): Optional = Optional.ofNullable(asc) + + /** The page to return in a paginated query. */ + fun page(): Optional = Optional.ofNullable(page) + + /** Maximum number of items to return per page. */ + fun perPage(): Optional = Optional.ofNullable(perPage) + + /** The column to sort on. */ + fun sortColumn(): Optional = Optional.ofNullable(sortColumn) + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): FrameworkListProjectRuleStatsParams = builder().build() + + /** + * Returns a mutable builder for constructing an instance of + * [FrameworkListProjectRuleStatsParams]. + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [FrameworkListProjectRuleStatsParams]. */ + class Builder internal constructor() { + + private var frameworkId: String? = null + private var asc: Boolean? = null + private var page: Long? = null + private var perPage: Long? = null + private var sortColumn: SortColumn? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from( + frameworkListProjectRuleStatsParams: FrameworkListProjectRuleStatsParams + ) = apply { + frameworkId = frameworkListProjectRuleStatsParams.frameworkId + asc = frameworkListProjectRuleStatsParams.asc + page = frameworkListProjectRuleStatsParams.page + perPage = frameworkListProjectRuleStatsParams.perPage + sortColumn = frameworkListProjectRuleStatsParams.sortColumn + additionalHeaders = frameworkListProjectRuleStatsParams.additionalHeaders.toBuilder() + additionalQueryParams = + frameworkListProjectRuleStatsParams.additionalQueryParams.toBuilder() + } + + fun frameworkId(frameworkId: String?) = apply { this.frameworkId = frameworkId } + + /** Alias for calling [Builder.frameworkId] with `frameworkId.orElse(null)`. */ + fun frameworkId(frameworkId: Optional) = frameworkId(frameworkId.getOrNull()) + + /** Whether to sort in ascending order. */ + fun asc(asc: Boolean?) = apply { this.asc = asc } + + /** + * Alias for [Builder.asc]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun asc(asc: Boolean) = asc(asc as Boolean?) + + /** Alias for calling [Builder.asc] with `asc.orElse(null)`. */ + fun asc(asc: Optional) = asc(asc.getOrNull()) + + /** The page to return in a paginated query. */ + fun page(page: Long?) = apply { this.page = page } + + /** + * Alias for [Builder.page]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun page(page: Long) = page(page as Long?) + + /** Alias for calling [Builder.page] with `page.orElse(null)`. */ + fun page(page: Optional) = page(page.getOrNull()) + + /** Maximum number of items to return per page. */ + fun perPage(perPage: Long?) = apply { this.perPage = perPage } + + /** + * Alias for [Builder.perPage]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun perPage(perPage: Long) = perPage(perPage as Long?) + + /** Alias for calling [Builder.perPage] with `perPage.orElse(null)`. */ + fun perPage(perPage: Optional) = perPage(perPage.getOrNull()) + + /** The column to sort on. */ + fun sortColumn(sortColumn: SortColumn?) = apply { this.sortColumn = sortColumn } + + /** Alias for calling [Builder.sortColumn] with `sortColumn.orElse(null)`. */ + fun sortColumn(sortColumn: Optional) = sortColumn(sortColumn.getOrNull()) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [FrameworkListProjectRuleStatsParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): FrameworkListProjectRuleStatsParams = + FrameworkListProjectRuleStatsParams( + frameworkId, + asc, + page, + perPage, + sortColumn, + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _pathParam(index: Int): String = + when (index) { + 0 -> frameworkId ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + asc?.let { put("asc", it.toString()) } + page?.let { put("page", it.toString()) } + perPage?.let { put("perPage", it.toString()) } + sortColumn?.let { put("sortColumn", it.toString()) } + putAll(additionalQueryParams) + } + .build() + + /** The column to sort on. */ + class SortColumn @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val PROJECT_NAME = of("projectName") + + @JvmField val TOTAL = of("total") + + @JvmField val OVERALL_COMPLETION = of("overallCompletion") + + @JvmField val TOTAL_PASSING = of("totalPassing") + + @JvmField val TOTAL_FAILING = of("totalFailing") + + @JvmField val TOTAL_SKIPPED = of("totalSkipped") + + @JvmField val TOTAL_RUNNING = of("totalRunning") + + @JvmField val TOTAL_ERROR = of("totalError") + + @JvmField val TOTAL_PENDING = of("totalPending") + + @JvmField val TOTAL_DUE_SOON = of("totalDueSoon") + + @JvmStatic fun of(value: String) = SortColumn(JsonField.of(value)) + } + + /** An enum containing [SortColumn]'s known values. */ + enum class Known { + PROJECT_NAME, + TOTAL, + OVERALL_COMPLETION, + TOTAL_PASSING, + TOTAL_FAILING, + TOTAL_SKIPPED, + TOTAL_RUNNING, + TOTAL_ERROR, + TOTAL_PENDING, + TOTAL_DUE_SOON, + } + + /** + * An enum containing [SortColumn]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [SortColumn] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + PROJECT_NAME, + TOTAL, + OVERALL_COMPLETION, + TOTAL_PASSING, + TOTAL_FAILING, + TOTAL_SKIPPED, + TOTAL_RUNNING, + TOTAL_ERROR, + TOTAL_PENDING, + TOTAL_DUE_SOON, + /** + * An enum member indicating that [SortColumn] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + PROJECT_NAME -> Value.PROJECT_NAME + TOTAL -> Value.TOTAL + OVERALL_COMPLETION -> Value.OVERALL_COMPLETION + TOTAL_PASSING -> Value.TOTAL_PASSING + TOTAL_FAILING -> Value.TOTAL_FAILING + TOTAL_SKIPPED -> Value.TOTAL_SKIPPED + TOTAL_RUNNING -> Value.TOTAL_RUNNING + TOTAL_ERROR -> Value.TOTAL_ERROR + TOTAL_PENDING -> Value.TOTAL_PENDING + TOTAL_DUE_SOON -> Value.TOTAL_DUE_SOON + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + PROJECT_NAME -> Known.PROJECT_NAME + TOTAL -> Known.TOTAL + OVERALL_COMPLETION -> Known.OVERALL_COMPLETION + TOTAL_PASSING -> Known.TOTAL_PASSING + TOTAL_FAILING -> Known.TOTAL_FAILING + TOTAL_SKIPPED -> Known.TOTAL_SKIPPED + TOTAL_RUNNING -> Known.TOTAL_RUNNING + TOTAL_ERROR -> Known.TOTAL_ERROR + TOTAL_PENDING -> Known.TOTAL_PENDING + TOTAL_DUE_SOON -> Known.TOTAL_DUE_SOON + else -> throw OpenlayerInvalidDataException("Unknown SortColumn: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): SortColumn = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SortColumn && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is FrameworkListProjectRuleStatsParams && + frameworkId == other.frameworkId && + asc == other.asc && + page == other.page && + perPage == other.perPage && + sortColumn == other.sortColumn && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = + Objects.hash( + frameworkId, + asc, + page, + perPage, + sortColumn, + additionalHeaders, + additionalQueryParams, + ) + + override fun toString() = + "FrameworkListProjectRuleStatsParams{frameworkId=$frameworkId, asc=$asc, page=$page, perPage=$perPage, sortColumn=$sortColumn, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListProjectRuleStatsResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListProjectRuleStatsResponse.kt new file mode 100644 index 00000000..4ec76691 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListProjectRuleStatsResponse.kt @@ -0,0 +1,2094 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.frameworks + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.openlayer.api.core.ExcludeMissing +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonMissing +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.checkKnown +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.toImmutable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class FrameworkListProjectRuleStatsResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val items: JsonField>, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("items") @ExcludeMissing items: JsonField> = JsonMissing.of() + ) : this(items, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun items(): List = items.getRequired("items") + + /** + * Returns the raw JSON value of [items]. + * + * Unlike [items], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("items") @ExcludeMissing fun _items(): JsonField> = items + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [FrameworkListProjectRuleStatsResponse]. + * + * The following fields are required: + * ```java + * .items() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [FrameworkListProjectRuleStatsResponse]. */ + class Builder internal constructor() { + + private var items: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + frameworkListProjectRuleStatsResponse: FrameworkListProjectRuleStatsResponse + ) = apply { + items = frameworkListProjectRuleStatsResponse.items.map { it.toMutableList() } + additionalProperties = + frameworkListProjectRuleStatsResponse.additionalProperties.toMutableMap() + } + + fun items(items: List) = items(JsonField.of(items)) + + /** + * Sets [Builder.items] to an arbitrary JSON value. + * + * You should usually call [Builder.items] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun items(items: JsonField>) = apply { + this.items = items.map { it.toMutableList() } + } + + /** + * Adds a single [Item] to [items]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addItem(item: Item) = apply { + items = + (items ?: JsonField.of(mutableListOf())).also { checkKnown("items", it).add(item) } + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [FrameworkListProjectRuleStatsResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .items() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): FrameworkListProjectRuleStatsResponse = + FrameworkListProjectRuleStatsResponse( + checkRequired("items", items).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): FrameworkListProjectRuleStatsResponse = apply { + if (validated) { + return@apply + } + + items().forEach { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (items.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + class Item + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val projectId: JsonField, + private val projectName: JsonField, + private val taskType: JsonField, + private val total: JsonField, + private val totalDueSoon: JsonField, + private val totalError: JsonField, + private val totalFailing: JsonField, + private val totalPassing: JsonField, + private val totalPending: JsonField, + private val totalRunning: JsonField, + private val totalSkipped: JsonField, + private val byRuleType: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("projectId") + @ExcludeMissing + projectId: JsonField = JsonMissing.of(), + @JsonProperty("projectName") + @ExcludeMissing + projectName: JsonField = JsonMissing.of(), + @JsonProperty("taskType") + @ExcludeMissing + taskType: JsonField = JsonMissing.of(), + @JsonProperty("total") @ExcludeMissing total: JsonField = JsonMissing.of(), + @JsonProperty("totalDueSoon") + @ExcludeMissing + totalDueSoon: JsonField = JsonMissing.of(), + @JsonProperty("totalError") + @ExcludeMissing + totalError: JsonField = JsonMissing.of(), + @JsonProperty("totalFailing") + @ExcludeMissing + totalFailing: JsonField = JsonMissing.of(), + @JsonProperty("totalPassing") + @ExcludeMissing + totalPassing: JsonField = JsonMissing.of(), + @JsonProperty("totalPending") + @ExcludeMissing + totalPending: JsonField = JsonMissing.of(), + @JsonProperty("totalRunning") + @ExcludeMissing + totalRunning: JsonField = JsonMissing.of(), + @JsonProperty("totalSkipped") + @ExcludeMissing + totalSkipped: JsonField = JsonMissing.of(), + @JsonProperty("byRuleType") + @ExcludeMissing + byRuleType: JsonField = JsonMissing.of(), + ) : this( + projectId, + projectName, + taskType, + total, + totalDueSoon, + totalError, + totalFailing, + totalPassing, + totalPending, + totalRunning, + totalSkipped, + byRuleType, + mutableMapOf(), + ) + + /** + * The project id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun projectId(): String = projectId.getRequired("projectId") + + /** + * The project name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun projectName(): String = projectName.getRequired("projectName") + + /** + * The project's task type. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun taskType(): String = taskType.getRequired("taskType") + + /** + * The total number of rule results. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun total(): Long = total.getRequired("total") + + /** + * The number of rule results whose evidence is about to expire. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun totalDueSoon(): Long = totalDueSoon.getRequired("totalDueSoon") + + /** + * The number of rule results that errored during evaluation. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun totalError(): Long = totalError.getRequired("totalError") + + /** + * The number of failing rule results. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun totalFailing(): Long = totalFailing.getRequired("totalFailing") + + /** + * The number of passing rule results. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun totalPassing(): Long = totalPassing.getRequired("totalPassing") + + /** + * The number of rule results that have not been satisfied yet. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun totalPending(): Long = totalPending.getRequired("totalPending") + + /** + * The number of rule results currently being evaluated. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun totalRunning(): Long = totalRunning.getRequired("totalRunning") + + /** + * The number of skipped rule results. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun totalSkipped(): Long = totalSkipped.getRequired("totalSkipped") + + /** + * The same counts, broken down by the type of the rule each result belongs to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun byRuleType(): Optional = byRuleType.getOptional("byRuleType") + + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("projectId") @ExcludeMissing fun _projectId(): JsonField = projectId + + /** + * Returns the raw JSON value of [projectName]. + * + * Unlike [projectName], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("projectName") + @ExcludeMissing + fun _projectName(): JsonField = projectName + + /** + * Returns the raw JSON value of [taskType]. + * + * Unlike [taskType], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("taskType") @ExcludeMissing fun _taskType(): JsonField = taskType + + /** + * Returns the raw JSON value of [total]. + * + * Unlike [total], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("total") @ExcludeMissing fun _total(): JsonField = total + + /** + * Returns the raw JSON value of [totalDueSoon]. + * + * Unlike [totalDueSoon], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("totalDueSoon") + @ExcludeMissing + fun _totalDueSoon(): JsonField = totalDueSoon + + /** + * Returns the raw JSON value of [totalError]. + * + * Unlike [totalError], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("totalError") @ExcludeMissing fun _totalError(): JsonField = totalError + + /** + * Returns the raw JSON value of [totalFailing]. + * + * Unlike [totalFailing], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("totalFailing") + @ExcludeMissing + fun _totalFailing(): JsonField = totalFailing + + /** + * Returns the raw JSON value of [totalPassing]. + * + * Unlike [totalPassing], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("totalPassing") + @ExcludeMissing + fun _totalPassing(): JsonField = totalPassing + + /** + * Returns the raw JSON value of [totalPending]. + * + * Unlike [totalPending], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("totalPending") + @ExcludeMissing + fun _totalPending(): JsonField = totalPending + + /** + * Returns the raw JSON value of [totalRunning]. + * + * Unlike [totalRunning], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("totalRunning") + @ExcludeMissing + fun _totalRunning(): JsonField = totalRunning + + /** + * Returns the raw JSON value of [totalSkipped]. + * + * Unlike [totalSkipped], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("totalSkipped") + @ExcludeMissing + fun _totalSkipped(): JsonField = totalSkipped + + /** + * Returns the raw JSON value of [byRuleType]. + * + * Unlike [byRuleType], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("byRuleType") + @ExcludeMissing + fun _byRuleType(): JsonField = byRuleType + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Item]. + * + * The following fields are required: + * ```java + * .projectId() + * .projectName() + * .taskType() + * .total() + * .totalDueSoon() + * .totalError() + * .totalFailing() + * .totalPassing() + * .totalPending() + * .totalRunning() + * .totalSkipped() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Item]. */ + class Builder internal constructor() { + + private var projectId: JsonField? = null + private var projectName: JsonField? = null + private var taskType: JsonField? = null + private var total: JsonField? = null + private var totalDueSoon: JsonField? = null + private var totalError: JsonField? = null + private var totalFailing: JsonField? = null + private var totalPassing: JsonField? = null + private var totalPending: JsonField? = null + private var totalRunning: JsonField? = null + private var totalSkipped: JsonField? = null + private var byRuleType: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(item: Item) = apply { + projectId = item.projectId + projectName = item.projectName + taskType = item.taskType + total = item.total + totalDueSoon = item.totalDueSoon + totalError = item.totalError + totalFailing = item.totalFailing + totalPassing = item.totalPassing + totalPending = item.totalPending + totalRunning = item.totalRunning + totalSkipped = item.totalSkipped + byRuleType = item.byRuleType + additionalProperties = item.additionalProperties.toMutableMap() + } + + /** The project id. */ + fun projectId(projectId: String) = projectId(JsonField.of(projectId)) + + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun projectId(projectId: JsonField) = apply { this.projectId = projectId } + + /** The project name. */ + fun projectName(projectName: String) = projectName(JsonField.of(projectName)) + + /** + * Sets [Builder.projectName] to an arbitrary JSON value. + * + * You should usually call [Builder.projectName] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun projectName(projectName: JsonField) = apply { + this.projectName = projectName + } + + /** The project's task type. */ + fun taskType(taskType: String) = taskType(JsonField.of(taskType)) + + /** + * Sets [Builder.taskType] to an arbitrary JSON value. + * + * You should usually call [Builder.taskType] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun taskType(taskType: JsonField) = apply { this.taskType = taskType } + + /** The total number of rule results. */ + fun total(total: Long) = total(JsonField.of(total)) + + /** + * Sets [Builder.total] to an arbitrary JSON value. + * + * You should usually call [Builder.total] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun total(total: JsonField) = apply { this.total = total } + + /** The number of rule results whose evidence is about to expire. */ + fun totalDueSoon(totalDueSoon: Long) = totalDueSoon(JsonField.of(totalDueSoon)) + + /** + * Sets [Builder.totalDueSoon] to an arbitrary JSON value. + * + * You should usually call [Builder.totalDueSoon] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun totalDueSoon(totalDueSoon: JsonField) = apply { + this.totalDueSoon = totalDueSoon + } + + /** The number of rule results that errored during evaluation. */ + fun totalError(totalError: Long) = totalError(JsonField.of(totalError)) + + /** + * Sets [Builder.totalError] to an arbitrary JSON value. + * + * You should usually call [Builder.totalError] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun totalError(totalError: JsonField) = apply { this.totalError = totalError } + + /** The number of failing rule results. */ + fun totalFailing(totalFailing: Long) = totalFailing(JsonField.of(totalFailing)) + + /** + * Sets [Builder.totalFailing] to an arbitrary JSON value. + * + * You should usually call [Builder.totalFailing] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun totalFailing(totalFailing: JsonField) = apply { + this.totalFailing = totalFailing + } + + /** The number of passing rule results. */ + fun totalPassing(totalPassing: Long) = totalPassing(JsonField.of(totalPassing)) + + /** + * Sets [Builder.totalPassing] to an arbitrary JSON value. + * + * You should usually call [Builder.totalPassing] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun totalPassing(totalPassing: JsonField) = apply { + this.totalPassing = totalPassing + } + + /** The number of rule results that have not been satisfied yet. */ + fun totalPending(totalPending: Long) = totalPending(JsonField.of(totalPending)) + + /** + * Sets [Builder.totalPending] to an arbitrary JSON value. + * + * You should usually call [Builder.totalPending] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun totalPending(totalPending: JsonField) = apply { + this.totalPending = totalPending + } + + /** The number of rule results currently being evaluated. */ + fun totalRunning(totalRunning: Long) = totalRunning(JsonField.of(totalRunning)) + + /** + * Sets [Builder.totalRunning] to an arbitrary JSON value. + * + * You should usually call [Builder.totalRunning] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun totalRunning(totalRunning: JsonField) = apply { + this.totalRunning = totalRunning + } + + /** The number of skipped rule results. */ + fun totalSkipped(totalSkipped: Long) = totalSkipped(JsonField.of(totalSkipped)) + + /** + * Sets [Builder.totalSkipped] to an arbitrary JSON value. + * + * You should usually call [Builder.totalSkipped] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun totalSkipped(totalSkipped: JsonField) = apply { + this.totalSkipped = totalSkipped + } + + /** The same counts, broken down by the type of the rule each result belongs to. */ + fun byRuleType(byRuleType: ByRuleType) = byRuleType(JsonField.of(byRuleType)) + + /** + * Sets [Builder.byRuleType] to an arbitrary JSON value. + * + * You should usually call [Builder.byRuleType] with a well-typed [ByRuleType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun byRuleType(byRuleType: JsonField) = apply { + this.byRuleType = byRuleType + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Item]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .projectId() + * .projectName() + * .taskType() + * .total() + * .totalDueSoon() + * .totalError() + * .totalFailing() + * .totalPassing() + * .totalPending() + * .totalRunning() + * .totalSkipped() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Item = + Item( + checkRequired("projectId", projectId), + checkRequired("projectName", projectName), + checkRequired("taskType", taskType), + checkRequired("total", total), + checkRequired("totalDueSoon", totalDueSoon), + checkRequired("totalError", totalError), + checkRequired("totalFailing", totalFailing), + checkRequired("totalPassing", totalPassing), + checkRequired("totalPending", totalPending), + checkRequired("totalRunning", totalRunning), + checkRequired("totalSkipped", totalSkipped), + byRuleType, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Item = apply { + if (validated) { + return@apply + } + + projectId() + projectName() + taskType() + total() + totalDueSoon() + totalError() + totalFailing() + totalPassing() + totalPending() + totalRunning() + totalSkipped() + byRuleType().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (projectId.asKnown().isPresent) 1 else 0) + + (if (projectName.asKnown().isPresent) 1 else 0) + + (if (taskType.asKnown().isPresent) 1 else 0) + + (if (total.asKnown().isPresent) 1 else 0) + + (if (totalDueSoon.asKnown().isPresent) 1 else 0) + + (if (totalError.asKnown().isPresent) 1 else 0) + + (if (totalFailing.asKnown().isPresent) 1 else 0) + + (if (totalPassing.asKnown().isPresent) 1 else 0) + + (if (totalPending.asKnown().isPresent) 1 else 0) + + (if (totalRunning.asKnown().isPresent) 1 else 0) + + (if (totalSkipped.asKnown().isPresent) 1 else 0) + + (byRuleType.asKnown().getOrNull()?.validity() ?: 0) + + /** The same counts, broken down by the type of the rule each result belongs to. */ + class ByRuleType + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val evidence: JsonField, + private val platform: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("evidence") + @ExcludeMissing + evidence: JsonField = JsonMissing.of(), + @JsonProperty("platform") + @ExcludeMissing + platform: JsonField = JsonMissing.of(), + ) : this(evidence, platform, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun evidence(): Optional = evidence.getOptional("evidence") + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun platform(): Optional = platform.getOptional("platform") + + /** + * Returns the raw JSON value of [evidence]. + * + * Unlike [evidence], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("evidence") + @ExcludeMissing + fun _evidence(): JsonField = evidence + + /** + * Returns the raw JSON value of [platform]. + * + * Unlike [platform], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("platform") + @ExcludeMissing + fun _platform(): JsonField = platform + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [ByRuleType]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ByRuleType]. */ + class Builder internal constructor() { + + private var evidence: JsonField = JsonMissing.of() + private var platform: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(byRuleType: ByRuleType) = apply { + evidence = byRuleType.evidence + platform = byRuleType.platform + additionalProperties = byRuleType.additionalProperties.toMutableMap() + } + + fun evidence(evidence: Evidence) = evidence(JsonField.of(evidence)) + + /** + * Sets [Builder.evidence] to an arbitrary JSON value. + * + * You should usually call [Builder.evidence] with a well-typed [Evidence] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun evidence(evidence: JsonField) = apply { this.evidence = evidence } + + fun platform(platform: Platform) = platform(JsonField.of(platform)) + + /** + * Sets [Builder.platform] to an arbitrary JSON value. + * + * You should usually call [Builder.platform] with a well-typed [Platform] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun platform(platform: JsonField) = apply { this.platform = platform } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ByRuleType]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): ByRuleType = + ByRuleType(evidence, platform, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): ByRuleType = apply { + if (validated) { + return@apply + } + + evidence().ifPresent { it.validate() } + platform().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (evidence.asKnown().getOrNull()?.validity() ?: 0) + + (platform.asKnown().getOrNull()?.validity() ?: 0) + + class Evidence + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val total: JsonField, + private val totalDueSoon: JsonField, + private val totalError: JsonField, + private val totalFailing: JsonField, + private val totalPassing: JsonField, + private val totalPending: JsonField, + private val totalRunning: JsonField, + private val totalSkipped: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("total") + @ExcludeMissing + total: JsonField = JsonMissing.of(), + @JsonProperty("totalDueSoon") + @ExcludeMissing + totalDueSoon: JsonField = JsonMissing.of(), + @JsonProperty("totalError") + @ExcludeMissing + totalError: JsonField = JsonMissing.of(), + @JsonProperty("totalFailing") + @ExcludeMissing + totalFailing: JsonField = JsonMissing.of(), + @JsonProperty("totalPassing") + @ExcludeMissing + totalPassing: JsonField = JsonMissing.of(), + @JsonProperty("totalPending") + @ExcludeMissing + totalPending: JsonField = JsonMissing.of(), + @JsonProperty("totalRunning") + @ExcludeMissing + totalRunning: JsonField = JsonMissing.of(), + @JsonProperty("totalSkipped") + @ExcludeMissing + totalSkipped: JsonField = JsonMissing.of(), + ) : this( + total, + totalDueSoon, + totalError, + totalFailing, + totalPassing, + totalPending, + totalRunning, + totalSkipped, + mutableMapOf(), + ) + + /** + * The total number of rule results. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun total(): Long = total.getRequired("total") + + /** + * The number of rule results whose evidence is about to expire. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalDueSoon(): Long = totalDueSoon.getRequired("totalDueSoon") + + /** + * The number of rule results that errored during evaluation. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalError(): Long = totalError.getRequired("totalError") + + /** + * The number of failing rule results. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalFailing(): Long = totalFailing.getRequired("totalFailing") + + /** + * The number of passing rule results. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalPassing(): Long = totalPassing.getRequired("totalPassing") + + /** + * The number of rule results that have not been satisfied yet. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalPending(): Long = totalPending.getRequired("totalPending") + + /** + * The number of rule results currently being evaluated. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalRunning(): Long = totalRunning.getRequired("totalRunning") + + /** + * The number of skipped rule results. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalSkipped(): Long = totalSkipped.getRequired("totalSkipped") + + /** + * Returns the raw JSON value of [total]. + * + * Unlike [total], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("total") @ExcludeMissing fun _total(): JsonField = total + + /** + * Returns the raw JSON value of [totalDueSoon]. + * + * Unlike [totalDueSoon], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalDueSoon") + @ExcludeMissing + fun _totalDueSoon(): JsonField = totalDueSoon + + /** + * Returns the raw JSON value of [totalError]. + * + * Unlike [totalError], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalError") + @ExcludeMissing + fun _totalError(): JsonField = totalError + + /** + * Returns the raw JSON value of [totalFailing]. + * + * Unlike [totalFailing], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalFailing") + @ExcludeMissing + fun _totalFailing(): JsonField = totalFailing + + /** + * Returns the raw JSON value of [totalPassing]. + * + * Unlike [totalPassing], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalPassing") + @ExcludeMissing + fun _totalPassing(): JsonField = totalPassing + + /** + * Returns the raw JSON value of [totalPending]. + * + * Unlike [totalPending], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalPending") + @ExcludeMissing + fun _totalPending(): JsonField = totalPending + + /** + * Returns the raw JSON value of [totalRunning]. + * + * Unlike [totalRunning], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalRunning") + @ExcludeMissing + fun _totalRunning(): JsonField = totalRunning + + /** + * Returns the raw JSON value of [totalSkipped]. + * + * Unlike [totalSkipped], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalSkipped") + @ExcludeMissing + fun _totalSkipped(): JsonField = totalSkipped + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Evidence]. + * + * The following fields are required: + * ```java + * .total() + * .totalDueSoon() + * .totalError() + * .totalFailing() + * .totalPassing() + * .totalPending() + * .totalRunning() + * .totalSkipped() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Evidence]. */ + class Builder internal constructor() { + + private var total: JsonField? = null + private var totalDueSoon: JsonField? = null + private var totalError: JsonField? = null + private var totalFailing: JsonField? = null + private var totalPassing: JsonField? = null + private var totalPending: JsonField? = null + private var totalRunning: JsonField? = null + private var totalSkipped: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(evidence: Evidence) = apply { + total = evidence.total + totalDueSoon = evidence.totalDueSoon + totalError = evidence.totalError + totalFailing = evidence.totalFailing + totalPassing = evidence.totalPassing + totalPending = evidence.totalPending + totalRunning = evidence.totalRunning + totalSkipped = evidence.totalSkipped + additionalProperties = evidence.additionalProperties.toMutableMap() + } + + /** The total number of rule results. */ + fun total(total: Long) = total(JsonField.of(total)) + + /** + * Sets [Builder.total] to an arbitrary JSON value. + * + * You should usually call [Builder.total] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun total(total: JsonField) = apply { this.total = total } + + /** The number of rule results whose evidence is about to expire. */ + fun totalDueSoon(totalDueSoon: Long) = totalDueSoon(JsonField.of(totalDueSoon)) + + /** + * Sets [Builder.totalDueSoon] to an arbitrary JSON value. + * + * You should usually call [Builder.totalDueSoon] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalDueSoon(totalDueSoon: JsonField) = apply { + this.totalDueSoon = totalDueSoon + } + + /** The number of rule results that errored during evaluation. */ + fun totalError(totalError: Long) = totalError(JsonField.of(totalError)) + + /** + * Sets [Builder.totalError] to an arbitrary JSON value. + * + * You should usually call [Builder.totalError] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalError(totalError: JsonField) = apply { + this.totalError = totalError + } + + /** The number of failing rule results. */ + fun totalFailing(totalFailing: Long) = totalFailing(JsonField.of(totalFailing)) + + /** + * Sets [Builder.totalFailing] to an arbitrary JSON value. + * + * You should usually call [Builder.totalFailing] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalFailing(totalFailing: JsonField) = apply { + this.totalFailing = totalFailing + } + + /** The number of passing rule results. */ + fun totalPassing(totalPassing: Long) = totalPassing(JsonField.of(totalPassing)) + + /** + * Sets [Builder.totalPassing] to an arbitrary JSON value. + * + * You should usually call [Builder.totalPassing] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalPassing(totalPassing: JsonField) = apply { + this.totalPassing = totalPassing + } + + /** The number of rule results that have not been satisfied yet. */ + fun totalPending(totalPending: Long) = totalPending(JsonField.of(totalPending)) + + /** + * Sets [Builder.totalPending] to an arbitrary JSON value. + * + * You should usually call [Builder.totalPending] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalPending(totalPending: JsonField) = apply { + this.totalPending = totalPending + } + + /** The number of rule results currently being evaluated. */ + fun totalRunning(totalRunning: Long) = totalRunning(JsonField.of(totalRunning)) + + /** + * Sets [Builder.totalRunning] to an arbitrary JSON value. + * + * You should usually call [Builder.totalRunning] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalRunning(totalRunning: JsonField) = apply { + this.totalRunning = totalRunning + } + + /** The number of skipped rule results. */ + fun totalSkipped(totalSkipped: Long) = totalSkipped(JsonField.of(totalSkipped)) + + /** + * Sets [Builder.totalSkipped] to an arbitrary JSON value. + * + * You should usually call [Builder.totalSkipped] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalSkipped(totalSkipped: JsonField) = apply { + this.totalSkipped = totalSkipped + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Evidence]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .total() + * .totalDueSoon() + * .totalError() + * .totalFailing() + * .totalPassing() + * .totalPending() + * .totalRunning() + * .totalSkipped() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Evidence = + Evidence( + checkRequired("total", total), + checkRequired("totalDueSoon", totalDueSoon), + checkRequired("totalError", totalError), + checkRequired("totalFailing", totalFailing), + checkRequired("totalPassing", totalPassing), + checkRequired("totalPending", totalPending), + checkRequired("totalRunning", totalRunning), + checkRequired("totalSkipped", totalSkipped), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): Evidence = apply { + if (validated) { + return@apply + } + + total() + totalDueSoon() + totalError() + totalFailing() + totalPassing() + totalPending() + totalRunning() + totalSkipped() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (total.asKnown().isPresent) 1 else 0) + + (if (totalDueSoon.asKnown().isPresent) 1 else 0) + + (if (totalError.asKnown().isPresent) 1 else 0) + + (if (totalFailing.asKnown().isPresent) 1 else 0) + + (if (totalPassing.asKnown().isPresent) 1 else 0) + + (if (totalPending.asKnown().isPresent) 1 else 0) + + (if (totalRunning.asKnown().isPresent) 1 else 0) + + (if (totalSkipped.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Evidence && + total == other.total && + totalDueSoon == other.totalDueSoon && + totalError == other.totalError && + totalFailing == other.totalFailing && + totalPassing == other.totalPassing && + totalPending == other.totalPending && + totalRunning == other.totalRunning && + totalSkipped == other.totalSkipped && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + total, + totalDueSoon, + totalError, + totalFailing, + totalPassing, + totalPending, + totalRunning, + totalSkipped, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Evidence{total=$total, totalDueSoon=$totalDueSoon, totalError=$totalError, totalFailing=$totalFailing, totalPassing=$totalPassing, totalPending=$totalPending, totalRunning=$totalRunning, totalSkipped=$totalSkipped, additionalProperties=$additionalProperties}" + } + + class Platform + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val total: JsonField, + private val totalDueSoon: JsonField, + private val totalError: JsonField, + private val totalFailing: JsonField, + private val totalPassing: JsonField, + private val totalPending: JsonField, + private val totalRunning: JsonField, + private val totalSkipped: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("total") + @ExcludeMissing + total: JsonField = JsonMissing.of(), + @JsonProperty("totalDueSoon") + @ExcludeMissing + totalDueSoon: JsonField = JsonMissing.of(), + @JsonProperty("totalError") + @ExcludeMissing + totalError: JsonField = JsonMissing.of(), + @JsonProperty("totalFailing") + @ExcludeMissing + totalFailing: JsonField = JsonMissing.of(), + @JsonProperty("totalPassing") + @ExcludeMissing + totalPassing: JsonField = JsonMissing.of(), + @JsonProperty("totalPending") + @ExcludeMissing + totalPending: JsonField = JsonMissing.of(), + @JsonProperty("totalRunning") + @ExcludeMissing + totalRunning: JsonField = JsonMissing.of(), + @JsonProperty("totalSkipped") + @ExcludeMissing + totalSkipped: JsonField = JsonMissing.of(), + ) : this( + total, + totalDueSoon, + totalError, + totalFailing, + totalPassing, + totalPending, + totalRunning, + totalSkipped, + mutableMapOf(), + ) + + /** + * The total number of rule results. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun total(): Long = total.getRequired("total") + + /** + * The number of rule results whose evidence is about to expire. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalDueSoon(): Long = totalDueSoon.getRequired("totalDueSoon") + + /** + * The number of rule results that errored during evaluation. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalError(): Long = totalError.getRequired("totalError") + + /** + * The number of failing rule results. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalFailing(): Long = totalFailing.getRequired("totalFailing") + + /** + * The number of passing rule results. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalPassing(): Long = totalPassing.getRequired("totalPassing") + + /** + * The number of rule results that have not been satisfied yet. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalPending(): Long = totalPending.getRequired("totalPending") + + /** + * The number of rule results currently being evaluated. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalRunning(): Long = totalRunning.getRequired("totalRunning") + + /** + * The number of skipped rule results. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalSkipped(): Long = totalSkipped.getRequired("totalSkipped") + + /** + * Returns the raw JSON value of [total]. + * + * Unlike [total], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("total") @ExcludeMissing fun _total(): JsonField = total + + /** + * Returns the raw JSON value of [totalDueSoon]. + * + * Unlike [totalDueSoon], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalDueSoon") + @ExcludeMissing + fun _totalDueSoon(): JsonField = totalDueSoon + + /** + * Returns the raw JSON value of [totalError]. + * + * Unlike [totalError], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalError") + @ExcludeMissing + fun _totalError(): JsonField = totalError + + /** + * Returns the raw JSON value of [totalFailing]. + * + * Unlike [totalFailing], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalFailing") + @ExcludeMissing + fun _totalFailing(): JsonField = totalFailing + + /** + * Returns the raw JSON value of [totalPassing]. + * + * Unlike [totalPassing], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalPassing") + @ExcludeMissing + fun _totalPassing(): JsonField = totalPassing + + /** + * Returns the raw JSON value of [totalPending]. + * + * Unlike [totalPending], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalPending") + @ExcludeMissing + fun _totalPending(): JsonField = totalPending + + /** + * Returns the raw JSON value of [totalRunning]. + * + * Unlike [totalRunning], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalRunning") + @ExcludeMissing + fun _totalRunning(): JsonField = totalRunning + + /** + * Returns the raw JSON value of [totalSkipped]. + * + * Unlike [totalSkipped], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalSkipped") + @ExcludeMissing + fun _totalSkipped(): JsonField = totalSkipped + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Platform]. + * + * The following fields are required: + * ```java + * .total() + * .totalDueSoon() + * .totalError() + * .totalFailing() + * .totalPassing() + * .totalPending() + * .totalRunning() + * .totalSkipped() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Platform]. */ + class Builder internal constructor() { + + private var total: JsonField? = null + private var totalDueSoon: JsonField? = null + private var totalError: JsonField? = null + private var totalFailing: JsonField? = null + private var totalPassing: JsonField? = null + private var totalPending: JsonField? = null + private var totalRunning: JsonField? = null + private var totalSkipped: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(platform: Platform) = apply { + total = platform.total + totalDueSoon = platform.totalDueSoon + totalError = platform.totalError + totalFailing = platform.totalFailing + totalPassing = platform.totalPassing + totalPending = platform.totalPending + totalRunning = platform.totalRunning + totalSkipped = platform.totalSkipped + additionalProperties = platform.additionalProperties.toMutableMap() + } + + /** The total number of rule results. */ + fun total(total: Long) = total(JsonField.of(total)) + + /** + * Sets [Builder.total] to an arbitrary JSON value. + * + * You should usually call [Builder.total] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun total(total: JsonField) = apply { this.total = total } + + /** The number of rule results whose evidence is about to expire. */ + fun totalDueSoon(totalDueSoon: Long) = totalDueSoon(JsonField.of(totalDueSoon)) + + /** + * Sets [Builder.totalDueSoon] to an arbitrary JSON value. + * + * You should usually call [Builder.totalDueSoon] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalDueSoon(totalDueSoon: JsonField) = apply { + this.totalDueSoon = totalDueSoon + } + + /** The number of rule results that errored during evaluation. */ + fun totalError(totalError: Long) = totalError(JsonField.of(totalError)) + + /** + * Sets [Builder.totalError] to an arbitrary JSON value. + * + * You should usually call [Builder.totalError] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalError(totalError: JsonField) = apply { + this.totalError = totalError + } + + /** The number of failing rule results. */ + fun totalFailing(totalFailing: Long) = totalFailing(JsonField.of(totalFailing)) + + /** + * Sets [Builder.totalFailing] to an arbitrary JSON value. + * + * You should usually call [Builder.totalFailing] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalFailing(totalFailing: JsonField) = apply { + this.totalFailing = totalFailing + } + + /** The number of passing rule results. */ + fun totalPassing(totalPassing: Long) = totalPassing(JsonField.of(totalPassing)) + + /** + * Sets [Builder.totalPassing] to an arbitrary JSON value. + * + * You should usually call [Builder.totalPassing] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalPassing(totalPassing: JsonField) = apply { + this.totalPassing = totalPassing + } + + /** The number of rule results that have not been satisfied yet. */ + fun totalPending(totalPending: Long) = totalPending(JsonField.of(totalPending)) + + /** + * Sets [Builder.totalPending] to an arbitrary JSON value. + * + * You should usually call [Builder.totalPending] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalPending(totalPending: JsonField) = apply { + this.totalPending = totalPending + } + + /** The number of rule results currently being evaluated. */ + fun totalRunning(totalRunning: Long) = totalRunning(JsonField.of(totalRunning)) + + /** + * Sets [Builder.totalRunning] to an arbitrary JSON value. + * + * You should usually call [Builder.totalRunning] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalRunning(totalRunning: JsonField) = apply { + this.totalRunning = totalRunning + } + + /** The number of skipped rule results. */ + fun totalSkipped(totalSkipped: Long) = totalSkipped(JsonField.of(totalSkipped)) + + /** + * Sets [Builder.totalSkipped] to an arbitrary JSON value. + * + * You should usually call [Builder.totalSkipped] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalSkipped(totalSkipped: JsonField) = apply { + this.totalSkipped = totalSkipped + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Platform]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .total() + * .totalDueSoon() + * .totalError() + * .totalFailing() + * .totalPassing() + * .totalPending() + * .totalRunning() + * .totalSkipped() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Platform = + Platform( + checkRequired("total", total), + checkRequired("totalDueSoon", totalDueSoon), + checkRequired("totalError", totalError), + checkRequired("totalFailing", totalFailing), + checkRequired("totalPassing", totalPassing), + checkRequired("totalPending", totalPending), + checkRequired("totalRunning", totalRunning), + checkRequired("totalSkipped", totalSkipped), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): Platform = apply { + if (validated) { + return@apply + } + + total() + totalDueSoon() + totalError() + totalFailing() + totalPassing() + totalPending() + totalRunning() + totalSkipped() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (total.asKnown().isPresent) 1 else 0) + + (if (totalDueSoon.asKnown().isPresent) 1 else 0) + + (if (totalError.asKnown().isPresent) 1 else 0) + + (if (totalFailing.asKnown().isPresent) 1 else 0) + + (if (totalPassing.asKnown().isPresent) 1 else 0) + + (if (totalPending.asKnown().isPresent) 1 else 0) + + (if (totalRunning.asKnown().isPresent) 1 else 0) + + (if (totalSkipped.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Platform && + total == other.total && + totalDueSoon == other.totalDueSoon && + totalError == other.totalError && + totalFailing == other.totalFailing && + totalPassing == other.totalPassing && + totalPending == other.totalPending && + totalRunning == other.totalRunning && + totalSkipped == other.totalSkipped && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + total, + totalDueSoon, + totalError, + totalFailing, + totalPassing, + totalPending, + totalRunning, + totalSkipped, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Platform{total=$total, totalDueSoon=$totalDueSoon, totalError=$totalError, totalFailing=$totalFailing, totalPassing=$totalPassing, totalPending=$totalPending, totalRunning=$totalRunning, totalSkipped=$totalSkipped, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ByRuleType && + evidence == other.evidence && + platform == other.platform && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(evidence, platform, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ByRuleType{evidence=$evidence, platform=$platform, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Item && + projectId == other.projectId && + projectName == other.projectName && + taskType == other.taskType && + total == other.total && + totalDueSoon == other.totalDueSoon && + totalError == other.totalError && + totalFailing == other.totalFailing && + totalPassing == other.totalPassing && + totalPending == other.totalPending && + totalRunning == other.totalRunning && + totalSkipped == other.totalSkipped && + byRuleType == other.byRuleType && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + projectId, + projectName, + taskType, + total, + totalDueSoon, + totalError, + totalFailing, + totalPassing, + totalPending, + totalRunning, + totalSkipped, + byRuleType, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Item{projectId=$projectId, projectName=$projectName, taskType=$taskType, total=$total, totalDueSoon=$totalDueSoon, totalError=$totalError, totalFailing=$totalFailing, totalPassing=$totalPassing, totalPending=$totalPending, totalRunning=$totalRunning, totalSkipped=$totalSkipped, byRuleType=$byRuleType, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is FrameworkListProjectRuleStatsResponse && + items == other.items && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(items, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "FrameworkListProjectRuleStatsResponse{items=$items, additionalProperties=$additionalProperties}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListProjectsParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListProjectsParams.kt new file mode 100644 index 00000000..4fe7d511 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListProjectsParams.kt @@ -0,0 +1,250 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.frameworks + +import com.openlayer.api.core.Params +import com.openlayer.api.core.http.Headers +import com.openlayer.api.core.http.QueryParams +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * List the projects a framework applies to. + * + * Which projects a framework covers is determined by its `projectSelector`. A framework with an + * empty selector applies to every project in the workspace. + */ +class FrameworkListProjectsParams +private constructor( + private val frameworkId: String?, + private val page: Long?, + private val perPage: Long?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun frameworkId(): Optional = Optional.ofNullable(frameworkId) + + /** The page to return in a paginated query. */ + fun page(): Optional = Optional.ofNullable(page) + + /** Maximum number of items to return per page. */ + fun perPage(): Optional = Optional.ofNullable(perPage) + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): FrameworkListProjectsParams = builder().build() + + /** + * Returns a mutable builder for constructing an instance of [FrameworkListProjectsParams]. + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [FrameworkListProjectsParams]. */ + class Builder internal constructor() { + + private var frameworkId: String? = null + private var page: Long? = null + private var perPage: Long? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(frameworkListProjectsParams: FrameworkListProjectsParams) = apply { + frameworkId = frameworkListProjectsParams.frameworkId + page = frameworkListProjectsParams.page + perPage = frameworkListProjectsParams.perPage + additionalHeaders = frameworkListProjectsParams.additionalHeaders.toBuilder() + additionalQueryParams = frameworkListProjectsParams.additionalQueryParams.toBuilder() + } + + fun frameworkId(frameworkId: String?) = apply { this.frameworkId = frameworkId } + + /** Alias for calling [Builder.frameworkId] with `frameworkId.orElse(null)`. */ + fun frameworkId(frameworkId: Optional) = frameworkId(frameworkId.getOrNull()) + + /** The page to return in a paginated query. */ + fun page(page: Long?) = apply { this.page = page } + + /** + * Alias for [Builder.page]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun page(page: Long) = page(page as Long?) + + /** Alias for calling [Builder.page] with `page.orElse(null)`. */ + fun page(page: Optional) = page(page.getOrNull()) + + /** Maximum number of items to return per page. */ + fun perPage(perPage: Long?) = apply { this.perPage = perPage } + + /** + * Alias for [Builder.perPage]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun perPage(perPage: Long) = perPage(perPage as Long?) + + /** Alias for calling [Builder.perPage] with `perPage.orElse(null)`. */ + fun perPage(perPage: Optional) = perPage(perPage.getOrNull()) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [FrameworkListProjectsParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): FrameworkListProjectsParams = + FrameworkListProjectsParams( + frameworkId, + page, + perPage, + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _pathParam(index: Int): String = + when (index) { + 0 -> frameworkId ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + page?.let { put("page", it.toString()) } + perPage?.let { put("perPage", it.toString()) } + putAll(additionalQueryParams) + } + .build() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is FrameworkListProjectsParams && + frameworkId == other.frameworkId && + page == other.page && + perPage == other.perPage && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = + Objects.hash(frameworkId, page, perPage, additionalHeaders, additionalQueryParams) + + override fun toString() = + "FrameworkListProjectsParams{frameworkId=$frameworkId, page=$page, perPage=$perPage, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListProjectsResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListProjectsResponse.kt new file mode 100644 index 00000000..88797140 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListProjectsResponse.kt @@ -0,0 +1,2319 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.frameworks + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.openlayer.api.core.Enum +import com.openlayer.api.core.ExcludeMissing +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonMissing +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.checkKnown +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.toImmutable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.time.OffsetDateTime +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class FrameworkListProjectsResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val items: JsonField>, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("items") @ExcludeMissing items: JsonField> = JsonMissing.of() + ) : this(items, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun items(): List = items.getRequired("items") + + /** + * Returns the raw JSON value of [items]. + * + * Unlike [items], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("items") @ExcludeMissing fun _items(): JsonField> = items + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [FrameworkListProjectsResponse]. + * + * The following fields are required: + * ```java + * .items() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [FrameworkListProjectsResponse]. */ + class Builder internal constructor() { + + private var items: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(frameworkListProjectsResponse: FrameworkListProjectsResponse) = apply { + items = frameworkListProjectsResponse.items.map { it.toMutableList() } + additionalProperties = frameworkListProjectsResponse.additionalProperties.toMutableMap() + } + + fun items(items: List) = items(JsonField.of(items)) + + /** + * Sets [Builder.items] to an arbitrary JSON value. + * + * You should usually call [Builder.items] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun items(items: JsonField>) = apply { + this.items = items.map { it.toMutableList() } + } + + /** + * Adds a single [Item] to [items]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addItem(item: Item) = apply { + items = + (items ?: JsonField.of(mutableListOf())).also { checkKnown("items", it).add(item) } + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [FrameworkListProjectsResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .items() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): FrameworkListProjectsResponse = + FrameworkListProjectsResponse( + checkRequired("items", items).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): FrameworkListProjectsResponse = apply { + if (validated) { + return@apply + } + + items().forEach { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (items.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + class Item + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val creatorId: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val developmentGoalCount: JsonField, + private val goalCount: JsonField, + private val inferencePipelineCount: JsonField, + private val links: JsonField, + private val monitoringGoalCount: JsonField, + private val name: JsonField, + private val source: JsonField, + private val taskType: JsonField, + private val versionCount: JsonField, + private val workspaceId: JsonField, + private val dataRetentionDays: JsonField, + private val description: JsonField, + private val gitRepo: JsonField, + private val modelDeveloper: JsonField, + private val modelTypes: JsonField>, + private val purpose: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("creatorId") + @ExcludeMissing + creatorId: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("developmentGoalCount") + @ExcludeMissing + developmentGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("goalCount") + @ExcludeMissing + goalCount: JsonField = JsonMissing.of(), + @JsonProperty("inferencePipelineCount") + @ExcludeMissing + inferencePipelineCount: JsonField = JsonMissing.of(), + @JsonProperty("links") @ExcludeMissing links: JsonField = JsonMissing.of(), + @JsonProperty("monitoringGoalCount") + @ExcludeMissing + monitoringGoalCount: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("source") @ExcludeMissing source: JsonField = JsonMissing.of(), + @JsonProperty("taskType") + @ExcludeMissing + taskType: JsonField = JsonMissing.of(), + @JsonProperty("versionCount") + @ExcludeMissing + versionCount: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + @JsonProperty("dataRetentionDays") + @ExcludeMissing + dataRetentionDays: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + description: JsonField = JsonMissing.of(), + @JsonProperty("gitRepo") @ExcludeMissing gitRepo: JsonField = JsonMissing.of(), + @JsonProperty("modelDeveloper") + @ExcludeMissing + modelDeveloper: JsonField = JsonMissing.of(), + @JsonProperty("modelTypes") + @ExcludeMissing + modelTypes: JsonField> = JsonMissing.of(), + @JsonProperty("purpose") @ExcludeMissing purpose: JsonField = JsonMissing.of(), + ) : this( + id, + creatorId, + dateCreated, + dateUpdated, + developmentGoalCount, + goalCount, + inferencePipelineCount, + links, + monitoringGoalCount, + name, + source, + taskType, + versionCount, + workspaceId, + dataRetentionDays, + description, + gitRepo, + modelDeveloper, + modelTypes, + purpose, + mutableMapOf(), + ) + + /** + * The project id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun id(): String = id.getRequired("id") + + /** + * The project creator id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun creatorId(): Optional = creatorId.getOptional("creatorId") + + /** + * The project creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** + * The project last updated date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** + * The number of tests in the development mode of the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun developmentGoalCount(): Long = developmentGoalCount.getRequired("developmentGoalCount") + + /** + * The total number of tests in the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun goalCount(): Long = goalCount.getRequired("goalCount") + + /** + * The number of inference pipelines in the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun inferencePipelineCount(): Long = + inferencePipelineCount.getRequired("inferencePipelineCount") + + /** + * Links to the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun links(): Links = links.getRequired("links") + + /** + * The number of tests in the monitoring mode of the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun monitoringGoalCount(): Long = monitoringGoalCount.getRequired("monitoringGoalCount") + + /** + * The project name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun name(): String = name.getRequired("name") + + /** + * The source of the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun source(): Optional = source.getOptional("source") + + /** + * The task type of the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun taskType(): TaskType = taskType.getRequired("taskType") + + /** + * The number of versions (commits) in the project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun versionCount(): Long = versionCount.getRequired("versionCount") + + /** + * The workspace id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun workspaceId(): Optional = workspaceId.getOptional("workspaceId") + + /** + * Number of days to retain monitoring data for this project. Null means data is retained + * indefinitely. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun dataRetentionDays(): Optional = dataRetentionDays.getOptional("dataRetentionDays") + + /** + * The project description. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun description(): Optional = description.getOptional("description") + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun gitRepo(): Optional = gitRepo.getOptional("gitRepo") + + /** + * Who developed the model used in this project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun modelDeveloper(): Optional = modelDeveloper.getOptional("modelDeveloper") + + /** + * The kinds of model used in this project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun modelTypes(): Optional> = modelTypes.getOptional("modelTypes") + + /** + * What the system in this project is intended to do. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun purpose(): Optional = purpose.getOptional("purpose") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [creatorId]. + * + * Unlike [creatorId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("creatorId") @ExcludeMissing fun _creatorId(): JsonField = creatorId + + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** + * Returns the raw JSON value of [developmentGoalCount]. + * + * Unlike [developmentGoalCount], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("developmentGoalCount") + @ExcludeMissing + fun _developmentGoalCount(): JsonField = developmentGoalCount + + /** + * Returns the raw JSON value of [goalCount]. + * + * Unlike [goalCount], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("goalCount") @ExcludeMissing fun _goalCount(): JsonField = goalCount + + /** + * Returns the raw JSON value of [inferencePipelineCount]. + * + * Unlike [inferencePipelineCount], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("inferencePipelineCount") + @ExcludeMissing + fun _inferencePipelineCount(): JsonField = inferencePipelineCount + + /** + * Returns the raw JSON value of [links]. + * + * Unlike [links], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("links") @ExcludeMissing fun _links(): JsonField = links + + /** + * Returns the raw JSON value of [monitoringGoalCount]. + * + * Unlike [monitoringGoalCount], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("monitoringGoalCount") + @ExcludeMissing + fun _monitoringGoalCount(): JsonField = monitoringGoalCount + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [source]. + * + * Unlike [source], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("source") @ExcludeMissing fun _source(): JsonField = source + + /** + * Returns the raw JSON value of [taskType]. + * + * Unlike [taskType], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("taskType") @ExcludeMissing fun _taskType(): JsonField = taskType + + /** + * Returns the raw JSON value of [versionCount]. + * + * Unlike [versionCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("versionCount") + @ExcludeMissing + fun _versionCount(): JsonField = versionCount + + /** + * Returns the raw JSON value of [workspaceId]. + * + * Unlike [workspaceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("workspaceId") + @ExcludeMissing + fun _workspaceId(): JsonField = workspaceId + + /** + * Returns the raw JSON value of [dataRetentionDays]. + * + * Unlike [dataRetentionDays], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("dataRetentionDays") + @ExcludeMissing + fun _dataRetentionDays(): JsonField = dataRetentionDays + + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("description") + @ExcludeMissing + fun _description(): JsonField = description + + /** + * Returns the raw JSON value of [gitRepo]. + * + * Unlike [gitRepo], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("gitRepo") @ExcludeMissing fun _gitRepo(): JsonField = gitRepo + + /** + * Returns the raw JSON value of [modelDeveloper]. + * + * Unlike [modelDeveloper], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("modelDeveloper") + @ExcludeMissing + fun _modelDeveloper(): JsonField = modelDeveloper + + /** + * Returns the raw JSON value of [modelTypes]. + * + * Unlike [modelTypes], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("modelTypes") + @ExcludeMissing + fun _modelTypes(): JsonField> = modelTypes + + /** + * Returns the raw JSON value of [purpose]. + * + * Unlike [purpose], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("purpose") @ExcludeMissing fun _purpose(): JsonField = purpose + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Item]. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .developmentGoalCount() + * .goalCount() + * .inferencePipelineCount() + * .links() + * .monitoringGoalCount() + * .name() + * .source() + * .taskType() + * .versionCount() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Item]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var creatorId: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var developmentGoalCount: JsonField? = null + private var goalCount: JsonField? = null + private var inferencePipelineCount: JsonField? = null + private var links: JsonField? = null + private var monitoringGoalCount: JsonField? = null + private var name: JsonField? = null + private var source: JsonField? = null + private var taskType: JsonField? = null + private var versionCount: JsonField? = null + private var workspaceId: JsonField? = null + private var dataRetentionDays: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var gitRepo: JsonField = JsonMissing.of() + private var modelDeveloper: JsonField = JsonMissing.of() + private var modelTypes: JsonField>? = null + private var purpose: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(item: Item) = apply { + id = item.id + creatorId = item.creatorId + dateCreated = item.dateCreated + dateUpdated = item.dateUpdated + developmentGoalCount = item.developmentGoalCount + goalCount = item.goalCount + inferencePipelineCount = item.inferencePipelineCount + links = item.links + monitoringGoalCount = item.monitoringGoalCount + name = item.name + source = item.source + taskType = item.taskType + versionCount = item.versionCount + workspaceId = item.workspaceId + dataRetentionDays = item.dataRetentionDays + description = item.description + gitRepo = item.gitRepo + modelDeveloper = item.modelDeveloper + modelTypes = item.modelTypes.map { it.toMutableList() } + purpose = item.purpose + additionalProperties = item.additionalProperties.toMutableMap() + } + + /** The project id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The project creator id. */ + fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) + + /** Alias for calling [Builder.creatorId] with `creatorId.orElse(null)`. */ + fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) + + /** + * Sets [Builder.creatorId] to an arbitrary JSON value. + * + * You should usually call [Builder.creatorId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } + + /** The project creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The project last updated date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** The number of tests in the development mode of the project. */ + fun developmentGoalCount(developmentGoalCount: Long) = + developmentGoalCount(JsonField.of(developmentGoalCount)) + + /** + * Sets [Builder.developmentGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.developmentGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun developmentGoalCount(developmentGoalCount: JsonField) = apply { + this.developmentGoalCount = developmentGoalCount + } + + /** The total number of tests in the project. */ + fun goalCount(goalCount: Long) = goalCount(JsonField.of(goalCount)) + + /** + * Sets [Builder.goalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.goalCount] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun goalCount(goalCount: JsonField) = apply { this.goalCount = goalCount } + + /** The number of inference pipelines in the project. */ + fun inferencePipelineCount(inferencePipelineCount: Long) = + inferencePipelineCount(JsonField.of(inferencePipelineCount)) + + /** + * Sets [Builder.inferencePipelineCount] to an arbitrary JSON value. + * + * You should usually call [Builder.inferencePipelineCount] with a well-typed [Long] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun inferencePipelineCount(inferencePipelineCount: JsonField) = apply { + this.inferencePipelineCount = inferencePipelineCount + } + + /** Links to the project. */ + fun links(links: Links) = links(JsonField.of(links)) + + /** + * Sets [Builder.links] to an arbitrary JSON value. + * + * You should usually call [Builder.links] with a well-typed [Links] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun links(links: JsonField) = apply { this.links = links } + + /** The number of tests in the monitoring mode of the project. */ + fun monitoringGoalCount(monitoringGoalCount: Long) = + monitoringGoalCount(JsonField.of(monitoringGoalCount)) + + /** + * Sets [Builder.monitoringGoalCount] to an arbitrary JSON value. + * + * You should usually call [Builder.monitoringGoalCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun monitoringGoalCount(monitoringGoalCount: JsonField) = apply { + this.monitoringGoalCount = monitoringGoalCount + } + + /** The project name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun name(name: JsonField) = apply { this.name = name } + + /** The source of the project. */ + fun source(source: Source?) = source(JsonField.ofNullable(source)) + + /** Alias for calling [Builder.source] with `source.orElse(null)`. */ + fun source(source: Optional) = source(source.getOrNull()) + + /** + * Sets [Builder.source] to an arbitrary JSON value. + * + * You should usually call [Builder.source] with a well-typed [Source] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun source(source: JsonField) = apply { this.source = source } + + /** The task type of the project. */ + fun taskType(taskType: TaskType) = taskType(JsonField.of(taskType)) + + /** + * Sets [Builder.taskType] to an arbitrary JSON value. + * + * You should usually call [Builder.taskType] with a well-typed [TaskType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun taskType(taskType: JsonField) = apply { this.taskType = taskType } + + /** The number of versions (commits) in the project. */ + fun versionCount(versionCount: Long) = versionCount(JsonField.of(versionCount)) + + /** + * Sets [Builder.versionCount] to an arbitrary JSON value. + * + * You should usually call [Builder.versionCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun versionCount(versionCount: JsonField) = apply { + this.versionCount = versionCount + } + + /** The workspace id. */ + fun workspaceId(workspaceId: String?) = workspaceId(JsonField.ofNullable(workspaceId)) + + /** Alias for calling [Builder.workspaceId] with `workspaceId.orElse(null)`. */ + fun workspaceId(workspaceId: Optional) = workspaceId(workspaceId.getOrNull()) + + /** + * Sets [Builder.workspaceId] to an arbitrary JSON value. + * + * You should usually call [Builder.workspaceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun workspaceId(workspaceId: JsonField) = apply { + this.workspaceId = workspaceId + } + + /** + * Number of days to retain monitoring data for this project. Null means data is + * retained indefinitely. + */ + fun dataRetentionDays(dataRetentionDays: Long?) = + dataRetentionDays(JsonField.ofNullable(dataRetentionDays)) + + /** + * Alias for [Builder.dataRetentionDays]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun dataRetentionDays(dataRetentionDays: Long) = + dataRetentionDays(dataRetentionDays as Long?) + + /** + * Alias for calling [Builder.dataRetentionDays] with `dataRetentionDays.orElse(null)`. + */ + fun dataRetentionDays(dataRetentionDays: Optional) = + dataRetentionDays(dataRetentionDays.getOrNull()) + + /** + * Sets [Builder.dataRetentionDays] to an arbitrary JSON value. + * + * You should usually call [Builder.dataRetentionDays] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun dataRetentionDays(dataRetentionDays: JsonField) = apply { + this.dataRetentionDays = dataRetentionDays + } + + /** The project description. */ + fun description(description: String?) = description(JsonField.ofNullable(description)) + + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ + fun description(description: Optional) = description(description.getOrNull()) + + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun description(description: JsonField) = apply { + this.description = description + } + + fun gitRepo(gitRepo: GitRepo?) = gitRepo(JsonField.ofNullable(gitRepo)) + + /** Alias for calling [Builder.gitRepo] with `gitRepo.orElse(null)`. */ + fun gitRepo(gitRepo: Optional) = gitRepo(gitRepo.getOrNull()) + + /** + * Sets [Builder.gitRepo] to an arbitrary JSON value. + * + * You should usually call [Builder.gitRepo] with a well-typed [GitRepo] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun gitRepo(gitRepo: JsonField) = apply { this.gitRepo = gitRepo } + + /** Who developed the model used in this project. */ + fun modelDeveloper(modelDeveloper: String?) = + modelDeveloper(JsonField.ofNullable(modelDeveloper)) + + /** Alias for calling [Builder.modelDeveloper] with `modelDeveloper.orElse(null)`. */ + fun modelDeveloper(modelDeveloper: Optional) = + modelDeveloper(modelDeveloper.getOrNull()) + + /** + * Sets [Builder.modelDeveloper] to an arbitrary JSON value. + * + * You should usually call [Builder.modelDeveloper] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun modelDeveloper(modelDeveloper: JsonField) = apply { + this.modelDeveloper = modelDeveloper + } + + /** The kinds of model used in this project. */ + fun modelTypes(modelTypes: List?) = modelTypes(JsonField.ofNullable(modelTypes)) + + /** Alias for calling [Builder.modelTypes] with `modelTypes.orElse(null)`. */ + fun modelTypes(modelTypes: Optional>) = modelTypes(modelTypes.getOrNull()) + + /** + * Sets [Builder.modelTypes] to an arbitrary JSON value. + * + * You should usually call [Builder.modelTypes] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun modelTypes(modelTypes: JsonField>) = apply { + this.modelTypes = modelTypes.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [modelTypes]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addModelType(modelType: String) = apply { + modelTypes = + (modelTypes ?: JsonField.of(mutableListOf())).also { + checkKnown("modelTypes", it).add(modelType) + } + } + + /** What the system in this project is intended to do. */ + fun purpose(purpose: String?) = purpose(JsonField.ofNullable(purpose)) + + /** Alias for calling [Builder.purpose] with `purpose.orElse(null)`. */ + fun purpose(purpose: Optional) = purpose(purpose.getOrNull()) + + /** + * Sets [Builder.purpose] to an arbitrary JSON value. + * + * You should usually call [Builder.purpose] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun purpose(purpose: JsonField) = apply { this.purpose = purpose } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Item]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .developmentGoalCount() + * .goalCount() + * .inferencePipelineCount() + * .links() + * .monitoringGoalCount() + * .name() + * .source() + * .taskType() + * .versionCount() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Item = + Item( + checkRequired("id", id), + checkRequired("creatorId", creatorId), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("developmentGoalCount", developmentGoalCount), + checkRequired("goalCount", goalCount), + checkRequired("inferencePipelineCount", inferencePipelineCount), + checkRequired("links", links), + checkRequired("monitoringGoalCount", monitoringGoalCount), + checkRequired("name", name), + checkRequired("source", source), + checkRequired("taskType", taskType), + checkRequired("versionCount", versionCount), + checkRequired("workspaceId", workspaceId), + dataRetentionDays, + description, + gitRepo, + modelDeveloper, + (modelTypes ?: JsonMissing.of()).map { it.toImmutable() }, + purpose, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Item = apply { + if (validated) { + return@apply + } + + id() + creatorId() + dateCreated() + dateUpdated() + developmentGoalCount() + goalCount() + inferencePipelineCount() + links().validate() + monitoringGoalCount() + name() + source().ifPresent { it.validate() } + taskType().validate() + versionCount() + workspaceId() + dataRetentionDays() + description() + gitRepo().ifPresent { it.validate() } + modelDeveloper() + modelTypes() + purpose() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (creatorId.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (developmentGoalCount.asKnown().isPresent) 1 else 0) + + (if (goalCount.asKnown().isPresent) 1 else 0) + + (if (inferencePipelineCount.asKnown().isPresent) 1 else 0) + + (links.asKnown().getOrNull()?.validity() ?: 0) + + (if (monitoringGoalCount.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (source.asKnown().getOrNull()?.validity() ?: 0) + + (taskType.asKnown().getOrNull()?.validity() ?: 0) + + (if (versionCount.asKnown().isPresent) 1 else 0) + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + (if (dataRetentionDays.asKnown().isPresent) 1 else 0) + + (if (description.asKnown().isPresent) 1 else 0) + + (gitRepo.asKnown().getOrNull()?.validity() ?: 0) + + (if (modelDeveloper.asKnown().isPresent) 1 else 0) + + (modelTypes.asKnown().getOrNull()?.size ?: 0) + + (if (purpose.asKnown().isPresent) 1 else 0) + + /** Links to the project. */ + class Links + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val app: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("app") @ExcludeMissing app: JsonField = JsonMissing.of() + ) : this(app, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun app(): String = app.getRequired("app") + + /** + * Returns the raw JSON value of [app]. + * + * Unlike [app], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("app") @ExcludeMissing fun _app(): JsonField = app + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Links]. + * + * The following fields are required: + * ```java + * .app() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Links]. */ + class Builder internal constructor() { + + private var app: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(links: Links) = apply { + app = links.app + additionalProperties = links.additionalProperties.toMutableMap() + } + + fun app(app: String) = app(JsonField.of(app)) + + /** + * Sets [Builder.app] to an arbitrary JSON value. + * + * You should usually call [Builder.app] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun app(app: JsonField) = apply { this.app = app } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Links]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .app() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Links = + Links(checkRequired("app", app), additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Links = apply { + if (validated) { + return@apply + } + + app() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = (if (app.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Links && + app == other.app && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(app, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = "Links{app=$app, additionalProperties=$additionalProperties}" + } + + /** The source of the project. */ + class Source @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val WEB = of("web") + + @JvmField val API = of("api") + + @JvmStatic fun of(value: String) = Source(JsonField.of(value)) + } + + /** An enum containing [Source]'s known values. */ + enum class Known { + WEB, + API, + } + + /** + * An enum containing [Source]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Source] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + WEB, + API, + /** + * An enum member indicating that [Source] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + WEB -> Value.WEB + API -> Value.API + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + WEB -> Known.WEB + API -> Known.API + else -> throw OpenlayerInvalidDataException("Unknown Source: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Source = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Source && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** The task type of the project. */ + class TaskType @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val LLM_BASE = of("llm-base") + + @JvmField val TABULAR_CLASSIFICATION = of("tabular-classification") + + @JvmField val TABULAR_REGRESSION = of("tabular-regression") + + @JvmField val TEXT_CLASSIFICATION = of("text-classification") + + @JvmStatic fun of(value: String) = TaskType(JsonField.of(value)) + } + + /** An enum containing [TaskType]'s known values. */ + enum class Known { + LLM_BASE, + TABULAR_CLASSIFICATION, + TABULAR_REGRESSION, + TEXT_CLASSIFICATION, + } + + /** + * An enum containing [TaskType]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [TaskType] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + LLM_BASE, + TABULAR_CLASSIFICATION, + TABULAR_REGRESSION, + TEXT_CLASSIFICATION, + /** + * An enum member indicating that [TaskType] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + LLM_BASE -> Value.LLM_BASE + TABULAR_CLASSIFICATION -> Value.TABULAR_CLASSIFICATION + TABULAR_REGRESSION -> Value.TABULAR_REGRESSION + TEXT_CLASSIFICATION -> Value.TEXT_CLASSIFICATION + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + LLM_BASE -> Known.LLM_BASE + TABULAR_CLASSIFICATION -> Known.TABULAR_CLASSIFICATION + TABULAR_REGRESSION -> Known.TABULAR_REGRESSION + TEXT_CLASSIFICATION -> Known.TEXT_CLASSIFICATION + else -> throw OpenlayerInvalidDataException("Unknown TaskType: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): TaskType = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is TaskType && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + class GitRepo + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val dateConnected: JsonField, + private val dateUpdated: JsonField, + private val gitAccountId: JsonField, + private val gitId: JsonField, + private val name: JsonField, + private val private_: JsonField, + private val projectId: JsonField, + private val slug: JsonField, + private val url: JsonField, + private val branch: JsonField, + private val rootDir: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("dateConnected") + @ExcludeMissing + dateConnected: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("gitAccountId") + @ExcludeMissing + gitAccountId: JsonField = JsonMissing.of(), + @JsonProperty("gitId") @ExcludeMissing gitId: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("private") + @ExcludeMissing + private_: JsonField = JsonMissing.of(), + @JsonProperty("projectId") + @ExcludeMissing + projectId: JsonField = JsonMissing.of(), + @JsonProperty("slug") @ExcludeMissing slug: JsonField = JsonMissing.of(), + @JsonProperty("url") @ExcludeMissing url: JsonField = JsonMissing.of(), + @JsonProperty("branch") + @ExcludeMissing + branch: JsonField = JsonMissing.of(), + @JsonProperty("rootDir") + @ExcludeMissing + rootDir: JsonField = JsonMissing.of(), + ) : this( + id, + dateConnected, + dateUpdated, + gitAccountId, + gitId, + name, + private_, + projectId, + slug, + url, + branch, + rootDir, + mutableMapOf(), + ) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun id(): String = id.getRequired("id") + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun dateConnected(): OffsetDateTime = dateConnected.getRequired("dateConnected") + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun gitAccountId(): String = gitAccountId.getRequired("gitAccountId") + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun gitId(): Long = gitId.getRequired("gitId") + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun name(): String = name.getRequired("name") + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun private_(): Boolean = private_.getRequired("private") + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun projectId(): String = projectId.getRequired("projectId") + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun slug(): String = slug.getRequired("slug") + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun url(): String = url.getRequired("url") + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun branch(): Optional = branch.getOptional("branch") + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun rootDir(): Optional = rootDir.getOptional("rootDir") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [dateConnected]. + * + * Unlike [dateConnected], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("dateConnected") + @ExcludeMissing + fun _dateConnected(): JsonField = dateConnected + + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** + * Returns the raw JSON value of [gitAccountId]. + * + * Unlike [gitAccountId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("gitAccountId") + @ExcludeMissing + fun _gitAccountId(): JsonField = gitAccountId + + /** + * Returns the raw JSON value of [gitId]. + * + * Unlike [gitId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("gitId") @ExcludeMissing fun _gitId(): JsonField = gitId + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [private_]. + * + * Unlike [private_], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("private") @ExcludeMissing fun _private_(): JsonField = private_ + + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("projectId") + @ExcludeMissing + fun _projectId(): JsonField = projectId + + /** + * Returns the raw JSON value of [slug]. + * + * Unlike [slug], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("slug") @ExcludeMissing fun _slug(): JsonField = slug + + /** + * Returns the raw JSON value of [url]. + * + * Unlike [url], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("url") @ExcludeMissing fun _url(): JsonField = url + + /** + * Returns the raw JSON value of [branch]. + * + * Unlike [branch], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("branch") @ExcludeMissing fun _branch(): JsonField = branch + + /** + * Returns the raw JSON value of [rootDir]. + * + * Unlike [rootDir], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("rootDir") @ExcludeMissing fun _rootDir(): JsonField = rootDir + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [GitRepo]. + * + * The following fields are required: + * ```java + * .id() + * .dateConnected() + * .dateUpdated() + * .gitAccountId() + * .gitId() + * .name() + * .private_() + * .projectId() + * .slug() + * .url() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [GitRepo]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var dateConnected: JsonField? = null + private var dateUpdated: JsonField? = null + private var gitAccountId: JsonField? = null + private var gitId: JsonField? = null + private var name: JsonField? = null + private var private_: JsonField? = null + private var projectId: JsonField? = null + private var slug: JsonField? = null + private var url: JsonField? = null + private var branch: JsonField = JsonMissing.of() + private var rootDir: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(gitRepo: GitRepo) = apply { + id = gitRepo.id + dateConnected = gitRepo.dateConnected + dateUpdated = gitRepo.dateUpdated + gitAccountId = gitRepo.gitAccountId + gitId = gitRepo.gitId + name = gitRepo.name + private_ = gitRepo.private_ + projectId = gitRepo.projectId + slug = gitRepo.slug + url = gitRepo.url + branch = gitRepo.branch + rootDir = gitRepo.rootDir + additionalProperties = gitRepo.additionalProperties.toMutableMap() + } + + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + fun dateConnected(dateConnected: OffsetDateTime) = + dateConnected(JsonField.of(dateConnected)) + + /** + * Sets [Builder.dateConnected] to an arbitrary JSON value. + * + * You should usually call [Builder.dateConnected] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun dateConnected(dateConnected: JsonField) = apply { + this.dateConnected = dateConnected + } + + fun dateUpdated(dateUpdated: OffsetDateTime) = + dateUpdated(JsonField.of(dateUpdated)) + + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + fun gitAccountId(gitAccountId: String) = gitAccountId(JsonField.of(gitAccountId)) + + /** + * Sets [Builder.gitAccountId] to an arbitrary JSON value. + * + * You should usually call [Builder.gitAccountId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun gitAccountId(gitAccountId: JsonField) = apply { + this.gitAccountId = gitAccountId + } + + fun gitId(gitId: Long) = gitId(JsonField.of(gitId)) + + /** + * Sets [Builder.gitId] to an arbitrary JSON value. + * + * You should usually call [Builder.gitId] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun gitId(gitId: JsonField) = apply { this.gitId = gitId } + + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun name(name: JsonField) = apply { this.name = name } + + fun private_(private_: Boolean) = private_(JsonField.of(private_)) + + /** + * Sets [Builder.private_] to an arbitrary JSON value. + * + * You should usually call [Builder.private_] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun private_(private_: JsonField) = apply { this.private_ = private_ } + + fun projectId(projectId: String) = projectId(JsonField.of(projectId)) + + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun projectId(projectId: JsonField) = apply { this.projectId = projectId } + + fun slug(slug: String) = slug(JsonField.of(slug)) + + /** + * Sets [Builder.slug] to an arbitrary JSON value. + * + * You should usually call [Builder.slug] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun slug(slug: JsonField) = apply { this.slug = slug } + + fun url(url: String) = url(JsonField.of(url)) + + /** + * Sets [Builder.url] to an arbitrary JSON value. + * + * You should usually call [Builder.url] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun url(url: JsonField) = apply { this.url = url } + + fun branch(branch: String) = branch(JsonField.of(branch)) + + /** + * Sets [Builder.branch] to an arbitrary JSON value. + * + * You should usually call [Builder.branch] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun branch(branch: JsonField) = apply { this.branch = branch } + + fun rootDir(rootDir: String) = rootDir(JsonField.of(rootDir)) + + /** + * Sets [Builder.rootDir] to an arbitrary JSON value. + * + * You should usually call [Builder.rootDir] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun rootDir(rootDir: JsonField) = apply { this.rootDir = rootDir } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [GitRepo]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .dateConnected() + * .dateUpdated() + * .gitAccountId() + * .gitId() + * .name() + * .private_() + * .projectId() + * .slug() + * .url() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): GitRepo = + GitRepo( + checkRequired("id", id), + checkRequired("dateConnected", dateConnected), + checkRequired("dateUpdated", dateUpdated), + checkRequired("gitAccountId", gitAccountId), + checkRequired("gitId", gitId), + checkRequired("name", name), + checkRequired("private_", private_), + checkRequired("projectId", projectId), + checkRequired("slug", slug), + checkRequired("url", url), + branch, + rootDir, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): GitRepo = apply { + if (validated) { + return@apply + } + + id() + dateConnected() + dateUpdated() + gitAccountId() + gitId() + name() + private_() + projectId() + slug() + url() + branch() + rootDir() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (dateConnected.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (gitAccountId.asKnown().isPresent) 1 else 0) + + (if (gitId.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (private_.asKnown().isPresent) 1 else 0) + + (if (projectId.asKnown().isPresent) 1 else 0) + + (if (slug.asKnown().isPresent) 1 else 0) + + (if (url.asKnown().isPresent) 1 else 0) + + (if (branch.asKnown().isPresent) 1 else 0) + + (if (rootDir.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is GitRepo && + id == other.id && + dateConnected == other.dateConnected && + dateUpdated == other.dateUpdated && + gitAccountId == other.gitAccountId && + gitId == other.gitId && + name == other.name && + private_ == other.private_ && + projectId == other.projectId && + slug == other.slug && + url == other.url && + branch == other.branch && + rootDir == other.rootDir && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + dateConnected, + dateUpdated, + gitAccountId, + gitId, + name, + private_, + projectId, + slug, + url, + branch, + rootDir, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "GitRepo{id=$id, dateConnected=$dateConnected, dateUpdated=$dateUpdated, gitAccountId=$gitAccountId, gitId=$gitId, name=$name, private_=$private_, projectId=$projectId, slug=$slug, url=$url, branch=$branch, rootDir=$rootDir, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Item && + id == other.id && + creatorId == other.creatorId && + dateCreated == other.dateCreated && + dateUpdated == other.dateUpdated && + developmentGoalCount == other.developmentGoalCount && + goalCount == other.goalCount && + inferencePipelineCount == other.inferencePipelineCount && + links == other.links && + monitoringGoalCount == other.monitoringGoalCount && + name == other.name && + source == other.source && + taskType == other.taskType && + versionCount == other.versionCount && + workspaceId == other.workspaceId && + dataRetentionDays == other.dataRetentionDays && + description == other.description && + gitRepo == other.gitRepo && + modelDeveloper == other.modelDeveloper && + modelTypes == other.modelTypes && + purpose == other.purpose && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + creatorId, + dateCreated, + dateUpdated, + developmentGoalCount, + goalCount, + inferencePipelineCount, + links, + monitoringGoalCount, + name, + source, + taskType, + versionCount, + workspaceId, + dataRetentionDays, + description, + gitRepo, + modelDeveloper, + modelTypes, + purpose, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Item{id=$id, creatorId=$creatorId, dateCreated=$dateCreated, dateUpdated=$dateUpdated, developmentGoalCount=$developmentGoalCount, goalCount=$goalCount, inferencePipelineCount=$inferencePipelineCount, links=$links, monitoringGoalCount=$monitoringGoalCount, name=$name, source=$source, taskType=$taskType, versionCount=$versionCount, workspaceId=$workspaceId, dataRetentionDays=$dataRetentionDays, description=$description, gitRepo=$gitRepo, modelDeveloper=$modelDeveloper, modelTypes=$modelTypes, purpose=$purpose, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is FrameworkListProjectsResponse && + items == other.items && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(items, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "FrameworkListProjectsResponse{items=$items, additionalProperties=$additionalProperties}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListResponse.kt new file mode 100644 index 00000000..9db0af73 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListResponse.kt @@ -0,0 +1,3174 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.frameworks + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.openlayer.api.core.Enum +import com.openlayer.api.core.ExcludeMissing +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonMissing +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.checkKnown +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.toImmutable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.time.OffsetDateTime +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class FrameworkListResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val items: JsonField>, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("items") @ExcludeMissing items: JsonField> = JsonMissing.of() + ) : this(items, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun items(): List = items.getRequired("items") + + /** + * Returns the raw JSON value of [items]. + * + * Unlike [items], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("items") @ExcludeMissing fun _items(): JsonField> = items + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [FrameworkListResponse]. + * + * The following fields are required: + * ```java + * .items() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [FrameworkListResponse]. */ + class Builder internal constructor() { + + private var items: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(frameworkListResponse: FrameworkListResponse) = apply { + items = frameworkListResponse.items.map { it.toMutableList() } + additionalProperties = frameworkListResponse.additionalProperties.toMutableMap() + } + + fun items(items: List) = items(JsonField.of(items)) + + /** + * Sets [Builder.items] to an arbitrary JSON value. + * + * You should usually call [Builder.items] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun items(items: JsonField>) = apply { + this.items = items.map { it.toMutableList() } + } + + /** + * Adds a single [Item] to [items]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addItem(item: Item) = apply { + items = + (items ?: JsonField.of(mutableListOf())).also { checkKnown("items", it).add(item) } + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [FrameworkListResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .items() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): FrameworkListResponse = + FrameworkListResponse( + checkRequired("items", items).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): FrameworkListResponse = apply { + if (validated) { + return@apply + } + + items().forEach { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (items.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + class Item + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val enabled: JsonField, + private val name: JsonField, + private val tags: JsonField>, + private val workspaceId: JsonField, + private val avatar: JsonField, + private val builtInSlug: JsonField, + private val creatorId: JsonField, + private val description: JsonField, + private val extendedDescription: JsonField, + private val href: JsonField, + private val immutable: JsonField, + private val projectSelector: JsonField, + private val ruleStats: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("enabled") @ExcludeMissing enabled: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("tags") @ExcludeMissing tags: JsonField> = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + @JsonProperty("avatar") @ExcludeMissing avatar: JsonField = JsonMissing.of(), + @JsonProperty("builtInSlug") + @ExcludeMissing + builtInSlug: JsonField = JsonMissing.of(), + @JsonProperty("creatorId") + @ExcludeMissing + creatorId: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + description: JsonField = JsonMissing.of(), + @JsonProperty("extendedDescription") + @ExcludeMissing + extendedDescription: JsonField = JsonMissing.of(), + @JsonProperty("href") @ExcludeMissing href: JsonField = JsonMissing.of(), + @JsonProperty("immutable") + @ExcludeMissing + immutable: JsonField = JsonMissing.of(), + @JsonProperty("projectSelector") + @ExcludeMissing + projectSelector: JsonField = JsonMissing.of(), + @JsonProperty("ruleStats") + @ExcludeMissing + ruleStats: JsonField = JsonMissing.of(), + ) : this( + id, + dateCreated, + dateUpdated, + enabled, + name, + tags, + workspaceId, + avatar, + builtInSlug, + creatorId, + description, + extendedDescription, + href, + immutable, + projectSelector, + ruleStats, + mutableMapOf(), + ) + + /** + * The framework id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun id(): String = id.getRequired("id") + + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** + * The last update date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** + * Whether the framework is active. Rules of a disabled framework are not evaluated and do + * not count towards compliance. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun enabled(): Boolean = enabled.getRequired("enabled") + + /** + * The framework name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun name(): String = name.getRequired("name") + + /** + * Free-form labels on the framework. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun tags(): List = tags.getRequired("tags") + + /** + * The id of the workspace the framework belongs to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun workspaceId(): String = workspaceId.getRequired("workspaceId") + + /** + * The icon shown for the framework. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun avatar(): Optional = avatar.getOptional("avatar") + + /** + * Identifies a framework that ships with Openlayer, for example `eu_ai_act`, `iso_42001`, + * `nist_ai_rmf`, or `traiga`. `null` for frameworks you create yourself. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun builtInSlug(): Optional = builtInSlug.getOptional("builtInSlug") + + /** + * The user who created the framework. `null` for built-in frameworks. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun creatorId(): Optional = creatorId.getOptional("creatorId") + + /** + * A short description of the framework. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun description(): Optional = description.getOptional("description") + + /** + * A longer, rich-text description, as a TipTap JSON document. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun extendedDescription(): Optional = + extendedDescription.getOptional("extendedDescription") + + /** + * A link to the external standard or regulation the framework is based on. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun href(): Optional = href.getOptional("href") + + /** + * Whether the framework definition is managed by Openlayer and cannot be edited. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun immutable(): Optional = immutable.getOptional("immutable") + + /** + * Determines which projects the framework applies to. An empty or `null` `match` array + * applies the framework to every project in the workspace. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun projectSelector(): Optional = + projectSelector.getOptional("projectSelector") + + /** + * Compliance roll-up for the framework. Present only on `GET + * /workspaces/{workspaceId}/frameworks` when the request sets `includeRuleStats=true`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun ruleStats(): Optional = ruleStats.getOptional("ruleStats") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** + * Returns the raw JSON value of [enabled]. + * + * Unlike [enabled], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("enabled") @ExcludeMissing fun _enabled(): JsonField = enabled + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [tags]. + * + * Unlike [tags], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("tags") @ExcludeMissing fun _tags(): JsonField> = tags + + /** + * Returns the raw JSON value of [workspaceId]. + * + * Unlike [workspaceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("workspaceId") + @ExcludeMissing + fun _workspaceId(): JsonField = workspaceId + + /** + * Returns the raw JSON value of [avatar]. + * + * Unlike [avatar], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("avatar") @ExcludeMissing fun _avatar(): JsonField = avatar + + /** + * Returns the raw JSON value of [builtInSlug]. + * + * Unlike [builtInSlug], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("builtInSlug") + @ExcludeMissing + fun _builtInSlug(): JsonField = builtInSlug + + /** + * Returns the raw JSON value of [creatorId]. + * + * Unlike [creatorId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("creatorId") @ExcludeMissing fun _creatorId(): JsonField = creatorId + + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("description") + @ExcludeMissing + fun _description(): JsonField = description + + /** + * Returns the raw JSON value of [extendedDescription]. + * + * Unlike [extendedDescription], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("extendedDescription") + @ExcludeMissing + fun _extendedDescription(): JsonField = extendedDescription + + /** + * Returns the raw JSON value of [href]. + * + * Unlike [href], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("href") @ExcludeMissing fun _href(): JsonField = href + + /** + * Returns the raw JSON value of [immutable]. + * + * Unlike [immutable], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("immutable") @ExcludeMissing fun _immutable(): JsonField = immutable + + /** + * Returns the raw JSON value of [projectSelector]. + * + * Unlike [projectSelector], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("projectSelector") + @ExcludeMissing + fun _projectSelector(): JsonField = projectSelector + + /** + * Returns the raw JSON value of [ruleStats]. + * + * Unlike [ruleStats], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("ruleStats") + @ExcludeMissing + fun _ruleStats(): JsonField = ruleStats + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Item]. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateUpdated() + * .enabled() + * .name() + * .tags() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Item]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var enabled: JsonField? = null + private var name: JsonField? = null + private var tags: JsonField>? = null + private var workspaceId: JsonField? = null + private var avatar: JsonField = JsonMissing.of() + private var builtInSlug: JsonField = JsonMissing.of() + private var creatorId: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var extendedDescription: JsonField = JsonMissing.of() + private var href: JsonField = JsonMissing.of() + private var immutable: JsonField = JsonMissing.of() + private var projectSelector: JsonField = JsonMissing.of() + private var ruleStats: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(item: Item) = apply { + id = item.id + dateCreated = item.dateCreated + dateUpdated = item.dateUpdated + enabled = item.enabled + name = item.name + tags = item.tags.map { it.toMutableList() } + workspaceId = item.workspaceId + avatar = item.avatar + builtInSlug = item.builtInSlug + creatorId = item.creatorId + description = item.description + extendedDescription = item.extendedDescription + href = item.href + immutable = item.immutable + projectSelector = item.projectSelector + ruleStats = item.ruleStats + additionalProperties = item.additionalProperties.toMutableMap() + } + + /** The framework id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The last update date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** + * Whether the framework is active. Rules of a disabled framework are not evaluated and + * do not count towards compliance. + */ + fun enabled(enabled: Boolean) = enabled(JsonField.of(enabled)) + + /** + * Sets [Builder.enabled] to an arbitrary JSON value. + * + * You should usually call [Builder.enabled] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun enabled(enabled: JsonField) = apply { this.enabled = enabled } + + /** The framework name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun name(name: JsonField) = apply { this.name = name } + + /** Free-form labels on the framework. */ + fun tags(tags: List) = tags(JsonField.of(tags)) + + /** + * Sets [Builder.tags] to an arbitrary JSON value. + * + * You should usually call [Builder.tags] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun tags(tags: JsonField>) = apply { + this.tags = tags.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [tags]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addTag(tag: String) = apply { + tags = + (tags ?: JsonField.of(mutableListOf())).also { checkKnown("tags", it).add(tag) } + } + + /** The id of the workspace the framework belongs to. */ + fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) + + /** + * Sets [Builder.workspaceId] to an arbitrary JSON value. + * + * You should usually call [Builder.workspaceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun workspaceId(workspaceId: JsonField) = apply { + this.workspaceId = workspaceId + } + + /** The icon shown for the framework. */ + fun avatar(avatar: Avatar?) = avatar(JsonField.ofNullable(avatar)) + + /** Alias for calling [Builder.avatar] with `avatar.orElse(null)`. */ + fun avatar(avatar: Optional) = avatar(avatar.getOrNull()) + + /** + * Sets [Builder.avatar] to an arbitrary JSON value. + * + * You should usually call [Builder.avatar] with a well-typed [Avatar] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun avatar(avatar: JsonField) = apply { this.avatar = avatar } + + /** + * Identifies a framework that ships with Openlayer, for example `eu_ai_act`, + * `iso_42001`, `nist_ai_rmf`, or `traiga`. `null` for frameworks you create yourself. + */ + fun builtInSlug(builtInSlug: String?) = builtInSlug(JsonField.ofNullable(builtInSlug)) + + /** Alias for calling [Builder.builtInSlug] with `builtInSlug.orElse(null)`. */ + fun builtInSlug(builtInSlug: Optional) = builtInSlug(builtInSlug.getOrNull()) + + /** + * Sets [Builder.builtInSlug] to an arbitrary JSON value. + * + * You should usually call [Builder.builtInSlug] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun builtInSlug(builtInSlug: JsonField) = apply { + this.builtInSlug = builtInSlug + } + + /** The user who created the framework. `null` for built-in frameworks. */ + fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) + + /** Alias for calling [Builder.creatorId] with `creatorId.orElse(null)`. */ + fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) + + /** + * Sets [Builder.creatorId] to an arbitrary JSON value. + * + * You should usually call [Builder.creatorId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } + + /** A short description of the framework. */ + fun description(description: String?) = description(JsonField.ofNullable(description)) + + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ + fun description(description: Optional) = description(description.getOrNull()) + + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun description(description: JsonField) = apply { + this.description = description + } + + /** A longer, rich-text description, as a TipTap JSON document. */ + fun extendedDescription(extendedDescription: ExtendedDescription?) = + extendedDescription(JsonField.ofNullable(extendedDescription)) + + /** + * Alias for calling [Builder.extendedDescription] with + * `extendedDescription.orElse(null)`. + */ + fun extendedDescription(extendedDescription: Optional) = + extendedDescription(extendedDescription.getOrNull()) + + /** + * Sets [Builder.extendedDescription] to an arbitrary JSON value. + * + * You should usually call [Builder.extendedDescription] with a well-typed + * [ExtendedDescription] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ + fun extendedDescription(extendedDescription: JsonField) = apply { + this.extendedDescription = extendedDescription + } + + /** A link to the external standard or regulation the framework is based on. */ + fun href(href: String?) = href(JsonField.ofNullable(href)) + + /** Alias for calling [Builder.href] with `href.orElse(null)`. */ + fun href(href: Optional) = href(href.getOrNull()) + + /** + * Sets [Builder.href] to an arbitrary JSON value. + * + * You should usually call [Builder.href] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun href(href: JsonField) = apply { this.href = href } + + /** Whether the framework definition is managed by Openlayer and cannot be edited. */ + fun immutable(immutable: Boolean) = immutable(JsonField.of(immutable)) + + /** + * Sets [Builder.immutable] to an arbitrary JSON value. + * + * You should usually call [Builder.immutable] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun immutable(immutable: JsonField) = apply { this.immutable = immutable } + + /** + * Determines which projects the framework applies to. An empty or `null` `match` array + * applies the framework to every project in the workspace. + */ + fun projectSelector(projectSelector: ProjectSelector?) = + projectSelector(JsonField.ofNullable(projectSelector)) + + /** Alias for calling [Builder.projectSelector] with `projectSelector.orElse(null)`. */ + fun projectSelector(projectSelector: Optional) = + projectSelector(projectSelector.getOrNull()) + + /** + * Sets [Builder.projectSelector] to an arbitrary JSON value. + * + * You should usually call [Builder.projectSelector] with a well-typed [ProjectSelector] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun projectSelector(projectSelector: JsonField) = apply { + this.projectSelector = projectSelector + } + + /** + * Compliance roll-up for the framework. Present only on `GET + * /workspaces/{workspaceId}/frameworks` when the request sets `includeRuleStats=true`. + */ + fun ruleStats(ruleStats: RuleStats) = ruleStats(JsonField.of(ruleStats)) + + /** + * Sets [Builder.ruleStats] to an arbitrary JSON value. + * + * You should usually call [Builder.ruleStats] with a well-typed [RuleStats] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun ruleStats(ruleStats: JsonField) = apply { this.ruleStats = ruleStats } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Item]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateUpdated() + * .enabled() + * .name() + * .tags() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Item = + Item( + checkRequired("id", id), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("enabled", enabled), + checkRequired("name", name), + checkRequired("tags", tags).map { it.toImmutable() }, + checkRequired("workspaceId", workspaceId), + avatar, + builtInSlug, + creatorId, + description, + extendedDescription, + href, + immutable, + projectSelector, + ruleStats, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Item = apply { + if (validated) { + return@apply + } + + id() + dateCreated() + dateUpdated() + enabled() + name() + tags() + workspaceId() + avatar().ifPresent { it.validate() } + builtInSlug() + creatorId() + description() + extendedDescription().ifPresent { it.validate() } + href() + immutable() + projectSelector().ifPresent { it.validate() } + ruleStats().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (enabled.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (tags.asKnown().getOrNull()?.size ?: 0) + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + (avatar.asKnown().getOrNull()?.validity() ?: 0) + + (if (builtInSlug.asKnown().isPresent) 1 else 0) + + (if (creatorId.asKnown().isPresent) 1 else 0) + + (if (description.asKnown().isPresent) 1 else 0) + + (extendedDescription.asKnown().getOrNull()?.validity() ?: 0) + + (if (href.asKnown().isPresent) 1 else 0) + + (if (immutable.asKnown().isPresent) 1 else 0) + + (projectSelector.asKnown().getOrNull()?.validity() ?: 0) + + (ruleStats.asKnown().getOrNull()?.validity() ?: 0) + + /** The icon shown for the framework. */ + class Avatar + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val type: JsonField, + private val value: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("value") @ExcludeMissing value: JsonField = JsonMissing.of(), + ) : this(type, value, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun type(): Type = type.getRequired("type") + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun value(): String = value.getRequired("value") + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + /** + * Returns the raw JSON value of [value]. + * + * Unlike [value], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Avatar]. + * + * The following fields are required: + * ```java + * .type() + * .value() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Avatar]. */ + class Builder internal constructor() { + + private var type: JsonField? = null + private var value: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(avatar: Avatar) = apply { + type = avatar.type + value = avatar.value + additionalProperties = avatar.additionalProperties.toMutableMap() + } + + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun type(type: JsonField) = apply { this.type = type } + + fun value(value: String) = value(JsonField.of(value)) + + /** + * Sets [Builder.value] to an arbitrary JSON value. + * + * You should usually call [Builder.value] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun value(value: JsonField) = apply { this.value = value } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Avatar]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .type() + * .value() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Avatar = + Avatar( + checkRequired("type", type), + checkRequired("value", value), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Avatar = apply { + if (validated) { + return@apply + } + + type().validate() + value() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (type.asKnown().getOrNull()?.validity() ?: 0) + + (if (value.asKnown().isPresent) 1 else 0) + + class Type @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val EMOJI = of("emoji") + + @JvmField val IMAGE_URL = of("imageUrl") + + @JvmField val BUILTIN_IMAGE = of("builtinImage") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + EMOJI, + IMAGE_URL, + BUILTIN_IMAGE, + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + EMOJI, + IMAGE_URL, + BUILTIN_IMAGE, + /** + * An enum member indicating that [Type] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + EMOJI -> Value.EMOJI + IMAGE_URL -> Value.IMAGE_URL + BUILTIN_IMAGE -> Value.BUILTIN_IMAGE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + EMOJI -> Known.EMOJI + IMAGE_URL -> Known.IMAGE_URL + BUILTIN_IMAGE -> Known.BUILTIN_IMAGE + else -> throw OpenlayerInvalidDataException("Unknown Type: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Avatar && + type == other.type && + value == other.value && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(type, value, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Avatar{type=$type, value=$value, additionalProperties=$additionalProperties}" + } + + /** A longer, rich-text description, as a TipTap JSON document. */ + class ExtendedDescription + @JsonCreator + private constructor( + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [ExtendedDescription]. + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ExtendedDescription]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(extendedDescription: ExtendedDescription) = apply { + additionalProperties = extendedDescription.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ExtendedDescription]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): ExtendedDescription = + ExtendedDescription(additionalProperties.toImmutable()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): ExtendedDescription = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ExtendedDescription && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ExtendedDescription{additionalProperties=$additionalProperties}" + } + + /** + * Determines which projects the framework applies to. An empty or `null` `match` array + * applies the framework to every project in the workspace. + */ + class ProjectSelector + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val match: JsonField>, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("match") + @ExcludeMissing + match: JsonField> = JsonMissing.of() + ) : this(match, mutableMapOf()) + + /** + * Match criteria, ANDed together. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun match(): Optional> = match.getOptional("match") + + /** + * Returns the raw JSON value of [match]. + * + * Unlike [match], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("match") @ExcludeMissing fun _match(): JsonField> = match + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [ProjectSelector]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ProjectSelector]. */ + class Builder internal constructor() { + + private var match: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(projectSelector: ProjectSelector) = apply { + match = projectSelector.match.map { it.toMutableList() } + additionalProperties = projectSelector.additionalProperties.toMutableMap() + } + + /** Match criteria, ANDed together. */ + fun match(match: List?) = match(JsonField.ofNullable(match)) + + /** Alias for calling [Builder.match] with `match.orElse(null)`. */ + fun match(match: Optional>) = match(match.getOrNull()) + + /** + * Sets [Builder.match] to an arbitrary JSON value. + * + * You should usually call [Builder.match] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun match(match: JsonField>) = apply { + this.match = match.map { it.toMutableList() } + } + + /** + * Adds a single [Match] to [Builder.match]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addMatch(match: Match) = apply { + this.match = + (this.match ?: JsonField.of(mutableListOf())).also { + checkKnown("match", it).add(match) + } + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ProjectSelector]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): ProjectSelector = + ProjectSelector( + (match ?: JsonMissing.of()).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): ProjectSelector = apply { + if (validated) { + return@apply + } + + match().ifPresent { it.forEach { it.validate() } } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (match.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + class Match + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val property: JsonField, + private val value: JsonValue, + private val operator: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("property") + @ExcludeMissing + property: JsonField = JsonMissing.of(), + @JsonProperty("value") @ExcludeMissing value: JsonValue = JsonMissing.of(), + @JsonProperty("operator") + @ExcludeMissing + operator: JsonField = JsonMissing.of(), + ) : this(property, value, operator, mutableMapOf()) + + /** + * The project property to match against. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun property(): Property = property.getRequired("property") + + /** + * The value to match against. Pass an array to match any of several values, or + * `null` to match projects where the property is unset. Omit it for `exists` and + * `notExists`. + * + * This arbitrary value can be deserialized into a custom type using the `convert` + * method: + * ```java + * MyClass myObject = match.value().convert(MyClass.class); + * ``` + */ + @JsonProperty("value") @ExcludeMissing fun _value(): JsonValue = value + + /** + * How to compare the project property with `value`. One of `equals`, `notEquals`, + * `contains`, `notContains`, `startsWith`, `endsWith`, `in`, `notIn`, + * `greaterThan`, `greaterThanOrEqual`, `lessThan`, `lessThanOrEqual`, + * `equalsIgnoreCase`, `containsIgnoreCase`, `matches`, `exists`, or `notExists`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun operator(): Optional = operator.getOptional("operator") + + /** + * Returns the raw JSON value of [property]. + * + * Unlike [property], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("property") + @ExcludeMissing + fun _property(): JsonField = property + + /** + * Returns the raw JSON value of [operator]. + * + * Unlike [operator], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("operator") + @ExcludeMissing + fun _operator(): JsonField = operator + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Match]. + * + * The following fields are required: + * ```java + * .property() + * .value() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Match]. */ + class Builder internal constructor() { + + private var property: JsonField? = null + private var value: JsonValue? = null + private var operator: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(match: Match) = apply { + property = match.property + value = match.value + operator = match.operator + additionalProperties = match.additionalProperties.toMutableMap() + } + + /** The project property to match against. */ + fun property(property: Property) = property(JsonField.of(property)) + + /** + * Sets [Builder.property] to an arbitrary JSON value. + * + * You should usually call [Builder.property] with a well-typed [Property] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun property(property: JsonField) = apply { this.property = property } + + /** + * The value to match against. Pass an array to match any of several values, or + * `null` to match projects where the property is unset. Omit it for `exists` + * and `notExists`. + */ + fun value(value: JsonValue) = apply { this.value = value } + + /** + * How to compare the project property with `value`. One of `equals`, + * `notEquals`, `contains`, `notContains`, `startsWith`, `endsWith`, `in`, + * `notIn`, `greaterThan`, `greaterThanOrEqual`, `lessThan`, `lessThanOrEqual`, + * `equalsIgnoreCase`, `containsIgnoreCase`, `matches`, `exists`, or + * `notExists`. + */ + fun operator(operator: String) = operator(JsonField.of(operator)) + + /** + * Sets [Builder.operator] to an arbitrary JSON value. + * + * You should usually call [Builder.operator] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun operator(operator: JsonField) = apply { this.operator = operator } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Match]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .property() + * .value() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Match = + Match( + checkRequired("property", property), + checkRequired("value", value), + operator, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): Match = apply { + if (validated) { + return@apply + } + + property().validate() + operator() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (property.asKnown().getOrNull()?.validity() ?: 0) + + (if (operator.asKnown().isPresent) 1 else 0) + + /** The project property to match against. */ + class Property + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val TASK_TYPE = of("taskType") + + @JvmField val RISK_LEVEL = of("riskLevel") + + @JvmField val RISK_TOTAL_SCORE = of("riskTotalScore") + + @JvmField val NAME = of("name") + + @JvmField val OWNER_ID = of("ownerId") + + @JvmField val MODEL_TYPES = of("modelTypes") + + @JvmStatic fun of(value: String) = Property(JsonField.of(value)) + } + + /** An enum containing [Property]'s known values. */ + enum class Known { + TASK_TYPE, + RISK_LEVEL, + RISK_TOTAL_SCORE, + NAME, + OWNER_ID, + MODEL_TYPES, + } + + /** + * An enum containing [Property]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [Property] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + TASK_TYPE, + RISK_LEVEL, + RISK_TOTAL_SCORE, + NAME, + OWNER_ID, + MODEL_TYPES, + /** + * An enum member indicating that [Property] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + TASK_TYPE -> Value.TASK_TYPE + RISK_LEVEL -> Value.RISK_LEVEL + RISK_TOTAL_SCORE -> Value.RISK_TOTAL_SCORE + NAME -> Value.NAME + OWNER_ID -> Value.OWNER_ID + MODEL_TYPES -> Value.MODEL_TYPES + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + TASK_TYPE -> Known.TASK_TYPE + RISK_LEVEL -> Known.RISK_LEVEL + RISK_TOTAL_SCORE -> Known.RISK_TOTAL_SCORE + NAME -> Known.NAME + OWNER_ID -> Known.OWNER_ID + MODEL_TYPES -> Known.MODEL_TYPES + else -> throw OpenlayerInvalidDataException("Unknown Property: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object + * doesn't match its expected type. + */ + fun validate(): Property = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Property && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Match && + property == other.property && + value == other.value && + operator == other.operator && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(property, value, operator, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Match{property=$property, value=$value, operator=$operator, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ProjectSelector && + match == other.match && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(match, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ProjectSelector{match=$match, additionalProperties=$additionalProperties}" + } + + /** + * Compliance roll-up for the framework. Present only on `GET + * /workspaces/{workspaceId}/frameworks` when the request sets `includeRuleStats=true`. + */ + class RuleStats + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val projectCompletion: JsonField, + private val ruleResults: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("projectCompletion") + @ExcludeMissing + projectCompletion: JsonField = JsonMissing.of(), + @JsonProperty("ruleResults") + @ExcludeMissing + ruleResults: JsonField = JsonMissing.of(), + ) : this(projectCompletion, ruleResults, mutableMapOf()) + + /** + * How many of the framework's projects fall into each completion band, where a + * project's completion is the share of its rule results that are passing or skipped. + * Projects with no evaluated results count as `low`. + * + * Zeroed when the request carries `projectId`: the bands compare a framework's projects + * against each other, which says nothing about a single project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun projectCompletion(): ProjectCompletion = + projectCompletion.getRequired("projectCompletion") + + /** + * Rule result counts by status for this framework, matching what + * `/workspaces/{workspaceId}/rule-stats?frameworkId=` reports. Narrowed to a single + * project when the request also carries `projectId`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun ruleResults(): RuleResults = ruleResults.getRequired("ruleResults") + + /** + * Returns the raw JSON value of [projectCompletion]. + * + * Unlike [projectCompletion], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("projectCompletion") + @ExcludeMissing + fun _projectCompletion(): JsonField = projectCompletion + + /** + * Returns the raw JSON value of [ruleResults]. + * + * Unlike [ruleResults], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("ruleResults") + @ExcludeMissing + fun _ruleResults(): JsonField = ruleResults + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [RuleStats]. + * + * The following fields are required: + * ```java + * .projectCompletion() + * .ruleResults() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [RuleStats]. */ + class Builder internal constructor() { + + private var projectCompletion: JsonField? = null + private var ruleResults: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(ruleStats: RuleStats) = apply { + projectCompletion = ruleStats.projectCompletion + ruleResults = ruleStats.ruleResults + additionalProperties = ruleStats.additionalProperties.toMutableMap() + } + + /** + * How many of the framework's projects fall into each completion band, where a + * project's completion is the share of its rule results that are passing or + * skipped. Projects with no evaluated results count as `low`. + * + * Zeroed when the request carries `projectId`: the bands compare a framework's + * projects against each other, which says nothing about a single project. + */ + fun projectCompletion(projectCompletion: ProjectCompletion) = + projectCompletion(JsonField.of(projectCompletion)) + + /** + * Sets [Builder.projectCompletion] to an arbitrary JSON value. + * + * You should usually call [Builder.projectCompletion] with a well-typed + * [ProjectCompletion] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ + fun projectCompletion(projectCompletion: JsonField) = apply { + this.projectCompletion = projectCompletion + } + + /** + * Rule result counts by status for this framework, matching what + * `/workspaces/{workspaceId}/rule-stats?frameworkId=` reports. Narrowed to a + * single project when the request also carries `projectId`. + */ + fun ruleResults(ruleResults: RuleResults) = ruleResults(JsonField.of(ruleResults)) + + /** + * Sets [Builder.ruleResults] to an arbitrary JSON value. + * + * You should usually call [Builder.ruleResults] with a well-typed [RuleResults] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun ruleResults(ruleResults: JsonField) = apply { + this.ruleResults = ruleResults + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [RuleStats]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .projectCompletion() + * .ruleResults() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): RuleStats = + RuleStats( + checkRequired("projectCompletion", projectCompletion), + checkRequired("ruleResults", ruleResults), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): RuleStats = apply { + if (validated) { + return@apply + } + + projectCompletion().validate() + ruleResults().validate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (projectCompletion.asKnown().getOrNull()?.validity() ?: 0) + + (ruleResults.asKnown().getOrNull()?.validity() ?: 0) + + /** + * How many of the framework's projects fall into each completion band, where a + * project's completion is the share of its rule results that are passing or skipped. + * Projects with no evaluated results count as `low`. + * + * Zeroed when the request carries `projectId`: the bands compare a framework's projects + * against each other, which says nothing about a single project. + */ + class ProjectCompletion + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val high: JsonField, + private val low: JsonField, + private val mid: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("high") @ExcludeMissing high: JsonField = JsonMissing.of(), + @JsonProperty("low") @ExcludeMissing low: JsonField = JsonMissing.of(), + @JsonProperty("mid") @ExcludeMissing mid: JsonField = JsonMissing.of(), + ) : this(high, low, mid, mutableMapOf()) + + /** + * Projects at 80% completion or above. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun high(): Long = high.getRequired("high") + + /** + * Projects below 20% completion. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun low(): Long = low.getRequired("low") + + /** + * Projects at or above 20% but below 80% completion. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun mid(): Long = mid.getRequired("mid") + + /** + * Returns the raw JSON value of [high]. + * + * Unlike [high], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("high") @ExcludeMissing fun _high(): JsonField = high + + /** + * Returns the raw JSON value of [low]. + * + * Unlike [low], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("low") @ExcludeMissing fun _low(): JsonField = low + + /** + * Returns the raw JSON value of [mid]. + * + * Unlike [mid], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("mid") @ExcludeMissing fun _mid(): JsonField = mid + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [ProjectCompletion]. + * + * The following fields are required: + * ```java + * .high() + * .low() + * .mid() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ProjectCompletion]. */ + class Builder internal constructor() { + + private var high: JsonField? = null + private var low: JsonField? = null + private var mid: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(projectCompletion: ProjectCompletion) = apply { + high = projectCompletion.high + low = projectCompletion.low + mid = projectCompletion.mid + additionalProperties = projectCompletion.additionalProperties.toMutableMap() + } + + /** Projects at 80% completion or above. */ + fun high(high: Long) = high(JsonField.of(high)) + + /** + * Sets [Builder.high] to an arbitrary JSON value. + * + * You should usually call [Builder.high] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun high(high: JsonField) = apply { this.high = high } + + /** Projects below 20% completion. */ + fun low(low: Long) = low(JsonField.of(low)) + + /** + * Sets [Builder.low] to an arbitrary JSON value. + * + * You should usually call [Builder.low] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun low(low: JsonField) = apply { this.low = low } + + /** Projects at or above 20% but below 80% completion. */ + fun mid(mid: Long) = mid(JsonField.of(mid)) + + /** + * Sets [Builder.mid] to an arbitrary JSON value. + * + * You should usually call [Builder.mid] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun mid(mid: JsonField) = apply { this.mid = mid } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ProjectCompletion]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .high() + * .low() + * .mid() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): ProjectCompletion = + ProjectCompletion( + checkRequired("high", high), + checkRequired("low", low), + checkRequired("mid", mid), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): ProjectCompletion = apply { + if (validated) { + return@apply + } + + high() + low() + mid() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (high.asKnown().isPresent) 1 else 0) + + (if (low.asKnown().isPresent) 1 else 0) + + (if (mid.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ProjectCompletion && + high == other.high && + low == other.low && + mid == other.mid && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(high, low, mid, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ProjectCompletion{high=$high, low=$low, mid=$mid, additionalProperties=$additionalProperties}" + } + + /** + * Rule result counts by status for this framework, matching what + * `/workspaces/{workspaceId}/rule-stats?frameworkId=` reports. Narrowed to a single + * project when the request also carries `projectId`. + */ + class RuleResults + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val total: JsonField, + private val totalDueSoon: JsonField, + private val totalError: JsonField, + private val totalFailing: JsonField, + private val totalPassing: JsonField, + private val totalPending: JsonField, + private val totalRunning: JsonField, + private val totalSkipped: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("total") + @ExcludeMissing + total: JsonField = JsonMissing.of(), + @JsonProperty("totalDueSoon") + @ExcludeMissing + totalDueSoon: JsonField = JsonMissing.of(), + @JsonProperty("totalError") + @ExcludeMissing + totalError: JsonField = JsonMissing.of(), + @JsonProperty("totalFailing") + @ExcludeMissing + totalFailing: JsonField = JsonMissing.of(), + @JsonProperty("totalPassing") + @ExcludeMissing + totalPassing: JsonField = JsonMissing.of(), + @JsonProperty("totalPending") + @ExcludeMissing + totalPending: JsonField = JsonMissing.of(), + @JsonProperty("totalRunning") + @ExcludeMissing + totalRunning: JsonField = JsonMissing.of(), + @JsonProperty("totalSkipped") + @ExcludeMissing + totalSkipped: JsonField = JsonMissing.of(), + ) : this( + total, + totalDueSoon, + totalError, + totalFailing, + totalPassing, + totalPending, + totalRunning, + totalSkipped, + mutableMapOf(), + ) + + /** + * The total number of rule results. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun total(): Long = total.getRequired("total") + + /** + * The number of rule results whose evidence is about to expire. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalDueSoon(): Long = totalDueSoon.getRequired("totalDueSoon") + + /** + * The number of rule results that errored during evaluation. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalError(): Long = totalError.getRequired("totalError") + + /** + * The number of failing rule results. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalFailing(): Long = totalFailing.getRequired("totalFailing") + + /** + * The number of passing rule results. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalPassing(): Long = totalPassing.getRequired("totalPassing") + + /** + * The number of rule results that have not been satisfied yet. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalPending(): Long = totalPending.getRequired("totalPending") + + /** + * The number of rule results currently being evaluated. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalRunning(): Long = totalRunning.getRequired("totalRunning") + + /** + * The number of skipped rule results. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalSkipped(): Long = totalSkipped.getRequired("totalSkipped") + + /** + * Returns the raw JSON value of [total]. + * + * Unlike [total], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("total") @ExcludeMissing fun _total(): JsonField = total + + /** + * Returns the raw JSON value of [totalDueSoon]. + * + * Unlike [totalDueSoon], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalDueSoon") + @ExcludeMissing + fun _totalDueSoon(): JsonField = totalDueSoon + + /** + * Returns the raw JSON value of [totalError]. + * + * Unlike [totalError], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalError") + @ExcludeMissing + fun _totalError(): JsonField = totalError + + /** + * Returns the raw JSON value of [totalFailing]. + * + * Unlike [totalFailing], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalFailing") + @ExcludeMissing + fun _totalFailing(): JsonField = totalFailing + + /** + * Returns the raw JSON value of [totalPassing]. + * + * Unlike [totalPassing], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalPassing") + @ExcludeMissing + fun _totalPassing(): JsonField = totalPassing + + /** + * Returns the raw JSON value of [totalPending]. + * + * Unlike [totalPending], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalPending") + @ExcludeMissing + fun _totalPending(): JsonField = totalPending + + /** + * Returns the raw JSON value of [totalRunning]. + * + * Unlike [totalRunning], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalRunning") + @ExcludeMissing + fun _totalRunning(): JsonField = totalRunning + + /** + * Returns the raw JSON value of [totalSkipped]. + * + * Unlike [totalSkipped], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalSkipped") + @ExcludeMissing + fun _totalSkipped(): JsonField = totalSkipped + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [RuleResults]. + * + * The following fields are required: + * ```java + * .total() + * .totalDueSoon() + * .totalError() + * .totalFailing() + * .totalPassing() + * .totalPending() + * .totalRunning() + * .totalSkipped() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [RuleResults]. */ + class Builder internal constructor() { + + private var total: JsonField? = null + private var totalDueSoon: JsonField? = null + private var totalError: JsonField? = null + private var totalFailing: JsonField? = null + private var totalPassing: JsonField? = null + private var totalPending: JsonField? = null + private var totalRunning: JsonField? = null + private var totalSkipped: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(ruleResults: RuleResults) = apply { + total = ruleResults.total + totalDueSoon = ruleResults.totalDueSoon + totalError = ruleResults.totalError + totalFailing = ruleResults.totalFailing + totalPassing = ruleResults.totalPassing + totalPending = ruleResults.totalPending + totalRunning = ruleResults.totalRunning + totalSkipped = ruleResults.totalSkipped + additionalProperties = ruleResults.additionalProperties.toMutableMap() + } + + /** The total number of rule results. */ + fun total(total: Long) = total(JsonField.of(total)) + + /** + * Sets [Builder.total] to an arbitrary JSON value. + * + * You should usually call [Builder.total] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun total(total: JsonField) = apply { this.total = total } + + /** The number of rule results whose evidence is about to expire. */ + fun totalDueSoon(totalDueSoon: Long) = totalDueSoon(JsonField.of(totalDueSoon)) + + /** + * Sets [Builder.totalDueSoon] to an arbitrary JSON value. + * + * You should usually call [Builder.totalDueSoon] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalDueSoon(totalDueSoon: JsonField) = apply { + this.totalDueSoon = totalDueSoon + } + + /** The number of rule results that errored during evaluation. */ + fun totalError(totalError: Long) = totalError(JsonField.of(totalError)) + + /** + * Sets [Builder.totalError] to an arbitrary JSON value. + * + * You should usually call [Builder.totalError] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalError(totalError: JsonField) = apply { + this.totalError = totalError + } + + /** The number of failing rule results. */ + fun totalFailing(totalFailing: Long) = totalFailing(JsonField.of(totalFailing)) + + /** + * Sets [Builder.totalFailing] to an arbitrary JSON value. + * + * You should usually call [Builder.totalFailing] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalFailing(totalFailing: JsonField) = apply { + this.totalFailing = totalFailing + } + + /** The number of passing rule results. */ + fun totalPassing(totalPassing: Long) = totalPassing(JsonField.of(totalPassing)) + + /** + * Sets [Builder.totalPassing] to an arbitrary JSON value. + * + * You should usually call [Builder.totalPassing] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalPassing(totalPassing: JsonField) = apply { + this.totalPassing = totalPassing + } + + /** The number of rule results that have not been satisfied yet. */ + fun totalPending(totalPending: Long) = totalPending(JsonField.of(totalPending)) + + /** + * Sets [Builder.totalPending] to an arbitrary JSON value. + * + * You should usually call [Builder.totalPending] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalPending(totalPending: JsonField) = apply { + this.totalPending = totalPending + } + + /** The number of rule results currently being evaluated. */ + fun totalRunning(totalRunning: Long) = totalRunning(JsonField.of(totalRunning)) + + /** + * Sets [Builder.totalRunning] to an arbitrary JSON value. + * + * You should usually call [Builder.totalRunning] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalRunning(totalRunning: JsonField) = apply { + this.totalRunning = totalRunning + } + + /** The number of skipped rule results. */ + fun totalSkipped(totalSkipped: Long) = totalSkipped(JsonField.of(totalSkipped)) + + /** + * Sets [Builder.totalSkipped] to an arbitrary JSON value. + * + * You should usually call [Builder.totalSkipped] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalSkipped(totalSkipped: JsonField) = apply { + this.totalSkipped = totalSkipped + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [RuleResults]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .total() + * .totalDueSoon() + * .totalError() + * .totalFailing() + * .totalPassing() + * .totalPending() + * .totalRunning() + * .totalSkipped() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): RuleResults = + RuleResults( + checkRequired("total", total), + checkRequired("totalDueSoon", totalDueSoon), + checkRequired("totalError", totalError), + checkRequired("totalFailing", totalFailing), + checkRequired("totalPassing", totalPassing), + checkRequired("totalPending", totalPending), + checkRequired("totalRunning", totalRunning), + checkRequired("totalSkipped", totalSkipped), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): RuleResults = apply { + if (validated) { + return@apply + } + + total() + totalDueSoon() + totalError() + totalFailing() + totalPassing() + totalPending() + totalRunning() + totalSkipped() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (total.asKnown().isPresent) 1 else 0) + + (if (totalDueSoon.asKnown().isPresent) 1 else 0) + + (if (totalError.asKnown().isPresent) 1 else 0) + + (if (totalFailing.asKnown().isPresent) 1 else 0) + + (if (totalPassing.asKnown().isPresent) 1 else 0) + + (if (totalPending.asKnown().isPresent) 1 else 0) + + (if (totalRunning.asKnown().isPresent) 1 else 0) + + (if (totalSkipped.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is RuleResults && + total == other.total && + totalDueSoon == other.totalDueSoon && + totalError == other.totalError && + totalFailing == other.totalFailing && + totalPassing == other.totalPassing && + totalPending == other.totalPending && + totalRunning == other.totalRunning && + totalSkipped == other.totalSkipped && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + total, + totalDueSoon, + totalError, + totalFailing, + totalPassing, + totalPending, + totalRunning, + totalSkipped, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "RuleResults{total=$total, totalDueSoon=$totalDueSoon, totalError=$totalError, totalFailing=$totalFailing, totalPassing=$totalPassing, totalPending=$totalPending, totalRunning=$totalRunning, totalSkipped=$totalSkipped, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is RuleStats && + projectCompletion == other.projectCompletion && + ruleResults == other.ruleResults && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(projectCompletion, ruleResults, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "RuleStats{projectCompletion=$projectCompletion, ruleResults=$ruleResults, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Item && + id == other.id && + dateCreated == other.dateCreated && + dateUpdated == other.dateUpdated && + enabled == other.enabled && + name == other.name && + tags == other.tags && + workspaceId == other.workspaceId && + avatar == other.avatar && + builtInSlug == other.builtInSlug && + creatorId == other.creatorId && + description == other.description && + extendedDescription == other.extendedDescription && + href == other.href && + immutable == other.immutable && + projectSelector == other.projectSelector && + ruleStats == other.ruleStats && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + dateCreated, + dateUpdated, + enabled, + name, + tags, + workspaceId, + avatar, + builtInSlug, + creatorId, + description, + extendedDescription, + href, + immutable, + projectSelector, + ruleStats, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Item{id=$id, dateCreated=$dateCreated, dateUpdated=$dateUpdated, enabled=$enabled, name=$name, tags=$tags, workspaceId=$workspaceId, avatar=$avatar, builtInSlug=$builtInSlug, creatorId=$creatorId, description=$description, extendedDescription=$extendedDescription, href=$href, immutable=$immutable, projectSelector=$projectSelector, ruleStats=$ruleStats, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is FrameworkListResponse && + items == other.items && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(items, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "FrameworkListResponse{items=$items, additionalProperties=$additionalProperties}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListRulesParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListRulesParams.kt new file mode 100644 index 00000000..71d0acfe --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListRulesParams.kt @@ -0,0 +1,249 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.frameworks + +import com.openlayer.api.core.Params +import com.openlayer.api.core.http.Headers +import com.openlayer.api.core.http.QueryParams +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * List the rules that belong to a framework. + * + * To read the compliance status of these rules, use + * [List rule results](/api-reference/rest/governance/list-rule-results) with the `frameworkId` + * filter, or fetch the results of an individual rule. + */ +class FrameworkListRulesParams +private constructor( + private val frameworkId: String?, + private val page: Long?, + private val perPage: Long?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun frameworkId(): Optional = Optional.ofNullable(frameworkId) + + /** The page to return in a paginated query. */ + fun page(): Optional = Optional.ofNullable(page) + + /** Maximum number of items to return per page. */ + fun perPage(): Optional = Optional.ofNullable(perPage) + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): FrameworkListRulesParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [FrameworkListRulesParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [FrameworkListRulesParams]. */ + class Builder internal constructor() { + + private var frameworkId: String? = null + private var page: Long? = null + private var perPage: Long? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(frameworkListRulesParams: FrameworkListRulesParams) = apply { + frameworkId = frameworkListRulesParams.frameworkId + page = frameworkListRulesParams.page + perPage = frameworkListRulesParams.perPage + additionalHeaders = frameworkListRulesParams.additionalHeaders.toBuilder() + additionalQueryParams = frameworkListRulesParams.additionalQueryParams.toBuilder() + } + + fun frameworkId(frameworkId: String?) = apply { this.frameworkId = frameworkId } + + /** Alias for calling [Builder.frameworkId] with `frameworkId.orElse(null)`. */ + fun frameworkId(frameworkId: Optional) = frameworkId(frameworkId.getOrNull()) + + /** The page to return in a paginated query. */ + fun page(page: Long?) = apply { this.page = page } + + /** + * Alias for [Builder.page]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun page(page: Long) = page(page as Long?) + + /** Alias for calling [Builder.page] with `page.orElse(null)`. */ + fun page(page: Optional) = page(page.getOrNull()) + + /** Maximum number of items to return per page. */ + fun perPage(perPage: Long?) = apply { this.perPage = perPage } + + /** + * Alias for [Builder.perPage]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun perPage(perPage: Long) = perPage(perPage as Long?) + + /** Alias for calling [Builder.perPage] with `perPage.orElse(null)`. */ + fun perPage(perPage: Optional) = perPage(perPage.getOrNull()) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [FrameworkListRulesParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): FrameworkListRulesParams = + FrameworkListRulesParams( + frameworkId, + page, + perPage, + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _pathParam(index: Int): String = + when (index) { + 0 -> frameworkId ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + page?.let { put("page", it.toString()) } + perPage?.let { put("perPage", it.toString()) } + putAll(additionalQueryParams) + } + .build() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is FrameworkListRulesParams && + frameworkId == other.frameworkId && + page == other.page && + perPage == other.perPage && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = + Objects.hash(frameworkId, page, perPage, additionalHeaders, additionalQueryParams) + + override fun toString() = + "FrameworkListRulesParams{frameworkId=$frameworkId, page=$page, perPage=$perPage, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListRulesResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListRulesResponse.kt new file mode 100644 index 00000000..9e35d949 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListRulesResponse.kt @@ -0,0 +1,5145 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.frameworks + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.openlayer.api.core.Enum +import com.openlayer.api.core.ExcludeMissing +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonMissing +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.checkKnown +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.toImmutable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.time.OffsetDateTime +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class FrameworkListRulesResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val items: JsonField>, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("items") @ExcludeMissing items: JsonField> = JsonMissing.of() + ) : this(items, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun items(): List = items.getRequired("items") + + /** + * Returns the raw JSON value of [items]. + * + * Unlike [items], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("items") @ExcludeMissing fun _items(): JsonField> = items + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [FrameworkListRulesResponse]. + * + * The following fields are required: + * ```java + * .items() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [FrameworkListRulesResponse]. */ + class Builder internal constructor() { + + private var items: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(frameworkListRulesResponse: FrameworkListRulesResponse) = apply { + items = frameworkListRulesResponse.items.map { it.toMutableList() } + additionalProperties = frameworkListRulesResponse.additionalProperties.toMutableMap() + } + + fun items(items: List) = items(JsonField.of(items)) + + /** + * Sets [Builder.items] to an arbitrary JSON value. + * + * You should usually call [Builder.items] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun items(items: JsonField>) = apply { + this.items = items.map { it.toMutableList() } + } + + /** + * Adds a single [Item] to [items]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addItem(item: Item) = apply { + items = + (items ?: JsonField.of(mutableListOf())).also { checkKnown("items", it).add(item) } + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [FrameworkListRulesResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .items() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): FrameworkListRulesResponse = + FrameworkListRulesResponse( + checkRequired("items", items).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): FrameworkListRulesResponse = apply { + if (validated) { + return@apply + } + + items().forEach { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (items.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + class Item + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val name: JsonField, + private val scope: JsonField, + private val type: JsonField, + private val workspaceId: JsonField, + private val assigneeId: JsonField, + private val automationParams: JsonField, + private val automationType: JsonField, + private val deactivated: JsonField, + private val description: JsonField, + private val evidenceType: JsonField, + private val frameworks: JsonField>, + private val immutable: JsonField, + private val renewalCadenceDays: JsonField, + private val results: JsonField>, + private val resultsSummary: JsonField, + private val tagIds: JsonField>, + private val tags: JsonField>, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("scope") @ExcludeMissing scope: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + @JsonProperty("assigneeId") + @ExcludeMissing + assigneeId: JsonField = JsonMissing.of(), + @JsonProperty("automationParams") + @ExcludeMissing + automationParams: JsonField = JsonMissing.of(), + @JsonProperty("automationType") + @ExcludeMissing + automationType: JsonField = JsonMissing.of(), + @JsonProperty("deactivated") + @ExcludeMissing + deactivated: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + description: JsonField = JsonMissing.of(), + @JsonProperty("evidenceType") + @ExcludeMissing + evidenceType: JsonField = JsonMissing.of(), + @JsonProperty("frameworks") + @ExcludeMissing + frameworks: JsonField> = JsonMissing.of(), + @JsonProperty("immutable") + @ExcludeMissing + immutable: JsonField = JsonMissing.of(), + @JsonProperty("renewalCadenceDays") + @ExcludeMissing + renewalCadenceDays: JsonField = JsonMissing.of(), + @JsonProperty("results") + @ExcludeMissing + results: JsonField> = JsonMissing.of(), + @JsonProperty("resultsSummary") + @ExcludeMissing + resultsSummary: JsonField = JsonMissing.of(), + @JsonProperty("tagIds") + @ExcludeMissing + tagIds: JsonField> = JsonMissing.of(), + @JsonProperty("tags") @ExcludeMissing tags: JsonField> = JsonMissing.of(), + ) : this( + id, + dateCreated, + dateUpdated, + name, + scope, + type, + workspaceId, + assigneeId, + automationParams, + automationType, + deactivated, + description, + evidenceType, + frameworks, + immutable, + renewalCadenceDays, + results, + resultsSummary, + tagIds, + tags, + mutableMapOf(), + ) + + /** + * The rule id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun id(): String = id.getRequired("id") + + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** + * The last update date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** + * The rule name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun name(): String = name.getRequired("name") + + /** + * Whether the rule is evaluated once for the whole workspace, or once per project the + * rule's frameworks apply to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun scope(): Scope = scope.getRequired("scope") + + /** + * `platform` rules are evaluated automatically from the state of your Openlayer workspace. + * `evidence` rules are satisfied by attaching evidence. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun type(): Type = type.getRequired("type") + + /** + * The id of the workspace the rule belongs to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun workspaceId(): String = workspaceId.getRequired("workspaceId") + + /** + * The user responsible for satisfying the rule. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun assigneeId(): Optional = assigneeId.getOptional("assigneeId") + + /** + * Configuration for the platform check, when the automation takes parameters. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun automationParams(): Optional = + automationParams.getOptional("automationParams") + + /** + * Which workspace signal a platform rule checks, for example `monitoring_mode_enabled`, + * `test_setup`, or `project_owner_set`. `null` for evidence rules. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun automationType(): Optional = automationType.getOptional("automationType") + + /** + * Whether the rule is excluded from compliance calculations. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun deactivated(): Optional = deactivated.getOptional("deactivated") + + /** + * What the rule requires. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun description(): Optional = description.getOptional("description") + + /** + * The kind of evidence that satisfies the rule. `null` for platform rules. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun evidenceType(): Optional = evidenceType.getOptional("evidenceType") + + /** + * The frameworks that include this rule. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun frameworks(): Optional> = frameworks.getOptional("frameworks") + + /** + * Whether the rule is managed by Openlayer and cannot be edited. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun immutable(): Optional = immutable.getOptional("immutable") + + /** + * How often evidence must be renewed, in days. Once evidence is older than this, the rule + * result becomes `due_soon` and then `failing`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun renewalCadenceDays(): Optional = + renewalCadenceDays.getOptional("renewalCadenceDays") + + /** + * The rule's results, one per entity the rule is evaluated against. Only returned when + * `includeResults` is `true`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun results(): Optional> = results.getOptional("results") + + /** + * Pass-rate counts across all of the rule's entities, independent of any status filter + * applied to the request. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun resultsSummary(): Optional = + resultsSummary.getOptional("resultsSummary") + + /** + * The ids of the rule tags to associate with the rule. Replaces the rule's tags. Read them + * back from `tags`, and list the tags available in the workspace with `GET + * /workspaces/{workspaceId}/rule-tags`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun tagIds(): Optional> = tagIds.getOptional("tagIds") + + /** + * The rule tags associated with the rule. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun tags(): Optional> = tags.getOptional("tags") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [scope]. + * + * Unlike [scope], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("scope") @ExcludeMissing fun _scope(): JsonField = scope + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + /** + * Returns the raw JSON value of [workspaceId]. + * + * Unlike [workspaceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("workspaceId") + @ExcludeMissing + fun _workspaceId(): JsonField = workspaceId + + /** + * Returns the raw JSON value of [assigneeId]. + * + * Unlike [assigneeId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("assigneeId") + @ExcludeMissing + fun _assigneeId(): JsonField = assigneeId + + /** + * Returns the raw JSON value of [automationParams]. + * + * Unlike [automationParams], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("automationParams") + @ExcludeMissing + fun _automationParams(): JsonField = automationParams + + /** + * Returns the raw JSON value of [automationType]. + * + * Unlike [automationType], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("automationType") + @ExcludeMissing + fun _automationType(): JsonField = automationType + + /** + * Returns the raw JSON value of [deactivated]. + * + * Unlike [deactivated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("deactivated") + @ExcludeMissing + fun _deactivated(): JsonField = deactivated + + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("description") + @ExcludeMissing + fun _description(): JsonField = description + + /** + * Returns the raw JSON value of [evidenceType]. + * + * Unlike [evidenceType], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("evidenceType") + @ExcludeMissing + fun _evidenceType(): JsonField = evidenceType + + /** + * Returns the raw JSON value of [frameworks]. + * + * Unlike [frameworks], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("frameworks") + @ExcludeMissing + fun _frameworks(): JsonField> = frameworks + + /** + * Returns the raw JSON value of [immutable]. + * + * Unlike [immutable], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("immutable") @ExcludeMissing fun _immutable(): JsonField = immutable + + /** + * Returns the raw JSON value of [renewalCadenceDays]. + * + * Unlike [renewalCadenceDays], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("renewalCadenceDays") + @ExcludeMissing + fun _renewalCadenceDays(): JsonField = renewalCadenceDays + + /** + * Returns the raw JSON value of [results]. + * + * Unlike [results], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("results") @ExcludeMissing fun _results(): JsonField> = results + + /** + * Returns the raw JSON value of [resultsSummary]. + * + * Unlike [resultsSummary], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("resultsSummary") + @ExcludeMissing + fun _resultsSummary(): JsonField = resultsSummary + + /** + * Returns the raw JSON value of [tagIds]. + * + * Unlike [tagIds], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("tagIds") @ExcludeMissing fun _tagIds(): JsonField> = tagIds + + /** + * Returns the raw JSON value of [tags]. + * + * Unlike [tags], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("tags") @ExcludeMissing fun _tags(): JsonField> = tags + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Item]. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateUpdated() + * .name() + * .scope() + * .type() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Item]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var name: JsonField? = null + private var scope: JsonField? = null + private var type: JsonField? = null + private var workspaceId: JsonField? = null + private var assigneeId: JsonField = JsonMissing.of() + private var automationParams: JsonField = JsonMissing.of() + private var automationType: JsonField = JsonMissing.of() + private var deactivated: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var evidenceType: JsonField = JsonMissing.of() + private var frameworks: JsonField>? = null + private var immutable: JsonField = JsonMissing.of() + private var renewalCadenceDays: JsonField = JsonMissing.of() + private var results: JsonField>? = null + private var resultsSummary: JsonField = JsonMissing.of() + private var tagIds: JsonField>? = null + private var tags: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(item: Item) = apply { + id = item.id + dateCreated = item.dateCreated + dateUpdated = item.dateUpdated + name = item.name + scope = item.scope + type = item.type + workspaceId = item.workspaceId + assigneeId = item.assigneeId + automationParams = item.automationParams + automationType = item.automationType + deactivated = item.deactivated + description = item.description + evidenceType = item.evidenceType + frameworks = item.frameworks.map { it.toMutableList() } + immutable = item.immutable + renewalCadenceDays = item.renewalCadenceDays + results = item.results.map { it.toMutableList() } + resultsSummary = item.resultsSummary + tagIds = item.tagIds.map { it.toMutableList() } + tags = item.tags.map { it.toMutableList() } + additionalProperties = item.additionalProperties.toMutableMap() + } + + /** The rule id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The last update date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** The rule name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun name(name: JsonField) = apply { this.name = name } + + /** + * Whether the rule is evaluated once for the whole workspace, or once per project the + * rule's frameworks apply to. + */ + fun scope(scope: Scope) = scope(JsonField.of(scope)) + + /** + * Sets [Builder.scope] to an arbitrary JSON value. + * + * You should usually call [Builder.scope] with a well-typed [Scope] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun scope(scope: JsonField) = apply { this.scope = scope } + + /** + * `platform` rules are evaluated automatically from the state of your Openlayer + * workspace. `evidence` rules are satisfied by attaching evidence. + */ + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun type(type: JsonField) = apply { this.type = type } + + /** The id of the workspace the rule belongs to. */ + fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) + + /** + * Sets [Builder.workspaceId] to an arbitrary JSON value. + * + * You should usually call [Builder.workspaceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun workspaceId(workspaceId: JsonField) = apply { + this.workspaceId = workspaceId + } + + /** The user responsible for satisfying the rule. */ + fun assigneeId(assigneeId: String?) = assigneeId(JsonField.ofNullable(assigneeId)) + + /** Alias for calling [Builder.assigneeId] with `assigneeId.orElse(null)`. */ + fun assigneeId(assigneeId: Optional) = assigneeId(assigneeId.getOrNull()) + + /** + * Sets [Builder.assigneeId] to an arbitrary JSON value. + * + * You should usually call [Builder.assigneeId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun assigneeId(assigneeId: JsonField) = apply { this.assigneeId = assigneeId } + + /** Configuration for the platform check, when the automation takes parameters. */ + fun automationParams(automationParams: AutomationParams?) = + automationParams(JsonField.ofNullable(automationParams)) + + /** + * Alias for calling [Builder.automationParams] with `automationParams.orElse(null)`. + */ + fun automationParams(automationParams: Optional) = + automationParams(automationParams.getOrNull()) + + /** + * Sets [Builder.automationParams] to an arbitrary JSON value. + * + * You should usually call [Builder.automationParams] with a well-typed + * [AutomationParams] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun automationParams(automationParams: JsonField) = apply { + this.automationParams = automationParams + } + + /** + * Which workspace signal a platform rule checks, for example `monitoring_mode_enabled`, + * `test_setup`, or `project_owner_set`. `null` for evidence rules. + */ + fun automationType(automationType: String?) = + automationType(JsonField.ofNullable(automationType)) + + /** Alias for calling [Builder.automationType] with `automationType.orElse(null)`. */ + fun automationType(automationType: Optional) = + automationType(automationType.getOrNull()) + + /** + * Sets [Builder.automationType] to an arbitrary JSON value. + * + * You should usually call [Builder.automationType] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun automationType(automationType: JsonField) = apply { + this.automationType = automationType + } + + /** Whether the rule is excluded from compliance calculations. */ + fun deactivated(deactivated: Boolean) = deactivated(JsonField.of(deactivated)) + + /** + * Sets [Builder.deactivated] to an arbitrary JSON value. + * + * You should usually call [Builder.deactivated] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun deactivated(deactivated: JsonField) = apply { + this.deactivated = deactivated + } + + /** What the rule requires. */ + fun description(description: String?) = description(JsonField.ofNullable(description)) + + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ + fun description(description: Optional) = description(description.getOrNull()) + + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun description(description: JsonField) = apply { + this.description = description + } + + /** The kind of evidence that satisfies the rule. `null` for platform rules. */ + fun evidenceType(evidenceType: EvidenceType?) = + evidenceType(JsonField.ofNullable(evidenceType)) + + /** Alias for calling [Builder.evidenceType] with `evidenceType.orElse(null)`. */ + fun evidenceType(evidenceType: Optional) = + evidenceType(evidenceType.getOrNull()) + + /** + * Sets [Builder.evidenceType] to an arbitrary JSON value. + * + * You should usually call [Builder.evidenceType] with a well-typed [EvidenceType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun evidenceType(evidenceType: JsonField) = apply { + this.evidenceType = evidenceType + } + + /** The frameworks that include this rule. */ + fun frameworks(frameworks: List) = frameworks(JsonField.of(frameworks)) + + /** + * Sets [Builder.frameworks] to an arbitrary JSON value. + * + * You should usually call [Builder.frameworks] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun frameworks(frameworks: JsonField>) = apply { + this.frameworks = frameworks.map { it.toMutableList() } + } + + /** + * Adds a single [Framework] to [frameworks]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addFramework(framework: Framework) = apply { + frameworks = + (frameworks ?: JsonField.of(mutableListOf())).also { + checkKnown("frameworks", it).add(framework) + } + } + + /** Whether the rule is managed by Openlayer and cannot be edited. */ + fun immutable(immutable: Boolean) = immutable(JsonField.of(immutable)) + + /** + * Sets [Builder.immutable] to an arbitrary JSON value. + * + * You should usually call [Builder.immutable] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun immutable(immutable: JsonField) = apply { this.immutable = immutable } + + /** + * How often evidence must be renewed, in days. Once evidence is older than this, the + * rule result becomes `due_soon` and then `failing`. + */ + fun renewalCadenceDays(renewalCadenceDays: Long?) = + renewalCadenceDays(JsonField.ofNullable(renewalCadenceDays)) + + /** + * Alias for [Builder.renewalCadenceDays]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun renewalCadenceDays(renewalCadenceDays: Long) = + renewalCadenceDays(renewalCadenceDays as Long?) + + /** + * Alias for calling [Builder.renewalCadenceDays] with + * `renewalCadenceDays.orElse(null)`. + */ + fun renewalCadenceDays(renewalCadenceDays: Optional) = + renewalCadenceDays(renewalCadenceDays.getOrNull()) + + /** + * Sets [Builder.renewalCadenceDays] to an arbitrary JSON value. + * + * You should usually call [Builder.renewalCadenceDays] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun renewalCadenceDays(renewalCadenceDays: JsonField) = apply { + this.renewalCadenceDays = renewalCadenceDays + } + + /** + * The rule's results, one per entity the rule is evaluated against. Only returned when + * `includeResults` is `true`. + */ + fun results(results: List) = results(JsonField.of(results)) + + /** + * Sets [Builder.results] to an arbitrary JSON value. + * + * You should usually call [Builder.results] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun results(results: JsonField>) = apply { + this.results = results.map { it.toMutableList() } + } + + /** + * Adds a single [Result] to [results]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addResult(result: Result) = apply { + results = + (results ?: JsonField.of(mutableListOf())).also { + checkKnown("results", it).add(result) + } + } + + /** + * Pass-rate counts across all of the rule's entities, independent of any status filter + * applied to the request. + */ + fun resultsSummary(resultsSummary: ResultsSummary?) = + resultsSummary(JsonField.ofNullable(resultsSummary)) + + /** Alias for calling [Builder.resultsSummary] with `resultsSummary.orElse(null)`. */ + fun resultsSummary(resultsSummary: Optional) = + resultsSummary(resultsSummary.getOrNull()) + + /** + * Sets [Builder.resultsSummary] to an arbitrary JSON value. + * + * You should usually call [Builder.resultsSummary] with a well-typed [ResultsSummary] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun resultsSummary(resultsSummary: JsonField) = apply { + this.resultsSummary = resultsSummary + } + + /** + * The ids of the rule tags to associate with the rule. Replaces the rule's tags. Read + * them back from `tags`, and list the tags available in the workspace with `GET + * /workspaces/{workspaceId}/rule-tags`. + */ + fun tagIds(tagIds: List?) = tagIds(JsonField.ofNullable(tagIds)) + + /** Alias for calling [Builder.tagIds] with `tagIds.orElse(null)`. */ + fun tagIds(tagIds: Optional>) = tagIds(tagIds.getOrNull()) + + /** + * Sets [Builder.tagIds] to an arbitrary JSON value. + * + * You should usually call [Builder.tagIds] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun tagIds(tagIds: JsonField>) = apply { + this.tagIds = tagIds.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [tagIds]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addTagId(tagId: String) = apply { + tagIds = + (tagIds ?: JsonField.of(mutableListOf())).also { + checkKnown("tagIds", it).add(tagId) + } + } + + /** The rule tags associated with the rule. */ + fun tags(tags: List?) = tags(JsonField.ofNullable(tags)) + + /** Alias for calling [Builder.tags] with `tags.orElse(null)`. */ + fun tags(tags: Optional>) = tags(tags.getOrNull()) + + /** + * Sets [Builder.tags] to an arbitrary JSON value. + * + * You should usually call [Builder.tags] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun tags(tags: JsonField>) = apply { + this.tags = tags.map { it.toMutableList() } + } + + /** + * Adds a single [Tag] to [tags]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addTag(tag: Tag) = apply { + tags = + (tags ?: JsonField.of(mutableListOf())).also { checkKnown("tags", it).add(tag) } + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Item]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateUpdated() + * .name() + * .scope() + * .type() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Item = + Item( + checkRequired("id", id), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("name", name), + checkRequired("scope", scope), + checkRequired("type", type), + checkRequired("workspaceId", workspaceId), + assigneeId, + automationParams, + automationType, + deactivated, + description, + evidenceType, + (frameworks ?: JsonMissing.of()).map { it.toImmutable() }, + immutable, + renewalCadenceDays, + (results ?: JsonMissing.of()).map { it.toImmutable() }, + resultsSummary, + (tagIds ?: JsonMissing.of()).map { it.toImmutable() }, + (tags ?: JsonMissing.of()).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Item = apply { + if (validated) { + return@apply + } + + id() + dateCreated() + dateUpdated() + name() + scope().validate() + type().validate() + workspaceId() + assigneeId() + automationParams().ifPresent { it.validate() } + automationType() + deactivated() + description() + evidenceType().ifPresent { it.validate() } + frameworks().ifPresent { it.forEach { it.validate() } } + immutable() + renewalCadenceDays() + results().ifPresent { it.forEach { it.validate() } } + resultsSummary().ifPresent { it.validate() } + tagIds() + tags().ifPresent { it.forEach { it.validate() } } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (scope.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + (if (assigneeId.asKnown().isPresent) 1 else 0) + + (automationParams.asKnown().getOrNull()?.validity() ?: 0) + + (if (automationType.asKnown().isPresent) 1 else 0) + + (if (deactivated.asKnown().isPresent) 1 else 0) + + (if (description.asKnown().isPresent) 1 else 0) + + (evidenceType.asKnown().getOrNull()?.validity() ?: 0) + + (frameworks.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (immutable.asKnown().isPresent) 1 else 0) + + (if (renewalCadenceDays.asKnown().isPresent) 1 else 0) + + (results.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (resultsSummary.asKnown().getOrNull()?.validity() ?: 0) + + (tagIds.asKnown().getOrNull()?.size ?: 0) + + (tags.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + /** + * Whether the rule is evaluated once for the whole workspace, or once per project the + * rule's frameworks apply to. + */ + class Scope @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val PROJECT = of("project") + + @JvmField val WORKSPACE = of("workspace") + + @JvmStatic fun of(value: String) = Scope(JsonField.of(value)) + } + + /** An enum containing [Scope]'s known values. */ + enum class Known { + PROJECT, + WORKSPACE, + } + + /** + * An enum containing [Scope]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Scope] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + PROJECT, + WORKSPACE, + /** + * An enum member indicating that [Scope] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + PROJECT -> Value.PROJECT + WORKSPACE -> Value.WORKSPACE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + PROJECT -> Known.PROJECT + WORKSPACE -> Known.WORKSPACE + else -> throw OpenlayerInvalidDataException("Unknown Scope: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Scope = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Scope && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** + * `platform` rules are evaluated automatically from the state of your Openlayer workspace. + * `evidence` rules are satisfied by attaching evidence. + */ + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val PLATFORM = of("platform") + + @JvmField val EVIDENCE = of("evidence") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + PLATFORM, + EVIDENCE, + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + PLATFORM, + EVIDENCE, + /** An enum member indicating that [Type] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + PLATFORM -> Value.PLATFORM + EVIDENCE -> Value.EVIDENCE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + PLATFORM -> Known.PLATFORM + EVIDENCE -> Known.EVIDENCE + else -> throw OpenlayerInvalidDataException("Unknown Type: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Configuration for the platform check, when the automation takes parameters. */ + class AutomationParams + @JsonCreator + private constructor( + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [AutomationParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [AutomationParams]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(automationParams: AutomationParams) = apply { + additionalProperties = automationParams.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [AutomationParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): AutomationParams = AutomationParams(additionalProperties.toImmutable()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): AutomationParams = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is AutomationParams && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = "AutomationParams{additionalProperties=$additionalProperties}" + } + + /** The kind of evidence that satisfies the rule. `null` for platform rules. */ + class EvidenceType @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val DOCUMENT = of("document") + + @JvmField val TEXT = of("text") + + @JvmField val URL = of("url") + + @JvmField val CATEGORY_VALUE = of("categoryValue") + + @JvmStatic fun of(value: String) = EvidenceType(JsonField.of(value)) + } + + /** An enum containing [EvidenceType]'s known values. */ + enum class Known { + DOCUMENT, + TEXT, + URL, + CATEGORY_VALUE, + } + + /** + * An enum containing [EvidenceType]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [EvidenceType] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DOCUMENT, + TEXT, + URL, + CATEGORY_VALUE, + /** + * An enum member indicating that [EvidenceType] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DOCUMENT -> Value.DOCUMENT + TEXT -> Value.TEXT + URL -> Value.URL + CATEGORY_VALUE -> Value.CATEGORY_VALUE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + DOCUMENT -> Known.DOCUMENT + TEXT -> Known.TEXT + URL -> Known.URL + CATEGORY_VALUE -> Known.CATEGORY_VALUE + else -> throw OpenlayerInvalidDataException("Unknown EvidenceType: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): EvidenceType = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is EvidenceType && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + class Framework + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val avatar: JsonField, + private val builtInSlug: JsonField, + private val enabled: JsonField, + private val name: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("avatar") + @ExcludeMissing + avatar: JsonField = JsonMissing.of(), + @JsonProperty("builtInSlug") + @ExcludeMissing + builtInSlug: JsonField = JsonMissing.of(), + @JsonProperty("enabled") + @ExcludeMissing + enabled: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + ) : this(id, avatar, builtInSlug, enabled, name, mutableMapOf()) + + /** + * The framework id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun id(): String = id.getRequired("id") + + /** + * The icon shown for the framework. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun avatar(): Optional = avatar.getOptional("avatar") + + /** + * Identifies a framework that ships with Openlayer, for example `eu_ai_act`, + * `iso_42001`, `nist_ai_rmf`, or `traiga`. `null` for frameworks you create yourself. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun builtInSlug(): Optional = builtInSlug.getOptional("builtInSlug") + + /** + * Whether the framework is active. Rules of a disabled framework are not evaluated and + * do not count towards compliance. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun enabled(): Boolean = enabled.getRequired("enabled") + + /** + * The framework name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun name(): String = name.getRequired("name") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [avatar]. + * + * Unlike [avatar], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("avatar") @ExcludeMissing fun _avatar(): JsonField = avatar + + /** + * Returns the raw JSON value of [builtInSlug]. + * + * Unlike [builtInSlug], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("builtInSlug") + @ExcludeMissing + fun _builtInSlug(): JsonField = builtInSlug + + /** + * Returns the raw JSON value of [enabled]. + * + * Unlike [enabled], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("enabled") @ExcludeMissing fun _enabled(): JsonField = enabled + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Framework]. + * + * The following fields are required: + * ```java + * .id() + * .avatar() + * .builtInSlug() + * .enabled() + * .name() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Framework]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var avatar: JsonField? = null + private var builtInSlug: JsonField? = null + private var enabled: JsonField? = null + private var name: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(framework: Framework) = apply { + id = framework.id + avatar = framework.avatar + builtInSlug = framework.builtInSlug + enabled = framework.enabled + name = framework.name + additionalProperties = framework.additionalProperties.toMutableMap() + } + + /** The framework id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The icon shown for the framework. */ + fun avatar(avatar: Avatar?) = avatar(JsonField.ofNullable(avatar)) + + /** Alias for calling [Builder.avatar] with `avatar.orElse(null)`. */ + fun avatar(avatar: Optional) = avatar(avatar.getOrNull()) + + /** + * Sets [Builder.avatar] to an arbitrary JSON value. + * + * You should usually call [Builder.avatar] with a well-typed [Avatar] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun avatar(avatar: JsonField) = apply { this.avatar = avatar } + + /** + * Identifies a framework that ships with Openlayer, for example `eu_ai_act`, + * `iso_42001`, `nist_ai_rmf`, or `traiga`. `null` for frameworks you create + * yourself. + */ + fun builtInSlug(builtInSlug: String?) = + builtInSlug(JsonField.ofNullable(builtInSlug)) + + /** Alias for calling [Builder.builtInSlug] with `builtInSlug.orElse(null)`. */ + fun builtInSlug(builtInSlug: Optional) = + builtInSlug(builtInSlug.getOrNull()) + + /** + * Sets [Builder.builtInSlug] to an arbitrary JSON value. + * + * You should usually call [Builder.builtInSlug] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun builtInSlug(builtInSlug: JsonField) = apply { + this.builtInSlug = builtInSlug + } + + /** + * Whether the framework is active. Rules of a disabled framework are not evaluated + * and do not count towards compliance. + */ + fun enabled(enabled: Boolean) = enabled(JsonField.of(enabled)) + + /** + * Sets [Builder.enabled] to an arbitrary JSON value. + * + * You should usually call [Builder.enabled] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun enabled(enabled: JsonField) = apply { this.enabled = enabled } + + /** The framework name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun name(name: JsonField) = apply { this.name = name } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Framework]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .avatar() + * .builtInSlug() + * .enabled() + * .name() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Framework = + Framework( + checkRequired("id", id), + checkRequired("avatar", avatar), + checkRequired("builtInSlug", builtInSlug), + checkRequired("enabled", enabled), + checkRequired("name", name), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Framework = apply { + if (validated) { + return@apply + } + + id() + avatar().ifPresent { it.validate() } + builtInSlug() + enabled() + name() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (avatar.asKnown().getOrNull()?.validity() ?: 0) + + (if (builtInSlug.asKnown().isPresent) 1 else 0) + + (if (enabled.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + /** The icon shown for the framework. */ + class Avatar + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val type: JsonField, + private val value: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("value") + @ExcludeMissing + value: JsonField = JsonMissing.of(), + ) : this(type, value, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun type(): Type = type.getRequired("type") + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun value(): String = value.getRequired("value") + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + /** + * Returns the raw JSON value of [value]. + * + * Unlike [value], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Avatar]. + * + * The following fields are required: + * ```java + * .type() + * .value() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Avatar]. */ + class Builder internal constructor() { + + private var type: JsonField? = null + private var value: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(avatar: Avatar) = apply { + type = avatar.type + value = avatar.value + additionalProperties = avatar.additionalProperties.toMutableMap() + } + + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun type(type: JsonField) = apply { this.type = type } + + fun value(value: String) = value(JsonField.of(value)) + + /** + * Sets [Builder.value] to an arbitrary JSON value. + * + * You should usually call [Builder.value] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun value(value: JsonField) = apply { this.value = value } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Avatar]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .type() + * .value() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Avatar = + Avatar( + checkRequired("type", type), + checkRequired("value", value), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): Avatar = apply { + if (validated) { + return@apply + } + + type().validate() + value() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (type.asKnown().getOrNull()?.validity() ?: 0) + + (if (value.asKnown().isPresent) 1 else 0) + + class Type @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val EMOJI = of("emoji") + + @JvmField val IMAGE_URL = of("imageUrl") + + @JvmField val BUILTIN_IMAGE = of("builtinImage") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + EMOJI, + IMAGE_URL, + BUILTIN_IMAGE, + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + EMOJI, + IMAGE_URL, + BUILTIN_IMAGE, + /** + * An enum member indicating that [Type] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + EMOJI -> Value.EMOJI + IMAGE_URL -> Value.IMAGE_URL + BUILTIN_IMAGE -> Value.BUILTIN_IMAGE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + EMOJI -> Known.EMOJI + IMAGE_URL -> Known.IMAGE_URL + BUILTIN_IMAGE -> Known.BUILTIN_IMAGE + else -> throw OpenlayerInvalidDataException("Unknown Type: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object + * doesn't match its expected type. + */ + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Avatar && + type == other.type && + value == other.value && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(type, value, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Avatar{type=$type, value=$value, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Framework && + id == other.id && + avatar == other.avatar && + builtInSlug == other.builtInSlug && + enabled == other.enabled && + name == other.name && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(id, avatar, builtInSlug, enabled, name, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Framework{id=$id, avatar=$avatar, builtInSlug=$builtInSlug, enabled=$enabled, name=$name, additionalProperties=$additionalProperties}" + } + + class Result + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val deactivated: JsonField, + private val ruleId: JsonField, + private val status: JsonField, + private val workspaceId: JsonField, + private val assigneeId: JsonField, + private val blockedBy: JsonField>, + private val blocking: JsonField>, + private val dateLastEvaluated: JsonField, + private val dateOfLatestEvidence: JsonField, + private val dateOfNextEvaluation: JsonField, + private val dateOfRenewal: JsonField, + private val deactivatedReason: JsonField, + private val projectId: JsonField, + private val statusMessage: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("deactivated") + @ExcludeMissing + deactivated: JsonField = JsonMissing.of(), + @JsonProperty("ruleId") + @ExcludeMissing + ruleId: JsonField = JsonMissing.of(), + @JsonProperty("status") + @ExcludeMissing + status: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + @JsonProperty("assigneeId") + @ExcludeMissing + assigneeId: JsonField = JsonMissing.of(), + @JsonProperty("blockedBy") + @ExcludeMissing + blockedBy: JsonField> = JsonMissing.of(), + @JsonProperty("blocking") + @ExcludeMissing + blocking: JsonField> = JsonMissing.of(), + @JsonProperty("dateLastEvaluated") + @ExcludeMissing + dateLastEvaluated: JsonField = JsonMissing.of(), + @JsonProperty("dateOfLatestEvidence") + @ExcludeMissing + dateOfLatestEvidence: JsonField = JsonMissing.of(), + @JsonProperty("dateOfNextEvaluation") + @ExcludeMissing + dateOfNextEvaluation: JsonField = JsonMissing.of(), + @JsonProperty("dateOfRenewal") + @ExcludeMissing + dateOfRenewal: JsonField = JsonMissing.of(), + @JsonProperty("deactivatedReason") + @ExcludeMissing + deactivatedReason: JsonField = JsonMissing.of(), + @JsonProperty("projectId") + @ExcludeMissing + projectId: JsonField = JsonMissing.of(), + @JsonProperty("statusMessage") + @ExcludeMissing + statusMessage: JsonField = JsonMissing.of(), + ) : this( + id, + dateCreated, + dateUpdated, + deactivated, + ruleId, + status, + workspaceId, + assigneeId, + blockedBy, + blocking, + dateLastEvaluated, + dateOfLatestEvidence, + dateOfNextEvaluation, + dateOfRenewal, + deactivatedReason, + projectId, + statusMessage, + mutableMapOf(), + ) + + /** + * The rule result id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun id(): String = id.getRequired("id") + + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** + * The last update date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** + * Whether this result is excluded from compliance calculations. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun deactivated(): Boolean = deactivated.getRequired("deactivated") + + /** + * The rule this result belongs to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun ruleId(): String = ruleId.getRequired("ruleId") + + /** + * The compliance status of the rule for this entity. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun status(): Status = status.getRequired("status") + + /** + * The id of the workspace the rule result belongs to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun workspaceId(): String = workspaceId.getRequired("workspaceId") + + /** + * The user responsible for this result. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun assigneeId(): Optional = assigneeId.getOptional("assigneeId") + + /** + * Rule results that must pass before this one can be satisfied. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun blockedBy(): Optional> = blockedBy.getOptional("blockedBy") + + /** + * Rule results that this one blocks. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun blocking(): Optional> = blocking.getOptional("blocking") + + /** + * When the rule was last evaluated. Platform rules only. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun dateLastEvaluated(): Optional = + dateLastEvaluated.getOptional("dateLastEvaluated") + + /** + * When the most recent piece of evidence was attached. Evidence rules only. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun dateOfLatestEvidence(): Optional = + dateOfLatestEvidence.getOptional("dateOfLatestEvidence") + + /** + * When the rule will next be evaluated. Platform rules only. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun dateOfNextEvaluation(): Optional = + dateOfNextEvaluation.getOptional("dateOfNextEvaluation") + + /** + * When the evidence must be renewed. Evidence rules with a renewal cadence only. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun dateOfRenewal(): Optional = + dateOfRenewal.getOptional("dateOfRenewal") + + /** + * Why the result was excluded. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun deactivatedReason(): Optional = + deactivatedReason.getOptional("deactivatedReason") + + /** + * The project this result was evaluated for. `null` for workspace-scoped rules. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun projectId(): Optional = projectId.getOptional("projectId") + + /** + * A human-readable explanation of the status. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun statusMessage(): Optional = statusMessage.getOptional("statusMessage") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** + * Returns the raw JSON value of [deactivated]. + * + * Unlike [deactivated], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("deactivated") + @ExcludeMissing + fun _deactivated(): JsonField = deactivated + + /** + * Returns the raw JSON value of [ruleId]. + * + * Unlike [ruleId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("ruleId") @ExcludeMissing fun _ruleId(): JsonField = ruleId + + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + + /** + * Returns the raw JSON value of [workspaceId]. + * + * Unlike [workspaceId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("workspaceId") + @ExcludeMissing + fun _workspaceId(): JsonField = workspaceId + + /** + * Returns the raw JSON value of [assigneeId]. + * + * Unlike [assigneeId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("assigneeId") + @ExcludeMissing + fun _assigneeId(): JsonField = assigneeId + + /** + * Returns the raw JSON value of [blockedBy]. + * + * Unlike [blockedBy], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("blockedBy") + @ExcludeMissing + fun _blockedBy(): JsonField> = blockedBy + + /** + * Returns the raw JSON value of [blocking]. + * + * Unlike [blocking], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("blocking") + @ExcludeMissing + fun _blocking(): JsonField> = blocking + + /** + * Returns the raw JSON value of [dateLastEvaluated]. + * + * Unlike [dateLastEvaluated], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("dateLastEvaluated") + @ExcludeMissing + fun _dateLastEvaluated(): JsonField = dateLastEvaluated + + /** + * Returns the raw JSON value of [dateOfLatestEvidence]. + * + * Unlike [dateOfLatestEvidence], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("dateOfLatestEvidence") + @ExcludeMissing + fun _dateOfLatestEvidence(): JsonField = dateOfLatestEvidence + + /** + * Returns the raw JSON value of [dateOfNextEvaluation]. + * + * Unlike [dateOfNextEvaluation], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("dateOfNextEvaluation") + @ExcludeMissing + fun _dateOfNextEvaluation(): JsonField = dateOfNextEvaluation + + /** + * Returns the raw JSON value of [dateOfRenewal]. + * + * Unlike [dateOfRenewal], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("dateOfRenewal") + @ExcludeMissing + fun _dateOfRenewal(): JsonField = dateOfRenewal + + /** + * Returns the raw JSON value of [deactivatedReason]. + * + * Unlike [deactivatedReason], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("deactivatedReason") + @ExcludeMissing + fun _deactivatedReason(): JsonField = deactivatedReason + + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("projectId") + @ExcludeMissing + fun _projectId(): JsonField = projectId + + /** + * Returns the raw JSON value of [statusMessage]. + * + * Unlike [statusMessage], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("statusMessage") + @ExcludeMissing + fun _statusMessage(): JsonField = statusMessage + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Result]. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateUpdated() + * .deactivated() + * .ruleId() + * .status() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Result]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var deactivated: JsonField? = null + private var ruleId: JsonField? = null + private var status: JsonField? = null + private var workspaceId: JsonField? = null + private var assigneeId: JsonField = JsonMissing.of() + private var blockedBy: JsonField>? = null + private var blocking: JsonField>? = null + private var dateLastEvaluated: JsonField = JsonMissing.of() + private var dateOfLatestEvidence: JsonField = JsonMissing.of() + private var dateOfNextEvaluation: JsonField = JsonMissing.of() + private var dateOfRenewal: JsonField = JsonMissing.of() + private var deactivatedReason: JsonField = JsonMissing.of() + private var projectId: JsonField = JsonMissing.of() + private var statusMessage: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(result: Result) = apply { + id = result.id + dateCreated = result.dateCreated + dateUpdated = result.dateUpdated + deactivated = result.deactivated + ruleId = result.ruleId + status = result.status + workspaceId = result.workspaceId + assigneeId = result.assigneeId + blockedBy = result.blockedBy.map { it.toMutableList() } + blocking = result.blocking.map { it.toMutableList() } + dateLastEvaluated = result.dateLastEvaluated + dateOfLatestEvidence = result.dateOfLatestEvidence + dateOfNextEvaluation = result.dateOfNextEvaluation + dateOfRenewal = result.dateOfRenewal + deactivatedReason = result.deactivatedReason + projectId = result.projectId + statusMessage = result.statusMessage + additionalProperties = result.additionalProperties.toMutableMap() + } + + /** The rule result id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = + dateCreated(JsonField.of(dateCreated)) + + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The last update date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = + dateUpdated(JsonField.of(dateUpdated)) + + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** Whether this result is excluded from compliance calculations. */ + fun deactivated(deactivated: Boolean) = deactivated(JsonField.of(deactivated)) + + /** + * Sets [Builder.deactivated] to an arbitrary JSON value. + * + * You should usually call [Builder.deactivated] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun deactivated(deactivated: JsonField) = apply { + this.deactivated = deactivated + } + + /** The rule this result belongs to. */ + fun ruleId(ruleId: String) = ruleId(JsonField.of(ruleId)) + + /** + * Sets [Builder.ruleId] to an arbitrary JSON value. + * + * You should usually call [Builder.ruleId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun ruleId(ruleId: JsonField) = apply { this.ruleId = ruleId } + + /** The compliance status of the rule for this entity. */ + fun status(status: Status) = status(JsonField.of(status)) + + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun status(status: JsonField) = apply { this.status = status } + + /** The id of the workspace the rule result belongs to. */ + fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) + + /** + * Sets [Builder.workspaceId] to an arbitrary JSON value. + * + * You should usually call [Builder.workspaceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun workspaceId(workspaceId: JsonField) = apply { + this.workspaceId = workspaceId + } + + /** The user responsible for this result. */ + fun assigneeId(assigneeId: String?) = assigneeId(JsonField.ofNullable(assigneeId)) + + /** Alias for calling [Builder.assigneeId] with `assigneeId.orElse(null)`. */ + fun assigneeId(assigneeId: Optional) = assigneeId(assigneeId.getOrNull()) + + /** + * Sets [Builder.assigneeId] to an arbitrary JSON value. + * + * You should usually call [Builder.assigneeId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun assigneeId(assigneeId: JsonField) = apply { + this.assigneeId = assigneeId + } + + /** Rule results that must pass before this one can be satisfied. */ + fun blockedBy(blockedBy: List) = blockedBy(JsonField.of(blockedBy)) + + /** + * Sets [Builder.blockedBy] to an arbitrary JSON value. + * + * You should usually call [Builder.blockedBy] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun blockedBy(blockedBy: JsonField>) = apply { + this.blockedBy = blockedBy.map { it.toMutableList() } + } + + /** + * Adds a single [BlockedBy] to [Builder.blockedBy]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addBlockedBy(blockedBy: BlockedBy) = apply { + this.blockedBy = + (this.blockedBy ?: JsonField.of(mutableListOf())).also { + checkKnown("blockedBy", it).add(blockedBy) + } + } + + /** Rule results that this one blocks. */ + fun blocking(blocking: List) = blocking(JsonField.of(blocking)) + + /** + * Sets [Builder.blocking] to an arbitrary JSON value. + * + * You should usually call [Builder.blocking] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun blocking(blocking: JsonField>) = apply { + this.blocking = blocking.map { it.toMutableList() } + } + + /** + * Adds a single [Blocking] to [Builder.blocking]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addBlocking(blocking: Blocking) = apply { + this.blocking = + (this.blocking ?: JsonField.of(mutableListOf())).also { + checkKnown("blocking", it).add(blocking) + } + } + + /** When the rule was last evaluated. Platform rules only. */ + fun dateLastEvaluated(dateLastEvaluated: OffsetDateTime?) = + dateLastEvaluated(JsonField.ofNullable(dateLastEvaluated)) + + /** + * Alias for calling [Builder.dateLastEvaluated] with + * `dateLastEvaluated.orElse(null)`. + */ + fun dateLastEvaluated(dateLastEvaluated: Optional) = + dateLastEvaluated(dateLastEvaluated.getOrNull()) + + /** + * Sets [Builder.dateLastEvaluated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateLastEvaluated] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun dateLastEvaluated(dateLastEvaluated: JsonField) = apply { + this.dateLastEvaluated = dateLastEvaluated + } + + /** When the most recent piece of evidence was attached. Evidence rules only. */ + fun dateOfLatestEvidence(dateOfLatestEvidence: OffsetDateTime?) = + dateOfLatestEvidence(JsonField.ofNullable(dateOfLatestEvidence)) + + /** + * Alias for calling [Builder.dateOfLatestEvidence] with + * `dateOfLatestEvidence.orElse(null)`. + */ + fun dateOfLatestEvidence(dateOfLatestEvidence: Optional) = + dateOfLatestEvidence(dateOfLatestEvidence.getOrNull()) + + /** + * Sets [Builder.dateOfLatestEvidence] to an arbitrary JSON value. + * + * You should usually call [Builder.dateOfLatestEvidence] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun dateOfLatestEvidence(dateOfLatestEvidence: JsonField) = apply { + this.dateOfLatestEvidence = dateOfLatestEvidence + } + + /** When the rule will next be evaluated. Platform rules only. */ + fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime?) = + dateOfNextEvaluation(JsonField.ofNullable(dateOfNextEvaluation)) + + /** + * Alias for calling [Builder.dateOfNextEvaluation] with + * `dateOfNextEvaluation.orElse(null)`. + */ + fun dateOfNextEvaluation(dateOfNextEvaluation: Optional) = + dateOfNextEvaluation(dateOfNextEvaluation.getOrNull()) + + /** + * Sets [Builder.dateOfNextEvaluation] to an arbitrary JSON value. + * + * You should usually call [Builder.dateOfNextEvaluation] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun dateOfNextEvaluation(dateOfNextEvaluation: JsonField) = apply { + this.dateOfNextEvaluation = dateOfNextEvaluation + } + + /** + * When the evidence must be renewed. Evidence rules with a renewal cadence only. + */ + fun dateOfRenewal(dateOfRenewal: OffsetDateTime?) = + dateOfRenewal(JsonField.ofNullable(dateOfRenewal)) + + /** Alias for calling [Builder.dateOfRenewal] with `dateOfRenewal.orElse(null)`. */ + fun dateOfRenewal(dateOfRenewal: Optional) = + dateOfRenewal(dateOfRenewal.getOrNull()) + + /** + * Sets [Builder.dateOfRenewal] to an arbitrary JSON value. + * + * You should usually call [Builder.dateOfRenewal] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun dateOfRenewal(dateOfRenewal: JsonField) = apply { + this.dateOfRenewal = dateOfRenewal + } + + /** Why the result was excluded. */ + fun deactivatedReason(deactivatedReason: String?) = + deactivatedReason(JsonField.ofNullable(deactivatedReason)) + + /** + * Alias for calling [Builder.deactivatedReason] with + * `deactivatedReason.orElse(null)`. + */ + fun deactivatedReason(deactivatedReason: Optional) = + deactivatedReason(deactivatedReason.getOrNull()) + + /** + * Sets [Builder.deactivatedReason] to an arbitrary JSON value. + * + * You should usually call [Builder.deactivatedReason] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun deactivatedReason(deactivatedReason: JsonField) = apply { + this.deactivatedReason = deactivatedReason + } + + /** The project this result was evaluated for. `null` for workspace-scoped rules. */ + fun projectId(projectId: String?) = projectId(JsonField.ofNullable(projectId)) + + /** Alias for calling [Builder.projectId] with `projectId.orElse(null)`. */ + fun projectId(projectId: Optional) = projectId(projectId.getOrNull()) + + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun projectId(projectId: JsonField) = apply { this.projectId = projectId } + + /** A human-readable explanation of the status. */ + fun statusMessage(statusMessage: String?) = + statusMessage(JsonField.ofNullable(statusMessage)) + + /** Alias for calling [Builder.statusMessage] with `statusMessage.orElse(null)`. */ + fun statusMessage(statusMessage: Optional) = + statusMessage(statusMessage.getOrNull()) + + /** + * Sets [Builder.statusMessage] to an arbitrary JSON value. + * + * You should usually call [Builder.statusMessage] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun statusMessage(statusMessage: JsonField) = apply { + this.statusMessage = statusMessage + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Result]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateUpdated() + * .deactivated() + * .ruleId() + * .status() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Result = + Result( + checkRequired("id", id), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("deactivated", deactivated), + checkRequired("ruleId", ruleId), + checkRequired("status", status), + checkRequired("workspaceId", workspaceId), + assigneeId, + (blockedBy ?: JsonMissing.of()).map { it.toImmutable() }, + (blocking ?: JsonMissing.of()).map { it.toImmutable() }, + dateLastEvaluated, + dateOfLatestEvidence, + dateOfNextEvaluation, + dateOfRenewal, + deactivatedReason, + projectId, + statusMessage, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Result = apply { + if (validated) { + return@apply + } + + id() + dateCreated() + dateUpdated() + deactivated() + ruleId() + status().validate() + workspaceId() + assigneeId() + blockedBy().ifPresent { it.forEach { it.validate() } } + blocking().ifPresent { it.forEach { it.validate() } } + dateLastEvaluated() + dateOfLatestEvidence() + dateOfNextEvaluation() + dateOfRenewal() + deactivatedReason() + projectId() + statusMessage() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (deactivated.asKnown().isPresent) 1 else 0) + + (if (ruleId.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + (if (assigneeId.asKnown().isPresent) 1 else 0) + + (blockedBy.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (blocking.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (dateLastEvaluated.asKnown().isPresent) 1 else 0) + + (if (dateOfLatestEvidence.asKnown().isPresent) 1 else 0) + + (if (dateOfNextEvaluation.asKnown().isPresent) 1 else 0) + + (if (dateOfRenewal.asKnown().isPresent) 1 else 0) + + (if (deactivatedReason.asKnown().isPresent) 1 else 0) + + (if (projectId.asKnown().isPresent) 1 else 0) + + (if (statusMessage.asKnown().isPresent) 1 else 0) + + /** The compliance status of the rule for this entity. */ + class Status @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val RUNNING = of("running") + + @JvmField val PASSING = of("passing") + + @JvmField val FAILING = of("failing") + + @JvmField val SKIPPED = of("skipped") + + @JvmField val ERROR = of("error") + + @JvmField val PENDING = of("pending") + + @JvmField val DUE_SOON = of("due_soon") + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + /** An enum containing [Status]'s known values. */ + enum class Known { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + } + + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + /** + * An enum member indicating that [Status] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + PENDING -> Value.PENDING + DUE_SOON -> Value.DUE_SOON + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + PENDING -> Known.PENDING + DUE_SOON -> Known.DUE_SOON + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + class BlockedBy + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val status: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("status") + @ExcludeMissing + status: JsonField = JsonMissing.of(), + ) : this(id, status, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun id(): Optional = id.getOptional("id") + + /** + * The compliance status of the rule for this entity. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun status(): Optional = status.getOptional("status") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [BlockedBy]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BlockedBy]. */ + class Builder internal constructor() { + + private var id: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(blockedBy: BlockedBy) = apply { + id = blockedBy.id + status = blockedBy.status + additionalProperties = blockedBy.additionalProperties.toMutableMap() + } + + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The compliance status of the rule for this entity. */ + fun status(status: Status) = status(JsonField.of(status)) + + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun status(status: JsonField) = apply { this.status = status } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [BlockedBy]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): BlockedBy = + BlockedBy(id, status, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): BlockedBy = apply { + if (validated) { + return@apply + } + + id() + status().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + /** The compliance status of the rule for this entity. */ + class Status + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val RUNNING = of("running") + + @JvmField val PASSING = of("passing") + + @JvmField val FAILING = of("failing") + + @JvmField val SKIPPED = of("skipped") + + @JvmField val ERROR = of("error") + + @JvmField val PENDING = of("pending") + + @JvmField val DUE_SOON = of("due_soon") + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + /** An enum containing [Status]'s known values. */ + enum class Known { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + } + + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + /** + * An enum member indicating that [Status] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + PENDING -> Value.PENDING + DUE_SOON -> Value.DUE_SOON + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + PENDING -> Known.PENDING + DUE_SOON -> Known.DUE_SOON + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object + * doesn't match its expected type. + */ + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is BlockedBy && + id == other.id && + status == other.status && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(id, status, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BlockedBy{id=$id, status=$status, additionalProperties=$additionalProperties}" + } + + class Blocking + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val status: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("status") + @ExcludeMissing + status: JsonField = JsonMissing.of(), + ) : this(id, status, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun id(): Optional = id.getOptional("id") + + /** + * The compliance status of the rule for this entity. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun status(): Optional = status.getOptional("status") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Blocking]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Blocking]. */ + class Builder internal constructor() { + + private var id: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(blocking: Blocking) = apply { + id = blocking.id + status = blocking.status + additionalProperties = blocking.additionalProperties.toMutableMap() + } + + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The compliance status of the rule for this entity. */ + fun status(status: Status) = status(JsonField.of(status)) + + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun status(status: JsonField) = apply { this.status = status } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Blocking]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Blocking = + Blocking(id, status, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): Blocking = apply { + if (validated) { + return@apply + } + + id() + status().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + /** The compliance status of the rule for this entity. */ + class Status + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val RUNNING = of("running") + + @JvmField val PASSING = of("passing") + + @JvmField val FAILING = of("failing") + + @JvmField val SKIPPED = of("skipped") + + @JvmField val ERROR = of("error") + + @JvmField val PENDING = of("pending") + + @JvmField val DUE_SOON = of("due_soon") + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + /** An enum containing [Status]'s known values. */ + enum class Known { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + } + + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + /** + * An enum member indicating that [Status] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + PENDING -> Value.PENDING + DUE_SOON -> Value.DUE_SOON + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + PENDING -> Known.PENDING + DUE_SOON -> Known.DUE_SOON + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object + * doesn't match its expected type. + */ + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Blocking && + id == other.id && + status == other.status && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(id, status, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Blocking{id=$id, status=$status, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Result && + id == other.id && + dateCreated == other.dateCreated && + dateUpdated == other.dateUpdated && + deactivated == other.deactivated && + ruleId == other.ruleId && + status == other.status && + workspaceId == other.workspaceId && + assigneeId == other.assigneeId && + blockedBy == other.blockedBy && + blocking == other.blocking && + dateLastEvaluated == other.dateLastEvaluated && + dateOfLatestEvidence == other.dateOfLatestEvidence && + dateOfNextEvaluation == other.dateOfNextEvaluation && + dateOfRenewal == other.dateOfRenewal && + deactivatedReason == other.deactivatedReason && + projectId == other.projectId && + statusMessage == other.statusMessage && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + dateCreated, + dateUpdated, + deactivated, + ruleId, + status, + workspaceId, + assigneeId, + blockedBy, + blocking, + dateLastEvaluated, + dateOfLatestEvidence, + dateOfNextEvaluation, + dateOfRenewal, + deactivatedReason, + projectId, + statusMessage, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Result{id=$id, dateCreated=$dateCreated, dateUpdated=$dateUpdated, deactivated=$deactivated, ruleId=$ruleId, status=$status, workspaceId=$workspaceId, assigneeId=$assigneeId, blockedBy=$blockedBy, blocking=$blocking, dateLastEvaluated=$dateLastEvaluated, dateOfLatestEvidence=$dateOfLatestEvidence, dateOfNextEvaluation=$dateOfNextEvaluation, dateOfRenewal=$dateOfRenewal, deactivatedReason=$deactivatedReason, projectId=$projectId, statusMessage=$statusMessage, additionalProperties=$additionalProperties}" + } + + /** + * Pass-rate counts across all of the rule's entities, independent of any status filter + * applied to the request. + */ + class ResultsSummary + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val passing: JsonField, + private val total: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("passing") + @ExcludeMissing + passing: JsonField = JsonMissing.of(), + @JsonProperty("total") @ExcludeMissing total: JsonField = JsonMissing.of(), + ) : this(passing, total, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun passing(): Optional = passing.getOptional("passing") + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun total(): Optional = total.getOptional("total") + + /** + * Returns the raw JSON value of [passing]. + * + * Unlike [passing], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("passing") @ExcludeMissing fun _passing(): JsonField = passing + + /** + * Returns the raw JSON value of [total]. + * + * Unlike [total], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("total") @ExcludeMissing fun _total(): JsonField = total + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [ResultsSummary]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ResultsSummary]. */ + class Builder internal constructor() { + + private var passing: JsonField = JsonMissing.of() + private var total: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(resultsSummary: ResultsSummary) = apply { + passing = resultsSummary.passing + total = resultsSummary.total + additionalProperties = resultsSummary.additionalProperties.toMutableMap() + } + + fun passing(passing: Long) = passing(JsonField.of(passing)) + + /** + * Sets [Builder.passing] to an arbitrary JSON value. + * + * You should usually call [Builder.passing] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun passing(passing: JsonField) = apply { this.passing = passing } + + fun total(total: Long) = total(JsonField.of(total)) + + /** + * Sets [Builder.total] to an arbitrary JSON value. + * + * You should usually call [Builder.total] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun total(total: JsonField) = apply { this.total = total } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ResultsSummary]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): ResultsSummary = + ResultsSummary(passing, total, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): ResultsSummary = apply { + if (validated) { + return@apply + } + + passing() + total() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (passing.asKnown().isPresent) 1 else 0) + + (if (total.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ResultsSummary && + passing == other.passing && + total == other.total && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(passing, total, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ResultsSummary{passing=$passing, total=$total, additionalProperties=$additionalProperties}" + } + + class Tag + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val creatorId: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val immutable: JsonField, + private val name: JsonField, + private val workspaceId: JsonField, + private val color: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("creatorId") + @ExcludeMissing + creatorId: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("immutable") + @ExcludeMissing + immutable: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + @JsonProperty("color") @ExcludeMissing color: JsonField = JsonMissing.of(), + ) : this( + id, + creatorId, + dateCreated, + dateUpdated, + immutable, + name, + workspaceId, + color, + mutableMapOf(), + ) + + /** + * The rule tag id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun id(): String = id.getRequired("id") + + /** + * The user who created the tag. `null` for tags that ship with Openlayer. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun creatorId(): Optional = creatorId.getOptional("creatorId") + + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** + * The last update date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** + * Whether the tag is managed by Openlayer and cannot be edited or deleted. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun immutable(): Boolean = immutable.getRequired("immutable") + + /** + * The tag name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun name(): String = name.getRequired("name") + + /** + * The id of the workspace the tag belongs to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun workspaceId(): String = workspaceId.getRequired("workspaceId") + + /** + * The color the tag is displayed with. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun color(): Optional = color.getOptional("color") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [creatorId]. + * + * Unlike [creatorId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("creatorId") + @ExcludeMissing + fun _creatorId(): JsonField = creatorId + + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** + * Returns the raw JSON value of [immutable]. + * + * Unlike [immutable], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("immutable") + @ExcludeMissing + fun _immutable(): JsonField = immutable + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [workspaceId]. + * + * Unlike [workspaceId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("workspaceId") + @ExcludeMissing + fun _workspaceId(): JsonField = workspaceId + + /** + * Returns the raw JSON value of [color]. + * + * Unlike [color], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("color") @ExcludeMissing fun _color(): JsonField = color + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Tag]. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .immutable() + * .name() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Tag]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var creatorId: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var immutable: JsonField? = null + private var name: JsonField? = null + private var workspaceId: JsonField? = null + private var color: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(tag: Tag) = apply { + id = tag.id + creatorId = tag.creatorId + dateCreated = tag.dateCreated + dateUpdated = tag.dateUpdated + immutable = tag.immutable + name = tag.name + workspaceId = tag.workspaceId + color = tag.color + additionalProperties = tag.additionalProperties.toMutableMap() + } + + /** The rule tag id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The user who created the tag. `null` for tags that ship with Openlayer. */ + fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) + + /** Alias for calling [Builder.creatorId] with `creatorId.orElse(null)`. */ + fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) + + /** + * Sets [Builder.creatorId] to an arbitrary JSON value. + * + * You should usually call [Builder.creatorId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = + dateCreated(JsonField.of(dateCreated)) + + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The last update date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = + dateUpdated(JsonField.of(dateUpdated)) + + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** Whether the tag is managed by Openlayer and cannot be edited or deleted. */ + fun immutable(immutable: Boolean) = immutable(JsonField.of(immutable)) + + /** + * Sets [Builder.immutable] to an arbitrary JSON value. + * + * You should usually call [Builder.immutable] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun immutable(immutable: JsonField) = apply { this.immutable = immutable } + + /** The tag name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun name(name: JsonField) = apply { this.name = name } + + /** The id of the workspace the tag belongs to. */ + fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) + + /** + * Sets [Builder.workspaceId] to an arbitrary JSON value. + * + * You should usually call [Builder.workspaceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun workspaceId(workspaceId: JsonField) = apply { + this.workspaceId = workspaceId + } + + /** The color the tag is displayed with. */ + fun color(color: String?) = color(JsonField.ofNullable(color)) + + /** Alias for calling [Builder.color] with `color.orElse(null)`. */ + fun color(color: Optional) = color(color.getOrNull()) + + /** + * Sets [Builder.color] to an arbitrary JSON value. + * + * You should usually call [Builder.color] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun color(color: JsonField) = apply { this.color = color } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Tag]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .immutable() + * .name() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Tag = + Tag( + checkRequired("id", id), + checkRequired("creatorId", creatorId), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("immutable", immutable), + checkRequired("name", name), + checkRequired("workspaceId", workspaceId), + color, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Tag = apply { + if (validated) { + return@apply + } + + id() + creatorId() + dateCreated() + dateUpdated() + immutable() + name() + workspaceId() + color() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (creatorId.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (immutable.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + (if (color.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Tag && + id == other.id && + creatorId == other.creatorId && + dateCreated == other.dateCreated && + dateUpdated == other.dateUpdated && + immutable == other.immutable && + name == other.name && + workspaceId == other.workspaceId && + color == other.color && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + creatorId, + dateCreated, + dateUpdated, + immutable, + name, + workspaceId, + color, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Tag{id=$id, creatorId=$creatorId, dateCreated=$dateCreated, dateUpdated=$dateUpdated, immutable=$immutable, name=$name, workspaceId=$workspaceId, color=$color, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Item && + id == other.id && + dateCreated == other.dateCreated && + dateUpdated == other.dateUpdated && + name == other.name && + scope == other.scope && + type == other.type && + workspaceId == other.workspaceId && + assigneeId == other.assigneeId && + automationParams == other.automationParams && + automationType == other.automationType && + deactivated == other.deactivated && + description == other.description && + evidenceType == other.evidenceType && + frameworks == other.frameworks && + immutable == other.immutable && + renewalCadenceDays == other.renewalCadenceDays && + results == other.results && + resultsSummary == other.resultsSummary && + tagIds == other.tagIds && + tags == other.tags && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + dateCreated, + dateUpdated, + name, + scope, + type, + workspaceId, + assigneeId, + automationParams, + automationType, + deactivated, + description, + evidenceType, + frameworks, + immutable, + renewalCadenceDays, + results, + resultsSummary, + tagIds, + tags, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Item{id=$id, dateCreated=$dateCreated, dateUpdated=$dateUpdated, name=$name, scope=$scope, type=$type, workspaceId=$workspaceId, assigneeId=$assigneeId, automationParams=$automationParams, automationType=$automationType, deactivated=$deactivated, description=$description, evidenceType=$evidenceType, frameworks=$frameworks, immutable=$immutable, renewalCadenceDays=$renewalCadenceDays, results=$results, resultsSummary=$resultsSummary, tagIds=$tagIds, tags=$tags, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is FrameworkListRulesResponse && + items == other.items && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(items, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "FrameworkListRulesResponse{items=$items, additionalProperties=$additionalProperties}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkRetrieveParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkRetrieveParams.kt new file mode 100644 index 00000000..e464a9b4 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkRetrieveParams.kt @@ -0,0 +1,194 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.frameworks + +import com.openlayer.api.core.Params +import com.openlayer.api.core.http.Headers +import com.openlayer.api.core.http.QueryParams +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** Retrieve a governance framework by its id. */ +class FrameworkRetrieveParams +private constructor( + private val frameworkId: String?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun frameworkId(): Optional = Optional.ofNullable(frameworkId) + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): FrameworkRetrieveParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [FrameworkRetrieveParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [FrameworkRetrieveParams]. */ + class Builder internal constructor() { + + private var frameworkId: String? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(frameworkRetrieveParams: FrameworkRetrieveParams) = apply { + frameworkId = frameworkRetrieveParams.frameworkId + additionalHeaders = frameworkRetrieveParams.additionalHeaders.toBuilder() + additionalQueryParams = frameworkRetrieveParams.additionalQueryParams.toBuilder() + } + + fun frameworkId(frameworkId: String?) = apply { this.frameworkId = frameworkId } + + /** Alias for calling [Builder.frameworkId] with `frameworkId.orElse(null)`. */ + fun frameworkId(frameworkId: Optional) = frameworkId(frameworkId.getOrNull()) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [FrameworkRetrieveParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): FrameworkRetrieveParams = + FrameworkRetrieveParams( + frameworkId, + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _pathParam(index: Int): String = + when (index) { + 0 -> frameworkId ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is FrameworkRetrieveParams && + frameworkId == other.frameworkId && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = + Objects.hash(frameworkId, additionalHeaders, additionalQueryParams) + + override fun toString() = + "FrameworkRetrieveParams{frameworkId=$frameworkId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkRetrieveResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkRetrieveResponse.kt new file mode 100644 index 00000000..455bd8fc --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkRetrieveResponse.kt @@ -0,0 +1,2923 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.frameworks + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.openlayer.api.core.Enum +import com.openlayer.api.core.ExcludeMissing +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonMissing +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.checkKnown +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.toImmutable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.time.OffsetDateTime +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class FrameworkRetrieveResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val id: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val enabled: JsonField, + private val name: JsonField, + private val tags: JsonField>, + private val workspaceId: JsonField, + private val avatar: JsonField, + private val builtInSlug: JsonField, + private val creatorId: JsonField, + private val description: JsonField, + private val extendedDescription: JsonField, + private val href: JsonField, + private val immutable: JsonField, + private val projectSelector: JsonField, + private val ruleStats: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("enabled") @ExcludeMissing enabled: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("tags") @ExcludeMissing tags: JsonField> = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + @JsonProperty("avatar") @ExcludeMissing avatar: JsonField = JsonMissing.of(), + @JsonProperty("builtInSlug") + @ExcludeMissing + builtInSlug: JsonField = JsonMissing.of(), + @JsonProperty("creatorId") @ExcludeMissing creatorId: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + description: JsonField = JsonMissing.of(), + @JsonProperty("extendedDescription") + @ExcludeMissing + extendedDescription: JsonField = JsonMissing.of(), + @JsonProperty("href") @ExcludeMissing href: JsonField = JsonMissing.of(), + @JsonProperty("immutable") @ExcludeMissing immutable: JsonField = JsonMissing.of(), + @JsonProperty("projectSelector") + @ExcludeMissing + projectSelector: JsonField = JsonMissing.of(), + @JsonProperty("ruleStats") + @ExcludeMissing + ruleStats: JsonField = JsonMissing.of(), + ) : this( + id, + dateCreated, + dateUpdated, + enabled, + name, + tags, + workspaceId, + avatar, + builtInSlug, + creatorId, + description, + extendedDescription, + href, + immutable, + projectSelector, + ruleStats, + mutableMapOf(), + ) + + /** + * The framework id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun id(): String = id.getRequired("id") + + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** + * The last update date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** + * Whether the framework is active. Rules of a disabled framework are not evaluated and do not + * count towards compliance. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun enabled(): Boolean = enabled.getRequired("enabled") + + /** + * The framework name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun name(): String = name.getRequired("name") + + /** + * Free-form labels on the framework. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun tags(): List = tags.getRequired("tags") + + /** + * The id of the workspace the framework belongs to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun workspaceId(): String = workspaceId.getRequired("workspaceId") + + /** + * The icon shown for the framework. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun avatar(): Optional = avatar.getOptional("avatar") + + /** + * Identifies a framework that ships with Openlayer, for example `eu_ai_act`, `iso_42001`, + * `nist_ai_rmf`, or `traiga`. `null` for frameworks you create yourself. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun builtInSlug(): Optional = builtInSlug.getOptional("builtInSlug") + + /** + * The user who created the framework. `null` for built-in frameworks. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun creatorId(): Optional = creatorId.getOptional("creatorId") + + /** + * A short description of the framework. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun description(): Optional = description.getOptional("description") + + /** + * A longer, rich-text description, as a TipTap JSON document. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun extendedDescription(): Optional = + extendedDescription.getOptional("extendedDescription") + + /** + * A link to the external standard or regulation the framework is based on. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun href(): Optional = href.getOptional("href") + + /** + * Whether the framework definition is managed by Openlayer and cannot be edited. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun immutable(): Optional = immutable.getOptional("immutable") + + /** + * Determines which projects the framework applies to. An empty or `null` `match` array applies + * the framework to every project in the workspace. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun projectSelector(): Optional = + projectSelector.getOptional("projectSelector") + + /** + * Compliance roll-up for the framework. Present only on `GET + * /workspaces/{workspaceId}/frameworks` when the request sets `includeRuleStats=true`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun ruleStats(): Optional = ruleStats.getOptional("ruleStats") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** + * Returns the raw JSON value of [enabled]. + * + * Unlike [enabled], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("enabled") @ExcludeMissing fun _enabled(): JsonField = enabled + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [tags]. + * + * Unlike [tags], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("tags") @ExcludeMissing fun _tags(): JsonField> = tags + + /** + * Returns the raw JSON value of [workspaceId]. + * + * Unlike [workspaceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("workspaceId") @ExcludeMissing fun _workspaceId(): JsonField = workspaceId + + /** + * Returns the raw JSON value of [avatar]. + * + * Unlike [avatar], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("avatar") @ExcludeMissing fun _avatar(): JsonField = avatar + + /** + * Returns the raw JSON value of [builtInSlug]. + * + * Unlike [builtInSlug], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("builtInSlug") @ExcludeMissing fun _builtInSlug(): JsonField = builtInSlug + + /** + * Returns the raw JSON value of [creatorId]. + * + * Unlike [creatorId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("creatorId") @ExcludeMissing fun _creatorId(): JsonField = creatorId + + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description + + /** + * Returns the raw JSON value of [extendedDescription]. + * + * Unlike [extendedDescription], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("extendedDescription") + @ExcludeMissing + fun _extendedDescription(): JsonField = extendedDescription + + /** + * Returns the raw JSON value of [href]. + * + * Unlike [href], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("href") @ExcludeMissing fun _href(): JsonField = href + + /** + * Returns the raw JSON value of [immutable]. + * + * Unlike [immutable], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("immutable") @ExcludeMissing fun _immutable(): JsonField = immutable + + /** + * Returns the raw JSON value of [projectSelector]. + * + * Unlike [projectSelector], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("projectSelector") + @ExcludeMissing + fun _projectSelector(): JsonField = projectSelector + + /** + * Returns the raw JSON value of [ruleStats]. + * + * Unlike [ruleStats], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("ruleStats") @ExcludeMissing fun _ruleStats(): JsonField = ruleStats + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [FrameworkRetrieveResponse]. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateUpdated() + * .enabled() + * .name() + * .tags() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [FrameworkRetrieveResponse]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var enabled: JsonField? = null + private var name: JsonField? = null + private var tags: JsonField>? = null + private var workspaceId: JsonField? = null + private var avatar: JsonField = JsonMissing.of() + private var builtInSlug: JsonField = JsonMissing.of() + private var creatorId: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var extendedDescription: JsonField = JsonMissing.of() + private var href: JsonField = JsonMissing.of() + private var immutable: JsonField = JsonMissing.of() + private var projectSelector: JsonField = JsonMissing.of() + private var ruleStats: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(frameworkRetrieveResponse: FrameworkRetrieveResponse) = apply { + id = frameworkRetrieveResponse.id + dateCreated = frameworkRetrieveResponse.dateCreated + dateUpdated = frameworkRetrieveResponse.dateUpdated + enabled = frameworkRetrieveResponse.enabled + name = frameworkRetrieveResponse.name + tags = frameworkRetrieveResponse.tags.map { it.toMutableList() } + workspaceId = frameworkRetrieveResponse.workspaceId + avatar = frameworkRetrieveResponse.avatar + builtInSlug = frameworkRetrieveResponse.builtInSlug + creatorId = frameworkRetrieveResponse.creatorId + description = frameworkRetrieveResponse.description + extendedDescription = frameworkRetrieveResponse.extendedDescription + href = frameworkRetrieveResponse.href + immutable = frameworkRetrieveResponse.immutable + projectSelector = frameworkRetrieveResponse.projectSelector + ruleStats = frameworkRetrieveResponse.ruleStats + additionalProperties = frameworkRetrieveResponse.additionalProperties.toMutableMap() + } + + /** The framework id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The last update date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** + * Whether the framework is active. Rules of a disabled framework are not evaluated and do + * not count towards compliance. + */ + fun enabled(enabled: Boolean) = enabled(JsonField.of(enabled)) + + /** + * Sets [Builder.enabled] to an arbitrary JSON value. + * + * You should usually call [Builder.enabled] with a well-typed [Boolean] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun enabled(enabled: JsonField) = apply { this.enabled = enabled } + + /** The framework name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun name(name: JsonField) = apply { this.name = name } + + /** Free-form labels on the framework. */ + fun tags(tags: List) = tags(JsonField.of(tags)) + + /** + * Sets [Builder.tags] to an arbitrary JSON value. + * + * You should usually call [Builder.tags] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun tags(tags: JsonField>) = apply { + this.tags = tags.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [tags]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addTag(tag: String) = apply { + tags = (tags ?: JsonField.of(mutableListOf())).also { checkKnown("tags", it).add(tag) } + } + + /** The id of the workspace the framework belongs to. */ + fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) + + /** + * Sets [Builder.workspaceId] to an arbitrary JSON value. + * + * You should usually call [Builder.workspaceId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun workspaceId(workspaceId: JsonField) = apply { this.workspaceId = workspaceId } + + /** The icon shown for the framework. */ + fun avatar(avatar: Avatar?) = avatar(JsonField.ofNullable(avatar)) + + /** Alias for calling [Builder.avatar] with `avatar.orElse(null)`. */ + fun avatar(avatar: Optional) = avatar(avatar.getOrNull()) + + /** + * Sets [Builder.avatar] to an arbitrary JSON value. + * + * You should usually call [Builder.avatar] with a well-typed [Avatar] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun avatar(avatar: JsonField) = apply { this.avatar = avatar } + + /** + * Identifies a framework that ships with Openlayer, for example `eu_ai_act`, `iso_42001`, + * `nist_ai_rmf`, or `traiga`. `null` for frameworks you create yourself. + */ + fun builtInSlug(builtInSlug: String?) = builtInSlug(JsonField.ofNullable(builtInSlug)) + + /** Alias for calling [Builder.builtInSlug] with `builtInSlug.orElse(null)`. */ + fun builtInSlug(builtInSlug: Optional) = builtInSlug(builtInSlug.getOrNull()) + + /** + * Sets [Builder.builtInSlug] to an arbitrary JSON value. + * + * You should usually call [Builder.builtInSlug] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun builtInSlug(builtInSlug: JsonField) = apply { this.builtInSlug = builtInSlug } + + /** The user who created the framework. `null` for built-in frameworks. */ + fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) + + /** Alias for calling [Builder.creatorId] with `creatorId.orElse(null)`. */ + fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) + + /** + * Sets [Builder.creatorId] to an arbitrary JSON value. + * + * You should usually call [Builder.creatorId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } + + /** A short description of the framework. */ + fun description(description: String?) = description(JsonField.ofNullable(description)) + + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ + fun description(description: Optional) = description(description.getOrNull()) + + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun description(description: JsonField) = apply { this.description = description } + + /** A longer, rich-text description, as a TipTap JSON document. */ + fun extendedDescription(extendedDescription: ExtendedDescription?) = + extendedDescription(JsonField.ofNullable(extendedDescription)) + + /** + * Alias for calling [Builder.extendedDescription] with `extendedDescription.orElse(null)`. + */ + fun extendedDescription(extendedDescription: Optional) = + extendedDescription(extendedDescription.getOrNull()) + + /** + * Sets [Builder.extendedDescription] to an arbitrary JSON value. + * + * You should usually call [Builder.extendedDescription] with a well-typed + * [ExtendedDescription] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun extendedDescription(extendedDescription: JsonField) = apply { + this.extendedDescription = extendedDescription + } + + /** A link to the external standard or regulation the framework is based on. */ + fun href(href: String?) = href(JsonField.ofNullable(href)) + + /** Alias for calling [Builder.href] with `href.orElse(null)`. */ + fun href(href: Optional) = href(href.getOrNull()) + + /** + * Sets [Builder.href] to an arbitrary JSON value. + * + * You should usually call [Builder.href] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun href(href: JsonField) = apply { this.href = href } + + /** Whether the framework definition is managed by Openlayer and cannot be edited. */ + fun immutable(immutable: Boolean) = immutable(JsonField.of(immutable)) + + /** + * Sets [Builder.immutable] to an arbitrary JSON value. + * + * You should usually call [Builder.immutable] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun immutable(immutable: JsonField) = apply { this.immutable = immutable } + + /** + * Determines which projects the framework applies to. An empty or `null` `match` array + * applies the framework to every project in the workspace. + */ + fun projectSelector(projectSelector: ProjectSelector?) = + projectSelector(JsonField.ofNullable(projectSelector)) + + /** Alias for calling [Builder.projectSelector] with `projectSelector.orElse(null)`. */ + fun projectSelector(projectSelector: Optional) = + projectSelector(projectSelector.getOrNull()) + + /** + * Sets [Builder.projectSelector] to an arbitrary JSON value. + * + * You should usually call [Builder.projectSelector] with a well-typed [ProjectSelector] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun projectSelector(projectSelector: JsonField) = apply { + this.projectSelector = projectSelector + } + + /** + * Compliance roll-up for the framework. Present only on `GET + * /workspaces/{workspaceId}/frameworks` when the request sets `includeRuleStats=true`. + */ + fun ruleStats(ruleStats: RuleStats) = ruleStats(JsonField.of(ruleStats)) + + /** + * Sets [Builder.ruleStats] to an arbitrary JSON value. + * + * You should usually call [Builder.ruleStats] with a well-typed [RuleStats] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun ruleStats(ruleStats: JsonField) = apply { this.ruleStats = ruleStats } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [FrameworkRetrieveResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateUpdated() + * .enabled() + * .name() + * .tags() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): FrameworkRetrieveResponse = + FrameworkRetrieveResponse( + checkRequired("id", id), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("enabled", enabled), + checkRequired("name", name), + checkRequired("tags", tags).map { it.toImmutable() }, + checkRequired("workspaceId", workspaceId), + avatar, + builtInSlug, + creatorId, + description, + extendedDescription, + href, + immutable, + projectSelector, + ruleStats, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): FrameworkRetrieveResponse = apply { + if (validated) { + return@apply + } + + id() + dateCreated() + dateUpdated() + enabled() + name() + tags() + workspaceId() + avatar().ifPresent { it.validate() } + builtInSlug() + creatorId() + description() + extendedDescription().ifPresent { it.validate() } + href() + immutable() + projectSelector().ifPresent { it.validate() } + ruleStats().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (enabled.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (tags.asKnown().getOrNull()?.size ?: 0) + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + (avatar.asKnown().getOrNull()?.validity() ?: 0) + + (if (builtInSlug.asKnown().isPresent) 1 else 0) + + (if (creatorId.asKnown().isPresent) 1 else 0) + + (if (description.asKnown().isPresent) 1 else 0) + + (extendedDescription.asKnown().getOrNull()?.validity() ?: 0) + + (if (href.asKnown().isPresent) 1 else 0) + + (if (immutable.asKnown().isPresent) 1 else 0) + + (projectSelector.asKnown().getOrNull()?.validity() ?: 0) + + (ruleStats.asKnown().getOrNull()?.validity() ?: 0) + + /** The icon shown for the framework. */ + class Avatar + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val type: JsonField, + private val value: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("value") @ExcludeMissing value: JsonField = JsonMissing.of(), + ) : this(type, value, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun type(): Type = type.getRequired("type") + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun value(): String = value.getRequired("value") + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + /** + * Returns the raw JSON value of [value]. + * + * Unlike [value], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Avatar]. + * + * The following fields are required: + * ```java + * .type() + * .value() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Avatar]. */ + class Builder internal constructor() { + + private var type: JsonField? = null + private var value: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(avatar: Avatar) = apply { + type = avatar.type + value = avatar.value + additionalProperties = avatar.additionalProperties.toMutableMap() + } + + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun type(type: JsonField) = apply { this.type = type } + + fun value(value: String) = value(JsonField.of(value)) + + /** + * Sets [Builder.value] to an arbitrary JSON value. + * + * You should usually call [Builder.value] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun value(value: JsonField) = apply { this.value = value } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Avatar]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .type() + * .value() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Avatar = + Avatar( + checkRequired("type", type), + checkRequired("value", value), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Avatar = apply { + if (validated) { + return@apply + } + + type().validate() + value() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (type.asKnown().getOrNull()?.validity() ?: 0) + + (if (value.asKnown().isPresent) 1 else 0) + + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val EMOJI = of("emoji") + + @JvmField val IMAGE_URL = of("imageUrl") + + @JvmField val BUILTIN_IMAGE = of("builtinImage") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + EMOJI, + IMAGE_URL, + BUILTIN_IMAGE, + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + EMOJI, + IMAGE_URL, + BUILTIN_IMAGE, + /** An enum member indicating that [Type] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + EMOJI -> Value.EMOJI + IMAGE_URL -> Value.IMAGE_URL + BUILTIN_IMAGE -> Value.BUILTIN_IMAGE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + EMOJI -> Known.EMOJI + IMAGE_URL -> Known.IMAGE_URL + BUILTIN_IMAGE -> Known.BUILTIN_IMAGE + else -> throw OpenlayerInvalidDataException("Unknown Type: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Avatar && + type == other.type && + value == other.value && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(type, value, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Avatar{type=$type, value=$value, additionalProperties=$additionalProperties}" + } + + /** A longer, rich-text description, as a TipTap JSON document. */ + class ExtendedDescription + @JsonCreator + private constructor( + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [ExtendedDescription]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ExtendedDescription]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(extendedDescription: ExtendedDescription) = apply { + additionalProperties = extendedDescription.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ExtendedDescription]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): ExtendedDescription = + ExtendedDescription(additionalProperties.toImmutable()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): ExtendedDescription = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ExtendedDescription && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = "ExtendedDescription{additionalProperties=$additionalProperties}" + } + + /** + * Determines which projects the framework applies to. An empty or `null` `match` array applies + * the framework to every project in the workspace. + */ + class ProjectSelector + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val match: JsonField>, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("match") @ExcludeMissing match: JsonField> = JsonMissing.of() + ) : this(match, mutableMapOf()) + + /** + * Match criteria, ANDed together. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun match(): Optional> = match.getOptional("match") + + /** + * Returns the raw JSON value of [match]. + * + * Unlike [match], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("match") @ExcludeMissing fun _match(): JsonField> = match + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [ProjectSelector]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ProjectSelector]. */ + class Builder internal constructor() { + + private var match: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(projectSelector: ProjectSelector) = apply { + match = projectSelector.match.map { it.toMutableList() } + additionalProperties = projectSelector.additionalProperties.toMutableMap() + } + + /** Match criteria, ANDed together. */ + fun match(match: List?) = match(JsonField.ofNullable(match)) + + /** Alias for calling [Builder.match] with `match.orElse(null)`. */ + fun match(match: Optional>) = match(match.getOrNull()) + + /** + * Sets [Builder.match] to an arbitrary JSON value. + * + * You should usually call [Builder.match] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun match(match: JsonField>) = apply { + this.match = match.map { it.toMutableList() } + } + + /** + * Adds a single [Match] to [Builder.match]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addMatch(match: Match) = apply { + this.match = + (this.match ?: JsonField.of(mutableListOf())).also { + checkKnown("match", it).add(match) + } + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ProjectSelector]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): ProjectSelector = + ProjectSelector( + (match ?: JsonMissing.of()).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): ProjectSelector = apply { + if (validated) { + return@apply + } + + match().ifPresent { it.forEach { it.validate() } } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (match.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + class Match + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val property: JsonField, + private val value: JsonValue, + private val operator: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("property") + @ExcludeMissing + property: JsonField = JsonMissing.of(), + @JsonProperty("value") @ExcludeMissing value: JsonValue = JsonMissing.of(), + @JsonProperty("operator") + @ExcludeMissing + operator: JsonField = JsonMissing.of(), + ) : this(property, value, operator, mutableMapOf()) + + /** + * The project property to match against. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun property(): Property = property.getRequired("property") + + /** + * The value to match against. Pass an array to match any of several values, or `null` + * to match projects where the property is unset. Omit it for `exists` and `notExists`. + * + * This arbitrary value can be deserialized into a custom type using the `convert` + * method: + * ```java + * MyClass myObject = match.value().convert(MyClass.class); + * ``` + */ + @JsonProperty("value") @ExcludeMissing fun _value(): JsonValue = value + + /** + * How to compare the project property with `value`. One of `equals`, `notEquals`, + * `contains`, `notContains`, `startsWith`, `endsWith`, `in`, `notIn`, `greaterThan`, + * `greaterThanOrEqual`, `lessThan`, `lessThanOrEqual`, `equalsIgnoreCase`, + * `containsIgnoreCase`, `matches`, `exists`, or `notExists`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun operator(): Optional = operator.getOptional("operator") + + /** + * Returns the raw JSON value of [property]. + * + * Unlike [property], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("property") + @ExcludeMissing + fun _property(): JsonField = property + + /** + * Returns the raw JSON value of [operator]. + * + * Unlike [operator], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("operator") @ExcludeMissing fun _operator(): JsonField = operator + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Match]. + * + * The following fields are required: + * ```java + * .property() + * .value() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Match]. */ + class Builder internal constructor() { + + private var property: JsonField? = null + private var value: JsonValue? = null + private var operator: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(match: Match) = apply { + property = match.property + value = match.value + operator = match.operator + additionalProperties = match.additionalProperties.toMutableMap() + } + + /** The project property to match against. */ + fun property(property: Property) = property(JsonField.of(property)) + + /** + * Sets [Builder.property] to an arbitrary JSON value. + * + * You should usually call [Builder.property] with a well-typed [Property] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun property(property: JsonField) = apply { this.property = property } + + /** + * The value to match against. Pass an array to match any of several values, or + * `null` to match projects where the property is unset. Omit it for `exists` and + * `notExists`. + */ + fun value(value: JsonValue) = apply { this.value = value } + + /** + * How to compare the project property with `value`. One of `equals`, `notEquals`, + * `contains`, `notContains`, `startsWith`, `endsWith`, `in`, `notIn`, + * `greaterThan`, `greaterThanOrEqual`, `lessThan`, `lessThanOrEqual`, + * `equalsIgnoreCase`, `containsIgnoreCase`, `matches`, `exists`, or `notExists`. + */ + fun operator(operator: String) = operator(JsonField.of(operator)) + + /** + * Sets [Builder.operator] to an arbitrary JSON value. + * + * You should usually call [Builder.operator] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun operator(operator: JsonField) = apply { this.operator = operator } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Match]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .property() + * .value() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Match = + Match( + checkRequired("property", property), + checkRequired("value", value), + operator, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Match = apply { + if (validated) { + return@apply + } + + property().validate() + operator() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (property.asKnown().getOrNull()?.validity() ?: 0) + + (if (operator.asKnown().isPresent) 1 else 0) + + /** The project property to match against. */ + class Property @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val TASK_TYPE = of("taskType") + + @JvmField val RISK_LEVEL = of("riskLevel") + + @JvmField val RISK_TOTAL_SCORE = of("riskTotalScore") + + @JvmField val NAME = of("name") + + @JvmField val OWNER_ID = of("ownerId") + + @JvmField val MODEL_TYPES = of("modelTypes") + + @JvmStatic fun of(value: String) = Property(JsonField.of(value)) + } + + /** An enum containing [Property]'s known values. */ + enum class Known { + TASK_TYPE, + RISK_LEVEL, + RISK_TOTAL_SCORE, + NAME, + OWNER_ID, + MODEL_TYPES, + } + + /** + * An enum containing [Property]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Property] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + TASK_TYPE, + RISK_LEVEL, + RISK_TOTAL_SCORE, + NAME, + OWNER_ID, + MODEL_TYPES, + /** + * An enum member indicating that [Property] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + TASK_TYPE -> Value.TASK_TYPE + RISK_LEVEL -> Value.RISK_LEVEL + RISK_TOTAL_SCORE -> Value.RISK_TOTAL_SCORE + NAME -> Value.NAME + OWNER_ID -> Value.OWNER_ID + MODEL_TYPES -> Value.MODEL_TYPES + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + TASK_TYPE -> Known.TASK_TYPE + RISK_LEVEL -> Known.RISK_LEVEL + RISK_TOTAL_SCORE -> Known.RISK_TOTAL_SCORE + NAME -> Known.NAME + OWNER_ID -> Known.OWNER_ID + MODEL_TYPES -> Known.MODEL_TYPES + else -> throw OpenlayerInvalidDataException("Unknown Property: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): Property = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Property && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Match && + property == other.property && + value == other.value && + operator == other.operator && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(property, value, operator, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Match{property=$property, value=$value, operator=$operator, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ProjectSelector && + match == other.match && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(match, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ProjectSelector{match=$match, additionalProperties=$additionalProperties}" + } + + /** + * Compliance roll-up for the framework. Present only on `GET + * /workspaces/{workspaceId}/frameworks` when the request sets `includeRuleStats=true`. + */ + class RuleStats + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val projectCompletion: JsonField, + private val ruleResults: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("projectCompletion") + @ExcludeMissing + projectCompletion: JsonField = JsonMissing.of(), + @JsonProperty("ruleResults") + @ExcludeMissing + ruleResults: JsonField = JsonMissing.of(), + ) : this(projectCompletion, ruleResults, mutableMapOf()) + + /** + * How many of the framework's projects fall into each completion band, where a project's + * completion is the share of its rule results that are passing or skipped. Projects with no + * evaluated results count as `low`. + * + * Zeroed when the request carries `projectId`: the bands compare a framework's projects + * against each other, which says nothing about a single project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun projectCompletion(): ProjectCompletion = + projectCompletion.getRequired("projectCompletion") + + /** + * Rule result counts by status for this framework, matching what + * `/workspaces/{workspaceId}/rule-stats?frameworkId=` reports. Narrowed to a single + * project when the request also carries `projectId`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun ruleResults(): RuleResults = ruleResults.getRequired("ruleResults") + + /** + * Returns the raw JSON value of [projectCompletion]. + * + * Unlike [projectCompletion], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("projectCompletion") + @ExcludeMissing + fun _projectCompletion(): JsonField = projectCompletion + + /** + * Returns the raw JSON value of [ruleResults]. + * + * Unlike [ruleResults], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("ruleResults") + @ExcludeMissing + fun _ruleResults(): JsonField = ruleResults + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [RuleStats]. + * + * The following fields are required: + * ```java + * .projectCompletion() + * .ruleResults() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [RuleStats]. */ + class Builder internal constructor() { + + private var projectCompletion: JsonField? = null + private var ruleResults: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(ruleStats: RuleStats) = apply { + projectCompletion = ruleStats.projectCompletion + ruleResults = ruleStats.ruleResults + additionalProperties = ruleStats.additionalProperties.toMutableMap() + } + + /** + * How many of the framework's projects fall into each completion band, where a + * project's completion is the share of its rule results that are passing or skipped. + * Projects with no evaluated results count as `low`. + * + * Zeroed when the request carries `projectId`: the bands compare a framework's projects + * against each other, which says nothing about a single project. + */ + fun projectCompletion(projectCompletion: ProjectCompletion) = + projectCompletion(JsonField.of(projectCompletion)) + + /** + * Sets [Builder.projectCompletion] to an arbitrary JSON value. + * + * You should usually call [Builder.projectCompletion] with a well-typed + * [ProjectCompletion] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun projectCompletion(projectCompletion: JsonField) = apply { + this.projectCompletion = projectCompletion + } + + /** + * Rule result counts by status for this framework, matching what + * `/workspaces/{workspaceId}/rule-stats?frameworkId=` reports. Narrowed to a single + * project when the request also carries `projectId`. + */ + fun ruleResults(ruleResults: RuleResults) = ruleResults(JsonField.of(ruleResults)) + + /** + * Sets [Builder.ruleResults] to an arbitrary JSON value. + * + * You should usually call [Builder.ruleResults] with a well-typed [RuleResults] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun ruleResults(ruleResults: JsonField) = apply { + this.ruleResults = ruleResults + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [RuleStats]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .projectCompletion() + * .ruleResults() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): RuleStats = + RuleStats( + checkRequired("projectCompletion", projectCompletion), + checkRequired("ruleResults", ruleResults), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): RuleStats = apply { + if (validated) { + return@apply + } + + projectCompletion().validate() + ruleResults().validate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (projectCompletion.asKnown().getOrNull()?.validity() ?: 0) + + (ruleResults.asKnown().getOrNull()?.validity() ?: 0) + + /** + * How many of the framework's projects fall into each completion band, where a project's + * completion is the share of its rule results that are passing or skipped. Projects with no + * evaluated results count as `low`. + * + * Zeroed when the request carries `projectId`: the bands compare a framework's projects + * against each other, which says nothing about a single project. + */ + class ProjectCompletion + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val high: JsonField, + private val low: JsonField, + private val mid: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("high") @ExcludeMissing high: JsonField = JsonMissing.of(), + @JsonProperty("low") @ExcludeMissing low: JsonField = JsonMissing.of(), + @JsonProperty("mid") @ExcludeMissing mid: JsonField = JsonMissing.of(), + ) : this(high, low, mid, mutableMapOf()) + + /** + * Projects at 80% completion or above. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun high(): Long = high.getRequired("high") + + /** + * Projects below 20% completion. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun low(): Long = low.getRequired("low") + + /** + * Projects at or above 20% but below 80% completion. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun mid(): Long = mid.getRequired("mid") + + /** + * Returns the raw JSON value of [high]. + * + * Unlike [high], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("high") @ExcludeMissing fun _high(): JsonField = high + + /** + * Returns the raw JSON value of [low]. + * + * Unlike [low], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("low") @ExcludeMissing fun _low(): JsonField = low + + /** + * Returns the raw JSON value of [mid]. + * + * Unlike [mid], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("mid") @ExcludeMissing fun _mid(): JsonField = mid + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [ProjectCompletion]. + * + * The following fields are required: + * ```java + * .high() + * .low() + * .mid() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ProjectCompletion]. */ + class Builder internal constructor() { + + private var high: JsonField? = null + private var low: JsonField? = null + private var mid: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(projectCompletion: ProjectCompletion) = apply { + high = projectCompletion.high + low = projectCompletion.low + mid = projectCompletion.mid + additionalProperties = projectCompletion.additionalProperties.toMutableMap() + } + + /** Projects at 80% completion or above. */ + fun high(high: Long) = high(JsonField.of(high)) + + /** + * Sets [Builder.high] to an arbitrary JSON value. + * + * You should usually call [Builder.high] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun high(high: JsonField) = apply { this.high = high } + + /** Projects below 20% completion. */ + fun low(low: Long) = low(JsonField.of(low)) + + /** + * Sets [Builder.low] to an arbitrary JSON value. + * + * You should usually call [Builder.low] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun low(low: JsonField) = apply { this.low = low } + + /** Projects at or above 20% but below 80% completion. */ + fun mid(mid: Long) = mid(JsonField.of(mid)) + + /** + * Sets [Builder.mid] to an arbitrary JSON value. + * + * You should usually call [Builder.mid] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun mid(mid: JsonField) = apply { this.mid = mid } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ProjectCompletion]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .high() + * .low() + * .mid() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): ProjectCompletion = + ProjectCompletion( + checkRequired("high", high), + checkRequired("low", low), + checkRequired("mid", mid), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): ProjectCompletion = apply { + if (validated) { + return@apply + } + + high() + low() + mid() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (high.asKnown().isPresent) 1 else 0) + + (if (low.asKnown().isPresent) 1 else 0) + + (if (mid.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ProjectCompletion && + high == other.high && + low == other.low && + mid == other.mid && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(high, low, mid, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ProjectCompletion{high=$high, low=$low, mid=$mid, additionalProperties=$additionalProperties}" + } + + /** + * Rule result counts by status for this framework, matching what + * `/workspaces/{workspaceId}/rule-stats?frameworkId=` reports. Narrowed to a single + * project when the request also carries `projectId`. + */ + class RuleResults + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val total: JsonField, + private val totalDueSoon: JsonField, + private val totalError: JsonField, + private val totalFailing: JsonField, + private val totalPassing: JsonField, + private val totalPending: JsonField, + private val totalRunning: JsonField, + private val totalSkipped: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("total") @ExcludeMissing total: JsonField = JsonMissing.of(), + @JsonProperty("totalDueSoon") + @ExcludeMissing + totalDueSoon: JsonField = JsonMissing.of(), + @JsonProperty("totalError") + @ExcludeMissing + totalError: JsonField = JsonMissing.of(), + @JsonProperty("totalFailing") + @ExcludeMissing + totalFailing: JsonField = JsonMissing.of(), + @JsonProperty("totalPassing") + @ExcludeMissing + totalPassing: JsonField = JsonMissing.of(), + @JsonProperty("totalPending") + @ExcludeMissing + totalPending: JsonField = JsonMissing.of(), + @JsonProperty("totalRunning") + @ExcludeMissing + totalRunning: JsonField = JsonMissing.of(), + @JsonProperty("totalSkipped") + @ExcludeMissing + totalSkipped: JsonField = JsonMissing.of(), + ) : this( + total, + totalDueSoon, + totalError, + totalFailing, + totalPassing, + totalPending, + totalRunning, + totalSkipped, + mutableMapOf(), + ) + + /** + * The total number of rule results. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun total(): Long = total.getRequired("total") + + /** + * The number of rule results whose evidence is about to expire. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun totalDueSoon(): Long = totalDueSoon.getRequired("totalDueSoon") + + /** + * The number of rule results that errored during evaluation. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun totalError(): Long = totalError.getRequired("totalError") + + /** + * The number of failing rule results. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun totalFailing(): Long = totalFailing.getRequired("totalFailing") + + /** + * The number of passing rule results. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun totalPassing(): Long = totalPassing.getRequired("totalPassing") + + /** + * The number of rule results that have not been satisfied yet. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun totalPending(): Long = totalPending.getRequired("totalPending") + + /** + * The number of rule results currently being evaluated. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun totalRunning(): Long = totalRunning.getRequired("totalRunning") + + /** + * The number of skipped rule results. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun totalSkipped(): Long = totalSkipped.getRequired("totalSkipped") + + /** + * Returns the raw JSON value of [total]. + * + * Unlike [total], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("total") @ExcludeMissing fun _total(): JsonField = total + + /** + * Returns the raw JSON value of [totalDueSoon]. + * + * Unlike [totalDueSoon], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("totalDueSoon") + @ExcludeMissing + fun _totalDueSoon(): JsonField = totalDueSoon + + /** + * Returns the raw JSON value of [totalError]. + * + * Unlike [totalError], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("totalError") + @ExcludeMissing + fun _totalError(): JsonField = totalError + + /** + * Returns the raw JSON value of [totalFailing]. + * + * Unlike [totalFailing], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("totalFailing") + @ExcludeMissing + fun _totalFailing(): JsonField = totalFailing + + /** + * Returns the raw JSON value of [totalPassing]. + * + * Unlike [totalPassing], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("totalPassing") + @ExcludeMissing + fun _totalPassing(): JsonField = totalPassing + + /** + * Returns the raw JSON value of [totalPending]. + * + * Unlike [totalPending], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("totalPending") + @ExcludeMissing + fun _totalPending(): JsonField = totalPending + + /** + * Returns the raw JSON value of [totalRunning]. + * + * Unlike [totalRunning], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("totalRunning") + @ExcludeMissing + fun _totalRunning(): JsonField = totalRunning + + /** + * Returns the raw JSON value of [totalSkipped]. + * + * Unlike [totalSkipped], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("totalSkipped") + @ExcludeMissing + fun _totalSkipped(): JsonField = totalSkipped + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [RuleResults]. + * + * The following fields are required: + * ```java + * .total() + * .totalDueSoon() + * .totalError() + * .totalFailing() + * .totalPassing() + * .totalPending() + * .totalRunning() + * .totalSkipped() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [RuleResults]. */ + class Builder internal constructor() { + + private var total: JsonField? = null + private var totalDueSoon: JsonField? = null + private var totalError: JsonField? = null + private var totalFailing: JsonField? = null + private var totalPassing: JsonField? = null + private var totalPending: JsonField? = null + private var totalRunning: JsonField? = null + private var totalSkipped: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(ruleResults: RuleResults) = apply { + total = ruleResults.total + totalDueSoon = ruleResults.totalDueSoon + totalError = ruleResults.totalError + totalFailing = ruleResults.totalFailing + totalPassing = ruleResults.totalPassing + totalPending = ruleResults.totalPending + totalRunning = ruleResults.totalRunning + totalSkipped = ruleResults.totalSkipped + additionalProperties = ruleResults.additionalProperties.toMutableMap() + } + + /** The total number of rule results. */ + fun total(total: Long) = total(JsonField.of(total)) + + /** + * Sets [Builder.total] to an arbitrary JSON value. + * + * You should usually call [Builder.total] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun total(total: JsonField) = apply { this.total = total } + + /** The number of rule results whose evidence is about to expire. */ + fun totalDueSoon(totalDueSoon: Long) = totalDueSoon(JsonField.of(totalDueSoon)) + + /** + * Sets [Builder.totalDueSoon] to an arbitrary JSON value. + * + * You should usually call [Builder.totalDueSoon] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun totalDueSoon(totalDueSoon: JsonField) = apply { + this.totalDueSoon = totalDueSoon + } + + /** The number of rule results that errored during evaluation. */ + fun totalError(totalError: Long) = totalError(JsonField.of(totalError)) + + /** + * Sets [Builder.totalError] to an arbitrary JSON value. + * + * You should usually call [Builder.totalError] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun totalError(totalError: JsonField) = apply { this.totalError = totalError } + + /** The number of failing rule results. */ + fun totalFailing(totalFailing: Long) = totalFailing(JsonField.of(totalFailing)) + + /** + * Sets [Builder.totalFailing] to an arbitrary JSON value. + * + * You should usually call [Builder.totalFailing] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun totalFailing(totalFailing: JsonField) = apply { + this.totalFailing = totalFailing + } + + /** The number of passing rule results. */ + fun totalPassing(totalPassing: Long) = totalPassing(JsonField.of(totalPassing)) + + /** + * Sets [Builder.totalPassing] to an arbitrary JSON value. + * + * You should usually call [Builder.totalPassing] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun totalPassing(totalPassing: JsonField) = apply { + this.totalPassing = totalPassing + } + + /** The number of rule results that have not been satisfied yet. */ + fun totalPending(totalPending: Long) = totalPending(JsonField.of(totalPending)) + + /** + * Sets [Builder.totalPending] to an arbitrary JSON value. + * + * You should usually call [Builder.totalPending] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun totalPending(totalPending: JsonField) = apply { + this.totalPending = totalPending + } + + /** The number of rule results currently being evaluated. */ + fun totalRunning(totalRunning: Long) = totalRunning(JsonField.of(totalRunning)) + + /** + * Sets [Builder.totalRunning] to an arbitrary JSON value. + * + * You should usually call [Builder.totalRunning] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun totalRunning(totalRunning: JsonField) = apply { + this.totalRunning = totalRunning + } + + /** The number of skipped rule results. */ + fun totalSkipped(totalSkipped: Long) = totalSkipped(JsonField.of(totalSkipped)) + + /** + * Sets [Builder.totalSkipped] to an arbitrary JSON value. + * + * You should usually call [Builder.totalSkipped] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun totalSkipped(totalSkipped: JsonField) = apply { + this.totalSkipped = totalSkipped + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [RuleResults]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .total() + * .totalDueSoon() + * .totalError() + * .totalFailing() + * .totalPassing() + * .totalPending() + * .totalRunning() + * .totalSkipped() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): RuleResults = + RuleResults( + checkRequired("total", total), + checkRequired("totalDueSoon", totalDueSoon), + checkRequired("totalError", totalError), + checkRequired("totalFailing", totalFailing), + checkRequired("totalPassing", totalPassing), + checkRequired("totalPending", totalPending), + checkRequired("totalRunning", totalRunning), + checkRequired("totalSkipped", totalSkipped), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): RuleResults = apply { + if (validated) { + return@apply + } + + total() + totalDueSoon() + totalError() + totalFailing() + totalPassing() + totalPending() + totalRunning() + totalSkipped() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (total.asKnown().isPresent) 1 else 0) + + (if (totalDueSoon.asKnown().isPresent) 1 else 0) + + (if (totalError.asKnown().isPresent) 1 else 0) + + (if (totalFailing.asKnown().isPresent) 1 else 0) + + (if (totalPassing.asKnown().isPresent) 1 else 0) + + (if (totalPending.asKnown().isPresent) 1 else 0) + + (if (totalRunning.asKnown().isPresent) 1 else 0) + + (if (totalSkipped.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is RuleResults && + total == other.total && + totalDueSoon == other.totalDueSoon && + totalError == other.totalError && + totalFailing == other.totalFailing && + totalPassing == other.totalPassing && + totalPending == other.totalPending && + totalRunning == other.totalRunning && + totalSkipped == other.totalSkipped && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + total, + totalDueSoon, + totalError, + totalFailing, + totalPassing, + totalPending, + totalRunning, + totalSkipped, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "RuleResults{total=$total, totalDueSoon=$totalDueSoon, totalError=$totalError, totalFailing=$totalFailing, totalPassing=$totalPassing, totalPending=$totalPending, totalRunning=$totalRunning, totalSkipped=$totalSkipped, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is RuleStats && + projectCompletion == other.projectCompletion && + ruleResults == other.ruleResults && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(projectCompletion, ruleResults, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "RuleStats{projectCompletion=$projectCompletion, ruleResults=$ruleResults, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is FrameworkRetrieveResponse && + id == other.id && + dateCreated == other.dateCreated && + dateUpdated == other.dateUpdated && + enabled == other.enabled && + name == other.name && + tags == other.tags && + workspaceId == other.workspaceId && + avatar == other.avatar && + builtInSlug == other.builtInSlug && + creatorId == other.creatorId && + description == other.description && + extendedDescription == other.extendedDescription && + href == other.href && + immutable == other.immutable && + projectSelector == other.projectSelector && + ruleStats == other.ruleStats && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + dateCreated, + dateUpdated, + enabled, + name, + tags, + workspaceId, + avatar, + builtInSlug, + creatorId, + description, + extendedDescription, + href, + immutable, + projectSelector, + ruleStats, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "FrameworkRetrieveResponse{id=$id, dateCreated=$dateCreated, dateUpdated=$dateUpdated, enabled=$enabled, name=$name, tags=$tags, workspaceId=$workspaceId, avatar=$avatar, builtInSlug=$builtInSlug, creatorId=$creatorId, description=$description, extendedDescription=$extendedDescription, href=$href, immutable=$immutable, projectSelector=$projectSelector, ruleStats=$ruleStats, additionalProperties=$additionalProperties}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkUpdateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkUpdateParams.kt new file mode 100644 index 00000000..232488f3 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkUpdateParams.kt @@ -0,0 +1,2056 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.frameworks + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.openlayer.api.core.Enum +import com.openlayer.api.core.ExcludeMissing +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonMissing +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.Params +import com.openlayer.api.core.checkKnown +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.http.Headers +import com.openlayer.api.core.http.QueryParams +import com.openlayer.api.core.toImmutable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * Update a governance framework. + * + * The most common use is activating or deactivating a framework for the workspace by setting + * `enabled`. Rules of a disabled framework are not evaluated and do not count towards compliance. + * + * Frameworks that ship with Openlayer report `immutable: true`. For those, only `enabled`, `tags`, + * and `projectSelector` can be changed -- their name and definition are managed by Openlayer. + * + * Only the fields you send are changed. + */ +class FrameworkUpdateParams +private constructor( + private val frameworkId: String?, + private val body: Body, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun frameworkId(): Optional = Optional.ofNullable(frameworkId) + + /** + * The icon shown for the framework. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun avatar(): Optional = body.avatar() + + /** + * A short description of the framework. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun description(): Optional = body.description() + + /** + * Whether the framework is active. Rules of a disabled framework are not evaluated and do not + * count towards compliance. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun enabled(): Optional = body.enabled() + + /** + * A longer, rich-text description, as a TipTap JSON document. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun extendedDescription(): Optional = body.extendedDescription() + + /** + * A link to the external standard or regulation the framework is based on. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun href(): Optional = body.href() + + /** + * The framework name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun name(): Optional = body.name() + + /** + * Determines which projects the framework applies to. An empty or `null` `match` array applies + * the framework to every project in the workspace. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun projectSelector(): Optional = body.projectSelector() + + /** + * Free-form labels on the framework. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun tags(): Optional> = body.tags() + + /** + * Returns the raw JSON value of [avatar]. + * + * Unlike [avatar], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _avatar(): JsonField = body._avatar() + + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _description(): JsonField = body._description() + + /** + * Returns the raw JSON value of [enabled]. + * + * Unlike [enabled], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _enabled(): JsonField = body._enabled() + + /** + * Returns the raw JSON value of [extendedDescription]. + * + * Unlike [extendedDescription], this method doesn't throw if the JSON field has an unexpected + * type. + */ + fun _extendedDescription(): JsonField = body._extendedDescription() + + /** + * Returns the raw JSON value of [href]. + * + * Unlike [href], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _href(): JsonField = body._href() + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _name(): JsonField = body._name() + + /** + * Returns the raw JSON value of [projectSelector]. + * + * Unlike [projectSelector], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _projectSelector(): JsonField = body._projectSelector() + + /** + * Returns the raw JSON value of [tags]. + * + * Unlike [tags], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _tags(): JsonField> = body._tags() + + fun _additionalBodyProperties(): Map = body._additionalProperties() + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): FrameworkUpdateParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [FrameworkUpdateParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [FrameworkUpdateParams]. */ + class Builder internal constructor() { + + private var frameworkId: String? = null + private var body: Body.Builder = Body.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(frameworkUpdateParams: FrameworkUpdateParams) = apply { + frameworkId = frameworkUpdateParams.frameworkId + body = frameworkUpdateParams.body.toBuilder() + additionalHeaders = frameworkUpdateParams.additionalHeaders.toBuilder() + additionalQueryParams = frameworkUpdateParams.additionalQueryParams.toBuilder() + } + + fun frameworkId(frameworkId: String?) = apply { this.frameworkId = frameworkId } + + /** Alias for calling [Builder.frameworkId] with `frameworkId.orElse(null)`. */ + fun frameworkId(frameworkId: Optional) = frameworkId(frameworkId.getOrNull()) + + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [avatar] + * - [description] + * - [enabled] + * - [extendedDescription] + * - [href] + * - etc. + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + + /** The icon shown for the framework. */ + fun avatar(avatar: Avatar?) = apply { body.avatar(avatar) } + + /** Alias for calling [Builder.avatar] with `avatar.orElse(null)`. */ + fun avatar(avatar: Optional) = avatar(avatar.getOrNull()) + + /** + * Sets [Builder.avatar] to an arbitrary JSON value. + * + * You should usually call [Builder.avatar] with a well-typed [Avatar] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun avatar(avatar: JsonField) = apply { body.avatar(avatar) } + + /** A short description of the framework. */ + fun description(description: String?) = apply { body.description(description) } + + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ + fun description(description: Optional) = description(description.getOrNull()) + + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun description(description: JsonField) = apply { body.description(description) } + + /** + * Whether the framework is active. Rules of a disabled framework are not evaluated and do + * not count towards compliance. + */ + fun enabled(enabled: Boolean) = apply { body.enabled(enabled) } + + /** + * Sets [Builder.enabled] to an arbitrary JSON value. + * + * You should usually call [Builder.enabled] with a well-typed [Boolean] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun enabled(enabled: JsonField) = apply { body.enabled(enabled) } + + /** A longer, rich-text description, as a TipTap JSON document. */ + fun extendedDescription(extendedDescription: ExtendedDescription?) = apply { + body.extendedDescription(extendedDescription) + } + + /** + * Alias for calling [Builder.extendedDescription] with `extendedDescription.orElse(null)`. + */ + fun extendedDescription(extendedDescription: Optional) = + extendedDescription(extendedDescription.getOrNull()) + + /** + * Sets [Builder.extendedDescription] to an arbitrary JSON value. + * + * You should usually call [Builder.extendedDescription] with a well-typed + * [ExtendedDescription] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun extendedDescription(extendedDescription: JsonField) = apply { + body.extendedDescription(extendedDescription) + } + + /** A link to the external standard or regulation the framework is based on. */ + fun href(href: String?) = apply { body.href(href) } + + /** Alias for calling [Builder.href] with `href.orElse(null)`. */ + fun href(href: Optional) = href(href.getOrNull()) + + /** + * Sets [Builder.href] to an arbitrary JSON value. + * + * You should usually call [Builder.href] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun href(href: JsonField) = apply { body.href(href) } + + /** The framework name. */ + fun name(name: String) = apply { body.name(name) } + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun name(name: JsonField) = apply { body.name(name) } + + /** + * Determines which projects the framework applies to. An empty or `null` `match` array + * applies the framework to every project in the workspace. + */ + fun projectSelector(projectSelector: ProjectSelector?) = apply { + body.projectSelector(projectSelector) + } + + /** Alias for calling [Builder.projectSelector] with `projectSelector.orElse(null)`. */ + fun projectSelector(projectSelector: Optional) = + projectSelector(projectSelector.getOrNull()) + + /** + * Sets [Builder.projectSelector] to an arbitrary JSON value. + * + * You should usually call [Builder.projectSelector] with a well-typed [ProjectSelector] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun projectSelector(projectSelector: JsonField) = apply { + body.projectSelector(projectSelector) + } + + /** Free-form labels on the framework. */ + fun tags(tags: List) = apply { body.tags(tags) } + + /** + * Sets [Builder.tags] to an arbitrary JSON value. + * + * You should usually call [Builder.tags] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun tags(tags: JsonField>) = apply { body.tags(tags) } + + /** + * Adds a single [String] to [tags]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addTag(tag: String) = apply { body.addTag(tag) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [FrameworkUpdateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): FrameworkUpdateParams = + FrameworkUpdateParams( + frameworkId, + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _body(): Body = body + + fun _pathParam(index: Int): String = + when (index) { + 0 -> frameworkId ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val avatar: JsonField, + private val description: JsonField, + private val enabled: JsonField, + private val extendedDescription: JsonField, + private val href: JsonField, + private val name: JsonField, + private val projectSelector: JsonField, + private val tags: JsonField>, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("avatar") @ExcludeMissing avatar: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + description: JsonField = JsonMissing.of(), + @JsonProperty("enabled") @ExcludeMissing enabled: JsonField = JsonMissing.of(), + @JsonProperty("extendedDescription") + @ExcludeMissing + extendedDescription: JsonField = JsonMissing.of(), + @JsonProperty("href") @ExcludeMissing href: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("projectSelector") + @ExcludeMissing + projectSelector: JsonField = JsonMissing.of(), + @JsonProperty("tags") @ExcludeMissing tags: JsonField> = JsonMissing.of(), + ) : this( + avatar, + description, + enabled, + extendedDescription, + href, + name, + projectSelector, + tags, + mutableMapOf(), + ) + + /** + * The icon shown for the framework. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun avatar(): Optional = avatar.getOptional("avatar") + + /** + * A short description of the framework. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun description(): Optional = description.getOptional("description") + + /** + * Whether the framework is active. Rules of a disabled framework are not evaluated and do + * not count towards compliance. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun enabled(): Optional = enabled.getOptional("enabled") + + /** + * A longer, rich-text description, as a TipTap JSON document. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun extendedDescription(): Optional = + extendedDescription.getOptional("extendedDescription") + + /** + * A link to the external standard or regulation the framework is based on. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun href(): Optional = href.getOptional("href") + + /** + * The framework name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun name(): Optional = name.getOptional("name") + + /** + * Determines which projects the framework applies to. An empty or `null` `match` array + * applies the framework to every project in the workspace. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun projectSelector(): Optional = + projectSelector.getOptional("projectSelector") + + /** + * Free-form labels on the framework. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun tags(): Optional> = tags.getOptional("tags") + + /** + * Returns the raw JSON value of [avatar]. + * + * Unlike [avatar], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("avatar") @ExcludeMissing fun _avatar(): JsonField = avatar + + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("description") + @ExcludeMissing + fun _description(): JsonField = description + + /** + * Returns the raw JSON value of [enabled]. + * + * Unlike [enabled], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("enabled") @ExcludeMissing fun _enabled(): JsonField = enabled + + /** + * Returns the raw JSON value of [extendedDescription]. + * + * Unlike [extendedDescription], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("extendedDescription") + @ExcludeMissing + fun _extendedDescription(): JsonField = extendedDescription + + /** + * Returns the raw JSON value of [href]. + * + * Unlike [href], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("href") @ExcludeMissing fun _href(): JsonField = href + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [projectSelector]. + * + * Unlike [projectSelector], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("projectSelector") + @ExcludeMissing + fun _projectSelector(): JsonField = projectSelector + + /** + * Returns the raw JSON value of [tags]. + * + * Unlike [tags], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("tags") @ExcludeMissing fun _tags(): JsonField> = tags + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Body]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var avatar: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var enabled: JsonField = JsonMissing.of() + private var extendedDescription: JsonField = JsonMissing.of() + private var href: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var projectSelector: JsonField = JsonMissing.of() + private var tags: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + avatar = body.avatar + description = body.description + enabled = body.enabled + extendedDescription = body.extendedDescription + href = body.href + name = body.name + projectSelector = body.projectSelector + tags = body.tags.map { it.toMutableList() } + additionalProperties = body.additionalProperties.toMutableMap() + } + + /** The icon shown for the framework. */ + fun avatar(avatar: Avatar?) = avatar(JsonField.ofNullable(avatar)) + + /** Alias for calling [Builder.avatar] with `avatar.orElse(null)`. */ + fun avatar(avatar: Optional) = avatar(avatar.getOrNull()) + + /** + * Sets [Builder.avatar] to an arbitrary JSON value. + * + * You should usually call [Builder.avatar] with a well-typed [Avatar] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun avatar(avatar: JsonField) = apply { this.avatar = avatar } + + /** A short description of the framework. */ + fun description(description: String?) = description(JsonField.ofNullable(description)) + + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ + fun description(description: Optional) = description(description.getOrNull()) + + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun description(description: JsonField) = apply { + this.description = description + } + + /** + * Whether the framework is active. Rules of a disabled framework are not evaluated and + * do not count towards compliance. + */ + fun enabled(enabled: Boolean) = enabled(JsonField.of(enabled)) + + /** + * Sets [Builder.enabled] to an arbitrary JSON value. + * + * You should usually call [Builder.enabled] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun enabled(enabled: JsonField) = apply { this.enabled = enabled } + + /** A longer, rich-text description, as a TipTap JSON document. */ + fun extendedDescription(extendedDescription: ExtendedDescription?) = + extendedDescription(JsonField.ofNullable(extendedDescription)) + + /** + * Alias for calling [Builder.extendedDescription] with + * `extendedDescription.orElse(null)`. + */ + fun extendedDescription(extendedDescription: Optional) = + extendedDescription(extendedDescription.getOrNull()) + + /** + * Sets [Builder.extendedDescription] to an arbitrary JSON value. + * + * You should usually call [Builder.extendedDescription] with a well-typed + * [ExtendedDescription] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ + fun extendedDescription(extendedDescription: JsonField) = apply { + this.extendedDescription = extendedDescription + } + + /** A link to the external standard or regulation the framework is based on. */ + fun href(href: String?) = href(JsonField.ofNullable(href)) + + /** Alias for calling [Builder.href] with `href.orElse(null)`. */ + fun href(href: Optional) = href(href.getOrNull()) + + /** + * Sets [Builder.href] to an arbitrary JSON value. + * + * You should usually call [Builder.href] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun href(href: JsonField) = apply { this.href = href } + + /** The framework name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun name(name: JsonField) = apply { this.name = name } + + /** + * Determines which projects the framework applies to. An empty or `null` `match` array + * applies the framework to every project in the workspace. + */ + fun projectSelector(projectSelector: ProjectSelector?) = + projectSelector(JsonField.ofNullable(projectSelector)) + + /** Alias for calling [Builder.projectSelector] with `projectSelector.orElse(null)`. */ + fun projectSelector(projectSelector: Optional) = + projectSelector(projectSelector.getOrNull()) + + /** + * Sets [Builder.projectSelector] to an arbitrary JSON value. + * + * You should usually call [Builder.projectSelector] with a well-typed [ProjectSelector] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun projectSelector(projectSelector: JsonField) = apply { + this.projectSelector = projectSelector + } + + /** Free-form labels on the framework. */ + fun tags(tags: List) = tags(JsonField.of(tags)) + + /** + * Sets [Builder.tags] to an arbitrary JSON value. + * + * You should usually call [Builder.tags] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun tags(tags: JsonField>) = apply { + this.tags = tags.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [tags]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addTag(tag: String) = apply { + tags = + (tags ?: JsonField.of(mutableListOf())).also { checkKnown("tags", it).add(tag) } + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Body = + Body( + avatar, + description, + enabled, + extendedDescription, + href, + name, + projectSelector, + (tags ?: JsonMissing.of()).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Body = apply { + if (validated) { + return@apply + } + + avatar().ifPresent { it.validate() } + description() + enabled() + extendedDescription().ifPresent { it.validate() } + href() + name() + projectSelector().ifPresent { it.validate() } + tags() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (avatar.asKnown().getOrNull()?.validity() ?: 0) + + (if (description.asKnown().isPresent) 1 else 0) + + (if (enabled.asKnown().isPresent) 1 else 0) + + (extendedDescription.asKnown().getOrNull()?.validity() ?: 0) + + (if (href.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (projectSelector.asKnown().getOrNull()?.validity() ?: 0) + + (tags.asKnown().getOrNull()?.size ?: 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Body && + avatar == other.avatar && + description == other.description && + enabled == other.enabled && + extendedDescription == other.extendedDescription && + href == other.href && + name == other.name && + projectSelector == other.projectSelector && + tags == other.tags && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + avatar, + description, + enabled, + extendedDescription, + href, + name, + projectSelector, + tags, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Body{avatar=$avatar, description=$description, enabled=$enabled, extendedDescription=$extendedDescription, href=$href, name=$name, projectSelector=$projectSelector, tags=$tags, additionalProperties=$additionalProperties}" + } + + /** The icon shown for the framework. */ + class Avatar + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val type: JsonField, + private val value: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("value") @ExcludeMissing value: JsonField = JsonMissing.of(), + ) : this(type, value, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun type(): Type = type.getRequired("type") + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun value(): String = value.getRequired("value") + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + /** + * Returns the raw JSON value of [value]. + * + * Unlike [value], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Avatar]. + * + * The following fields are required: + * ```java + * .type() + * .value() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Avatar]. */ + class Builder internal constructor() { + + private var type: JsonField? = null + private var value: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(avatar: Avatar) = apply { + type = avatar.type + value = avatar.value + additionalProperties = avatar.additionalProperties.toMutableMap() + } + + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun type(type: JsonField) = apply { this.type = type } + + fun value(value: String) = value(JsonField.of(value)) + + /** + * Sets [Builder.value] to an arbitrary JSON value. + * + * You should usually call [Builder.value] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun value(value: JsonField) = apply { this.value = value } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Avatar]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .type() + * .value() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Avatar = + Avatar( + checkRequired("type", type), + checkRequired("value", value), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Avatar = apply { + if (validated) { + return@apply + } + + type().validate() + value() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (type.asKnown().getOrNull()?.validity() ?: 0) + + (if (value.asKnown().isPresent) 1 else 0) + + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val EMOJI = of("emoji") + + @JvmField val IMAGE_URL = of("imageUrl") + + @JvmField val BUILTIN_IMAGE = of("builtinImage") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + EMOJI, + IMAGE_URL, + BUILTIN_IMAGE, + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + EMOJI, + IMAGE_URL, + BUILTIN_IMAGE, + /** An enum member indicating that [Type] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + EMOJI -> Value.EMOJI + IMAGE_URL -> Value.IMAGE_URL + BUILTIN_IMAGE -> Value.BUILTIN_IMAGE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + EMOJI -> Known.EMOJI + IMAGE_URL -> Known.IMAGE_URL + BUILTIN_IMAGE -> Known.BUILTIN_IMAGE + else -> throw OpenlayerInvalidDataException("Unknown Type: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Avatar && + type == other.type && + value == other.value && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(type, value, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Avatar{type=$type, value=$value, additionalProperties=$additionalProperties}" + } + + /** A longer, rich-text description, as a TipTap JSON document. */ + class ExtendedDescription + @JsonCreator + private constructor( + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [ExtendedDescription]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ExtendedDescription]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(extendedDescription: ExtendedDescription) = apply { + additionalProperties = extendedDescription.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ExtendedDescription]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): ExtendedDescription = + ExtendedDescription(additionalProperties.toImmutable()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): ExtendedDescription = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ExtendedDescription && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = "ExtendedDescription{additionalProperties=$additionalProperties}" + } + + /** + * Determines which projects the framework applies to. An empty or `null` `match` array applies + * the framework to every project in the workspace. + */ + class ProjectSelector + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val match: JsonField>, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("match") @ExcludeMissing match: JsonField> = JsonMissing.of() + ) : this(match, mutableMapOf()) + + /** + * Match criteria, ANDed together. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun match(): Optional> = match.getOptional("match") + + /** + * Returns the raw JSON value of [match]. + * + * Unlike [match], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("match") @ExcludeMissing fun _match(): JsonField> = match + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [ProjectSelector]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ProjectSelector]. */ + class Builder internal constructor() { + + private var match: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(projectSelector: ProjectSelector) = apply { + match = projectSelector.match.map { it.toMutableList() } + additionalProperties = projectSelector.additionalProperties.toMutableMap() + } + + /** Match criteria, ANDed together. */ + fun match(match: List?) = match(JsonField.ofNullable(match)) + + /** Alias for calling [Builder.match] with `match.orElse(null)`. */ + fun match(match: Optional>) = match(match.getOrNull()) + + /** + * Sets [Builder.match] to an arbitrary JSON value. + * + * You should usually call [Builder.match] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun match(match: JsonField>) = apply { + this.match = match.map { it.toMutableList() } + } + + /** + * Adds a single [Match] to [Builder.match]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addMatch(match: Match) = apply { + this.match = + (this.match ?: JsonField.of(mutableListOf())).also { + checkKnown("match", it).add(match) + } + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ProjectSelector]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): ProjectSelector = + ProjectSelector( + (match ?: JsonMissing.of()).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): ProjectSelector = apply { + if (validated) { + return@apply + } + + match().ifPresent { it.forEach { it.validate() } } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (match.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + class Match + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val property: JsonField, + private val value: JsonValue, + private val operator: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("property") + @ExcludeMissing + property: JsonField = JsonMissing.of(), + @JsonProperty("value") @ExcludeMissing value: JsonValue = JsonMissing.of(), + @JsonProperty("operator") + @ExcludeMissing + operator: JsonField = JsonMissing.of(), + ) : this(property, value, operator, mutableMapOf()) + + /** + * The project property to match against. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun property(): Property = property.getRequired("property") + + /** + * The value to match against. Pass an array to match any of several values, or `null` + * to match projects where the property is unset. Omit it for `exists` and `notExists`. + * + * This arbitrary value can be deserialized into a custom type using the `convert` + * method: + * ```java + * MyClass myObject = match.value().convert(MyClass.class); + * ``` + */ + @JsonProperty("value") @ExcludeMissing fun _value(): JsonValue = value + + /** + * How to compare the project property with `value`. One of `equals`, `notEquals`, + * `contains`, `notContains`, `startsWith`, `endsWith`, `in`, `notIn`, `greaterThan`, + * `greaterThanOrEqual`, `lessThan`, `lessThanOrEqual`, `equalsIgnoreCase`, + * `containsIgnoreCase`, `matches`, `exists`, or `notExists`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun operator(): Optional = operator.getOptional("operator") + + /** + * Returns the raw JSON value of [property]. + * + * Unlike [property], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("property") + @ExcludeMissing + fun _property(): JsonField = property + + /** + * Returns the raw JSON value of [operator]. + * + * Unlike [operator], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("operator") @ExcludeMissing fun _operator(): JsonField = operator + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Match]. + * + * The following fields are required: + * ```java + * .property() + * .value() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Match]. */ + class Builder internal constructor() { + + private var property: JsonField? = null + private var value: JsonValue? = null + private var operator: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(match: Match) = apply { + property = match.property + value = match.value + operator = match.operator + additionalProperties = match.additionalProperties.toMutableMap() + } + + /** The project property to match against. */ + fun property(property: Property) = property(JsonField.of(property)) + + /** + * Sets [Builder.property] to an arbitrary JSON value. + * + * You should usually call [Builder.property] with a well-typed [Property] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun property(property: JsonField) = apply { this.property = property } + + /** + * The value to match against. Pass an array to match any of several values, or + * `null` to match projects where the property is unset. Omit it for `exists` and + * `notExists`. + */ + fun value(value: JsonValue) = apply { this.value = value } + + /** + * How to compare the project property with `value`. One of `equals`, `notEquals`, + * `contains`, `notContains`, `startsWith`, `endsWith`, `in`, `notIn`, + * `greaterThan`, `greaterThanOrEqual`, `lessThan`, `lessThanOrEqual`, + * `equalsIgnoreCase`, `containsIgnoreCase`, `matches`, `exists`, or `notExists`. + */ + fun operator(operator: String) = operator(JsonField.of(operator)) + + /** + * Sets [Builder.operator] to an arbitrary JSON value. + * + * You should usually call [Builder.operator] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun operator(operator: JsonField) = apply { this.operator = operator } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Match]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .property() + * .value() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Match = + Match( + checkRequired("property", property), + checkRequired("value", value), + operator, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Match = apply { + if (validated) { + return@apply + } + + property().validate() + operator() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (property.asKnown().getOrNull()?.validity() ?: 0) + + (if (operator.asKnown().isPresent) 1 else 0) + + /** The project property to match against. */ + class Property @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val TASK_TYPE = of("taskType") + + @JvmField val RISK_LEVEL = of("riskLevel") + + @JvmField val RISK_TOTAL_SCORE = of("riskTotalScore") + + @JvmField val NAME = of("name") + + @JvmField val OWNER_ID = of("ownerId") + + @JvmField val MODEL_TYPES = of("modelTypes") + + @JvmStatic fun of(value: String) = Property(JsonField.of(value)) + } + + /** An enum containing [Property]'s known values. */ + enum class Known { + TASK_TYPE, + RISK_LEVEL, + RISK_TOTAL_SCORE, + NAME, + OWNER_ID, + MODEL_TYPES, + } + + /** + * An enum containing [Property]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Property] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + TASK_TYPE, + RISK_LEVEL, + RISK_TOTAL_SCORE, + NAME, + OWNER_ID, + MODEL_TYPES, + /** + * An enum member indicating that [Property] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + TASK_TYPE -> Value.TASK_TYPE + RISK_LEVEL -> Value.RISK_LEVEL + RISK_TOTAL_SCORE -> Value.RISK_TOTAL_SCORE + NAME -> Value.NAME + OWNER_ID -> Value.OWNER_ID + MODEL_TYPES -> Value.MODEL_TYPES + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + TASK_TYPE -> Known.TASK_TYPE + RISK_LEVEL -> Known.RISK_LEVEL + RISK_TOTAL_SCORE -> Known.RISK_TOTAL_SCORE + NAME -> Known.NAME + OWNER_ID -> Known.OWNER_ID + MODEL_TYPES -> Known.MODEL_TYPES + else -> throw OpenlayerInvalidDataException("Unknown Property: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): Property = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Property && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Match && + property == other.property && + value == other.value && + operator == other.operator && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(property, value, operator, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Match{property=$property, value=$value, operator=$operator, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ProjectSelector && + match == other.match && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(match, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ProjectSelector{match=$match, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is FrameworkUpdateParams && + frameworkId == other.frameworkId && + body == other.body && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = + Objects.hash(frameworkId, body, additionalHeaders, additionalQueryParams) + + override fun toString() = + "FrameworkUpdateParams{frameworkId=$frameworkId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkUpdateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkUpdateResponse.kt new file mode 100644 index 00000000..34a8162c --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkUpdateResponse.kt @@ -0,0 +1,2923 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.frameworks + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.openlayer.api.core.Enum +import com.openlayer.api.core.ExcludeMissing +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonMissing +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.checkKnown +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.toImmutable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.time.OffsetDateTime +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class FrameworkUpdateResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val id: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val enabled: JsonField, + private val name: JsonField, + private val tags: JsonField>, + private val workspaceId: JsonField, + private val avatar: JsonField, + private val builtInSlug: JsonField, + private val creatorId: JsonField, + private val description: JsonField, + private val extendedDescription: JsonField, + private val href: JsonField, + private val immutable: JsonField, + private val projectSelector: JsonField, + private val ruleStats: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("enabled") @ExcludeMissing enabled: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("tags") @ExcludeMissing tags: JsonField> = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + @JsonProperty("avatar") @ExcludeMissing avatar: JsonField = JsonMissing.of(), + @JsonProperty("builtInSlug") + @ExcludeMissing + builtInSlug: JsonField = JsonMissing.of(), + @JsonProperty("creatorId") @ExcludeMissing creatorId: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + description: JsonField = JsonMissing.of(), + @JsonProperty("extendedDescription") + @ExcludeMissing + extendedDescription: JsonField = JsonMissing.of(), + @JsonProperty("href") @ExcludeMissing href: JsonField = JsonMissing.of(), + @JsonProperty("immutable") @ExcludeMissing immutable: JsonField = JsonMissing.of(), + @JsonProperty("projectSelector") + @ExcludeMissing + projectSelector: JsonField = JsonMissing.of(), + @JsonProperty("ruleStats") + @ExcludeMissing + ruleStats: JsonField = JsonMissing.of(), + ) : this( + id, + dateCreated, + dateUpdated, + enabled, + name, + tags, + workspaceId, + avatar, + builtInSlug, + creatorId, + description, + extendedDescription, + href, + immutable, + projectSelector, + ruleStats, + mutableMapOf(), + ) + + /** + * The framework id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun id(): String = id.getRequired("id") + + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** + * The last update date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** + * Whether the framework is active. Rules of a disabled framework are not evaluated and do not + * count towards compliance. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun enabled(): Boolean = enabled.getRequired("enabled") + + /** + * The framework name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun name(): String = name.getRequired("name") + + /** + * Free-form labels on the framework. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun tags(): List = tags.getRequired("tags") + + /** + * The id of the workspace the framework belongs to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun workspaceId(): String = workspaceId.getRequired("workspaceId") + + /** + * The icon shown for the framework. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun avatar(): Optional = avatar.getOptional("avatar") + + /** + * Identifies a framework that ships with Openlayer, for example `eu_ai_act`, `iso_42001`, + * `nist_ai_rmf`, or `traiga`. `null` for frameworks you create yourself. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun builtInSlug(): Optional = builtInSlug.getOptional("builtInSlug") + + /** + * The user who created the framework. `null` for built-in frameworks. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun creatorId(): Optional = creatorId.getOptional("creatorId") + + /** + * A short description of the framework. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun description(): Optional = description.getOptional("description") + + /** + * A longer, rich-text description, as a TipTap JSON document. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun extendedDescription(): Optional = + extendedDescription.getOptional("extendedDescription") + + /** + * A link to the external standard or regulation the framework is based on. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun href(): Optional = href.getOptional("href") + + /** + * Whether the framework definition is managed by Openlayer and cannot be edited. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun immutable(): Optional = immutable.getOptional("immutable") + + /** + * Determines which projects the framework applies to. An empty or `null` `match` array applies + * the framework to every project in the workspace. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun projectSelector(): Optional = + projectSelector.getOptional("projectSelector") + + /** + * Compliance roll-up for the framework. Present only on `GET + * /workspaces/{workspaceId}/frameworks` when the request sets `includeRuleStats=true`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun ruleStats(): Optional = ruleStats.getOptional("ruleStats") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** + * Returns the raw JSON value of [enabled]. + * + * Unlike [enabled], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("enabled") @ExcludeMissing fun _enabled(): JsonField = enabled + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [tags]. + * + * Unlike [tags], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("tags") @ExcludeMissing fun _tags(): JsonField> = tags + + /** + * Returns the raw JSON value of [workspaceId]. + * + * Unlike [workspaceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("workspaceId") @ExcludeMissing fun _workspaceId(): JsonField = workspaceId + + /** + * Returns the raw JSON value of [avatar]. + * + * Unlike [avatar], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("avatar") @ExcludeMissing fun _avatar(): JsonField = avatar + + /** + * Returns the raw JSON value of [builtInSlug]. + * + * Unlike [builtInSlug], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("builtInSlug") @ExcludeMissing fun _builtInSlug(): JsonField = builtInSlug + + /** + * Returns the raw JSON value of [creatorId]. + * + * Unlike [creatorId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("creatorId") @ExcludeMissing fun _creatorId(): JsonField = creatorId + + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description + + /** + * Returns the raw JSON value of [extendedDescription]. + * + * Unlike [extendedDescription], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("extendedDescription") + @ExcludeMissing + fun _extendedDescription(): JsonField = extendedDescription + + /** + * Returns the raw JSON value of [href]. + * + * Unlike [href], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("href") @ExcludeMissing fun _href(): JsonField = href + + /** + * Returns the raw JSON value of [immutable]. + * + * Unlike [immutable], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("immutable") @ExcludeMissing fun _immutable(): JsonField = immutable + + /** + * Returns the raw JSON value of [projectSelector]. + * + * Unlike [projectSelector], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("projectSelector") + @ExcludeMissing + fun _projectSelector(): JsonField = projectSelector + + /** + * Returns the raw JSON value of [ruleStats]. + * + * Unlike [ruleStats], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("ruleStats") @ExcludeMissing fun _ruleStats(): JsonField = ruleStats + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [FrameworkUpdateResponse]. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateUpdated() + * .enabled() + * .name() + * .tags() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [FrameworkUpdateResponse]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var enabled: JsonField? = null + private var name: JsonField? = null + private var tags: JsonField>? = null + private var workspaceId: JsonField? = null + private var avatar: JsonField = JsonMissing.of() + private var builtInSlug: JsonField = JsonMissing.of() + private var creatorId: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var extendedDescription: JsonField = JsonMissing.of() + private var href: JsonField = JsonMissing.of() + private var immutable: JsonField = JsonMissing.of() + private var projectSelector: JsonField = JsonMissing.of() + private var ruleStats: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(frameworkUpdateResponse: FrameworkUpdateResponse) = apply { + id = frameworkUpdateResponse.id + dateCreated = frameworkUpdateResponse.dateCreated + dateUpdated = frameworkUpdateResponse.dateUpdated + enabled = frameworkUpdateResponse.enabled + name = frameworkUpdateResponse.name + tags = frameworkUpdateResponse.tags.map { it.toMutableList() } + workspaceId = frameworkUpdateResponse.workspaceId + avatar = frameworkUpdateResponse.avatar + builtInSlug = frameworkUpdateResponse.builtInSlug + creatorId = frameworkUpdateResponse.creatorId + description = frameworkUpdateResponse.description + extendedDescription = frameworkUpdateResponse.extendedDescription + href = frameworkUpdateResponse.href + immutable = frameworkUpdateResponse.immutable + projectSelector = frameworkUpdateResponse.projectSelector + ruleStats = frameworkUpdateResponse.ruleStats + additionalProperties = frameworkUpdateResponse.additionalProperties.toMutableMap() + } + + /** The framework id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The last update date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** + * Whether the framework is active. Rules of a disabled framework are not evaluated and do + * not count towards compliance. + */ + fun enabled(enabled: Boolean) = enabled(JsonField.of(enabled)) + + /** + * Sets [Builder.enabled] to an arbitrary JSON value. + * + * You should usually call [Builder.enabled] with a well-typed [Boolean] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun enabled(enabled: JsonField) = apply { this.enabled = enabled } + + /** The framework name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun name(name: JsonField) = apply { this.name = name } + + /** Free-form labels on the framework. */ + fun tags(tags: List) = tags(JsonField.of(tags)) + + /** + * Sets [Builder.tags] to an arbitrary JSON value. + * + * You should usually call [Builder.tags] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun tags(tags: JsonField>) = apply { + this.tags = tags.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [tags]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addTag(tag: String) = apply { + tags = (tags ?: JsonField.of(mutableListOf())).also { checkKnown("tags", it).add(tag) } + } + + /** The id of the workspace the framework belongs to. */ + fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) + + /** + * Sets [Builder.workspaceId] to an arbitrary JSON value. + * + * You should usually call [Builder.workspaceId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun workspaceId(workspaceId: JsonField) = apply { this.workspaceId = workspaceId } + + /** The icon shown for the framework. */ + fun avatar(avatar: Avatar?) = avatar(JsonField.ofNullable(avatar)) + + /** Alias for calling [Builder.avatar] with `avatar.orElse(null)`. */ + fun avatar(avatar: Optional) = avatar(avatar.getOrNull()) + + /** + * Sets [Builder.avatar] to an arbitrary JSON value. + * + * You should usually call [Builder.avatar] with a well-typed [Avatar] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun avatar(avatar: JsonField) = apply { this.avatar = avatar } + + /** + * Identifies a framework that ships with Openlayer, for example `eu_ai_act`, `iso_42001`, + * `nist_ai_rmf`, or `traiga`. `null` for frameworks you create yourself. + */ + fun builtInSlug(builtInSlug: String?) = builtInSlug(JsonField.ofNullable(builtInSlug)) + + /** Alias for calling [Builder.builtInSlug] with `builtInSlug.orElse(null)`. */ + fun builtInSlug(builtInSlug: Optional) = builtInSlug(builtInSlug.getOrNull()) + + /** + * Sets [Builder.builtInSlug] to an arbitrary JSON value. + * + * You should usually call [Builder.builtInSlug] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun builtInSlug(builtInSlug: JsonField) = apply { this.builtInSlug = builtInSlug } + + /** The user who created the framework. `null` for built-in frameworks. */ + fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) + + /** Alias for calling [Builder.creatorId] with `creatorId.orElse(null)`. */ + fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) + + /** + * Sets [Builder.creatorId] to an arbitrary JSON value. + * + * You should usually call [Builder.creatorId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } + + /** A short description of the framework. */ + fun description(description: String?) = description(JsonField.ofNullable(description)) + + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ + fun description(description: Optional) = description(description.getOrNull()) + + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun description(description: JsonField) = apply { this.description = description } + + /** A longer, rich-text description, as a TipTap JSON document. */ + fun extendedDescription(extendedDescription: ExtendedDescription?) = + extendedDescription(JsonField.ofNullable(extendedDescription)) + + /** + * Alias for calling [Builder.extendedDescription] with `extendedDescription.orElse(null)`. + */ + fun extendedDescription(extendedDescription: Optional) = + extendedDescription(extendedDescription.getOrNull()) + + /** + * Sets [Builder.extendedDescription] to an arbitrary JSON value. + * + * You should usually call [Builder.extendedDescription] with a well-typed + * [ExtendedDescription] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun extendedDescription(extendedDescription: JsonField) = apply { + this.extendedDescription = extendedDescription + } + + /** A link to the external standard or regulation the framework is based on. */ + fun href(href: String?) = href(JsonField.ofNullable(href)) + + /** Alias for calling [Builder.href] with `href.orElse(null)`. */ + fun href(href: Optional) = href(href.getOrNull()) + + /** + * Sets [Builder.href] to an arbitrary JSON value. + * + * You should usually call [Builder.href] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun href(href: JsonField) = apply { this.href = href } + + /** Whether the framework definition is managed by Openlayer and cannot be edited. */ + fun immutable(immutable: Boolean) = immutable(JsonField.of(immutable)) + + /** + * Sets [Builder.immutable] to an arbitrary JSON value. + * + * You should usually call [Builder.immutable] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun immutable(immutable: JsonField) = apply { this.immutable = immutable } + + /** + * Determines which projects the framework applies to. An empty or `null` `match` array + * applies the framework to every project in the workspace. + */ + fun projectSelector(projectSelector: ProjectSelector?) = + projectSelector(JsonField.ofNullable(projectSelector)) + + /** Alias for calling [Builder.projectSelector] with `projectSelector.orElse(null)`. */ + fun projectSelector(projectSelector: Optional) = + projectSelector(projectSelector.getOrNull()) + + /** + * Sets [Builder.projectSelector] to an arbitrary JSON value. + * + * You should usually call [Builder.projectSelector] with a well-typed [ProjectSelector] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun projectSelector(projectSelector: JsonField) = apply { + this.projectSelector = projectSelector + } + + /** + * Compliance roll-up for the framework. Present only on `GET + * /workspaces/{workspaceId}/frameworks` when the request sets `includeRuleStats=true`. + */ + fun ruleStats(ruleStats: RuleStats) = ruleStats(JsonField.of(ruleStats)) + + /** + * Sets [Builder.ruleStats] to an arbitrary JSON value. + * + * You should usually call [Builder.ruleStats] with a well-typed [RuleStats] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun ruleStats(ruleStats: JsonField) = apply { this.ruleStats = ruleStats } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [FrameworkUpdateResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateUpdated() + * .enabled() + * .name() + * .tags() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): FrameworkUpdateResponse = + FrameworkUpdateResponse( + checkRequired("id", id), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("enabled", enabled), + checkRequired("name", name), + checkRequired("tags", tags).map { it.toImmutable() }, + checkRequired("workspaceId", workspaceId), + avatar, + builtInSlug, + creatorId, + description, + extendedDescription, + href, + immutable, + projectSelector, + ruleStats, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): FrameworkUpdateResponse = apply { + if (validated) { + return@apply + } + + id() + dateCreated() + dateUpdated() + enabled() + name() + tags() + workspaceId() + avatar().ifPresent { it.validate() } + builtInSlug() + creatorId() + description() + extendedDescription().ifPresent { it.validate() } + href() + immutable() + projectSelector().ifPresent { it.validate() } + ruleStats().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (enabled.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (tags.asKnown().getOrNull()?.size ?: 0) + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + (avatar.asKnown().getOrNull()?.validity() ?: 0) + + (if (builtInSlug.asKnown().isPresent) 1 else 0) + + (if (creatorId.asKnown().isPresent) 1 else 0) + + (if (description.asKnown().isPresent) 1 else 0) + + (extendedDescription.asKnown().getOrNull()?.validity() ?: 0) + + (if (href.asKnown().isPresent) 1 else 0) + + (if (immutable.asKnown().isPresent) 1 else 0) + + (projectSelector.asKnown().getOrNull()?.validity() ?: 0) + + (ruleStats.asKnown().getOrNull()?.validity() ?: 0) + + /** The icon shown for the framework. */ + class Avatar + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val type: JsonField, + private val value: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("value") @ExcludeMissing value: JsonField = JsonMissing.of(), + ) : this(type, value, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun type(): Type = type.getRequired("type") + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun value(): String = value.getRequired("value") + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + /** + * Returns the raw JSON value of [value]. + * + * Unlike [value], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Avatar]. + * + * The following fields are required: + * ```java + * .type() + * .value() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Avatar]. */ + class Builder internal constructor() { + + private var type: JsonField? = null + private var value: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(avatar: Avatar) = apply { + type = avatar.type + value = avatar.value + additionalProperties = avatar.additionalProperties.toMutableMap() + } + + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun type(type: JsonField) = apply { this.type = type } + + fun value(value: String) = value(JsonField.of(value)) + + /** + * Sets [Builder.value] to an arbitrary JSON value. + * + * You should usually call [Builder.value] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun value(value: JsonField) = apply { this.value = value } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Avatar]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .type() + * .value() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Avatar = + Avatar( + checkRequired("type", type), + checkRequired("value", value), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Avatar = apply { + if (validated) { + return@apply + } + + type().validate() + value() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (type.asKnown().getOrNull()?.validity() ?: 0) + + (if (value.asKnown().isPresent) 1 else 0) + + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val EMOJI = of("emoji") + + @JvmField val IMAGE_URL = of("imageUrl") + + @JvmField val BUILTIN_IMAGE = of("builtinImage") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + EMOJI, + IMAGE_URL, + BUILTIN_IMAGE, + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + EMOJI, + IMAGE_URL, + BUILTIN_IMAGE, + /** An enum member indicating that [Type] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + EMOJI -> Value.EMOJI + IMAGE_URL -> Value.IMAGE_URL + BUILTIN_IMAGE -> Value.BUILTIN_IMAGE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + EMOJI -> Known.EMOJI + IMAGE_URL -> Known.IMAGE_URL + BUILTIN_IMAGE -> Known.BUILTIN_IMAGE + else -> throw OpenlayerInvalidDataException("Unknown Type: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Avatar && + type == other.type && + value == other.value && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(type, value, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Avatar{type=$type, value=$value, additionalProperties=$additionalProperties}" + } + + /** A longer, rich-text description, as a TipTap JSON document. */ + class ExtendedDescription + @JsonCreator + private constructor( + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [ExtendedDescription]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ExtendedDescription]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(extendedDescription: ExtendedDescription) = apply { + additionalProperties = extendedDescription.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ExtendedDescription]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): ExtendedDescription = + ExtendedDescription(additionalProperties.toImmutable()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): ExtendedDescription = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ExtendedDescription && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = "ExtendedDescription{additionalProperties=$additionalProperties}" + } + + /** + * Determines which projects the framework applies to. An empty or `null` `match` array applies + * the framework to every project in the workspace. + */ + class ProjectSelector + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val match: JsonField>, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("match") @ExcludeMissing match: JsonField> = JsonMissing.of() + ) : this(match, mutableMapOf()) + + /** + * Match criteria, ANDed together. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun match(): Optional> = match.getOptional("match") + + /** + * Returns the raw JSON value of [match]. + * + * Unlike [match], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("match") @ExcludeMissing fun _match(): JsonField> = match + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [ProjectSelector]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ProjectSelector]. */ + class Builder internal constructor() { + + private var match: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(projectSelector: ProjectSelector) = apply { + match = projectSelector.match.map { it.toMutableList() } + additionalProperties = projectSelector.additionalProperties.toMutableMap() + } + + /** Match criteria, ANDed together. */ + fun match(match: List?) = match(JsonField.ofNullable(match)) + + /** Alias for calling [Builder.match] with `match.orElse(null)`. */ + fun match(match: Optional>) = match(match.getOrNull()) + + /** + * Sets [Builder.match] to an arbitrary JSON value. + * + * You should usually call [Builder.match] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun match(match: JsonField>) = apply { + this.match = match.map { it.toMutableList() } + } + + /** + * Adds a single [Match] to [Builder.match]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addMatch(match: Match) = apply { + this.match = + (this.match ?: JsonField.of(mutableListOf())).also { + checkKnown("match", it).add(match) + } + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ProjectSelector]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): ProjectSelector = + ProjectSelector( + (match ?: JsonMissing.of()).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): ProjectSelector = apply { + if (validated) { + return@apply + } + + match().ifPresent { it.forEach { it.validate() } } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (match.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + class Match + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val property: JsonField, + private val value: JsonValue, + private val operator: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("property") + @ExcludeMissing + property: JsonField = JsonMissing.of(), + @JsonProperty("value") @ExcludeMissing value: JsonValue = JsonMissing.of(), + @JsonProperty("operator") + @ExcludeMissing + operator: JsonField = JsonMissing.of(), + ) : this(property, value, operator, mutableMapOf()) + + /** + * The project property to match against. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun property(): Property = property.getRequired("property") + + /** + * The value to match against. Pass an array to match any of several values, or `null` + * to match projects where the property is unset. Omit it for `exists` and `notExists`. + * + * This arbitrary value can be deserialized into a custom type using the `convert` + * method: + * ```java + * MyClass myObject = match.value().convert(MyClass.class); + * ``` + */ + @JsonProperty("value") @ExcludeMissing fun _value(): JsonValue = value + + /** + * How to compare the project property with `value`. One of `equals`, `notEquals`, + * `contains`, `notContains`, `startsWith`, `endsWith`, `in`, `notIn`, `greaterThan`, + * `greaterThanOrEqual`, `lessThan`, `lessThanOrEqual`, `equalsIgnoreCase`, + * `containsIgnoreCase`, `matches`, `exists`, or `notExists`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun operator(): Optional = operator.getOptional("operator") + + /** + * Returns the raw JSON value of [property]. + * + * Unlike [property], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("property") + @ExcludeMissing + fun _property(): JsonField = property + + /** + * Returns the raw JSON value of [operator]. + * + * Unlike [operator], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("operator") @ExcludeMissing fun _operator(): JsonField = operator + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Match]. + * + * The following fields are required: + * ```java + * .property() + * .value() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Match]. */ + class Builder internal constructor() { + + private var property: JsonField? = null + private var value: JsonValue? = null + private var operator: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(match: Match) = apply { + property = match.property + value = match.value + operator = match.operator + additionalProperties = match.additionalProperties.toMutableMap() + } + + /** The project property to match against. */ + fun property(property: Property) = property(JsonField.of(property)) + + /** + * Sets [Builder.property] to an arbitrary JSON value. + * + * You should usually call [Builder.property] with a well-typed [Property] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun property(property: JsonField) = apply { this.property = property } + + /** + * The value to match against. Pass an array to match any of several values, or + * `null` to match projects where the property is unset. Omit it for `exists` and + * `notExists`. + */ + fun value(value: JsonValue) = apply { this.value = value } + + /** + * How to compare the project property with `value`. One of `equals`, `notEquals`, + * `contains`, `notContains`, `startsWith`, `endsWith`, `in`, `notIn`, + * `greaterThan`, `greaterThanOrEqual`, `lessThan`, `lessThanOrEqual`, + * `equalsIgnoreCase`, `containsIgnoreCase`, `matches`, `exists`, or `notExists`. + */ + fun operator(operator: String) = operator(JsonField.of(operator)) + + /** + * Sets [Builder.operator] to an arbitrary JSON value. + * + * You should usually call [Builder.operator] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun operator(operator: JsonField) = apply { this.operator = operator } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Match]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .property() + * .value() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Match = + Match( + checkRequired("property", property), + checkRequired("value", value), + operator, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Match = apply { + if (validated) { + return@apply + } + + property().validate() + operator() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (property.asKnown().getOrNull()?.validity() ?: 0) + + (if (operator.asKnown().isPresent) 1 else 0) + + /** The project property to match against. */ + class Property @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val TASK_TYPE = of("taskType") + + @JvmField val RISK_LEVEL = of("riskLevel") + + @JvmField val RISK_TOTAL_SCORE = of("riskTotalScore") + + @JvmField val NAME = of("name") + + @JvmField val OWNER_ID = of("ownerId") + + @JvmField val MODEL_TYPES = of("modelTypes") + + @JvmStatic fun of(value: String) = Property(JsonField.of(value)) + } + + /** An enum containing [Property]'s known values. */ + enum class Known { + TASK_TYPE, + RISK_LEVEL, + RISK_TOTAL_SCORE, + NAME, + OWNER_ID, + MODEL_TYPES, + } + + /** + * An enum containing [Property]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Property] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + TASK_TYPE, + RISK_LEVEL, + RISK_TOTAL_SCORE, + NAME, + OWNER_ID, + MODEL_TYPES, + /** + * An enum member indicating that [Property] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + TASK_TYPE -> Value.TASK_TYPE + RISK_LEVEL -> Value.RISK_LEVEL + RISK_TOTAL_SCORE -> Value.RISK_TOTAL_SCORE + NAME -> Value.NAME + OWNER_ID -> Value.OWNER_ID + MODEL_TYPES -> Value.MODEL_TYPES + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + TASK_TYPE -> Known.TASK_TYPE + RISK_LEVEL -> Known.RISK_LEVEL + RISK_TOTAL_SCORE -> Known.RISK_TOTAL_SCORE + NAME -> Known.NAME + OWNER_ID -> Known.OWNER_ID + MODEL_TYPES -> Known.MODEL_TYPES + else -> throw OpenlayerInvalidDataException("Unknown Property: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): Property = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Property && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Match && + property == other.property && + value == other.value && + operator == other.operator && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(property, value, operator, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Match{property=$property, value=$value, operator=$operator, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ProjectSelector && + match == other.match && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(match, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ProjectSelector{match=$match, additionalProperties=$additionalProperties}" + } + + /** + * Compliance roll-up for the framework. Present only on `GET + * /workspaces/{workspaceId}/frameworks` when the request sets `includeRuleStats=true`. + */ + class RuleStats + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val projectCompletion: JsonField, + private val ruleResults: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("projectCompletion") + @ExcludeMissing + projectCompletion: JsonField = JsonMissing.of(), + @JsonProperty("ruleResults") + @ExcludeMissing + ruleResults: JsonField = JsonMissing.of(), + ) : this(projectCompletion, ruleResults, mutableMapOf()) + + /** + * How many of the framework's projects fall into each completion band, where a project's + * completion is the share of its rule results that are passing or skipped. Projects with no + * evaluated results count as `low`. + * + * Zeroed when the request carries `projectId`: the bands compare a framework's projects + * against each other, which says nothing about a single project. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun projectCompletion(): ProjectCompletion = + projectCompletion.getRequired("projectCompletion") + + /** + * Rule result counts by status for this framework, matching what + * `/workspaces/{workspaceId}/rule-stats?frameworkId=` reports. Narrowed to a single + * project when the request also carries `projectId`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun ruleResults(): RuleResults = ruleResults.getRequired("ruleResults") + + /** + * Returns the raw JSON value of [projectCompletion]. + * + * Unlike [projectCompletion], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("projectCompletion") + @ExcludeMissing + fun _projectCompletion(): JsonField = projectCompletion + + /** + * Returns the raw JSON value of [ruleResults]. + * + * Unlike [ruleResults], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("ruleResults") + @ExcludeMissing + fun _ruleResults(): JsonField = ruleResults + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [RuleStats]. + * + * The following fields are required: + * ```java + * .projectCompletion() + * .ruleResults() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [RuleStats]. */ + class Builder internal constructor() { + + private var projectCompletion: JsonField? = null + private var ruleResults: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(ruleStats: RuleStats) = apply { + projectCompletion = ruleStats.projectCompletion + ruleResults = ruleStats.ruleResults + additionalProperties = ruleStats.additionalProperties.toMutableMap() + } + + /** + * How many of the framework's projects fall into each completion band, where a + * project's completion is the share of its rule results that are passing or skipped. + * Projects with no evaluated results count as `low`. + * + * Zeroed when the request carries `projectId`: the bands compare a framework's projects + * against each other, which says nothing about a single project. + */ + fun projectCompletion(projectCompletion: ProjectCompletion) = + projectCompletion(JsonField.of(projectCompletion)) + + /** + * Sets [Builder.projectCompletion] to an arbitrary JSON value. + * + * You should usually call [Builder.projectCompletion] with a well-typed + * [ProjectCompletion] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun projectCompletion(projectCompletion: JsonField) = apply { + this.projectCompletion = projectCompletion + } + + /** + * Rule result counts by status for this framework, matching what + * `/workspaces/{workspaceId}/rule-stats?frameworkId=` reports. Narrowed to a single + * project when the request also carries `projectId`. + */ + fun ruleResults(ruleResults: RuleResults) = ruleResults(JsonField.of(ruleResults)) + + /** + * Sets [Builder.ruleResults] to an arbitrary JSON value. + * + * You should usually call [Builder.ruleResults] with a well-typed [RuleResults] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun ruleResults(ruleResults: JsonField) = apply { + this.ruleResults = ruleResults + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [RuleStats]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .projectCompletion() + * .ruleResults() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): RuleStats = + RuleStats( + checkRequired("projectCompletion", projectCompletion), + checkRequired("ruleResults", ruleResults), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): RuleStats = apply { + if (validated) { + return@apply + } + + projectCompletion().validate() + ruleResults().validate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (projectCompletion.asKnown().getOrNull()?.validity() ?: 0) + + (ruleResults.asKnown().getOrNull()?.validity() ?: 0) + + /** + * How many of the framework's projects fall into each completion band, where a project's + * completion is the share of its rule results that are passing or skipped. Projects with no + * evaluated results count as `low`. + * + * Zeroed when the request carries `projectId`: the bands compare a framework's projects + * against each other, which says nothing about a single project. + */ + class ProjectCompletion + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val high: JsonField, + private val low: JsonField, + private val mid: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("high") @ExcludeMissing high: JsonField = JsonMissing.of(), + @JsonProperty("low") @ExcludeMissing low: JsonField = JsonMissing.of(), + @JsonProperty("mid") @ExcludeMissing mid: JsonField = JsonMissing.of(), + ) : this(high, low, mid, mutableMapOf()) + + /** + * Projects at 80% completion or above. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun high(): Long = high.getRequired("high") + + /** + * Projects below 20% completion. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun low(): Long = low.getRequired("low") + + /** + * Projects at or above 20% but below 80% completion. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun mid(): Long = mid.getRequired("mid") + + /** + * Returns the raw JSON value of [high]. + * + * Unlike [high], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("high") @ExcludeMissing fun _high(): JsonField = high + + /** + * Returns the raw JSON value of [low]. + * + * Unlike [low], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("low") @ExcludeMissing fun _low(): JsonField = low + + /** + * Returns the raw JSON value of [mid]. + * + * Unlike [mid], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("mid") @ExcludeMissing fun _mid(): JsonField = mid + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [ProjectCompletion]. + * + * The following fields are required: + * ```java + * .high() + * .low() + * .mid() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ProjectCompletion]. */ + class Builder internal constructor() { + + private var high: JsonField? = null + private var low: JsonField? = null + private var mid: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(projectCompletion: ProjectCompletion) = apply { + high = projectCompletion.high + low = projectCompletion.low + mid = projectCompletion.mid + additionalProperties = projectCompletion.additionalProperties.toMutableMap() + } + + /** Projects at 80% completion or above. */ + fun high(high: Long) = high(JsonField.of(high)) + + /** + * Sets [Builder.high] to an arbitrary JSON value. + * + * You should usually call [Builder.high] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun high(high: JsonField) = apply { this.high = high } + + /** Projects below 20% completion. */ + fun low(low: Long) = low(JsonField.of(low)) + + /** + * Sets [Builder.low] to an arbitrary JSON value. + * + * You should usually call [Builder.low] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun low(low: JsonField) = apply { this.low = low } + + /** Projects at or above 20% but below 80% completion. */ + fun mid(mid: Long) = mid(JsonField.of(mid)) + + /** + * Sets [Builder.mid] to an arbitrary JSON value. + * + * You should usually call [Builder.mid] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun mid(mid: JsonField) = apply { this.mid = mid } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ProjectCompletion]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .high() + * .low() + * .mid() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): ProjectCompletion = + ProjectCompletion( + checkRequired("high", high), + checkRequired("low", low), + checkRequired("mid", mid), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): ProjectCompletion = apply { + if (validated) { + return@apply + } + + high() + low() + mid() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (high.asKnown().isPresent) 1 else 0) + + (if (low.asKnown().isPresent) 1 else 0) + + (if (mid.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ProjectCompletion && + high == other.high && + low == other.low && + mid == other.mid && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(high, low, mid, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ProjectCompletion{high=$high, low=$low, mid=$mid, additionalProperties=$additionalProperties}" + } + + /** + * Rule result counts by status for this framework, matching what + * `/workspaces/{workspaceId}/rule-stats?frameworkId=` reports. Narrowed to a single + * project when the request also carries `projectId`. + */ + class RuleResults + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val total: JsonField, + private val totalDueSoon: JsonField, + private val totalError: JsonField, + private val totalFailing: JsonField, + private val totalPassing: JsonField, + private val totalPending: JsonField, + private val totalRunning: JsonField, + private val totalSkipped: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("total") @ExcludeMissing total: JsonField = JsonMissing.of(), + @JsonProperty("totalDueSoon") + @ExcludeMissing + totalDueSoon: JsonField = JsonMissing.of(), + @JsonProperty("totalError") + @ExcludeMissing + totalError: JsonField = JsonMissing.of(), + @JsonProperty("totalFailing") + @ExcludeMissing + totalFailing: JsonField = JsonMissing.of(), + @JsonProperty("totalPassing") + @ExcludeMissing + totalPassing: JsonField = JsonMissing.of(), + @JsonProperty("totalPending") + @ExcludeMissing + totalPending: JsonField = JsonMissing.of(), + @JsonProperty("totalRunning") + @ExcludeMissing + totalRunning: JsonField = JsonMissing.of(), + @JsonProperty("totalSkipped") + @ExcludeMissing + totalSkipped: JsonField = JsonMissing.of(), + ) : this( + total, + totalDueSoon, + totalError, + totalFailing, + totalPassing, + totalPending, + totalRunning, + totalSkipped, + mutableMapOf(), + ) + + /** + * The total number of rule results. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun total(): Long = total.getRequired("total") + + /** + * The number of rule results whose evidence is about to expire. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun totalDueSoon(): Long = totalDueSoon.getRequired("totalDueSoon") + + /** + * The number of rule results that errored during evaluation. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun totalError(): Long = totalError.getRequired("totalError") + + /** + * The number of failing rule results. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun totalFailing(): Long = totalFailing.getRequired("totalFailing") + + /** + * The number of passing rule results. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun totalPassing(): Long = totalPassing.getRequired("totalPassing") + + /** + * The number of rule results that have not been satisfied yet. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun totalPending(): Long = totalPending.getRequired("totalPending") + + /** + * The number of rule results currently being evaluated. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun totalRunning(): Long = totalRunning.getRequired("totalRunning") + + /** + * The number of skipped rule results. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun totalSkipped(): Long = totalSkipped.getRequired("totalSkipped") + + /** + * Returns the raw JSON value of [total]. + * + * Unlike [total], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("total") @ExcludeMissing fun _total(): JsonField = total + + /** + * Returns the raw JSON value of [totalDueSoon]. + * + * Unlike [totalDueSoon], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("totalDueSoon") + @ExcludeMissing + fun _totalDueSoon(): JsonField = totalDueSoon + + /** + * Returns the raw JSON value of [totalError]. + * + * Unlike [totalError], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("totalError") + @ExcludeMissing + fun _totalError(): JsonField = totalError + + /** + * Returns the raw JSON value of [totalFailing]. + * + * Unlike [totalFailing], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("totalFailing") + @ExcludeMissing + fun _totalFailing(): JsonField = totalFailing + + /** + * Returns the raw JSON value of [totalPassing]. + * + * Unlike [totalPassing], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("totalPassing") + @ExcludeMissing + fun _totalPassing(): JsonField = totalPassing + + /** + * Returns the raw JSON value of [totalPending]. + * + * Unlike [totalPending], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("totalPending") + @ExcludeMissing + fun _totalPending(): JsonField = totalPending + + /** + * Returns the raw JSON value of [totalRunning]. + * + * Unlike [totalRunning], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("totalRunning") + @ExcludeMissing + fun _totalRunning(): JsonField = totalRunning + + /** + * Returns the raw JSON value of [totalSkipped]. + * + * Unlike [totalSkipped], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("totalSkipped") + @ExcludeMissing + fun _totalSkipped(): JsonField = totalSkipped + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [RuleResults]. + * + * The following fields are required: + * ```java + * .total() + * .totalDueSoon() + * .totalError() + * .totalFailing() + * .totalPassing() + * .totalPending() + * .totalRunning() + * .totalSkipped() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [RuleResults]. */ + class Builder internal constructor() { + + private var total: JsonField? = null + private var totalDueSoon: JsonField? = null + private var totalError: JsonField? = null + private var totalFailing: JsonField? = null + private var totalPassing: JsonField? = null + private var totalPending: JsonField? = null + private var totalRunning: JsonField? = null + private var totalSkipped: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(ruleResults: RuleResults) = apply { + total = ruleResults.total + totalDueSoon = ruleResults.totalDueSoon + totalError = ruleResults.totalError + totalFailing = ruleResults.totalFailing + totalPassing = ruleResults.totalPassing + totalPending = ruleResults.totalPending + totalRunning = ruleResults.totalRunning + totalSkipped = ruleResults.totalSkipped + additionalProperties = ruleResults.additionalProperties.toMutableMap() + } + + /** The total number of rule results. */ + fun total(total: Long) = total(JsonField.of(total)) + + /** + * Sets [Builder.total] to an arbitrary JSON value. + * + * You should usually call [Builder.total] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun total(total: JsonField) = apply { this.total = total } + + /** The number of rule results whose evidence is about to expire. */ + fun totalDueSoon(totalDueSoon: Long) = totalDueSoon(JsonField.of(totalDueSoon)) + + /** + * Sets [Builder.totalDueSoon] to an arbitrary JSON value. + * + * You should usually call [Builder.totalDueSoon] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun totalDueSoon(totalDueSoon: JsonField) = apply { + this.totalDueSoon = totalDueSoon + } + + /** The number of rule results that errored during evaluation. */ + fun totalError(totalError: Long) = totalError(JsonField.of(totalError)) + + /** + * Sets [Builder.totalError] to an arbitrary JSON value. + * + * You should usually call [Builder.totalError] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun totalError(totalError: JsonField) = apply { this.totalError = totalError } + + /** The number of failing rule results. */ + fun totalFailing(totalFailing: Long) = totalFailing(JsonField.of(totalFailing)) + + /** + * Sets [Builder.totalFailing] to an arbitrary JSON value. + * + * You should usually call [Builder.totalFailing] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun totalFailing(totalFailing: JsonField) = apply { + this.totalFailing = totalFailing + } + + /** The number of passing rule results. */ + fun totalPassing(totalPassing: Long) = totalPassing(JsonField.of(totalPassing)) + + /** + * Sets [Builder.totalPassing] to an arbitrary JSON value. + * + * You should usually call [Builder.totalPassing] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun totalPassing(totalPassing: JsonField) = apply { + this.totalPassing = totalPassing + } + + /** The number of rule results that have not been satisfied yet. */ + fun totalPending(totalPending: Long) = totalPending(JsonField.of(totalPending)) + + /** + * Sets [Builder.totalPending] to an arbitrary JSON value. + * + * You should usually call [Builder.totalPending] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun totalPending(totalPending: JsonField) = apply { + this.totalPending = totalPending + } + + /** The number of rule results currently being evaluated. */ + fun totalRunning(totalRunning: Long) = totalRunning(JsonField.of(totalRunning)) + + /** + * Sets [Builder.totalRunning] to an arbitrary JSON value. + * + * You should usually call [Builder.totalRunning] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun totalRunning(totalRunning: JsonField) = apply { + this.totalRunning = totalRunning + } + + /** The number of skipped rule results. */ + fun totalSkipped(totalSkipped: Long) = totalSkipped(JsonField.of(totalSkipped)) + + /** + * Sets [Builder.totalSkipped] to an arbitrary JSON value. + * + * You should usually call [Builder.totalSkipped] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun totalSkipped(totalSkipped: JsonField) = apply { + this.totalSkipped = totalSkipped + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [RuleResults]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .total() + * .totalDueSoon() + * .totalError() + * .totalFailing() + * .totalPassing() + * .totalPending() + * .totalRunning() + * .totalSkipped() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): RuleResults = + RuleResults( + checkRequired("total", total), + checkRequired("totalDueSoon", totalDueSoon), + checkRequired("totalError", totalError), + checkRequired("totalFailing", totalFailing), + checkRequired("totalPassing", totalPassing), + checkRequired("totalPending", totalPending), + checkRequired("totalRunning", totalRunning), + checkRequired("totalSkipped", totalSkipped), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): RuleResults = apply { + if (validated) { + return@apply + } + + total() + totalDueSoon() + totalError() + totalFailing() + totalPassing() + totalPending() + totalRunning() + totalSkipped() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (total.asKnown().isPresent) 1 else 0) + + (if (totalDueSoon.asKnown().isPresent) 1 else 0) + + (if (totalError.asKnown().isPresent) 1 else 0) + + (if (totalFailing.asKnown().isPresent) 1 else 0) + + (if (totalPassing.asKnown().isPresent) 1 else 0) + + (if (totalPending.asKnown().isPresent) 1 else 0) + + (if (totalRunning.asKnown().isPresent) 1 else 0) + + (if (totalSkipped.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is RuleResults && + total == other.total && + totalDueSoon == other.totalDueSoon && + totalError == other.totalError && + totalFailing == other.totalFailing && + totalPassing == other.totalPassing && + totalPending == other.totalPending && + totalRunning == other.totalRunning && + totalSkipped == other.totalSkipped && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + total, + totalDueSoon, + totalError, + totalFailing, + totalPassing, + totalPending, + totalRunning, + totalSkipped, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "RuleResults{total=$total, totalDueSoon=$totalDueSoon, totalError=$totalError, totalFailing=$totalFailing, totalPassing=$totalPassing, totalPending=$totalPending, totalRunning=$totalRunning, totalSkipped=$totalSkipped, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is RuleStats && + projectCompletion == other.projectCompletion && + ruleResults == other.ruleResults && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(projectCompletion, ruleResults, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "RuleStats{projectCompletion=$projectCompletion, ruleResults=$ruleResults, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is FrameworkUpdateResponse && + id == other.id && + dateCreated == other.dateCreated && + dateUpdated == other.dateUpdated && + enabled == other.enabled && + name == other.name && + tags == other.tags && + workspaceId == other.workspaceId && + avatar == other.avatar && + builtInSlug == other.builtInSlug && + creatorId == other.creatorId && + description == other.description && + extendedDescription == other.extendedDescription && + href == other.href && + immutable == other.immutable && + projectSelector == other.projectSelector && + ruleStats == other.ruleStats && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + dateCreated, + dateUpdated, + enabled, + name, + tags, + workspaceId, + avatar, + builtInSlug, + creatorId, + description, + extendedDescription, + href, + immutable, + projectSelector, + ruleStats, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "FrameworkUpdateResponse{id=$id, dateCreated=$dateCreated, dateUpdated=$dateUpdated, enabled=$enabled, name=$name, tags=$tags, workspaceId=$workspaceId, avatar=$avatar, builtInSlug=$builtInSlug, creatorId=$creatorId, description=$description, extendedDescription=$extendedDescription, href=$href, immutable=$immutable, projectSelector=$projectSelector, ruleStats=$ruleStats, additionalProperties=$additionalProperties}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/documents/DocumentListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/documents/DocumentListParams.kt new file mode 100644 index 00000000..2a49811a --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/documents/DocumentListParams.kt @@ -0,0 +1,249 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.frameworks.documents + +import com.openlayer.api.core.Params +import com.openlayer.api.core.http.Headers +import com.openlayer.api.core.http.QueryParams +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * List the documents attached to a framework. + * + * A document holds the text of the standard the framework is based on, split into sections and + * subsections. Retrieve a single document to get that structure, along with the rules mapped to + * each part of it. + */ +class DocumentListParams +private constructor( + private val frameworkId: String?, + private val page: Long?, + private val perPage: Long?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun frameworkId(): Optional = Optional.ofNullable(frameworkId) + + /** The page to return in a paginated query. */ + fun page(): Optional = Optional.ofNullable(page) + + /** Maximum number of items to return per page. */ + fun perPage(): Optional = Optional.ofNullable(perPage) + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): DocumentListParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [DocumentListParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [DocumentListParams]. */ + class Builder internal constructor() { + + private var frameworkId: String? = null + private var page: Long? = null + private var perPage: Long? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(documentListParams: DocumentListParams) = apply { + frameworkId = documentListParams.frameworkId + page = documentListParams.page + perPage = documentListParams.perPage + additionalHeaders = documentListParams.additionalHeaders.toBuilder() + additionalQueryParams = documentListParams.additionalQueryParams.toBuilder() + } + + fun frameworkId(frameworkId: String?) = apply { this.frameworkId = frameworkId } + + /** Alias for calling [Builder.frameworkId] with `frameworkId.orElse(null)`. */ + fun frameworkId(frameworkId: Optional) = frameworkId(frameworkId.getOrNull()) + + /** The page to return in a paginated query. */ + fun page(page: Long?) = apply { this.page = page } + + /** + * Alias for [Builder.page]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun page(page: Long) = page(page as Long?) + + /** Alias for calling [Builder.page] with `page.orElse(null)`. */ + fun page(page: Optional) = page(page.getOrNull()) + + /** Maximum number of items to return per page. */ + fun perPage(perPage: Long?) = apply { this.perPage = perPage } + + /** + * Alias for [Builder.perPage]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun perPage(perPage: Long) = perPage(perPage as Long?) + + /** Alias for calling [Builder.perPage] with `perPage.orElse(null)`. */ + fun perPage(perPage: Optional) = perPage(perPage.getOrNull()) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [DocumentListParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): DocumentListParams = + DocumentListParams( + frameworkId, + page, + perPage, + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _pathParam(index: Int): String = + when (index) { + 0 -> frameworkId ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + page?.let { put("page", it.toString()) } + perPage?.let { put("perPage", it.toString()) } + putAll(additionalQueryParams) + } + .build() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is DocumentListParams && + frameworkId == other.frameworkId && + page == other.page && + perPage == other.perPage && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = + Objects.hash(frameworkId, page, perPage, additionalHeaders, additionalQueryParams) + + override fun toString() = + "DocumentListParams{frameworkId=$frameworkId, page=$page, perPage=$perPage, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/documents/DocumentListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/documents/DocumentListResponse.kt new file mode 100644 index 00000000..5a922dcd --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/documents/DocumentListResponse.kt @@ -0,0 +1,4383 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.frameworks.documents + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.openlayer.api.core.Enum +import com.openlayer.api.core.ExcludeMissing +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonMissing +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.checkKnown +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.toImmutable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.time.OffsetDateTime +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class DocumentListResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val items: JsonField>, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("items") @ExcludeMissing items: JsonField> = JsonMissing.of() + ) : this(items, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun items(): List = items.getRequired("items") + + /** + * Returns the raw JSON value of [items]. + * + * Unlike [items], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("items") @ExcludeMissing fun _items(): JsonField> = items + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [DocumentListResponse]. + * + * The following fields are required: + * ```java + * .items() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [DocumentListResponse]. */ + class Builder internal constructor() { + + private var items: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(documentListResponse: DocumentListResponse) = apply { + items = documentListResponse.items.map { it.toMutableList() } + additionalProperties = documentListResponse.additionalProperties.toMutableMap() + } + + fun items(items: List) = items(JsonField.of(items)) + + /** + * Sets [Builder.items] to an arbitrary JSON value. + * + * You should usually call [Builder.items] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun items(items: JsonField>) = apply { + this.items = items.map { it.toMutableList() } + } + + /** + * Adds a single [Item] to [items]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addItem(item: Item) = apply { + items = + (items ?: JsonField.of(mutableListOf())).also { checkKnown("items", it).add(item) } + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [DocumentListResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .items() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): DocumentListResponse = + DocumentListResponse( + checkRequired("items", items).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): DocumentListResponse = apply { + if (validated) { + return@apply + } + + items().forEach { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (items.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + class Item + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val frameworkId: JsonField, + private val title: JsonField, + private val sections: JsonField>, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("frameworkId") + @ExcludeMissing + frameworkId: JsonField = JsonMissing.of(), + @JsonProperty("title") @ExcludeMissing title: JsonField = JsonMissing.of(), + @JsonProperty("sections") + @ExcludeMissing + sections: JsonField> = JsonMissing.of(), + ) : this(id, dateCreated, dateUpdated, frameworkId, title, sections, mutableMapOf()) + + /** + * The document id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun id(): String = id.getRequired("id") + + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** + * The last update date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** + * The framework the document belongs to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun frameworkId(): String = frameworkId.getRequired("frameworkId") + + /** + * The document title. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun title(): String = title.getRequired("title") + + /** + * The document's sections, in display order. Only returned when retrieving a single + * document. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun sections(): Optional> = sections.getOptional("sections") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** + * Returns the raw JSON value of [frameworkId]. + * + * Unlike [frameworkId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("frameworkId") + @ExcludeMissing + fun _frameworkId(): JsonField = frameworkId + + /** + * Returns the raw JSON value of [title]. + * + * Unlike [title], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("title") @ExcludeMissing fun _title(): JsonField = title + + /** + * Returns the raw JSON value of [sections]. + * + * Unlike [sections], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("sections") + @ExcludeMissing + fun _sections(): JsonField> = sections + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Item]. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateUpdated() + * .frameworkId() + * .title() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Item]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var frameworkId: JsonField? = null + private var title: JsonField? = null + private var sections: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(item: Item) = apply { + id = item.id + dateCreated = item.dateCreated + dateUpdated = item.dateUpdated + frameworkId = item.frameworkId + title = item.title + sections = item.sections.map { it.toMutableList() } + additionalProperties = item.additionalProperties.toMutableMap() + } + + /** The document id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The last update date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** The framework the document belongs to. */ + fun frameworkId(frameworkId: String) = frameworkId(JsonField.of(frameworkId)) + + /** + * Sets [Builder.frameworkId] to an arbitrary JSON value. + * + * You should usually call [Builder.frameworkId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun frameworkId(frameworkId: JsonField) = apply { + this.frameworkId = frameworkId + } + + /** The document title. */ + fun title(title: String) = title(JsonField.of(title)) + + /** + * Sets [Builder.title] to an arbitrary JSON value. + * + * You should usually call [Builder.title] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun title(title: JsonField) = apply { this.title = title } + + /** + * The document's sections, in display order. Only returned when retrieving a single + * document. + */ + fun sections(sections: List
) = sections(JsonField.of(sections)) + + /** + * Sets [Builder.sections] to an arbitrary JSON value. + * + * You should usually call [Builder.sections] with a well-typed `List
` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun sections(sections: JsonField>) = apply { + this.sections = sections.map { it.toMutableList() } + } + + /** + * Adds a single [Section] to [sections]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addSection(section: Section) = apply { + sections = + (sections ?: JsonField.of(mutableListOf())).also { + checkKnown("sections", it).add(section) + } + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Item]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateUpdated() + * .frameworkId() + * .title() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Item = + Item( + checkRequired("id", id), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("frameworkId", frameworkId), + checkRequired("title", title), + (sections ?: JsonMissing.of()).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Item = apply { + if (validated) { + return@apply + } + + id() + dateCreated() + dateUpdated() + frameworkId() + title() + sections().ifPresent { it.forEach { it.validate() } } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (frameworkId.asKnown().isPresent) 1 else 0) + + (if (title.asKnown().isPresent) 1 else 0) + + (sections.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + class Section + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val documentId: JsonField, + private val number: JsonField, + private val sortOrder: JsonField, + private val title: JsonField, + private val ruleCount: JsonField, + private val rules: JsonField>, + private val subsections: JsonField>, + private val text: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("documentId") + @ExcludeMissing + documentId: JsonField = JsonMissing.of(), + @JsonProperty("number") + @ExcludeMissing + number: JsonField = JsonMissing.of(), + @JsonProperty("sortOrder") + @ExcludeMissing + sortOrder: JsonField = JsonMissing.of(), + @JsonProperty("title") @ExcludeMissing title: JsonField = JsonMissing.of(), + @JsonProperty("ruleCount") + @ExcludeMissing + ruleCount: JsonField = JsonMissing.of(), + @JsonProperty("rules") + @ExcludeMissing + rules: JsonField> = JsonMissing.of(), + @JsonProperty("subsections") + @ExcludeMissing + subsections: JsonField> = JsonMissing.of(), + @JsonProperty("text") @ExcludeMissing text: JsonField = JsonMissing.of(), + ) : this( + id, + documentId, + number, + sortOrder, + title, + ruleCount, + rules, + subsections, + text, + mutableMapOf(), + ) + + /** + * The section id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun id(): String = id.getRequired("id") + + /** + * The document the section belongs to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun documentId(): String = documentId.getRequired("documentId") + + /** + * The section number as it appears in the source standard. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun number(): String = number.getRequired("number") + + /** + * The position of the section within the document. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun sortOrder(): Long = sortOrder.getRequired("sortOrder") + + /** + * The section title. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun title(): String = title.getRequired("title") + + /** + * How many rules are linked to this section, including its subsections. Use it to + * decide whether to fetch the section's rules. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun ruleCount(): Optional = ruleCount.getOptional("ruleCount") + + /** + * The rules linked directly to this section. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun rules(): Optional> = rules.getOptional("rules") + + /** + * The section's subsections, in display order. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun subsections(): Optional> = subsections.getOptional("subsections") + + /** + * The section text. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun text(): Optional = text.getOptional("text") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [documentId]. + * + * Unlike [documentId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("documentId") + @ExcludeMissing + fun _documentId(): JsonField = documentId + + /** + * Returns the raw JSON value of [number]. + * + * Unlike [number], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("number") @ExcludeMissing fun _number(): JsonField = number + + /** + * Returns the raw JSON value of [sortOrder]. + * + * Unlike [sortOrder], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("sortOrder") @ExcludeMissing fun _sortOrder(): JsonField = sortOrder + + /** + * Returns the raw JSON value of [title]. + * + * Unlike [title], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("title") @ExcludeMissing fun _title(): JsonField = title + + /** + * Returns the raw JSON value of [ruleCount]. + * + * Unlike [ruleCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("ruleCount") @ExcludeMissing fun _ruleCount(): JsonField = ruleCount + + /** + * Returns the raw JSON value of [rules]. + * + * Unlike [rules], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("rules") @ExcludeMissing fun _rules(): JsonField> = rules + + /** + * Returns the raw JSON value of [subsections]. + * + * Unlike [subsections], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("subsections") + @ExcludeMissing + fun _subsections(): JsonField> = subsections + + /** + * Returns the raw JSON value of [text]. + * + * Unlike [text], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("text") @ExcludeMissing fun _text(): JsonField = text + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Section]. + * + * The following fields are required: + * ```java + * .id() + * .documentId() + * .number() + * .sortOrder() + * .title() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Section]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var documentId: JsonField? = null + private var number: JsonField? = null + private var sortOrder: JsonField? = null + private var title: JsonField? = null + private var ruleCount: JsonField = JsonMissing.of() + private var rules: JsonField>? = null + private var subsections: JsonField>? = null + private var text: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(section: Section) = apply { + id = section.id + documentId = section.documentId + number = section.number + sortOrder = section.sortOrder + title = section.title + ruleCount = section.ruleCount + rules = section.rules.map { it.toMutableList() } + subsections = section.subsections.map { it.toMutableList() } + text = section.text + additionalProperties = section.additionalProperties.toMutableMap() + } + + /** The section id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The document the section belongs to. */ + fun documentId(documentId: String) = documentId(JsonField.of(documentId)) + + /** + * Sets [Builder.documentId] to an arbitrary JSON value. + * + * You should usually call [Builder.documentId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun documentId(documentId: JsonField) = apply { + this.documentId = documentId + } + + /** The section number as it appears in the source standard. */ + fun number(number: String) = number(JsonField.of(number)) + + /** + * Sets [Builder.number] to an arbitrary JSON value. + * + * You should usually call [Builder.number] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun number(number: JsonField) = apply { this.number = number } + + /** The position of the section within the document. */ + fun sortOrder(sortOrder: Long) = sortOrder(JsonField.of(sortOrder)) + + /** + * Sets [Builder.sortOrder] to an arbitrary JSON value. + * + * You should usually call [Builder.sortOrder] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun sortOrder(sortOrder: JsonField) = apply { this.sortOrder = sortOrder } + + /** The section title. */ + fun title(title: String) = title(JsonField.of(title)) + + /** + * Sets [Builder.title] to an arbitrary JSON value. + * + * You should usually call [Builder.title] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun title(title: JsonField) = apply { this.title = title } + + /** + * How many rules are linked to this section, including its subsections. Use it to + * decide whether to fetch the section's rules. + */ + fun ruleCount(ruleCount: Long) = ruleCount(JsonField.of(ruleCount)) + + /** + * Sets [Builder.ruleCount] to an arbitrary JSON value. + * + * You should usually call [Builder.ruleCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun ruleCount(ruleCount: JsonField) = apply { this.ruleCount = ruleCount } + + /** The rules linked directly to this section. */ + fun rules(rules: List) = rules(JsonField.of(rules)) + + /** + * Sets [Builder.rules] to an arbitrary JSON value. + * + * You should usually call [Builder.rules] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun rules(rules: JsonField>) = apply { + this.rules = rules.map { it.toMutableList() } + } + + /** + * Adds a single [Rule] to [rules]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addRule(rule: Rule) = apply { + rules = + (rules ?: JsonField.of(mutableListOf())).also { + checkKnown("rules", it).add(rule) + } + } + + /** The section's subsections, in display order. */ + fun subsections(subsections: List) = + subsections(JsonField.of(subsections)) + + /** + * Sets [Builder.subsections] to an arbitrary JSON value. + * + * You should usually call [Builder.subsections] with a well-typed + * `List` value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ + fun subsections(subsections: JsonField>) = apply { + this.subsections = subsections.map { it.toMutableList() } + } + + /** + * Adds a single [Subsection] to [subsections]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addSubsection(subsection: Subsection) = apply { + subsections = + (subsections ?: JsonField.of(mutableListOf())).also { + checkKnown("subsections", it).add(subsection) + } + } + + /** The section text. */ + fun text(text: String?) = text(JsonField.ofNullable(text)) + + /** Alias for calling [Builder.text] with `text.orElse(null)`. */ + fun text(text: Optional) = text(text.getOrNull()) + + /** + * Sets [Builder.text] to an arbitrary JSON value. + * + * You should usually call [Builder.text] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun text(text: JsonField) = apply { this.text = text } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Section]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .documentId() + * .number() + * .sortOrder() + * .title() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Section = + Section( + checkRequired("id", id), + checkRequired("documentId", documentId), + checkRequired("number", number), + checkRequired("sortOrder", sortOrder), + checkRequired("title", title), + ruleCount, + (rules ?: JsonMissing.of()).map { it.toImmutable() }, + (subsections ?: JsonMissing.of()).map { it.toImmutable() }, + text, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Section = apply { + if (validated) { + return@apply + } + + id() + documentId() + number() + sortOrder() + title() + ruleCount() + rules().ifPresent { it.forEach { it.validate() } } + subsections().ifPresent { it.forEach { it.validate() } } + text() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (documentId.asKnown().isPresent) 1 else 0) + + (if (number.asKnown().isPresent) 1 else 0) + + (if (sortOrder.asKnown().isPresent) 1 else 0) + + (if (title.asKnown().isPresent) 1 else 0) + + (if (ruleCount.asKnown().isPresent) 1 else 0) + + (rules.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (subsections.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (text.asKnown().isPresent) 1 else 0) + + class Rule + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val name: JsonField, + private val scope: JsonField, + private val type: JsonField, + private val automationParams: JsonField, + private val automationType: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val deactivated: JsonField, + private val description: JsonField, + private val evidenceType: JsonField, + private val immutable: JsonField, + private val renewalCadenceDays: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + name: JsonField = JsonMissing.of(), + @JsonProperty("scope") + @ExcludeMissing + scope: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("automationParams") + @ExcludeMissing + automationParams: JsonField = JsonMissing.of(), + @JsonProperty("automationType") + @ExcludeMissing + automationType: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("deactivated") + @ExcludeMissing + deactivated: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + description: JsonField = JsonMissing.of(), + @JsonProperty("evidenceType") + @ExcludeMissing + evidenceType: JsonField = JsonMissing.of(), + @JsonProperty("immutable") + @ExcludeMissing + immutable: JsonField = JsonMissing.of(), + @JsonProperty("renewalCadenceDays") + @ExcludeMissing + renewalCadenceDays: JsonField = JsonMissing.of(), + ) : this( + id, + name, + scope, + type, + automationParams, + automationType, + dateCreated, + dateUpdated, + deactivated, + description, + evidenceType, + immutable, + renewalCadenceDays, + mutableMapOf(), + ) + + /** + * The rule id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun id(): String = id.getRequired("id") + + /** + * The rule name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun name(): String = name.getRequired("name") + + /** + * Whether the rule is evaluated once for the whole workspace, or once per project + * the rule's frameworks apply to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun scope(): Scope = scope.getRequired("scope") + + /** + * `platform` rules are evaluated automatically from the state of your Openlayer + * workspace. `evidence` rules are satisfied by attaching evidence. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun type(): Type = type.getRequired("type") + + /** + * Configuration for the platform check, when the automation takes parameters. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun automationParams(): Optional = + automationParams.getOptional("automationParams") + + /** + * Which workspace signal a platform rule checks, for example + * `monitoring_mode_enabled`, `test_setup`, or `project_owner_set`. `null` for + * evidence rules. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun automationType(): Optional = + automationType.getOptional("automationType") + + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun dateCreated(): Optional = dateCreated.getOptional("dateCreated") + + /** + * The last update date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun dateUpdated(): Optional = dateUpdated.getOptional("dateUpdated") + + /** + * Whether the rule is excluded from compliance calculations. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun deactivated(): Optional = deactivated.getOptional("deactivated") + + /** + * What the rule requires. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun description(): Optional = description.getOptional("description") + + /** + * The kind of evidence that satisfies the rule. `null` for platform rules. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun evidenceType(): Optional = + evidenceType.getOptional("evidenceType") + + /** + * Whether the rule is managed by Openlayer and cannot be edited. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun immutable(): Optional = immutable.getOptional("immutable") + + /** + * How often evidence must be renewed, in days. Once evidence is older than this, + * the rule result becomes `due_soon` and then `failing`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun renewalCadenceDays(): Optional = + renewalCadenceDays.getOptional("renewalCadenceDays") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [scope]. + * + * Unlike [scope], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("scope") @ExcludeMissing fun _scope(): JsonField = scope + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + /** + * Returns the raw JSON value of [automationParams]. + * + * Unlike [automationParams], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("automationParams") + @ExcludeMissing + fun _automationParams(): JsonField = automationParams + + /** + * Returns the raw JSON value of [automationType]. + * + * Unlike [automationType], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("automationType") + @ExcludeMissing + fun _automationType(): JsonField = automationType + + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** + * Returns the raw JSON value of [deactivated]. + * + * Unlike [deactivated], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("deactivated") + @ExcludeMissing + fun _deactivated(): JsonField = deactivated + + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("description") + @ExcludeMissing + fun _description(): JsonField = description + + /** + * Returns the raw JSON value of [evidenceType]. + * + * Unlike [evidenceType], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("evidenceType") + @ExcludeMissing + fun _evidenceType(): JsonField = evidenceType + + /** + * Returns the raw JSON value of [immutable]. + * + * Unlike [immutable], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("immutable") + @ExcludeMissing + fun _immutable(): JsonField = immutable + + /** + * Returns the raw JSON value of [renewalCadenceDays]. + * + * Unlike [renewalCadenceDays], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("renewalCadenceDays") + @ExcludeMissing + fun _renewalCadenceDays(): JsonField = renewalCadenceDays + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Rule]. + * + * The following fields are required: + * ```java + * .id() + * .name() + * .scope() + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Rule]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var name: JsonField? = null + private var scope: JsonField? = null + private var type: JsonField? = null + private var automationParams: JsonField = JsonMissing.of() + private var automationType: JsonField = JsonMissing.of() + private var dateCreated: JsonField = JsonMissing.of() + private var dateUpdated: JsonField = JsonMissing.of() + private var deactivated: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var evidenceType: JsonField = JsonMissing.of() + private var immutable: JsonField = JsonMissing.of() + private var renewalCadenceDays: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(rule: Rule) = apply { + id = rule.id + name = rule.name + scope = rule.scope + type = rule.type + automationParams = rule.automationParams + automationType = rule.automationType + dateCreated = rule.dateCreated + dateUpdated = rule.dateUpdated + deactivated = rule.deactivated + description = rule.description + evidenceType = rule.evidenceType + immutable = rule.immutable + renewalCadenceDays = rule.renewalCadenceDays + additionalProperties = rule.additionalProperties.toMutableMap() + } + + /** The rule id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The rule name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun name(name: JsonField) = apply { this.name = name } + + /** + * Whether the rule is evaluated once for the whole workspace, or once per + * project the rule's frameworks apply to. + */ + fun scope(scope: Scope) = scope(JsonField.of(scope)) + + /** + * Sets [Builder.scope] to an arbitrary JSON value. + * + * You should usually call [Builder.scope] with a well-typed [Scope] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun scope(scope: JsonField) = apply { this.scope = scope } + + /** + * `platform` rules are evaluated automatically from the state of your Openlayer + * workspace. `evidence` rules are satisfied by attaching evidence. + */ + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun type(type: JsonField) = apply { this.type = type } + + /** + * Configuration for the platform check, when the automation takes parameters. + */ + fun automationParams(automationParams: AutomationParams?) = + automationParams(JsonField.ofNullable(automationParams)) + + /** + * Alias for calling [Builder.automationParams] with + * `automationParams.orElse(null)`. + */ + fun automationParams(automationParams: Optional) = + automationParams(automationParams.getOrNull()) + + /** + * Sets [Builder.automationParams] to an arbitrary JSON value. + * + * You should usually call [Builder.automationParams] with a well-typed + * [AutomationParams] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun automationParams(automationParams: JsonField) = apply { + this.automationParams = automationParams + } + + /** + * Which workspace signal a platform rule checks, for example + * `monitoring_mode_enabled`, `test_setup`, or `project_owner_set`. `null` for + * evidence rules. + */ + fun automationType(automationType: String?) = + automationType(JsonField.ofNullable(automationType)) + + /** + * Alias for calling [Builder.automationType] with + * `automationType.orElse(null)`. + */ + fun automationType(automationType: Optional) = + automationType(automationType.getOrNull()) + + /** + * Sets [Builder.automationType] to an arbitrary JSON value. + * + * You should usually call [Builder.automationType] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun automationType(automationType: JsonField) = apply { + this.automationType = automationType + } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = + dateCreated(JsonField.of(dateCreated)) + + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The last update date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = + dateUpdated(JsonField.of(dateUpdated)) + + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** Whether the rule is excluded from compliance calculations. */ + fun deactivated(deactivated: Boolean) = deactivated(JsonField.of(deactivated)) + + /** + * Sets [Builder.deactivated] to an arbitrary JSON value. + * + * You should usually call [Builder.deactivated] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun deactivated(deactivated: JsonField) = apply { + this.deactivated = deactivated + } + + /** What the rule requires. */ + fun description(description: String?) = + description(JsonField.ofNullable(description)) + + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ + fun description(description: Optional) = + description(description.getOrNull()) + + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun description(description: JsonField) = apply { + this.description = description + } + + /** The kind of evidence that satisfies the rule. `null` for platform rules. */ + fun evidenceType(evidenceType: EvidenceType?) = + evidenceType(JsonField.ofNullable(evidenceType)) + + /** + * Alias for calling [Builder.evidenceType] with `evidenceType.orElse(null)`. + */ + fun evidenceType(evidenceType: Optional) = + evidenceType(evidenceType.getOrNull()) + + /** + * Sets [Builder.evidenceType] to an arbitrary JSON value. + * + * You should usually call [Builder.evidenceType] with a well-typed + * [EvidenceType] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ + fun evidenceType(evidenceType: JsonField) = apply { + this.evidenceType = evidenceType + } + + /** Whether the rule is managed by Openlayer and cannot be edited. */ + fun immutable(immutable: Boolean) = immutable(JsonField.of(immutable)) + + /** + * Sets [Builder.immutable] to an arbitrary JSON value. + * + * You should usually call [Builder.immutable] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun immutable(immutable: JsonField) = apply { + this.immutable = immutable + } + + /** + * How often evidence must be renewed, in days. Once evidence is older than + * this, the rule result becomes `due_soon` and then `failing`. + */ + fun renewalCadenceDays(renewalCadenceDays: Long?) = + renewalCadenceDays(JsonField.ofNullable(renewalCadenceDays)) + + /** + * Alias for [Builder.renewalCadenceDays]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun renewalCadenceDays(renewalCadenceDays: Long) = + renewalCadenceDays(renewalCadenceDays as Long?) + + /** + * Alias for calling [Builder.renewalCadenceDays] with + * `renewalCadenceDays.orElse(null)`. + */ + fun renewalCadenceDays(renewalCadenceDays: Optional) = + renewalCadenceDays(renewalCadenceDays.getOrNull()) + + /** + * Sets [Builder.renewalCadenceDays] to an arbitrary JSON value. + * + * You should usually call [Builder.renewalCadenceDays] with a well-typed [Long] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun renewalCadenceDays(renewalCadenceDays: JsonField) = apply { + this.renewalCadenceDays = renewalCadenceDays + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Rule]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .name() + * .scope() + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Rule = + Rule( + checkRequired("id", id), + checkRequired("name", name), + checkRequired("scope", scope), + checkRequired("type", type), + automationParams, + automationType, + dateCreated, + dateUpdated, + deactivated, + description, + evidenceType, + immutable, + renewalCadenceDays, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): Rule = apply { + if (validated) { + return@apply + } + + id() + name() + scope().validate() + type().validate() + automationParams().ifPresent { it.validate() } + automationType() + dateCreated() + dateUpdated() + deactivated() + description() + evidenceType().ifPresent { it.validate() } + immutable() + renewalCadenceDays() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (scope.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + (automationParams.asKnown().getOrNull()?.validity() ?: 0) + + (if (automationType.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (deactivated.asKnown().isPresent) 1 else 0) + + (if (description.asKnown().isPresent) 1 else 0) + + (evidenceType.asKnown().getOrNull()?.validity() ?: 0) + + (if (immutable.asKnown().isPresent) 1 else 0) + + (if (renewalCadenceDays.asKnown().isPresent) 1 else 0) + + /** + * Whether the rule is evaluated once for the whole workspace, or once per project + * the rule's frameworks apply to. + */ + class Scope @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val PROJECT = of("project") + + @JvmField val WORKSPACE = of("workspace") + + @JvmStatic fun of(value: String) = Scope(JsonField.of(value)) + } + + /** An enum containing [Scope]'s known values. */ + enum class Known { + PROJECT, + WORKSPACE, + } + + /** + * An enum containing [Scope]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Scope] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + PROJECT, + WORKSPACE, + /** + * An enum member indicating that [Scope] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + PROJECT -> Value.PROJECT + WORKSPACE -> Value.WORKSPACE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + PROJECT -> Known.PROJECT + WORKSPACE -> Known.WORKSPACE + else -> throw OpenlayerInvalidDataException("Unknown Scope: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object + * doesn't match its expected type. + */ + fun validate(): Scope = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Scope && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** + * `platform` rules are evaluated automatically from the state of your Openlayer + * workspace. `evidence` rules are satisfied by attaching evidence. + */ + class Type @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val PLATFORM = of("platform") + + @JvmField val EVIDENCE = of("evidence") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + PLATFORM, + EVIDENCE, + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + PLATFORM, + EVIDENCE, + /** + * An enum member indicating that [Type] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + PLATFORM -> Value.PLATFORM + EVIDENCE -> Value.EVIDENCE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + PLATFORM -> Known.PLATFORM + EVIDENCE -> Known.EVIDENCE + else -> throw OpenlayerInvalidDataException("Unknown Type: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object + * doesn't match its expected type. + */ + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Configuration for the platform check, when the automation takes parameters. */ + class AutomationParams + @JsonCreator + private constructor( + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [AutomationParams]. + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [AutomationParams]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(automationParams: AutomationParams) = apply { + additionalProperties = + automationParams.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [AutomationParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): AutomationParams = + AutomationParams(additionalProperties.toImmutable()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object + * doesn't match its expected type. + */ + fun validate(): AutomationParams = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + additionalProperties.count { (_, value) -> + !value.isNull() && !value.isMissing() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is AutomationParams && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "AutomationParams{additionalProperties=$additionalProperties}" + } + + /** The kind of evidence that satisfies the rule. `null` for platform rules. */ + class EvidenceType + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val DOCUMENT = of("document") + + @JvmField val TEXT = of("text") + + @JvmField val URL = of("url") + + @JvmField val CATEGORY_VALUE = of("categoryValue") + + @JvmStatic fun of(value: String) = EvidenceType(JsonField.of(value)) + } + + /** An enum containing [EvidenceType]'s known values. */ + enum class Known { + DOCUMENT, + TEXT, + URL, + CATEGORY_VALUE, + } + + /** + * An enum containing [EvidenceType]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [EvidenceType] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DOCUMENT, + TEXT, + URL, + CATEGORY_VALUE, + /** + * An enum member indicating that [EvidenceType] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DOCUMENT -> Value.DOCUMENT + TEXT -> Value.TEXT + URL -> Value.URL + CATEGORY_VALUE -> Value.CATEGORY_VALUE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + DOCUMENT -> Known.DOCUMENT + TEXT -> Known.TEXT + URL -> Known.URL + CATEGORY_VALUE -> Known.CATEGORY_VALUE + else -> + throw OpenlayerInvalidDataException("Unknown EvidenceType: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object + * doesn't match its expected type. + */ + fun validate(): EvidenceType = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is EvidenceType && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Rule && + id == other.id && + name == other.name && + scope == other.scope && + type == other.type && + automationParams == other.automationParams && + automationType == other.automationType && + dateCreated == other.dateCreated && + dateUpdated == other.dateUpdated && + deactivated == other.deactivated && + description == other.description && + evidenceType == other.evidenceType && + immutable == other.immutable && + renewalCadenceDays == other.renewalCadenceDays && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + name, + scope, + type, + automationParams, + automationType, + dateCreated, + dateUpdated, + deactivated, + description, + evidenceType, + immutable, + renewalCadenceDays, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Rule{id=$id, name=$name, scope=$scope, type=$type, automationParams=$automationParams, automationType=$automationType, dateCreated=$dateCreated, dateUpdated=$dateUpdated, deactivated=$deactivated, description=$description, evidenceType=$evidenceType, immutable=$immutable, renewalCadenceDays=$renewalCadenceDays, additionalProperties=$additionalProperties}" + } + + class Subsection + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val number: JsonField, + private val sectionId: JsonField, + private val sortOrder: JsonField, + private val title: JsonField, + private val ruleCount: JsonField, + private val rules: JsonField>, + private val text: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("number") + @ExcludeMissing + number: JsonField = JsonMissing.of(), + @JsonProperty("sectionId") + @ExcludeMissing + sectionId: JsonField = JsonMissing.of(), + @JsonProperty("sortOrder") + @ExcludeMissing + sortOrder: JsonField = JsonMissing.of(), + @JsonProperty("title") + @ExcludeMissing + title: JsonField = JsonMissing.of(), + @JsonProperty("ruleCount") + @ExcludeMissing + ruleCount: JsonField = JsonMissing.of(), + @JsonProperty("rules") + @ExcludeMissing + rules: JsonField> = JsonMissing.of(), + @JsonProperty("text") @ExcludeMissing text: JsonField = JsonMissing.of(), + ) : this( + id, + number, + sectionId, + sortOrder, + title, + ruleCount, + rules, + text, + mutableMapOf(), + ) + + /** + * The subsection id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun id(): String = id.getRequired("id") + + /** + * The subsection number as it appears in the source standard. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun number(): String = number.getRequired("number") + + /** + * The section the subsection belongs to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun sectionId(): String = sectionId.getRequired("sectionId") + + /** + * The position of the subsection within its section. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun sortOrder(): Long = sortOrder.getRequired("sortOrder") + + /** + * The subsection title. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun title(): String = title.getRequired("title") + + /** + * How many rules are linked to this subsection. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun ruleCount(): Optional = ruleCount.getOptional("ruleCount") + + /** + * The rules linked to this subsection. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun rules(): Optional> = rules.getOptional("rules") + + /** + * The subsection text. This is the requirement your rules are mapped against. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun text(): Optional = text.getOptional("text") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [number]. + * + * Unlike [number], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("number") @ExcludeMissing fun _number(): JsonField = number + + /** + * Returns the raw JSON value of [sectionId]. + * + * Unlike [sectionId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("sectionId") + @ExcludeMissing + fun _sectionId(): JsonField = sectionId + + /** + * Returns the raw JSON value of [sortOrder]. + * + * Unlike [sortOrder], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("sortOrder") + @ExcludeMissing + fun _sortOrder(): JsonField = sortOrder + + /** + * Returns the raw JSON value of [title]. + * + * Unlike [title], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("title") @ExcludeMissing fun _title(): JsonField = title + + /** + * Returns the raw JSON value of [ruleCount]. + * + * Unlike [ruleCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("ruleCount") + @ExcludeMissing + fun _ruleCount(): JsonField = ruleCount + + /** + * Returns the raw JSON value of [rules]. + * + * Unlike [rules], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("rules") @ExcludeMissing fun _rules(): JsonField> = rules + + /** + * Returns the raw JSON value of [text]. + * + * Unlike [text], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("text") @ExcludeMissing fun _text(): JsonField = text + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Subsection]. + * + * The following fields are required: + * ```java + * .id() + * .number() + * .sectionId() + * .sortOrder() + * .title() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Subsection]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var number: JsonField? = null + private var sectionId: JsonField? = null + private var sortOrder: JsonField? = null + private var title: JsonField? = null + private var ruleCount: JsonField = JsonMissing.of() + private var rules: JsonField>? = null + private var text: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(subsection: Subsection) = apply { + id = subsection.id + number = subsection.number + sectionId = subsection.sectionId + sortOrder = subsection.sortOrder + title = subsection.title + ruleCount = subsection.ruleCount + rules = subsection.rules.map { it.toMutableList() } + text = subsection.text + additionalProperties = subsection.additionalProperties.toMutableMap() + } + + /** The subsection id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The subsection number as it appears in the source standard. */ + fun number(number: String) = number(JsonField.of(number)) + + /** + * Sets [Builder.number] to an arbitrary JSON value. + * + * You should usually call [Builder.number] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun number(number: JsonField) = apply { this.number = number } + + /** The section the subsection belongs to. */ + fun sectionId(sectionId: String) = sectionId(JsonField.of(sectionId)) + + /** + * Sets [Builder.sectionId] to an arbitrary JSON value. + * + * You should usually call [Builder.sectionId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun sectionId(sectionId: JsonField) = apply { + this.sectionId = sectionId + } + + /** The position of the subsection within its section. */ + fun sortOrder(sortOrder: Long) = sortOrder(JsonField.of(sortOrder)) + + /** + * Sets [Builder.sortOrder] to an arbitrary JSON value. + * + * You should usually call [Builder.sortOrder] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun sortOrder(sortOrder: JsonField) = apply { this.sortOrder = sortOrder } + + /** The subsection title. */ + fun title(title: String) = title(JsonField.of(title)) + + /** + * Sets [Builder.title] to an arbitrary JSON value. + * + * You should usually call [Builder.title] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun title(title: JsonField) = apply { this.title = title } + + /** How many rules are linked to this subsection. */ + fun ruleCount(ruleCount: Long) = ruleCount(JsonField.of(ruleCount)) + + /** + * Sets [Builder.ruleCount] to an arbitrary JSON value. + * + * You should usually call [Builder.ruleCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun ruleCount(ruleCount: JsonField) = apply { this.ruleCount = ruleCount } + + /** The rules linked to this subsection. */ + fun rules(rules: List) = rules(JsonField.of(rules)) + + /** + * Sets [Builder.rules] to an arbitrary JSON value. + * + * You should usually call [Builder.rules] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun rules(rules: JsonField>) = apply { + this.rules = rules.map { it.toMutableList() } + } + + /** + * Adds a single [Rule] to [rules]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addRule(rule: Rule) = apply { + rules = + (rules ?: JsonField.of(mutableListOf())).also { + checkKnown("rules", it).add(rule) + } + } + + /** + * The subsection text. This is the requirement your rules are mapped against. + */ + fun text(text: String?) = text(JsonField.ofNullable(text)) + + /** Alias for calling [Builder.text] with `text.orElse(null)`. */ + fun text(text: Optional) = text(text.getOrNull()) + + /** + * Sets [Builder.text] to an arbitrary JSON value. + * + * You should usually call [Builder.text] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun text(text: JsonField) = apply { this.text = text } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Subsection]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .number() + * .sectionId() + * .sortOrder() + * .title() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Subsection = + Subsection( + checkRequired("id", id), + checkRequired("number", number), + checkRequired("sectionId", sectionId), + checkRequired("sortOrder", sortOrder), + checkRequired("title", title), + ruleCount, + (rules ?: JsonMissing.of()).map { it.toImmutable() }, + text, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): Subsection = apply { + if (validated) { + return@apply + } + + id() + number() + sectionId() + sortOrder() + title() + ruleCount() + rules().ifPresent { it.forEach { it.validate() } } + text() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (number.asKnown().isPresent) 1 else 0) + + (if (sectionId.asKnown().isPresent) 1 else 0) + + (if (sortOrder.asKnown().isPresent) 1 else 0) + + (if (title.asKnown().isPresent) 1 else 0) + + (if (ruleCount.asKnown().isPresent) 1 else 0) + + (rules.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (text.asKnown().isPresent) 1 else 0) + + class Rule + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val name: JsonField, + private val scope: JsonField, + private val type: JsonField, + private val automationParams: JsonField, + private val automationType: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val deactivated: JsonField, + private val description: JsonField, + private val evidenceType: JsonField, + private val immutable: JsonField, + private val renewalCadenceDays: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") + @ExcludeMissing + id: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + name: JsonField = JsonMissing.of(), + @JsonProperty("scope") + @ExcludeMissing + scope: JsonField = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + type: JsonField = JsonMissing.of(), + @JsonProperty("automationParams") + @ExcludeMissing + automationParams: JsonField = JsonMissing.of(), + @JsonProperty("automationType") + @ExcludeMissing + automationType: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("deactivated") + @ExcludeMissing + deactivated: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + description: JsonField = JsonMissing.of(), + @JsonProperty("evidenceType") + @ExcludeMissing + evidenceType: JsonField = JsonMissing.of(), + @JsonProperty("immutable") + @ExcludeMissing + immutable: JsonField = JsonMissing.of(), + @JsonProperty("renewalCadenceDays") + @ExcludeMissing + renewalCadenceDays: JsonField = JsonMissing.of(), + ) : this( + id, + name, + scope, + type, + automationParams, + automationType, + dateCreated, + dateUpdated, + deactivated, + description, + evidenceType, + immutable, + renewalCadenceDays, + mutableMapOf(), + ) + + /** + * The rule id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ + fun id(): String = id.getRequired("id") + + /** + * The rule name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ + fun name(): String = name.getRequired("name") + + /** + * Whether the rule is evaluated once for the whole workspace, or once per + * project the rule's frameworks apply to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ + fun scope(): Scope = scope.getRequired("scope") + + /** + * `platform` rules are evaluated automatically from the state of your Openlayer + * workspace. `evidence` rules are satisfied by attaching evidence. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ + fun type(): Type = type.getRequired("type") + + /** + * Configuration for the platform check, when the automation takes parameters. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ + fun automationParams(): Optional = + automationParams.getOptional("automationParams") + + /** + * Which workspace signal a platform rule checks, for example + * `monitoring_mode_enabled`, `test_setup`, or `project_owner_set`. `null` for + * evidence rules. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ + fun automationType(): Optional = + automationType.getOptional("automationType") + + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ + fun dateCreated(): Optional = + dateCreated.getOptional("dateCreated") + + /** + * The last update date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ + fun dateUpdated(): Optional = + dateUpdated.getOptional("dateUpdated") + + /** + * Whether the rule is excluded from compliance calculations. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ + fun deactivated(): Optional = deactivated.getOptional("deactivated") + + /** + * What the rule requires. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ + fun description(): Optional = description.getOptional("description") + + /** + * The kind of evidence that satisfies the rule. `null` for platform rules. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ + fun evidenceType(): Optional = + evidenceType.getOptional("evidenceType") + + /** + * Whether the rule is managed by Openlayer and cannot be edited. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ + fun immutable(): Optional = immutable.getOptional("immutable") + + /** + * How often evidence must be renewed, in days. Once evidence is older than + * this, the rule result becomes `due_soon` and then `failing`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected + * type (e.g. if the server responded with an unexpected value). + */ + fun renewalCadenceDays(): Optional = + renewalCadenceDays.getOptional("renewalCadenceDays") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [scope]. + * + * Unlike [scope], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("scope") @ExcludeMissing fun _scope(): JsonField = scope + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + /** + * Returns the raw JSON value of [automationParams]. + * + * Unlike [automationParams], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("automationParams") + @ExcludeMissing + fun _automationParams(): JsonField = automationParams + + /** + * Returns the raw JSON value of [automationType]. + * + * Unlike [automationType], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("automationType") + @ExcludeMissing + fun _automationType(): JsonField = automationType + + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** + * Returns the raw JSON value of [deactivated]. + * + * Unlike [deactivated], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("deactivated") + @ExcludeMissing + fun _deactivated(): JsonField = deactivated + + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("description") + @ExcludeMissing + fun _description(): JsonField = description + + /** + * Returns the raw JSON value of [evidenceType]. + * + * Unlike [evidenceType], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("evidenceType") + @ExcludeMissing + fun _evidenceType(): JsonField = evidenceType + + /** + * Returns the raw JSON value of [immutable]. + * + * Unlike [immutable], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("immutable") + @ExcludeMissing + fun _immutable(): JsonField = immutable + + /** + * Returns the raw JSON value of [renewalCadenceDays]. + * + * Unlike [renewalCadenceDays], this method doesn't throw if the JSON field has + * an unexpected type. + */ + @JsonProperty("renewalCadenceDays") + @ExcludeMissing + fun _renewalCadenceDays(): JsonField = renewalCadenceDays + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Rule]. + * + * The following fields are required: + * ```java + * .id() + * .name() + * .scope() + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Rule]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var name: JsonField? = null + private var scope: JsonField? = null + private var type: JsonField? = null + private var automationParams: JsonField = JsonMissing.of() + private var automationType: JsonField = JsonMissing.of() + private var dateCreated: JsonField = JsonMissing.of() + private var dateUpdated: JsonField = JsonMissing.of() + private var deactivated: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var evidenceType: JsonField = JsonMissing.of() + private var immutable: JsonField = JsonMissing.of() + private var renewalCadenceDays: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(rule: Rule) = apply { + id = rule.id + name = rule.name + scope = rule.scope + type = rule.type + automationParams = rule.automationParams + automationType = rule.automationType + dateCreated = rule.dateCreated + dateUpdated = rule.dateUpdated + deactivated = rule.deactivated + description = rule.description + evidenceType = rule.evidenceType + immutable = rule.immutable + renewalCadenceDays = rule.renewalCadenceDays + additionalProperties = rule.additionalProperties.toMutableMap() + } + + /** The rule id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The rule name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun name(name: JsonField) = apply { this.name = name } + + /** + * Whether the rule is evaluated once for the whole workspace, or once per + * project the rule's frameworks apply to. + */ + fun scope(scope: Scope) = scope(JsonField.of(scope)) + + /** + * Sets [Builder.scope] to an arbitrary JSON value. + * + * You should usually call [Builder.scope] with a well-typed [Scope] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun scope(scope: JsonField) = apply { this.scope = scope } + + /** + * `platform` rules are evaluated automatically from the state of your + * Openlayer workspace. `evidence` rules are satisfied by attaching + * evidence. + */ + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun type(type: JsonField) = apply { this.type = type } + + /** + * Configuration for the platform check, when the automation takes + * parameters. + */ + fun automationParams(automationParams: AutomationParams?) = + automationParams(JsonField.ofNullable(automationParams)) + + /** + * Alias for calling [Builder.automationParams] with + * `automationParams.orElse(null)`. + */ + fun automationParams(automationParams: Optional) = + automationParams(automationParams.getOrNull()) + + /** + * Sets [Builder.automationParams] to an arbitrary JSON value. + * + * You should usually call [Builder.automationParams] with a well-typed + * [AutomationParams] value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. + */ + fun automationParams(automationParams: JsonField) = + apply { + this.automationParams = automationParams + } + + /** + * Which workspace signal a platform rule checks, for example + * `monitoring_mode_enabled`, `test_setup`, or `project_owner_set`. `null` + * for evidence rules. + */ + fun automationType(automationType: String?) = + automationType(JsonField.ofNullable(automationType)) + + /** + * Alias for calling [Builder.automationType] with + * `automationType.orElse(null)`. + */ + fun automationType(automationType: Optional) = + automationType(automationType.getOrNull()) + + /** + * Sets [Builder.automationType] to an arbitrary JSON value. + * + * You should usually call [Builder.automationType] with a well-typed + * [String] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun automationType(automationType: JsonField) = apply { + this.automationType = automationType + } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = + dateCreated(JsonField.of(dateCreated)) + + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The last update date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = + dateUpdated(JsonField.of(dateUpdated)) + + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** Whether the rule is excluded from compliance calculations. */ + fun deactivated(deactivated: Boolean) = + deactivated(JsonField.of(deactivated)) + + /** + * Sets [Builder.deactivated] to an arbitrary JSON value. + * + * You should usually call [Builder.deactivated] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun deactivated(deactivated: JsonField) = apply { + this.deactivated = deactivated + } + + /** What the rule requires. */ + fun description(description: String?) = + description(JsonField.ofNullable(description)) + + /** + * Alias for calling [Builder.description] with `description.orElse(null)`. + */ + fun description(description: Optional) = + description(description.getOrNull()) + + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun description(description: JsonField) = apply { + this.description = description + } + + /** + * The kind of evidence that satisfies the rule. `null` for platform rules. + */ + fun evidenceType(evidenceType: EvidenceType?) = + evidenceType(JsonField.ofNullable(evidenceType)) + + /** + * Alias for calling [Builder.evidenceType] with + * `evidenceType.orElse(null)`. + */ + fun evidenceType(evidenceType: Optional) = + evidenceType(evidenceType.getOrNull()) + + /** + * Sets [Builder.evidenceType] to an arbitrary JSON value. + * + * You should usually call [Builder.evidenceType] with a well-typed + * [EvidenceType] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun evidenceType(evidenceType: JsonField) = apply { + this.evidenceType = evidenceType + } + + /** Whether the rule is managed by Openlayer and cannot be edited. */ + fun immutable(immutable: Boolean) = immutable(JsonField.of(immutable)) + + /** + * Sets [Builder.immutable] to an arbitrary JSON value. + * + * You should usually call [Builder.immutable] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun immutable(immutable: JsonField) = apply { + this.immutable = immutable + } + + /** + * How often evidence must be renewed, in days. Once evidence is older than + * this, the rule result becomes `due_soon` and then `failing`. + */ + fun renewalCadenceDays(renewalCadenceDays: Long?) = + renewalCadenceDays(JsonField.ofNullable(renewalCadenceDays)) + + /** + * Alias for [Builder.renewalCadenceDays]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun renewalCadenceDays(renewalCadenceDays: Long) = + renewalCadenceDays(renewalCadenceDays as Long?) + + /** + * Alias for calling [Builder.renewalCadenceDays] with + * `renewalCadenceDays.orElse(null)`. + */ + fun renewalCadenceDays(renewalCadenceDays: Optional) = + renewalCadenceDays(renewalCadenceDays.getOrNull()) + + /** + * Sets [Builder.renewalCadenceDays] to an arbitrary JSON value. + * + * You should usually call [Builder.renewalCadenceDays] with a well-typed + * [Long] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun renewalCadenceDays(renewalCadenceDays: JsonField) = apply { + this.renewalCadenceDays = renewalCadenceDays + } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Rule]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .name() + * .scope() + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Rule = + Rule( + checkRequired("id", id), + checkRequired("name", name), + checkRequired("scope", scope), + checkRequired("type", type), + automationParams, + automationType, + dateCreated, + dateUpdated, + deactivated, + description, + evidenceType, + immutable, + renewalCadenceDays, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object + * doesn't match its expected type. + */ + fun validate(): Rule = apply { + if (validated) { + return@apply + } + + id() + name() + scope().validate() + type().validate() + automationParams().ifPresent { it.validate() } + automationType() + dateCreated() + dateUpdated() + deactivated() + description() + evidenceType().ifPresent { it.validate() } + immutable() + renewalCadenceDays() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (scope.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + (automationParams.asKnown().getOrNull()?.validity() ?: 0) + + (if (automationType.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (deactivated.asKnown().isPresent) 1 else 0) + + (if (description.asKnown().isPresent) 1 else 0) + + (evidenceType.asKnown().getOrNull()?.validity() ?: 0) + + (if (immutable.asKnown().isPresent) 1 else 0) + + (if (renewalCadenceDays.asKnown().isPresent) 1 else 0) + + /** + * Whether the rule is evaluated once for the whole workspace, or once per + * project the rule's frameworks apply to. + */ + class Scope + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data + * that doesn't match any known member, and you want to know that value. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val PROJECT = of("project") + + @JvmField val WORKSPACE = of("workspace") + + @JvmStatic fun of(value: String) = Scope(JsonField.of(value)) + } + + /** An enum containing [Scope]'s known values. */ + enum class Known { + PROJECT, + WORKSPACE, + } + + /** + * An enum containing [Scope]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [Scope] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API + * may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + PROJECT, + WORKSPACE, + /** + * An enum member indicating that [Scope] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + PROJECT -> Value.PROJECT + WORKSPACE -> Value.WORKSPACE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always + * known and don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a + * not a known member. + */ + fun known(): Known = + when (this) { + PROJECT -> Known.PROJECT + WORKSPACE -> Known.WORKSPACE + else -> throw OpenlayerInvalidDataException("Unknown Scope: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily + * for debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does + * not have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object + * doesn't match its expected type. + */ + fun validate(): Scope = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this + * object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Scope && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** + * `platform` rules are evaluated automatically from the state of your Openlayer + * workspace. `evidence` rules are satisfied by attaching evidence. + */ + class Type + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data + * that doesn't match any known member, and you want to know that value. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val PLATFORM = of("platform") + + @JvmField val EVIDENCE = of("evidence") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + PLATFORM, + EVIDENCE, + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API + * may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + PLATFORM, + EVIDENCE, + /** + * An enum member indicating that [Type] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + PLATFORM -> Value.PLATFORM + EVIDENCE -> Value.EVIDENCE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always + * known and don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a + * not a known member. + */ + fun known(): Known = + when (this) { + PLATFORM -> Known.PLATFORM + EVIDENCE -> Known.EVIDENCE + else -> throw OpenlayerInvalidDataException("Unknown Type: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily + * for debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does + * not have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object + * doesn't match its expected type. + */ + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this + * object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** + * Configuration for the platform check, when the automation takes parameters. + */ + class AutomationParams + @JsonCreator + private constructor( + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [AutomationParams]. + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [AutomationParams]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(automationParams: AutomationParams) = apply { + additionalProperties = + automationParams.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [AutomationParams]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + */ + fun build(): AutomationParams = + AutomationParams(additionalProperties.toImmutable()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object + * doesn't match its expected type. + */ + fun validate(): AutomationParams = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this + * object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + additionalProperties.count { (_, value) -> + !value.isNull() && !value.isMissing() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is AutomationParams && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "AutomationParams{additionalProperties=$additionalProperties}" + } + + /** The kind of evidence that satisfies the rule. `null` for platform rules. */ + class EvidenceType + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data + * that doesn't match any known member, and you want to know that value. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val DOCUMENT = of("document") + + @JvmField val TEXT = of("text") + + @JvmField val URL = of("url") + + @JvmField val CATEGORY_VALUE = of("categoryValue") + + @JvmStatic fun of(value: String) = EvidenceType(JsonField.of(value)) + } + + /** An enum containing [EvidenceType]'s known values. */ + enum class Known { + DOCUMENT, + TEXT, + URL, + CATEGORY_VALUE, + } + + /** + * An enum containing [EvidenceType]'s known values, as well as an + * [_UNKNOWN] member. + * + * An instance of [EvidenceType] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API + * may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DOCUMENT, + TEXT, + URL, + CATEGORY_VALUE, + /** + * An enum member indicating that [EvidenceType] was instantiated with + * an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DOCUMENT -> Value.DOCUMENT + TEXT -> Value.TEXT + URL -> Value.URL + CATEGORY_VALUE -> Value.CATEGORY_VALUE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always + * known and don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a + * not a known member. + */ + fun known(): Known = + when (this) { + DOCUMENT -> Known.DOCUMENT + TEXT -> Known.TEXT + URL -> Known.URL + CATEGORY_VALUE -> Known.CATEGORY_VALUE + else -> + throw OpenlayerInvalidDataException( + "Unknown EvidenceType: $value" + ) + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily + * for debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does + * not have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object + * doesn't match its expected type. + */ + fun validate(): EvidenceType = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this + * object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is EvidenceType && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Rule && + id == other.id && + name == other.name && + scope == other.scope && + type == other.type && + automationParams == other.automationParams && + automationType == other.automationType && + dateCreated == other.dateCreated && + dateUpdated == other.dateUpdated && + deactivated == other.deactivated && + description == other.description && + evidenceType == other.evidenceType && + immutable == other.immutable && + renewalCadenceDays == other.renewalCadenceDays && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + name, + scope, + type, + automationParams, + automationType, + dateCreated, + dateUpdated, + deactivated, + description, + evidenceType, + immutable, + renewalCadenceDays, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Rule{id=$id, name=$name, scope=$scope, type=$type, automationParams=$automationParams, automationType=$automationType, dateCreated=$dateCreated, dateUpdated=$dateUpdated, deactivated=$deactivated, description=$description, evidenceType=$evidenceType, immutable=$immutable, renewalCadenceDays=$renewalCadenceDays, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Subsection && + id == other.id && + number == other.number && + sectionId == other.sectionId && + sortOrder == other.sortOrder && + title == other.title && + ruleCount == other.ruleCount && + rules == other.rules && + text == other.text && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + number, + sectionId, + sortOrder, + title, + ruleCount, + rules, + text, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Subsection{id=$id, number=$number, sectionId=$sectionId, sortOrder=$sortOrder, title=$title, ruleCount=$ruleCount, rules=$rules, text=$text, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Section && + id == other.id && + documentId == other.documentId && + number == other.number && + sortOrder == other.sortOrder && + title == other.title && + ruleCount == other.ruleCount && + rules == other.rules && + subsections == other.subsections && + text == other.text && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + documentId, + number, + sortOrder, + title, + ruleCount, + rules, + subsections, + text, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Section{id=$id, documentId=$documentId, number=$number, sortOrder=$sortOrder, title=$title, ruleCount=$ruleCount, rules=$rules, subsections=$subsections, text=$text, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Item && + id == other.id && + dateCreated == other.dateCreated && + dateUpdated == other.dateUpdated && + frameworkId == other.frameworkId && + title == other.title && + sections == other.sections && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + dateCreated, + dateUpdated, + frameworkId, + title, + sections, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Item{id=$id, dateCreated=$dateCreated, dateUpdated=$dateUpdated, frameworkId=$frameworkId, title=$title, sections=$sections, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is DocumentListResponse && + items == other.items && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(items, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "DocumentListResponse{items=$items, additionalProperties=$additionalProperties}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/documents/DocumentRetrieveParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/documents/DocumentRetrieveParams.kt new file mode 100644 index 00000000..18673f01 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/documents/DocumentRetrieveParams.kt @@ -0,0 +1,222 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.frameworks.documents + +import com.openlayer.api.core.Params +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.http.Headers +import com.openlayer.api.core.http.QueryParams +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * Retrieve a framework document, including its sections, subsections, and the rules mapped to each. + * + * Each section and subsection carries a `ruleCount`, so you can tell which requirements have rules + * mapped to them before drilling in. + */ +class DocumentRetrieveParams +private constructor( + private val frameworkId: String, + private val documentId: String?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun frameworkId(): String = frameworkId + + fun documentId(): Optional = Optional.ofNullable(documentId) + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [DocumentRetrieveParams]. + * + * The following fields are required: + * ```java + * .frameworkId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [DocumentRetrieveParams]. */ + class Builder internal constructor() { + + private var frameworkId: String? = null + private var documentId: String? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(documentRetrieveParams: DocumentRetrieveParams) = apply { + frameworkId = documentRetrieveParams.frameworkId + documentId = documentRetrieveParams.documentId + additionalHeaders = documentRetrieveParams.additionalHeaders.toBuilder() + additionalQueryParams = documentRetrieveParams.additionalQueryParams.toBuilder() + } + + fun frameworkId(frameworkId: String) = apply { this.frameworkId = frameworkId } + + fun documentId(documentId: String?) = apply { this.documentId = documentId } + + /** Alias for calling [Builder.documentId] with `documentId.orElse(null)`. */ + fun documentId(documentId: Optional) = documentId(documentId.getOrNull()) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [DocumentRetrieveParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .frameworkId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): DocumentRetrieveParams = + DocumentRetrieveParams( + checkRequired("frameworkId", frameworkId), + documentId, + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _pathParam(index: Int): String = + when (index) { + 0 -> frameworkId + 1 -> documentId ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is DocumentRetrieveParams && + frameworkId == other.frameworkId && + documentId == other.documentId && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = + Objects.hash(frameworkId, documentId, additionalHeaders, additionalQueryParams) + + override fun toString() = + "DocumentRetrieveParams{frameworkId=$frameworkId, documentId=$documentId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/documents/DocumentRetrieveResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/documents/DocumentRetrieveResponse.kt new file mode 100644 index 00000000..0903f7ac --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/documents/DocumentRetrieveResponse.kt @@ -0,0 +1,4106 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.frameworks.documents + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.openlayer.api.core.Enum +import com.openlayer.api.core.ExcludeMissing +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonMissing +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.checkKnown +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.toImmutable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.time.OffsetDateTime +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class DocumentRetrieveResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val id: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val frameworkId: JsonField, + private val title: JsonField, + private val sections: JsonField>, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("frameworkId") + @ExcludeMissing + frameworkId: JsonField = JsonMissing.of(), + @JsonProperty("title") @ExcludeMissing title: JsonField = JsonMissing.of(), + @JsonProperty("sections") + @ExcludeMissing + sections: JsonField> = JsonMissing.of(), + ) : this(id, dateCreated, dateUpdated, frameworkId, title, sections, mutableMapOf()) + + /** + * The document id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun id(): String = id.getRequired("id") + + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** + * The last update date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** + * The framework the document belongs to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun frameworkId(): String = frameworkId.getRequired("frameworkId") + + /** + * The document title. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun title(): String = title.getRequired("title") + + /** + * The document's sections, in display order. Only returned when retrieving a single document. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun sections(): Optional> = sections.getOptional("sections") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** + * Returns the raw JSON value of [frameworkId]. + * + * Unlike [frameworkId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("frameworkId") @ExcludeMissing fun _frameworkId(): JsonField = frameworkId + + /** + * Returns the raw JSON value of [title]. + * + * Unlike [title], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("title") @ExcludeMissing fun _title(): JsonField = title + + /** + * Returns the raw JSON value of [sections]. + * + * Unlike [sections], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("sections") @ExcludeMissing fun _sections(): JsonField> = sections + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [DocumentRetrieveResponse]. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateUpdated() + * .frameworkId() + * .title() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [DocumentRetrieveResponse]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var frameworkId: JsonField? = null + private var title: JsonField? = null + private var sections: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(documentRetrieveResponse: DocumentRetrieveResponse) = apply { + id = documentRetrieveResponse.id + dateCreated = documentRetrieveResponse.dateCreated + dateUpdated = documentRetrieveResponse.dateUpdated + frameworkId = documentRetrieveResponse.frameworkId + title = documentRetrieveResponse.title + sections = documentRetrieveResponse.sections.map { it.toMutableList() } + additionalProperties = documentRetrieveResponse.additionalProperties.toMutableMap() + } + + /** The document id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The last update date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** The framework the document belongs to. */ + fun frameworkId(frameworkId: String) = frameworkId(JsonField.of(frameworkId)) + + /** + * Sets [Builder.frameworkId] to an arbitrary JSON value. + * + * You should usually call [Builder.frameworkId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun frameworkId(frameworkId: JsonField) = apply { this.frameworkId = frameworkId } + + /** The document title. */ + fun title(title: String) = title(JsonField.of(title)) + + /** + * Sets [Builder.title] to an arbitrary JSON value. + * + * You should usually call [Builder.title] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun title(title: JsonField) = apply { this.title = title } + + /** + * The document's sections, in display order. Only returned when retrieving a single + * document. + */ + fun sections(sections: List
) = sections(JsonField.of(sections)) + + /** + * Sets [Builder.sections] to an arbitrary JSON value. + * + * You should usually call [Builder.sections] with a well-typed `List
` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun sections(sections: JsonField>) = apply { + this.sections = sections.map { it.toMutableList() } + } + + /** + * Adds a single [Section] to [sections]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addSection(section: Section) = apply { + sections = + (sections ?: JsonField.of(mutableListOf())).also { + checkKnown("sections", it).add(section) + } + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [DocumentRetrieveResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateUpdated() + * .frameworkId() + * .title() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): DocumentRetrieveResponse = + DocumentRetrieveResponse( + checkRequired("id", id), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("frameworkId", frameworkId), + checkRequired("title", title), + (sections ?: JsonMissing.of()).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): DocumentRetrieveResponse = apply { + if (validated) { + return@apply + } + + id() + dateCreated() + dateUpdated() + frameworkId() + title() + sections().ifPresent { it.forEach { it.validate() } } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (frameworkId.asKnown().isPresent) 1 else 0) + + (if (title.asKnown().isPresent) 1 else 0) + + (sections.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + class Section + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val documentId: JsonField, + private val number: JsonField, + private val sortOrder: JsonField, + private val title: JsonField, + private val ruleCount: JsonField, + private val rules: JsonField>, + private val subsections: JsonField>, + private val text: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("documentId") + @ExcludeMissing + documentId: JsonField = JsonMissing.of(), + @JsonProperty("number") @ExcludeMissing number: JsonField = JsonMissing.of(), + @JsonProperty("sortOrder") + @ExcludeMissing + sortOrder: JsonField = JsonMissing.of(), + @JsonProperty("title") @ExcludeMissing title: JsonField = JsonMissing.of(), + @JsonProperty("ruleCount") + @ExcludeMissing + ruleCount: JsonField = JsonMissing.of(), + @JsonProperty("rules") @ExcludeMissing rules: JsonField> = JsonMissing.of(), + @JsonProperty("subsections") + @ExcludeMissing + subsections: JsonField> = JsonMissing.of(), + @JsonProperty("text") @ExcludeMissing text: JsonField = JsonMissing.of(), + ) : this( + id, + documentId, + number, + sortOrder, + title, + ruleCount, + rules, + subsections, + text, + mutableMapOf(), + ) + + /** + * The section id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun id(): String = id.getRequired("id") + + /** + * The document the section belongs to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun documentId(): String = documentId.getRequired("documentId") + + /** + * The section number as it appears in the source standard. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun number(): String = number.getRequired("number") + + /** + * The position of the section within the document. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun sortOrder(): Long = sortOrder.getRequired("sortOrder") + + /** + * The section title. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun title(): String = title.getRequired("title") + + /** + * How many rules are linked to this section, including its subsections. Use it to decide + * whether to fetch the section's rules. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun ruleCount(): Optional = ruleCount.getOptional("ruleCount") + + /** + * The rules linked directly to this section. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun rules(): Optional> = rules.getOptional("rules") + + /** + * The section's subsections, in display order. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun subsections(): Optional> = subsections.getOptional("subsections") + + /** + * The section text. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun text(): Optional = text.getOptional("text") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [documentId]. + * + * Unlike [documentId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("documentId") + @ExcludeMissing + fun _documentId(): JsonField = documentId + + /** + * Returns the raw JSON value of [number]. + * + * Unlike [number], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("number") @ExcludeMissing fun _number(): JsonField = number + + /** + * Returns the raw JSON value of [sortOrder]. + * + * Unlike [sortOrder], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("sortOrder") @ExcludeMissing fun _sortOrder(): JsonField = sortOrder + + /** + * Returns the raw JSON value of [title]. + * + * Unlike [title], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("title") @ExcludeMissing fun _title(): JsonField = title + + /** + * Returns the raw JSON value of [ruleCount]. + * + * Unlike [ruleCount], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("ruleCount") @ExcludeMissing fun _ruleCount(): JsonField = ruleCount + + /** + * Returns the raw JSON value of [rules]. + * + * Unlike [rules], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("rules") @ExcludeMissing fun _rules(): JsonField> = rules + + /** + * Returns the raw JSON value of [subsections]. + * + * Unlike [subsections], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("subsections") + @ExcludeMissing + fun _subsections(): JsonField> = subsections + + /** + * Returns the raw JSON value of [text]. + * + * Unlike [text], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("text") @ExcludeMissing fun _text(): JsonField = text + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Section]. + * + * The following fields are required: + * ```java + * .id() + * .documentId() + * .number() + * .sortOrder() + * .title() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Section]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var documentId: JsonField? = null + private var number: JsonField? = null + private var sortOrder: JsonField? = null + private var title: JsonField? = null + private var ruleCount: JsonField = JsonMissing.of() + private var rules: JsonField>? = null + private var subsections: JsonField>? = null + private var text: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(section: Section) = apply { + id = section.id + documentId = section.documentId + number = section.number + sortOrder = section.sortOrder + title = section.title + ruleCount = section.ruleCount + rules = section.rules.map { it.toMutableList() } + subsections = section.subsections.map { it.toMutableList() } + text = section.text + additionalProperties = section.additionalProperties.toMutableMap() + } + + /** The section id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The document the section belongs to. */ + fun documentId(documentId: String) = documentId(JsonField.of(documentId)) + + /** + * Sets [Builder.documentId] to an arbitrary JSON value. + * + * You should usually call [Builder.documentId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun documentId(documentId: JsonField) = apply { this.documentId = documentId } + + /** The section number as it appears in the source standard. */ + fun number(number: String) = number(JsonField.of(number)) + + /** + * Sets [Builder.number] to an arbitrary JSON value. + * + * You should usually call [Builder.number] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun number(number: JsonField) = apply { this.number = number } + + /** The position of the section within the document. */ + fun sortOrder(sortOrder: Long) = sortOrder(JsonField.of(sortOrder)) + + /** + * Sets [Builder.sortOrder] to an arbitrary JSON value. + * + * You should usually call [Builder.sortOrder] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun sortOrder(sortOrder: JsonField) = apply { this.sortOrder = sortOrder } + + /** The section title. */ + fun title(title: String) = title(JsonField.of(title)) + + /** + * Sets [Builder.title] to an arbitrary JSON value. + * + * You should usually call [Builder.title] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun title(title: JsonField) = apply { this.title = title } + + /** + * How many rules are linked to this section, including its subsections. Use it to + * decide whether to fetch the section's rules. + */ + fun ruleCount(ruleCount: Long) = ruleCount(JsonField.of(ruleCount)) + + /** + * Sets [Builder.ruleCount] to an arbitrary JSON value. + * + * You should usually call [Builder.ruleCount] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun ruleCount(ruleCount: JsonField) = apply { this.ruleCount = ruleCount } + + /** The rules linked directly to this section. */ + fun rules(rules: List) = rules(JsonField.of(rules)) + + /** + * Sets [Builder.rules] to an arbitrary JSON value. + * + * You should usually call [Builder.rules] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun rules(rules: JsonField>) = apply { + this.rules = rules.map { it.toMutableList() } + } + + /** + * Adds a single [Rule] to [rules]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addRule(rule: Rule) = apply { + rules = + (rules ?: JsonField.of(mutableListOf())).also { + checkKnown("rules", it).add(rule) + } + } + + /** The section's subsections, in display order. */ + fun subsections(subsections: List) = subsections(JsonField.of(subsections)) + + /** + * Sets [Builder.subsections] to an arbitrary JSON value. + * + * You should usually call [Builder.subsections] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun subsections(subsections: JsonField>) = apply { + this.subsections = subsections.map { it.toMutableList() } + } + + /** + * Adds a single [Subsection] to [subsections]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addSubsection(subsection: Subsection) = apply { + subsections = + (subsections ?: JsonField.of(mutableListOf())).also { + checkKnown("subsections", it).add(subsection) + } + } + + /** The section text. */ + fun text(text: String?) = text(JsonField.ofNullable(text)) + + /** Alias for calling [Builder.text] with `text.orElse(null)`. */ + fun text(text: Optional) = text(text.getOrNull()) + + /** + * Sets [Builder.text] to an arbitrary JSON value. + * + * You should usually call [Builder.text] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun text(text: JsonField) = apply { this.text = text } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Section]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .documentId() + * .number() + * .sortOrder() + * .title() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Section = + Section( + checkRequired("id", id), + checkRequired("documentId", documentId), + checkRequired("number", number), + checkRequired("sortOrder", sortOrder), + checkRequired("title", title), + ruleCount, + (rules ?: JsonMissing.of()).map { it.toImmutable() }, + (subsections ?: JsonMissing.of()).map { it.toImmutable() }, + text, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Section = apply { + if (validated) { + return@apply + } + + id() + documentId() + number() + sortOrder() + title() + ruleCount() + rules().ifPresent { it.forEach { it.validate() } } + subsections().ifPresent { it.forEach { it.validate() } } + text() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (documentId.asKnown().isPresent) 1 else 0) + + (if (number.asKnown().isPresent) 1 else 0) + + (if (sortOrder.asKnown().isPresent) 1 else 0) + + (if (title.asKnown().isPresent) 1 else 0) + + (if (ruleCount.asKnown().isPresent) 1 else 0) + + (rules.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (subsections.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (text.asKnown().isPresent) 1 else 0) + + class Rule + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val name: JsonField, + private val scope: JsonField, + private val type: JsonField, + private val automationParams: JsonField, + private val automationType: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val deactivated: JsonField, + private val description: JsonField, + private val evidenceType: JsonField, + private val immutable: JsonField, + private val renewalCadenceDays: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("scope") @ExcludeMissing scope: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("automationParams") + @ExcludeMissing + automationParams: JsonField = JsonMissing.of(), + @JsonProperty("automationType") + @ExcludeMissing + automationType: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("deactivated") + @ExcludeMissing + deactivated: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + description: JsonField = JsonMissing.of(), + @JsonProperty("evidenceType") + @ExcludeMissing + evidenceType: JsonField = JsonMissing.of(), + @JsonProperty("immutable") + @ExcludeMissing + immutable: JsonField = JsonMissing.of(), + @JsonProperty("renewalCadenceDays") + @ExcludeMissing + renewalCadenceDays: JsonField = JsonMissing.of(), + ) : this( + id, + name, + scope, + type, + automationParams, + automationType, + dateCreated, + dateUpdated, + deactivated, + description, + evidenceType, + immutable, + renewalCadenceDays, + mutableMapOf(), + ) + + /** + * The rule id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun id(): String = id.getRequired("id") + + /** + * The rule name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun name(): String = name.getRequired("name") + + /** + * Whether the rule is evaluated once for the whole workspace, or once per project the + * rule's frameworks apply to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun scope(): Scope = scope.getRequired("scope") + + /** + * `platform` rules are evaluated automatically from the state of your Openlayer + * workspace. `evidence` rules are satisfied by attaching evidence. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun type(): Type = type.getRequired("type") + + /** + * Configuration for the platform check, when the automation takes parameters. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun automationParams(): Optional = + automationParams.getOptional("automationParams") + + /** + * Which workspace signal a platform rule checks, for example `monitoring_mode_enabled`, + * `test_setup`, or `project_owner_set`. `null` for evidence rules. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun automationType(): Optional = automationType.getOptional("automationType") + + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun dateCreated(): Optional = dateCreated.getOptional("dateCreated") + + /** + * The last update date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun dateUpdated(): Optional = dateUpdated.getOptional("dateUpdated") + + /** + * Whether the rule is excluded from compliance calculations. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun deactivated(): Optional = deactivated.getOptional("deactivated") + + /** + * What the rule requires. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun description(): Optional = description.getOptional("description") + + /** + * The kind of evidence that satisfies the rule. `null` for platform rules. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun evidenceType(): Optional = evidenceType.getOptional("evidenceType") + + /** + * Whether the rule is managed by Openlayer and cannot be edited. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun immutable(): Optional = immutable.getOptional("immutable") + + /** + * How often evidence must be renewed, in days. Once evidence is older than this, the + * rule result becomes `due_soon` and then `failing`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun renewalCadenceDays(): Optional = + renewalCadenceDays.getOptional("renewalCadenceDays") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [scope]. + * + * Unlike [scope], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("scope") @ExcludeMissing fun _scope(): JsonField = scope + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + /** + * Returns the raw JSON value of [automationParams]. + * + * Unlike [automationParams], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("automationParams") + @ExcludeMissing + fun _automationParams(): JsonField = automationParams + + /** + * Returns the raw JSON value of [automationType]. + * + * Unlike [automationType], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("automationType") + @ExcludeMissing + fun _automationType(): JsonField = automationType + + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** + * Returns the raw JSON value of [deactivated]. + * + * Unlike [deactivated], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("deactivated") + @ExcludeMissing + fun _deactivated(): JsonField = deactivated + + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("description") + @ExcludeMissing + fun _description(): JsonField = description + + /** + * Returns the raw JSON value of [evidenceType]. + * + * Unlike [evidenceType], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("evidenceType") + @ExcludeMissing + fun _evidenceType(): JsonField = evidenceType + + /** + * Returns the raw JSON value of [immutable]. + * + * Unlike [immutable], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("immutable") + @ExcludeMissing + fun _immutable(): JsonField = immutable + + /** + * Returns the raw JSON value of [renewalCadenceDays]. + * + * Unlike [renewalCadenceDays], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("renewalCadenceDays") + @ExcludeMissing + fun _renewalCadenceDays(): JsonField = renewalCadenceDays + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Rule]. + * + * The following fields are required: + * ```java + * .id() + * .name() + * .scope() + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Rule]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var name: JsonField? = null + private var scope: JsonField? = null + private var type: JsonField? = null + private var automationParams: JsonField = JsonMissing.of() + private var automationType: JsonField = JsonMissing.of() + private var dateCreated: JsonField = JsonMissing.of() + private var dateUpdated: JsonField = JsonMissing.of() + private var deactivated: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var evidenceType: JsonField = JsonMissing.of() + private var immutable: JsonField = JsonMissing.of() + private var renewalCadenceDays: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(rule: Rule) = apply { + id = rule.id + name = rule.name + scope = rule.scope + type = rule.type + automationParams = rule.automationParams + automationType = rule.automationType + dateCreated = rule.dateCreated + dateUpdated = rule.dateUpdated + deactivated = rule.deactivated + description = rule.description + evidenceType = rule.evidenceType + immutable = rule.immutable + renewalCadenceDays = rule.renewalCadenceDays + additionalProperties = rule.additionalProperties.toMutableMap() + } + + /** The rule id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The rule name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun name(name: JsonField) = apply { this.name = name } + + /** + * Whether the rule is evaluated once for the whole workspace, or once per project + * the rule's frameworks apply to. + */ + fun scope(scope: Scope) = scope(JsonField.of(scope)) + + /** + * Sets [Builder.scope] to an arbitrary JSON value. + * + * You should usually call [Builder.scope] with a well-typed [Scope] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun scope(scope: JsonField) = apply { this.scope = scope } + + /** + * `platform` rules are evaluated automatically from the state of your Openlayer + * workspace. `evidence` rules are satisfied by attaching evidence. + */ + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun type(type: JsonField) = apply { this.type = type } + + /** Configuration for the platform check, when the automation takes parameters. */ + fun automationParams(automationParams: AutomationParams?) = + automationParams(JsonField.ofNullable(automationParams)) + + /** + * Alias for calling [Builder.automationParams] with + * `automationParams.orElse(null)`. + */ + fun automationParams(automationParams: Optional) = + automationParams(automationParams.getOrNull()) + + /** + * Sets [Builder.automationParams] to an arbitrary JSON value. + * + * You should usually call [Builder.automationParams] with a well-typed + * [AutomationParams] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ + fun automationParams(automationParams: JsonField) = apply { + this.automationParams = automationParams + } + + /** + * Which workspace signal a platform rule checks, for example + * `monitoring_mode_enabled`, `test_setup`, or `project_owner_set`. `null` for + * evidence rules. + */ + fun automationType(automationType: String?) = + automationType(JsonField.ofNullable(automationType)) + + /** + * Alias for calling [Builder.automationType] with `automationType.orElse(null)`. + */ + fun automationType(automationType: Optional) = + automationType(automationType.getOrNull()) + + /** + * Sets [Builder.automationType] to an arbitrary JSON value. + * + * You should usually call [Builder.automationType] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun automationType(automationType: JsonField) = apply { + this.automationType = automationType + } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = + dateCreated(JsonField.of(dateCreated)) + + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The last update date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = + dateUpdated(JsonField.of(dateUpdated)) + + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** Whether the rule is excluded from compliance calculations. */ + fun deactivated(deactivated: Boolean) = deactivated(JsonField.of(deactivated)) + + /** + * Sets [Builder.deactivated] to an arbitrary JSON value. + * + * You should usually call [Builder.deactivated] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun deactivated(deactivated: JsonField) = apply { + this.deactivated = deactivated + } + + /** What the rule requires. */ + fun description(description: String?) = + description(JsonField.ofNullable(description)) + + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ + fun description(description: Optional) = + description(description.getOrNull()) + + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun description(description: JsonField) = apply { + this.description = description + } + + /** The kind of evidence that satisfies the rule. `null` for platform rules. */ + fun evidenceType(evidenceType: EvidenceType?) = + evidenceType(JsonField.ofNullable(evidenceType)) + + /** Alias for calling [Builder.evidenceType] with `evidenceType.orElse(null)`. */ + fun evidenceType(evidenceType: Optional) = + evidenceType(evidenceType.getOrNull()) + + /** + * Sets [Builder.evidenceType] to an arbitrary JSON value. + * + * You should usually call [Builder.evidenceType] with a well-typed [EvidenceType] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun evidenceType(evidenceType: JsonField) = apply { + this.evidenceType = evidenceType + } + + /** Whether the rule is managed by Openlayer and cannot be edited. */ + fun immutable(immutable: Boolean) = immutable(JsonField.of(immutable)) + + /** + * Sets [Builder.immutable] to an arbitrary JSON value. + * + * You should usually call [Builder.immutable] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun immutable(immutable: JsonField) = apply { this.immutable = immutable } + + /** + * How often evidence must be renewed, in days. Once evidence is older than this, + * the rule result becomes `due_soon` and then `failing`. + */ + fun renewalCadenceDays(renewalCadenceDays: Long?) = + renewalCadenceDays(JsonField.ofNullable(renewalCadenceDays)) + + /** + * Alias for [Builder.renewalCadenceDays]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun renewalCadenceDays(renewalCadenceDays: Long) = + renewalCadenceDays(renewalCadenceDays as Long?) + + /** + * Alias for calling [Builder.renewalCadenceDays] with + * `renewalCadenceDays.orElse(null)`. + */ + fun renewalCadenceDays(renewalCadenceDays: Optional) = + renewalCadenceDays(renewalCadenceDays.getOrNull()) + + /** + * Sets [Builder.renewalCadenceDays] to an arbitrary JSON value. + * + * You should usually call [Builder.renewalCadenceDays] with a well-typed [Long] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun renewalCadenceDays(renewalCadenceDays: JsonField) = apply { + this.renewalCadenceDays = renewalCadenceDays + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Rule]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .name() + * .scope() + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Rule = + Rule( + checkRequired("id", id), + checkRequired("name", name), + checkRequired("scope", scope), + checkRequired("type", type), + automationParams, + automationType, + dateCreated, + dateUpdated, + deactivated, + description, + evidenceType, + immutable, + renewalCadenceDays, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Rule = apply { + if (validated) { + return@apply + } + + id() + name() + scope().validate() + type().validate() + automationParams().ifPresent { it.validate() } + automationType() + dateCreated() + dateUpdated() + deactivated() + description() + evidenceType().ifPresent { it.validate() } + immutable() + renewalCadenceDays() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (scope.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + (automationParams.asKnown().getOrNull()?.validity() ?: 0) + + (if (automationType.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (deactivated.asKnown().isPresent) 1 else 0) + + (if (description.asKnown().isPresent) 1 else 0) + + (evidenceType.asKnown().getOrNull()?.validity() ?: 0) + + (if (immutable.asKnown().isPresent) 1 else 0) + + (if (renewalCadenceDays.asKnown().isPresent) 1 else 0) + + /** + * Whether the rule is evaluated once for the whole workspace, or once per project the + * rule's frameworks apply to. + */ + class Scope @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val PROJECT = of("project") + + @JvmField val WORKSPACE = of("workspace") + + @JvmStatic fun of(value: String) = Scope(JsonField.of(value)) + } + + /** An enum containing [Scope]'s known values. */ + enum class Known { + PROJECT, + WORKSPACE, + } + + /** + * An enum containing [Scope]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Scope] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + PROJECT, + WORKSPACE, + /** + * An enum member indicating that [Scope] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + PROJECT -> Value.PROJECT + WORKSPACE -> Value.WORKSPACE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + PROJECT -> Known.PROJECT + WORKSPACE -> Known.WORKSPACE + else -> throw OpenlayerInvalidDataException("Unknown Scope: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): Scope = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Scope && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** + * `platform` rules are evaluated automatically from the state of your Openlayer + * workspace. `evidence` rules are satisfied by attaching evidence. + */ + class Type @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val PLATFORM = of("platform") + + @JvmField val EVIDENCE = of("evidence") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + PLATFORM, + EVIDENCE, + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + PLATFORM, + EVIDENCE, + /** + * An enum member indicating that [Type] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + PLATFORM -> Value.PLATFORM + EVIDENCE -> Value.EVIDENCE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + PLATFORM -> Known.PLATFORM + EVIDENCE -> Known.EVIDENCE + else -> throw OpenlayerInvalidDataException("Unknown Type: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Configuration for the platform check, when the automation takes parameters. */ + class AutomationParams + @JsonCreator + private constructor( + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [AutomationParams]. + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [AutomationParams]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(automationParams: AutomationParams) = apply { + additionalProperties = automationParams.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [AutomationParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): AutomationParams = + AutomationParams(additionalProperties.toImmutable()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): AutomationParams = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + additionalProperties.count { (_, value) -> + !value.isNull() && !value.isMissing() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is AutomationParams && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "AutomationParams{additionalProperties=$additionalProperties}" + } + + /** The kind of evidence that satisfies the rule. `null` for platform rules. */ + class EvidenceType + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val DOCUMENT = of("document") + + @JvmField val TEXT = of("text") + + @JvmField val URL = of("url") + + @JvmField val CATEGORY_VALUE = of("categoryValue") + + @JvmStatic fun of(value: String) = EvidenceType(JsonField.of(value)) + } + + /** An enum containing [EvidenceType]'s known values. */ + enum class Known { + DOCUMENT, + TEXT, + URL, + CATEGORY_VALUE, + } + + /** + * An enum containing [EvidenceType]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [EvidenceType] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DOCUMENT, + TEXT, + URL, + CATEGORY_VALUE, + /** + * An enum member indicating that [EvidenceType] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DOCUMENT -> Value.DOCUMENT + TEXT -> Value.TEXT + URL -> Value.URL + CATEGORY_VALUE -> Value.CATEGORY_VALUE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DOCUMENT -> Known.DOCUMENT + TEXT -> Known.TEXT + URL -> Known.URL + CATEGORY_VALUE -> Known.CATEGORY_VALUE + else -> throw OpenlayerInvalidDataException("Unknown EvidenceType: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): EvidenceType = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is EvidenceType && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Rule && + id == other.id && + name == other.name && + scope == other.scope && + type == other.type && + automationParams == other.automationParams && + automationType == other.automationType && + dateCreated == other.dateCreated && + dateUpdated == other.dateUpdated && + deactivated == other.deactivated && + description == other.description && + evidenceType == other.evidenceType && + immutable == other.immutable && + renewalCadenceDays == other.renewalCadenceDays && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + name, + scope, + type, + automationParams, + automationType, + dateCreated, + dateUpdated, + deactivated, + description, + evidenceType, + immutable, + renewalCadenceDays, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Rule{id=$id, name=$name, scope=$scope, type=$type, automationParams=$automationParams, automationType=$automationType, dateCreated=$dateCreated, dateUpdated=$dateUpdated, deactivated=$deactivated, description=$description, evidenceType=$evidenceType, immutable=$immutable, renewalCadenceDays=$renewalCadenceDays, additionalProperties=$additionalProperties}" + } + + class Subsection + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val number: JsonField, + private val sectionId: JsonField, + private val sortOrder: JsonField, + private val title: JsonField, + private val ruleCount: JsonField, + private val rules: JsonField>, + private val text: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("number") + @ExcludeMissing + number: JsonField = JsonMissing.of(), + @JsonProperty("sectionId") + @ExcludeMissing + sectionId: JsonField = JsonMissing.of(), + @JsonProperty("sortOrder") + @ExcludeMissing + sortOrder: JsonField = JsonMissing.of(), + @JsonProperty("title") @ExcludeMissing title: JsonField = JsonMissing.of(), + @JsonProperty("ruleCount") + @ExcludeMissing + ruleCount: JsonField = JsonMissing.of(), + @JsonProperty("rules") + @ExcludeMissing + rules: JsonField> = JsonMissing.of(), + @JsonProperty("text") @ExcludeMissing text: JsonField = JsonMissing.of(), + ) : this( + id, + number, + sectionId, + sortOrder, + title, + ruleCount, + rules, + text, + mutableMapOf(), + ) + + /** + * The subsection id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun id(): String = id.getRequired("id") + + /** + * The subsection number as it appears in the source standard. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun number(): String = number.getRequired("number") + + /** + * The section the subsection belongs to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun sectionId(): String = sectionId.getRequired("sectionId") + + /** + * The position of the subsection within its section. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun sortOrder(): Long = sortOrder.getRequired("sortOrder") + + /** + * The subsection title. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun title(): String = title.getRequired("title") + + /** + * How many rules are linked to this subsection. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun ruleCount(): Optional = ruleCount.getOptional("ruleCount") + + /** + * The rules linked to this subsection. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun rules(): Optional> = rules.getOptional("rules") + + /** + * The subsection text. This is the requirement your rules are mapped against. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun text(): Optional = text.getOptional("text") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [number]. + * + * Unlike [number], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("number") @ExcludeMissing fun _number(): JsonField = number + + /** + * Returns the raw JSON value of [sectionId]. + * + * Unlike [sectionId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("sectionId") + @ExcludeMissing + fun _sectionId(): JsonField = sectionId + + /** + * Returns the raw JSON value of [sortOrder]. + * + * Unlike [sortOrder], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("sortOrder") @ExcludeMissing fun _sortOrder(): JsonField = sortOrder + + /** + * Returns the raw JSON value of [title]. + * + * Unlike [title], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("title") @ExcludeMissing fun _title(): JsonField = title + + /** + * Returns the raw JSON value of [ruleCount]. + * + * Unlike [ruleCount], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("ruleCount") @ExcludeMissing fun _ruleCount(): JsonField = ruleCount + + /** + * Returns the raw JSON value of [rules]. + * + * Unlike [rules], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("rules") @ExcludeMissing fun _rules(): JsonField> = rules + + /** + * Returns the raw JSON value of [text]. + * + * Unlike [text], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("text") @ExcludeMissing fun _text(): JsonField = text + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Subsection]. + * + * The following fields are required: + * ```java + * .id() + * .number() + * .sectionId() + * .sortOrder() + * .title() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Subsection]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var number: JsonField? = null + private var sectionId: JsonField? = null + private var sortOrder: JsonField? = null + private var title: JsonField? = null + private var ruleCount: JsonField = JsonMissing.of() + private var rules: JsonField>? = null + private var text: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(subsection: Subsection) = apply { + id = subsection.id + number = subsection.number + sectionId = subsection.sectionId + sortOrder = subsection.sortOrder + title = subsection.title + ruleCount = subsection.ruleCount + rules = subsection.rules.map { it.toMutableList() } + text = subsection.text + additionalProperties = subsection.additionalProperties.toMutableMap() + } + + /** The subsection id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The subsection number as it appears in the source standard. */ + fun number(number: String) = number(JsonField.of(number)) + + /** + * Sets [Builder.number] to an arbitrary JSON value. + * + * You should usually call [Builder.number] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun number(number: JsonField) = apply { this.number = number } + + /** The section the subsection belongs to. */ + fun sectionId(sectionId: String) = sectionId(JsonField.of(sectionId)) + + /** + * Sets [Builder.sectionId] to an arbitrary JSON value. + * + * You should usually call [Builder.sectionId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun sectionId(sectionId: JsonField) = apply { this.sectionId = sectionId } + + /** The position of the subsection within its section. */ + fun sortOrder(sortOrder: Long) = sortOrder(JsonField.of(sortOrder)) + + /** + * Sets [Builder.sortOrder] to an arbitrary JSON value. + * + * You should usually call [Builder.sortOrder] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun sortOrder(sortOrder: JsonField) = apply { this.sortOrder = sortOrder } + + /** The subsection title. */ + fun title(title: String) = title(JsonField.of(title)) + + /** + * Sets [Builder.title] to an arbitrary JSON value. + * + * You should usually call [Builder.title] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun title(title: JsonField) = apply { this.title = title } + + /** How many rules are linked to this subsection. */ + fun ruleCount(ruleCount: Long) = ruleCount(JsonField.of(ruleCount)) + + /** + * Sets [Builder.ruleCount] to an arbitrary JSON value. + * + * You should usually call [Builder.ruleCount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun ruleCount(ruleCount: JsonField) = apply { this.ruleCount = ruleCount } + + /** The rules linked to this subsection. */ + fun rules(rules: List) = rules(JsonField.of(rules)) + + /** + * Sets [Builder.rules] to an arbitrary JSON value. + * + * You should usually call [Builder.rules] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun rules(rules: JsonField>) = apply { + this.rules = rules.map { it.toMutableList() } + } + + /** + * Adds a single [Rule] to [rules]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addRule(rule: Rule) = apply { + rules = + (rules ?: JsonField.of(mutableListOf())).also { + checkKnown("rules", it).add(rule) + } + } + + /** The subsection text. This is the requirement your rules are mapped against. */ + fun text(text: String?) = text(JsonField.ofNullable(text)) + + /** Alias for calling [Builder.text] with `text.orElse(null)`. */ + fun text(text: Optional) = text(text.getOrNull()) + + /** + * Sets [Builder.text] to an arbitrary JSON value. + * + * You should usually call [Builder.text] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun text(text: JsonField) = apply { this.text = text } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Subsection]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .number() + * .sectionId() + * .sortOrder() + * .title() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Subsection = + Subsection( + checkRequired("id", id), + checkRequired("number", number), + checkRequired("sectionId", sectionId), + checkRequired("sortOrder", sortOrder), + checkRequired("title", title), + ruleCount, + (rules ?: JsonMissing.of()).map { it.toImmutable() }, + text, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Subsection = apply { + if (validated) { + return@apply + } + + id() + number() + sectionId() + sortOrder() + title() + ruleCount() + rules().ifPresent { it.forEach { it.validate() } } + text() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (number.asKnown().isPresent) 1 else 0) + + (if (sectionId.asKnown().isPresent) 1 else 0) + + (if (sortOrder.asKnown().isPresent) 1 else 0) + + (if (title.asKnown().isPresent) 1 else 0) + + (if (ruleCount.asKnown().isPresent) 1 else 0) + + (rules.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (text.asKnown().isPresent) 1 else 0) + + class Rule + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val name: JsonField, + private val scope: JsonField, + private val type: JsonField, + private val automationParams: JsonField, + private val automationType: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val deactivated: JsonField, + private val description: JsonField, + private val evidenceType: JsonField, + private val immutable: JsonField, + private val renewalCadenceDays: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + name: JsonField = JsonMissing.of(), + @JsonProperty("scope") + @ExcludeMissing + scope: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("automationParams") + @ExcludeMissing + automationParams: JsonField = JsonMissing.of(), + @JsonProperty("automationType") + @ExcludeMissing + automationType: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("deactivated") + @ExcludeMissing + deactivated: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + description: JsonField = JsonMissing.of(), + @JsonProperty("evidenceType") + @ExcludeMissing + evidenceType: JsonField = JsonMissing.of(), + @JsonProperty("immutable") + @ExcludeMissing + immutable: JsonField = JsonMissing.of(), + @JsonProperty("renewalCadenceDays") + @ExcludeMissing + renewalCadenceDays: JsonField = JsonMissing.of(), + ) : this( + id, + name, + scope, + type, + automationParams, + automationType, + dateCreated, + dateUpdated, + deactivated, + description, + evidenceType, + immutable, + renewalCadenceDays, + mutableMapOf(), + ) + + /** + * The rule id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun id(): String = id.getRequired("id") + + /** + * The rule name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun name(): String = name.getRequired("name") + + /** + * Whether the rule is evaluated once for the whole workspace, or once per project + * the rule's frameworks apply to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun scope(): Scope = scope.getRequired("scope") + + /** + * `platform` rules are evaluated automatically from the state of your Openlayer + * workspace. `evidence` rules are satisfied by attaching evidence. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun type(): Type = type.getRequired("type") + + /** + * Configuration for the platform check, when the automation takes parameters. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun automationParams(): Optional = + automationParams.getOptional("automationParams") + + /** + * Which workspace signal a platform rule checks, for example + * `monitoring_mode_enabled`, `test_setup`, or `project_owner_set`. `null` for + * evidence rules. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun automationType(): Optional = + automationType.getOptional("automationType") + + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun dateCreated(): Optional = dateCreated.getOptional("dateCreated") + + /** + * The last update date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun dateUpdated(): Optional = dateUpdated.getOptional("dateUpdated") + + /** + * Whether the rule is excluded from compliance calculations. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun deactivated(): Optional = deactivated.getOptional("deactivated") + + /** + * What the rule requires. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun description(): Optional = description.getOptional("description") + + /** + * The kind of evidence that satisfies the rule. `null` for platform rules. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun evidenceType(): Optional = + evidenceType.getOptional("evidenceType") + + /** + * Whether the rule is managed by Openlayer and cannot be edited. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun immutable(): Optional = immutable.getOptional("immutable") + + /** + * How often evidence must be renewed, in days. Once evidence is older than this, + * the rule result becomes `due_soon` and then `failing`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun renewalCadenceDays(): Optional = + renewalCadenceDays.getOptional("renewalCadenceDays") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [scope]. + * + * Unlike [scope], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("scope") @ExcludeMissing fun _scope(): JsonField = scope + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + /** + * Returns the raw JSON value of [automationParams]. + * + * Unlike [automationParams], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("automationParams") + @ExcludeMissing + fun _automationParams(): JsonField = automationParams + + /** + * Returns the raw JSON value of [automationType]. + * + * Unlike [automationType], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("automationType") + @ExcludeMissing + fun _automationType(): JsonField = automationType + + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** + * Returns the raw JSON value of [deactivated]. + * + * Unlike [deactivated], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("deactivated") + @ExcludeMissing + fun _deactivated(): JsonField = deactivated + + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("description") + @ExcludeMissing + fun _description(): JsonField = description + + /** + * Returns the raw JSON value of [evidenceType]. + * + * Unlike [evidenceType], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("evidenceType") + @ExcludeMissing + fun _evidenceType(): JsonField = evidenceType + + /** + * Returns the raw JSON value of [immutable]. + * + * Unlike [immutable], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("immutable") + @ExcludeMissing + fun _immutable(): JsonField = immutable + + /** + * Returns the raw JSON value of [renewalCadenceDays]. + * + * Unlike [renewalCadenceDays], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("renewalCadenceDays") + @ExcludeMissing + fun _renewalCadenceDays(): JsonField = renewalCadenceDays + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Rule]. + * + * The following fields are required: + * ```java + * .id() + * .name() + * .scope() + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Rule]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var name: JsonField? = null + private var scope: JsonField? = null + private var type: JsonField? = null + private var automationParams: JsonField = JsonMissing.of() + private var automationType: JsonField = JsonMissing.of() + private var dateCreated: JsonField = JsonMissing.of() + private var dateUpdated: JsonField = JsonMissing.of() + private var deactivated: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var evidenceType: JsonField = JsonMissing.of() + private var immutable: JsonField = JsonMissing.of() + private var renewalCadenceDays: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(rule: Rule) = apply { + id = rule.id + name = rule.name + scope = rule.scope + type = rule.type + automationParams = rule.automationParams + automationType = rule.automationType + dateCreated = rule.dateCreated + dateUpdated = rule.dateUpdated + deactivated = rule.deactivated + description = rule.description + evidenceType = rule.evidenceType + immutable = rule.immutable + renewalCadenceDays = rule.renewalCadenceDays + additionalProperties = rule.additionalProperties.toMutableMap() + } + + /** The rule id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The rule name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun name(name: JsonField) = apply { this.name = name } + + /** + * Whether the rule is evaluated once for the whole workspace, or once per + * project the rule's frameworks apply to. + */ + fun scope(scope: Scope) = scope(JsonField.of(scope)) + + /** + * Sets [Builder.scope] to an arbitrary JSON value. + * + * You should usually call [Builder.scope] with a well-typed [Scope] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun scope(scope: JsonField) = apply { this.scope = scope } + + /** + * `platform` rules are evaluated automatically from the state of your Openlayer + * workspace. `evidence` rules are satisfied by attaching evidence. + */ + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun type(type: JsonField) = apply { this.type = type } + + /** + * Configuration for the platform check, when the automation takes parameters. + */ + fun automationParams(automationParams: AutomationParams?) = + automationParams(JsonField.ofNullable(automationParams)) + + /** + * Alias for calling [Builder.automationParams] with + * `automationParams.orElse(null)`. + */ + fun automationParams(automationParams: Optional) = + automationParams(automationParams.getOrNull()) + + /** + * Sets [Builder.automationParams] to an arbitrary JSON value. + * + * You should usually call [Builder.automationParams] with a well-typed + * [AutomationParams] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun automationParams(automationParams: JsonField) = apply { + this.automationParams = automationParams + } + + /** + * Which workspace signal a platform rule checks, for example + * `monitoring_mode_enabled`, `test_setup`, or `project_owner_set`. `null` for + * evidence rules. + */ + fun automationType(automationType: String?) = + automationType(JsonField.ofNullable(automationType)) + + /** + * Alias for calling [Builder.automationType] with + * `automationType.orElse(null)`. + */ + fun automationType(automationType: Optional) = + automationType(automationType.getOrNull()) + + /** + * Sets [Builder.automationType] to an arbitrary JSON value. + * + * You should usually call [Builder.automationType] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun automationType(automationType: JsonField) = apply { + this.automationType = automationType + } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = + dateCreated(JsonField.of(dateCreated)) + + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The last update date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = + dateUpdated(JsonField.of(dateUpdated)) + + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** Whether the rule is excluded from compliance calculations. */ + fun deactivated(deactivated: Boolean) = deactivated(JsonField.of(deactivated)) + + /** + * Sets [Builder.deactivated] to an arbitrary JSON value. + * + * You should usually call [Builder.deactivated] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun deactivated(deactivated: JsonField) = apply { + this.deactivated = deactivated + } + + /** What the rule requires. */ + fun description(description: String?) = + description(JsonField.ofNullable(description)) + + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ + fun description(description: Optional) = + description(description.getOrNull()) + + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun description(description: JsonField) = apply { + this.description = description + } + + /** The kind of evidence that satisfies the rule. `null` for platform rules. */ + fun evidenceType(evidenceType: EvidenceType?) = + evidenceType(JsonField.ofNullable(evidenceType)) + + /** + * Alias for calling [Builder.evidenceType] with `evidenceType.orElse(null)`. + */ + fun evidenceType(evidenceType: Optional) = + evidenceType(evidenceType.getOrNull()) + + /** + * Sets [Builder.evidenceType] to an arbitrary JSON value. + * + * You should usually call [Builder.evidenceType] with a well-typed + * [EvidenceType] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ + fun evidenceType(evidenceType: JsonField) = apply { + this.evidenceType = evidenceType + } + + /** Whether the rule is managed by Openlayer and cannot be edited. */ + fun immutable(immutable: Boolean) = immutable(JsonField.of(immutable)) + + /** + * Sets [Builder.immutable] to an arbitrary JSON value. + * + * You should usually call [Builder.immutable] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun immutable(immutable: JsonField) = apply { + this.immutable = immutable + } + + /** + * How often evidence must be renewed, in days. Once evidence is older than + * this, the rule result becomes `due_soon` and then `failing`. + */ + fun renewalCadenceDays(renewalCadenceDays: Long?) = + renewalCadenceDays(JsonField.ofNullable(renewalCadenceDays)) + + /** + * Alias for [Builder.renewalCadenceDays]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun renewalCadenceDays(renewalCadenceDays: Long) = + renewalCadenceDays(renewalCadenceDays as Long?) + + /** + * Alias for calling [Builder.renewalCadenceDays] with + * `renewalCadenceDays.orElse(null)`. + */ + fun renewalCadenceDays(renewalCadenceDays: Optional) = + renewalCadenceDays(renewalCadenceDays.getOrNull()) + + /** + * Sets [Builder.renewalCadenceDays] to an arbitrary JSON value. + * + * You should usually call [Builder.renewalCadenceDays] with a well-typed [Long] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun renewalCadenceDays(renewalCadenceDays: JsonField) = apply { + this.renewalCadenceDays = renewalCadenceDays + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Rule]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .name() + * .scope() + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Rule = + Rule( + checkRequired("id", id), + checkRequired("name", name), + checkRequired("scope", scope), + checkRequired("type", type), + automationParams, + automationType, + dateCreated, + dateUpdated, + deactivated, + description, + evidenceType, + immutable, + renewalCadenceDays, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): Rule = apply { + if (validated) { + return@apply + } + + id() + name() + scope().validate() + type().validate() + automationParams().ifPresent { it.validate() } + automationType() + dateCreated() + dateUpdated() + deactivated() + description() + evidenceType().ifPresent { it.validate() } + immutable() + renewalCadenceDays() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (scope.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + (automationParams.asKnown().getOrNull()?.validity() ?: 0) + + (if (automationType.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (deactivated.asKnown().isPresent) 1 else 0) + + (if (description.asKnown().isPresent) 1 else 0) + + (evidenceType.asKnown().getOrNull()?.validity() ?: 0) + + (if (immutable.asKnown().isPresent) 1 else 0) + + (if (renewalCadenceDays.asKnown().isPresent) 1 else 0) + + /** + * Whether the rule is evaluated once for the whole workspace, or once per project + * the rule's frameworks apply to. + */ + class Scope @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val PROJECT = of("project") + + @JvmField val WORKSPACE = of("workspace") + + @JvmStatic fun of(value: String) = Scope(JsonField.of(value)) + } + + /** An enum containing [Scope]'s known values. */ + enum class Known { + PROJECT, + WORKSPACE, + } + + /** + * An enum containing [Scope]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Scope] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + PROJECT, + WORKSPACE, + /** + * An enum member indicating that [Scope] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + PROJECT -> Value.PROJECT + WORKSPACE -> Value.WORKSPACE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + PROJECT -> Known.PROJECT + WORKSPACE -> Known.WORKSPACE + else -> throw OpenlayerInvalidDataException("Unknown Scope: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object + * doesn't match its expected type. + */ + fun validate(): Scope = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Scope && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** + * `platform` rules are evaluated automatically from the state of your Openlayer + * workspace. `evidence` rules are satisfied by attaching evidence. + */ + class Type @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val PLATFORM = of("platform") + + @JvmField val EVIDENCE = of("evidence") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + PLATFORM, + EVIDENCE, + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + PLATFORM, + EVIDENCE, + /** + * An enum member indicating that [Type] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + PLATFORM -> Value.PLATFORM + EVIDENCE -> Value.EVIDENCE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + PLATFORM -> Known.PLATFORM + EVIDENCE -> Known.EVIDENCE + else -> throw OpenlayerInvalidDataException("Unknown Type: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object + * doesn't match its expected type. + */ + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Configuration for the platform check, when the automation takes parameters. */ + class AutomationParams + @JsonCreator + private constructor( + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [AutomationParams]. + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [AutomationParams]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(automationParams: AutomationParams) = apply { + additionalProperties = + automationParams.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [AutomationParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): AutomationParams = + AutomationParams(additionalProperties.toImmutable()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object + * doesn't match its expected type. + */ + fun validate(): AutomationParams = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + additionalProperties.count { (_, value) -> + !value.isNull() && !value.isMissing() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is AutomationParams && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "AutomationParams{additionalProperties=$additionalProperties}" + } + + /** The kind of evidence that satisfies the rule. `null` for platform rules. */ + class EvidenceType + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val DOCUMENT = of("document") + + @JvmField val TEXT = of("text") + + @JvmField val URL = of("url") + + @JvmField val CATEGORY_VALUE = of("categoryValue") + + @JvmStatic fun of(value: String) = EvidenceType(JsonField.of(value)) + } + + /** An enum containing [EvidenceType]'s known values. */ + enum class Known { + DOCUMENT, + TEXT, + URL, + CATEGORY_VALUE, + } + + /** + * An enum containing [EvidenceType]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [EvidenceType] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DOCUMENT, + TEXT, + URL, + CATEGORY_VALUE, + /** + * An enum member indicating that [EvidenceType] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DOCUMENT -> Value.DOCUMENT + TEXT -> Value.TEXT + URL -> Value.URL + CATEGORY_VALUE -> Value.CATEGORY_VALUE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + DOCUMENT -> Known.DOCUMENT + TEXT -> Known.TEXT + URL -> Known.URL + CATEGORY_VALUE -> Known.CATEGORY_VALUE + else -> + throw OpenlayerInvalidDataException("Unknown EvidenceType: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object + * doesn't match its expected type. + */ + fun validate(): EvidenceType = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is EvidenceType && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Rule && + id == other.id && + name == other.name && + scope == other.scope && + type == other.type && + automationParams == other.automationParams && + automationType == other.automationType && + dateCreated == other.dateCreated && + dateUpdated == other.dateUpdated && + deactivated == other.deactivated && + description == other.description && + evidenceType == other.evidenceType && + immutable == other.immutable && + renewalCadenceDays == other.renewalCadenceDays && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + name, + scope, + type, + automationParams, + automationType, + dateCreated, + dateUpdated, + deactivated, + description, + evidenceType, + immutable, + renewalCadenceDays, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Rule{id=$id, name=$name, scope=$scope, type=$type, automationParams=$automationParams, automationType=$automationType, dateCreated=$dateCreated, dateUpdated=$dateUpdated, deactivated=$deactivated, description=$description, evidenceType=$evidenceType, immutable=$immutable, renewalCadenceDays=$renewalCadenceDays, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Subsection && + id == other.id && + number == other.number && + sectionId == other.sectionId && + sortOrder == other.sortOrder && + title == other.title && + ruleCount == other.ruleCount && + rules == other.rules && + text == other.text && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + number, + sectionId, + sortOrder, + title, + ruleCount, + rules, + text, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Subsection{id=$id, number=$number, sectionId=$sectionId, sortOrder=$sortOrder, title=$title, ruleCount=$ruleCount, rules=$rules, text=$text, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Section && + id == other.id && + documentId == other.documentId && + number == other.number && + sortOrder == other.sortOrder && + title == other.title && + ruleCount == other.ruleCount && + rules == other.rules && + subsections == other.subsections && + text == other.text && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + documentId, + number, + sortOrder, + title, + ruleCount, + rules, + subsections, + text, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Section{id=$id, documentId=$documentId, number=$number, sortOrder=$sortOrder, title=$title, ruleCount=$ruleCount, rules=$rules, subsections=$subsections, text=$text, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is DocumentRetrieveResponse && + id == other.id && + dateCreated == other.dateCreated && + dateUpdated == other.dateUpdated && + frameworkId == other.frameworkId && + title == other.title && + sections == other.sections && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + dateCreated, + dateUpdated, + frameworkId, + title, + sections, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "DocumentRetrieveResponse{id=$id, dateCreated=$dateCreated, dateUpdated=$dateUpdated, frameworkId=$frameworkId, title=$title, sections=$sections, additionalProperties=$additionalProperties}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/sections/SectionListRulesParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/sections/SectionListRulesParams.kt new file mode 100644 index 00000000..7f639077 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/sections/SectionListRulesParams.kt @@ -0,0 +1,537 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.frameworks.sections + +import com.fasterxml.jackson.annotation.JsonCreator +import com.openlayer.api.core.Enum +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.Params +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.http.Headers +import com.openlayer.api.core.http.QueryParams +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * List the rules mapped to a section of a framework document. + * + * Pass `includeSubsectionRules=true` to also return the rules mapped to the section's subsections, + * which is how you get every rule covering a requirement and everything under it. + */ +class SectionListRulesParams +private constructor( + private val frameworkId: String, + private val sectionId: String?, + private val includeResults: Boolean?, + private val includeSubsectionRules: Boolean?, + private val page: Long?, + private val perPage: Long?, + private val projectId: String?, + private val status: Status?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun frameworkId(): String = frameworkId + + fun sectionId(): Optional = Optional.ofNullable(sectionId) + + /** Whether to include each rule's results inline, in a `results` array. */ + fun includeResults(): Optional = Optional.ofNullable(includeResults) + + /** Whether to also include the rules mapped to the section's subsections. */ + fun includeSubsectionRules(): Optional = Optional.ofNullable(includeSubsectionRules) + + /** The page to return in a paginated query. */ + fun page(): Optional = Optional.ofNullable(page) + + /** Maximum number of items to return per page. */ + fun perPage(): Optional = Optional.ofNullable(perPage) + + /** Only include items that apply to this project. */ + fun projectId(): Optional = Optional.ofNullable(projectId) + + /** Only include items whose rule result has this compliance status. */ + fun status(): Optional = Optional.ofNullable(status) + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [SectionListRulesParams]. + * + * The following fields are required: + * ```java + * .frameworkId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [SectionListRulesParams]. */ + class Builder internal constructor() { + + private var frameworkId: String? = null + private var sectionId: String? = null + private var includeResults: Boolean? = null + private var includeSubsectionRules: Boolean? = null + private var page: Long? = null + private var perPage: Long? = null + private var projectId: String? = null + private var status: Status? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(sectionListRulesParams: SectionListRulesParams) = apply { + frameworkId = sectionListRulesParams.frameworkId + sectionId = sectionListRulesParams.sectionId + includeResults = sectionListRulesParams.includeResults + includeSubsectionRules = sectionListRulesParams.includeSubsectionRules + page = sectionListRulesParams.page + perPage = sectionListRulesParams.perPage + projectId = sectionListRulesParams.projectId + status = sectionListRulesParams.status + additionalHeaders = sectionListRulesParams.additionalHeaders.toBuilder() + additionalQueryParams = sectionListRulesParams.additionalQueryParams.toBuilder() + } + + fun frameworkId(frameworkId: String) = apply { this.frameworkId = frameworkId } + + fun sectionId(sectionId: String?) = apply { this.sectionId = sectionId } + + /** Alias for calling [Builder.sectionId] with `sectionId.orElse(null)`. */ + fun sectionId(sectionId: Optional) = sectionId(sectionId.getOrNull()) + + /** Whether to include each rule's results inline, in a `results` array. */ + fun includeResults(includeResults: Boolean?) = apply { + this.includeResults = includeResults + } + + /** + * Alias for [Builder.includeResults]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun includeResults(includeResults: Boolean) = includeResults(includeResults as Boolean?) + + /** Alias for calling [Builder.includeResults] with `includeResults.orElse(null)`. */ + fun includeResults(includeResults: Optional) = + includeResults(includeResults.getOrNull()) + + /** Whether to also include the rules mapped to the section's subsections. */ + fun includeSubsectionRules(includeSubsectionRules: Boolean?) = apply { + this.includeSubsectionRules = includeSubsectionRules + } + + /** + * Alias for [Builder.includeSubsectionRules]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun includeSubsectionRules(includeSubsectionRules: Boolean) = + includeSubsectionRules(includeSubsectionRules as Boolean?) + + /** + * Alias for calling [Builder.includeSubsectionRules] with + * `includeSubsectionRules.orElse(null)`. + */ + fun includeSubsectionRules(includeSubsectionRules: Optional) = + includeSubsectionRules(includeSubsectionRules.getOrNull()) + + /** The page to return in a paginated query. */ + fun page(page: Long?) = apply { this.page = page } + + /** + * Alias for [Builder.page]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun page(page: Long) = page(page as Long?) + + /** Alias for calling [Builder.page] with `page.orElse(null)`. */ + fun page(page: Optional) = page(page.getOrNull()) + + /** Maximum number of items to return per page. */ + fun perPage(perPage: Long?) = apply { this.perPage = perPage } + + /** + * Alias for [Builder.perPage]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun perPage(perPage: Long) = perPage(perPage as Long?) + + /** Alias for calling [Builder.perPage] with `perPage.orElse(null)`. */ + fun perPage(perPage: Optional) = perPage(perPage.getOrNull()) + + /** Only include items that apply to this project. */ + fun projectId(projectId: String?) = apply { this.projectId = projectId } + + /** Alias for calling [Builder.projectId] with `projectId.orElse(null)`. */ + fun projectId(projectId: Optional) = projectId(projectId.getOrNull()) + + /** Only include items whose rule result has this compliance status. */ + fun status(status: Status?) = apply { this.status = status } + + /** Alias for calling [Builder.status] with `status.orElse(null)`. */ + fun status(status: Optional) = status(status.getOrNull()) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [SectionListRulesParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .frameworkId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): SectionListRulesParams = + SectionListRulesParams( + checkRequired("frameworkId", frameworkId), + sectionId, + includeResults, + includeSubsectionRules, + page, + perPage, + projectId, + status, + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _pathParam(index: Int): String = + when (index) { + 0 -> frameworkId + 1 -> sectionId ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + includeResults?.let { put("includeResults", it.toString()) } + includeSubsectionRules?.let { put("includeSubsectionRules", it.toString()) } + page?.let { put("page", it.toString()) } + perPage?.let { put("perPage", it.toString()) } + projectId?.let { put("projectId", it) } + status?.let { put("status", it.toString()) } + putAll(additionalQueryParams) + } + .build() + + /** Only include items whose rule result has this compliance status. */ + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val RUNNING = of("running") + + @JvmField val PASSING = of("passing") + + @JvmField val FAILING = of("failing") + + @JvmField val SKIPPED = of("skipped") + + @JvmField val ERROR = of("error") + + @JvmField val PENDING = of("pending") + + @JvmField val DUE_SOON = of("due_soon") + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + /** An enum containing [Status]'s known values. */ + enum class Known { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + } + + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + /** An enum member indicating that [Status] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + PENDING -> Value.PENDING + DUE_SOON -> Value.DUE_SOON + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + PENDING -> Known.PENDING + DUE_SOON -> Known.DUE_SOON + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SectionListRulesParams && + frameworkId == other.frameworkId && + sectionId == other.sectionId && + includeResults == other.includeResults && + includeSubsectionRules == other.includeSubsectionRules && + page == other.page && + perPage == other.perPage && + projectId == other.projectId && + status == other.status && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = + Objects.hash( + frameworkId, + sectionId, + includeResults, + includeSubsectionRules, + page, + perPage, + projectId, + status, + additionalHeaders, + additionalQueryParams, + ) + + override fun toString() = + "SectionListRulesParams{frameworkId=$frameworkId, sectionId=$sectionId, includeResults=$includeResults, includeSubsectionRules=$includeSubsectionRules, page=$page, perPage=$perPage, projectId=$projectId, status=$status, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/sections/SectionListRulesResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/sections/SectionListRulesResponse.kt new file mode 100644 index 00000000..8af9303a --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/sections/SectionListRulesResponse.kt @@ -0,0 +1,5145 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.frameworks.sections + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.openlayer.api.core.Enum +import com.openlayer.api.core.ExcludeMissing +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonMissing +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.checkKnown +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.toImmutable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.time.OffsetDateTime +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class SectionListRulesResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val items: JsonField>, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("items") @ExcludeMissing items: JsonField> = JsonMissing.of() + ) : this(items, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun items(): List = items.getRequired("items") + + /** + * Returns the raw JSON value of [items]. + * + * Unlike [items], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("items") @ExcludeMissing fun _items(): JsonField> = items + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [SectionListRulesResponse]. + * + * The following fields are required: + * ```java + * .items() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [SectionListRulesResponse]. */ + class Builder internal constructor() { + + private var items: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(sectionListRulesResponse: SectionListRulesResponse) = apply { + items = sectionListRulesResponse.items.map { it.toMutableList() } + additionalProperties = sectionListRulesResponse.additionalProperties.toMutableMap() + } + + fun items(items: List) = items(JsonField.of(items)) + + /** + * Sets [Builder.items] to an arbitrary JSON value. + * + * You should usually call [Builder.items] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun items(items: JsonField>) = apply { + this.items = items.map { it.toMutableList() } + } + + /** + * Adds a single [Item] to [items]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addItem(item: Item) = apply { + items = + (items ?: JsonField.of(mutableListOf())).also { checkKnown("items", it).add(item) } + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [SectionListRulesResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .items() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): SectionListRulesResponse = + SectionListRulesResponse( + checkRequired("items", items).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): SectionListRulesResponse = apply { + if (validated) { + return@apply + } + + items().forEach { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (items.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + class Item + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val name: JsonField, + private val scope: JsonField, + private val type: JsonField, + private val workspaceId: JsonField, + private val assigneeId: JsonField, + private val automationParams: JsonField, + private val automationType: JsonField, + private val deactivated: JsonField, + private val description: JsonField, + private val evidenceType: JsonField, + private val frameworks: JsonField>, + private val immutable: JsonField, + private val renewalCadenceDays: JsonField, + private val results: JsonField>, + private val resultsSummary: JsonField, + private val tagIds: JsonField>, + private val tags: JsonField>, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("scope") @ExcludeMissing scope: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + @JsonProperty("assigneeId") + @ExcludeMissing + assigneeId: JsonField = JsonMissing.of(), + @JsonProperty("automationParams") + @ExcludeMissing + automationParams: JsonField = JsonMissing.of(), + @JsonProperty("automationType") + @ExcludeMissing + automationType: JsonField = JsonMissing.of(), + @JsonProperty("deactivated") + @ExcludeMissing + deactivated: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + description: JsonField = JsonMissing.of(), + @JsonProperty("evidenceType") + @ExcludeMissing + evidenceType: JsonField = JsonMissing.of(), + @JsonProperty("frameworks") + @ExcludeMissing + frameworks: JsonField> = JsonMissing.of(), + @JsonProperty("immutable") + @ExcludeMissing + immutable: JsonField = JsonMissing.of(), + @JsonProperty("renewalCadenceDays") + @ExcludeMissing + renewalCadenceDays: JsonField = JsonMissing.of(), + @JsonProperty("results") + @ExcludeMissing + results: JsonField> = JsonMissing.of(), + @JsonProperty("resultsSummary") + @ExcludeMissing + resultsSummary: JsonField = JsonMissing.of(), + @JsonProperty("tagIds") + @ExcludeMissing + tagIds: JsonField> = JsonMissing.of(), + @JsonProperty("tags") @ExcludeMissing tags: JsonField> = JsonMissing.of(), + ) : this( + id, + dateCreated, + dateUpdated, + name, + scope, + type, + workspaceId, + assigneeId, + automationParams, + automationType, + deactivated, + description, + evidenceType, + frameworks, + immutable, + renewalCadenceDays, + results, + resultsSummary, + tagIds, + tags, + mutableMapOf(), + ) + + /** + * The rule id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun id(): String = id.getRequired("id") + + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** + * The last update date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** + * The rule name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun name(): String = name.getRequired("name") + + /** + * Whether the rule is evaluated once for the whole workspace, or once per project the + * rule's frameworks apply to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun scope(): Scope = scope.getRequired("scope") + + /** + * `platform` rules are evaluated automatically from the state of your Openlayer workspace. + * `evidence` rules are satisfied by attaching evidence. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun type(): Type = type.getRequired("type") + + /** + * The id of the workspace the rule belongs to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun workspaceId(): String = workspaceId.getRequired("workspaceId") + + /** + * The user responsible for satisfying the rule. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun assigneeId(): Optional = assigneeId.getOptional("assigneeId") + + /** + * Configuration for the platform check, when the automation takes parameters. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun automationParams(): Optional = + automationParams.getOptional("automationParams") + + /** + * Which workspace signal a platform rule checks, for example `monitoring_mode_enabled`, + * `test_setup`, or `project_owner_set`. `null` for evidence rules. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun automationType(): Optional = automationType.getOptional("automationType") + + /** + * Whether the rule is excluded from compliance calculations. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun deactivated(): Optional = deactivated.getOptional("deactivated") + + /** + * What the rule requires. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun description(): Optional = description.getOptional("description") + + /** + * The kind of evidence that satisfies the rule. `null` for platform rules. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun evidenceType(): Optional = evidenceType.getOptional("evidenceType") + + /** + * The frameworks that include this rule. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun frameworks(): Optional> = frameworks.getOptional("frameworks") + + /** + * Whether the rule is managed by Openlayer and cannot be edited. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun immutable(): Optional = immutable.getOptional("immutable") + + /** + * How often evidence must be renewed, in days. Once evidence is older than this, the rule + * result becomes `due_soon` and then `failing`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun renewalCadenceDays(): Optional = + renewalCadenceDays.getOptional("renewalCadenceDays") + + /** + * The rule's results, one per entity the rule is evaluated against. Only returned when + * `includeResults` is `true`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun results(): Optional> = results.getOptional("results") + + /** + * Pass-rate counts across all of the rule's entities, independent of any status filter + * applied to the request. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun resultsSummary(): Optional = + resultsSummary.getOptional("resultsSummary") + + /** + * The ids of the rule tags to associate with the rule. Replaces the rule's tags. Read them + * back from `tags`, and list the tags available in the workspace with `GET + * /workspaces/{workspaceId}/rule-tags`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun tagIds(): Optional> = tagIds.getOptional("tagIds") + + /** + * The rule tags associated with the rule. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun tags(): Optional> = tags.getOptional("tags") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [scope]. + * + * Unlike [scope], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("scope") @ExcludeMissing fun _scope(): JsonField = scope + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + /** + * Returns the raw JSON value of [workspaceId]. + * + * Unlike [workspaceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("workspaceId") + @ExcludeMissing + fun _workspaceId(): JsonField = workspaceId + + /** + * Returns the raw JSON value of [assigneeId]. + * + * Unlike [assigneeId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("assigneeId") + @ExcludeMissing + fun _assigneeId(): JsonField = assigneeId + + /** + * Returns the raw JSON value of [automationParams]. + * + * Unlike [automationParams], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("automationParams") + @ExcludeMissing + fun _automationParams(): JsonField = automationParams + + /** + * Returns the raw JSON value of [automationType]. + * + * Unlike [automationType], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("automationType") + @ExcludeMissing + fun _automationType(): JsonField = automationType + + /** + * Returns the raw JSON value of [deactivated]. + * + * Unlike [deactivated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("deactivated") + @ExcludeMissing + fun _deactivated(): JsonField = deactivated + + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("description") + @ExcludeMissing + fun _description(): JsonField = description + + /** + * Returns the raw JSON value of [evidenceType]. + * + * Unlike [evidenceType], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("evidenceType") + @ExcludeMissing + fun _evidenceType(): JsonField = evidenceType + + /** + * Returns the raw JSON value of [frameworks]. + * + * Unlike [frameworks], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("frameworks") + @ExcludeMissing + fun _frameworks(): JsonField> = frameworks + + /** + * Returns the raw JSON value of [immutable]. + * + * Unlike [immutable], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("immutable") @ExcludeMissing fun _immutable(): JsonField = immutable + + /** + * Returns the raw JSON value of [renewalCadenceDays]. + * + * Unlike [renewalCadenceDays], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("renewalCadenceDays") + @ExcludeMissing + fun _renewalCadenceDays(): JsonField = renewalCadenceDays + + /** + * Returns the raw JSON value of [results]. + * + * Unlike [results], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("results") @ExcludeMissing fun _results(): JsonField> = results + + /** + * Returns the raw JSON value of [resultsSummary]. + * + * Unlike [resultsSummary], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("resultsSummary") + @ExcludeMissing + fun _resultsSummary(): JsonField = resultsSummary + + /** + * Returns the raw JSON value of [tagIds]. + * + * Unlike [tagIds], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("tagIds") @ExcludeMissing fun _tagIds(): JsonField> = tagIds + + /** + * Returns the raw JSON value of [tags]. + * + * Unlike [tags], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("tags") @ExcludeMissing fun _tags(): JsonField> = tags + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Item]. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateUpdated() + * .name() + * .scope() + * .type() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Item]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var name: JsonField? = null + private var scope: JsonField? = null + private var type: JsonField? = null + private var workspaceId: JsonField? = null + private var assigneeId: JsonField = JsonMissing.of() + private var automationParams: JsonField = JsonMissing.of() + private var automationType: JsonField = JsonMissing.of() + private var deactivated: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var evidenceType: JsonField = JsonMissing.of() + private var frameworks: JsonField>? = null + private var immutable: JsonField = JsonMissing.of() + private var renewalCadenceDays: JsonField = JsonMissing.of() + private var results: JsonField>? = null + private var resultsSummary: JsonField = JsonMissing.of() + private var tagIds: JsonField>? = null + private var tags: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(item: Item) = apply { + id = item.id + dateCreated = item.dateCreated + dateUpdated = item.dateUpdated + name = item.name + scope = item.scope + type = item.type + workspaceId = item.workspaceId + assigneeId = item.assigneeId + automationParams = item.automationParams + automationType = item.automationType + deactivated = item.deactivated + description = item.description + evidenceType = item.evidenceType + frameworks = item.frameworks.map { it.toMutableList() } + immutable = item.immutable + renewalCadenceDays = item.renewalCadenceDays + results = item.results.map { it.toMutableList() } + resultsSummary = item.resultsSummary + tagIds = item.tagIds.map { it.toMutableList() } + tags = item.tags.map { it.toMutableList() } + additionalProperties = item.additionalProperties.toMutableMap() + } + + /** The rule id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The last update date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** The rule name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun name(name: JsonField) = apply { this.name = name } + + /** + * Whether the rule is evaluated once for the whole workspace, or once per project the + * rule's frameworks apply to. + */ + fun scope(scope: Scope) = scope(JsonField.of(scope)) + + /** + * Sets [Builder.scope] to an arbitrary JSON value. + * + * You should usually call [Builder.scope] with a well-typed [Scope] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun scope(scope: JsonField) = apply { this.scope = scope } + + /** + * `platform` rules are evaluated automatically from the state of your Openlayer + * workspace. `evidence` rules are satisfied by attaching evidence. + */ + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun type(type: JsonField) = apply { this.type = type } + + /** The id of the workspace the rule belongs to. */ + fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) + + /** + * Sets [Builder.workspaceId] to an arbitrary JSON value. + * + * You should usually call [Builder.workspaceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun workspaceId(workspaceId: JsonField) = apply { + this.workspaceId = workspaceId + } + + /** The user responsible for satisfying the rule. */ + fun assigneeId(assigneeId: String?) = assigneeId(JsonField.ofNullable(assigneeId)) + + /** Alias for calling [Builder.assigneeId] with `assigneeId.orElse(null)`. */ + fun assigneeId(assigneeId: Optional) = assigneeId(assigneeId.getOrNull()) + + /** + * Sets [Builder.assigneeId] to an arbitrary JSON value. + * + * You should usually call [Builder.assigneeId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun assigneeId(assigneeId: JsonField) = apply { this.assigneeId = assigneeId } + + /** Configuration for the platform check, when the automation takes parameters. */ + fun automationParams(automationParams: AutomationParams?) = + automationParams(JsonField.ofNullable(automationParams)) + + /** + * Alias for calling [Builder.automationParams] with `automationParams.orElse(null)`. + */ + fun automationParams(automationParams: Optional) = + automationParams(automationParams.getOrNull()) + + /** + * Sets [Builder.automationParams] to an arbitrary JSON value. + * + * You should usually call [Builder.automationParams] with a well-typed + * [AutomationParams] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun automationParams(automationParams: JsonField) = apply { + this.automationParams = automationParams + } + + /** + * Which workspace signal a platform rule checks, for example `monitoring_mode_enabled`, + * `test_setup`, or `project_owner_set`. `null` for evidence rules. + */ + fun automationType(automationType: String?) = + automationType(JsonField.ofNullable(automationType)) + + /** Alias for calling [Builder.automationType] with `automationType.orElse(null)`. */ + fun automationType(automationType: Optional) = + automationType(automationType.getOrNull()) + + /** + * Sets [Builder.automationType] to an arbitrary JSON value. + * + * You should usually call [Builder.automationType] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun automationType(automationType: JsonField) = apply { + this.automationType = automationType + } + + /** Whether the rule is excluded from compliance calculations. */ + fun deactivated(deactivated: Boolean) = deactivated(JsonField.of(deactivated)) + + /** + * Sets [Builder.deactivated] to an arbitrary JSON value. + * + * You should usually call [Builder.deactivated] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun deactivated(deactivated: JsonField) = apply { + this.deactivated = deactivated + } + + /** What the rule requires. */ + fun description(description: String?) = description(JsonField.ofNullable(description)) + + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ + fun description(description: Optional) = description(description.getOrNull()) + + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun description(description: JsonField) = apply { + this.description = description + } + + /** The kind of evidence that satisfies the rule. `null` for platform rules. */ + fun evidenceType(evidenceType: EvidenceType?) = + evidenceType(JsonField.ofNullable(evidenceType)) + + /** Alias for calling [Builder.evidenceType] with `evidenceType.orElse(null)`. */ + fun evidenceType(evidenceType: Optional) = + evidenceType(evidenceType.getOrNull()) + + /** + * Sets [Builder.evidenceType] to an arbitrary JSON value. + * + * You should usually call [Builder.evidenceType] with a well-typed [EvidenceType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun evidenceType(evidenceType: JsonField) = apply { + this.evidenceType = evidenceType + } + + /** The frameworks that include this rule. */ + fun frameworks(frameworks: List) = frameworks(JsonField.of(frameworks)) + + /** + * Sets [Builder.frameworks] to an arbitrary JSON value. + * + * You should usually call [Builder.frameworks] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun frameworks(frameworks: JsonField>) = apply { + this.frameworks = frameworks.map { it.toMutableList() } + } + + /** + * Adds a single [Framework] to [frameworks]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addFramework(framework: Framework) = apply { + frameworks = + (frameworks ?: JsonField.of(mutableListOf())).also { + checkKnown("frameworks", it).add(framework) + } + } + + /** Whether the rule is managed by Openlayer and cannot be edited. */ + fun immutable(immutable: Boolean) = immutable(JsonField.of(immutable)) + + /** + * Sets [Builder.immutable] to an arbitrary JSON value. + * + * You should usually call [Builder.immutable] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun immutable(immutable: JsonField) = apply { this.immutable = immutable } + + /** + * How often evidence must be renewed, in days. Once evidence is older than this, the + * rule result becomes `due_soon` and then `failing`. + */ + fun renewalCadenceDays(renewalCadenceDays: Long?) = + renewalCadenceDays(JsonField.ofNullable(renewalCadenceDays)) + + /** + * Alias for [Builder.renewalCadenceDays]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun renewalCadenceDays(renewalCadenceDays: Long) = + renewalCadenceDays(renewalCadenceDays as Long?) + + /** + * Alias for calling [Builder.renewalCadenceDays] with + * `renewalCadenceDays.orElse(null)`. + */ + fun renewalCadenceDays(renewalCadenceDays: Optional) = + renewalCadenceDays(renewalCadenceDays.getOrNull()) + + /** + * Sets [Builder.renewalCadenceDays] to an arbitrary JSON value. + * + * You should usually call [Builder.renewalCadenceDays] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun renewalCadenceDays(renewalCadenceDays: JsonField) = apply { + this.renewalCadenceDays = renewalCadenceDays + } + + /** + * The rule's results, one per entity the rule is evaluated against. Only returned when + * `includeResults` is `true`. + */ + fun results(results: List) = results(JsonField.of(results)) + + /** + * Sets [Builder.results] to an arbitrary JSON value. + * + * You should usually call [Builder.results] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun results(results: JsonField>) = apply { + this.results = results.map { it.toMutableList() } + } + + /** + * Adds a single [Result] to [results]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addResult(result: Result) = apply { + results = + (results ?: JsonField.of(mutableListOf())).also { + checkKnown("results", it).add(result) + } + } + + /** + * Pass-rate counts across all of the rule's entities, independent of any status filter + * applied to the request. + */ + fun resultsSummary(resultsSummary: ResultsSummary?) = + resultsSummary(JsonField.ofNullable(resultsSummary)) + + /** Alias for calling [Builder.resultsSummary] with `resultsSummary.orElse(null)`. */ + fun resultsSummary(resultsSummary: Optional) = + resultsSummary(resultsSummary.getOrNull()) + + /** + * Sets [Builder.resultsSummary] to an arbitrary JSON value. + * + * You should usually call [Builder.resultsSummary] with a well-typed [ResultsSummary] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun resultsSummary(resultsSummary: JsonField) = apply { + this.resultsSummary = resultsSummary + } + + /** + * The ids of the rule tags to associate with the rule. Replaces the rule's tags. Read + * them back from `tags`, and list the tags available in the workspace with `GET + * /workspaces/{workspaceId}/rule-tags`. + */ + fun tagIds(tagIds: List?) = tagIds(JsonField.ofNullable(tagIds)) + + /** Alias for calling [Builder.tagIds] with `tagIds.orElse(null)`. */ + fun tagIds(tagIds: Optional>) = tagIds(tagIds.getOrNull()) + + /** + * Sets [Builder.tagIds] to an arbitrary JSON value. + * + * You should usually call [Builder.tagIds] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun tagIds(tagIds: JsonField>) = apply { + this.tagIds = tagIds.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [tagIds]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addTagId(tagId: String) = apply { + tagIds = + (tagIds ?: JsonField.of(mutableListOf())).also { + checkKnown("tagIds", it).add(tagId) + } + } + + /** The rule tags associated with the rule. */ + fun tags(tags: List?) = tags(JsonField.ofNullable(tags)) + + /** Alias for calling [Builder.tags] with `tags.orElse(null)`. */ + fun tags(tags: Optional>) = tags(tags.getOrNull()) + + /** + * Sets [Builder.tags] to an arbitrary JSON value. + * + * You should usually call [Builder.tags] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun tags(tags: JsonField>) = apply { + this.tags = tags.map { it.toMutableList() } + } + + /** + * Adds a single [Tag] to [tags]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addTag(tag: Tag) = apply { + tags = + (tags ?: JsonField.of(mutableListOf())).also { checkKnown("tags", it).add(tag) } + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Item]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateUpdated() + * .name() + * .scope() + * .type() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Item = + Item( + checkRequired("id", id), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("name", name), + checkRequired("scope", scope), + checkRequired("type", type), + checkRequired("workspaceId", workspaceId), + assigneeId, + automationParams, + automationType, + deactivated, + description, + evidenceType, + (frameworks ?: JsonMissing.of()).map { it.toImmutable() }, + immutable, + renewalCadenceDays, + (results ?: JsonMissing.of()).map { it.toImmutable() }, + resultsSummary, + (tagIds ?: JsonMissing.of()).map { it.toImmutable() }, + (tags ?: JsonMissing.of()).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Item = apply { + if (validated) { + return@apply + } + + id() + dateCreated() + dateUpdated() + name() + scope().validate() + type().validate() + workspaceId() + assigneeId() + automationParams().ifPresent { it.validate() } + automationType() + deactivated() + description() + evidenceType().ifPresent { it.validate() } + frameworks().ifPresent { it.forEach { it.validate() } } + immutable() + renewalCadenceDays() + results().ifPresent { it.forEach { it.validate() } } + resultsSummary().ifPresent { it.validate() } + tagIds() + tags().ifPresent { it.forEach { it.validate() } } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (scope.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + (if (assigneeId.asKnown().isPresent) 1 else 0) + + (automationParams.asKnown().getOrNull()?.validity() ?: 0) + + (if (automationType.asKnown().isPresent) 1 else 0) + + (if (deactivated.asKnown().isPresent) 1 else 0) + + (if (description.asKnown().isPresent) 1 else 0) + + (evidenceType.asKnown().getOrNull()?.validity() ?: 0) + + (frameworks.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (immutable.asKnown().isPresent) 1 else 0) + + (if (renewalCadenceDays.asKnown().isPresent) 1 else 0) + + (results.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (resultsSummary.asKnown().getOrNull()?.validity() ?: 0) + + (tagIds.asKnown().getOrNull()?.size ?: 0) + + (tags.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + /** + * Whether the rule is evaluated once for the whole workspace, or once per project the + * rule's frameworks apply to. + */ + class Scope @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val PROJECT = of("project") + + @JvmField val WORKSPACE = of("workspace") + + @JvmStatic fun of(value: String) = Scope(JsonField.of(value)) + } + + /** An enum containing [Scope]'s known values. */ + enum class Known { + PROJECT, + WORKSPACE, + } + + /** + * An enum containing [Scope]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Scope] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + PROJECT, + WORKSPACE, + /** + * An enum member indicating that [Scope] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + PROJECT -> Value.PROJECT + WORKSPACE -> Value.WORKSPACE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + PROJECT -> Known.PROJECT + WORKSPACE -> Known.WORKSPACE + else -> throw OpenlayerInvalidDataException("Unknown Scope: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Scope = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Scope && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** + * `platform` rules are evaluated automatically from the state of your Openlayer workspace. + * `evidence` rules are satisfied by attaching evidence. + */ + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val PLATFORM = of("platform") + + @JvmField val EVIDENCE = of("evidence") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + PLATFORM, + EVIDENCE, + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + PLATFORM, + EVIDENCE, + /** An enum member indicating that [Type] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + PLATFORM -> Value.PLATFORM + EVIDENCE -> Value.EVIDENCE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + PLATFORM -> Known.PLATFORM + EVIDENCE -> Known.EVIDENCE + else -> throw OpenlayerInvalidDataException("Unknown Type: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Configuration for the platform check, when the automation takes parameters. */ + class AutomationParams + @JsonCreator + private constructor( + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [AutomationParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [AutomationParams]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(automationParams: AutomationParams) = apply { + additionalProperties = automationParams.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [AutomationParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): AutomationParams = AutomationParams(additionalProperties.toImmutable()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): AutomationParams = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is AutomationParams && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = "AutomationParams{additionalProperties=$additionalProperties}" + } + + /** The kind of evidence that satisfies the rule. `null` for platform rules. */ + class EvidenceType @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val DOCUMENT = of("document") + + @JvmField val TEXT = of("text") + + @JvmField val URL = of("url") + + @JvmField val CATEGORY_VALUE = of("categoryValue") + + @JvmStatic fun of(value: String) = EvidenceType(JsonField.of(value)) + } + + /** An enum containing [EvidenceType]'s known values. */ + enum class Known { + DOCUMENT, + TEXT, + URL, + CATEGORY_VALUE, + } + + /** + * An enum containing [EvidenceType]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [EvidenceType] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DOCUMENT, + TEXT, + URL, + CATEGORY_VALUE, + /** + * An enum member indicating that [EvidenceType] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DOCUMENT -> Value.DOCUMENT + TEXT -> Value.TEXT + URL -> Value.URL + CATEGORY_VALUE -> Value.CATEGORY_VALUE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + DOCUMENT -> Known.DOCUMENT + TEXT -> Known.TEXT + URL -> Known.URL + CATEGORY_VALUE -> Known.CATEGORY_VALUE + else -> throw OpenlayerInvalidDataException("Unknown EvidenceType: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): EvidenceType = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is EvidenceType && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + class Framework + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val avatar: JsonField, + private val builtInSlug: JsonField, + private val enabled: JsonField, + private val name: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("avatar") + @ExcludeMissing + avatar: JsonField = JsonMissing.of(), + @JsonProperty("builtInSlug") + @ExcludeMissing + builtInSlug: JsonField = JsonMissing.of(), + @JsonProperty("enabled") + @ExcludeMissing + enabled: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + ) : this(id, avatar, builtInSlug, enabled, name, mutableMapOf()) + + /** + * The framework id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun id(): String = id.getRequired("id") + + /** + * The icon shown for the framework. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun avatar(): Optional = avatar.getOptional("avatar") + + /** + * Identifies a framework that ships with Openlayer, for example `eu_ai_act`, + * `iso_42001`, `nist_ai_rmf`, or `traiga`. `null` for frameworks you create yourself. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun builtInSlug(): Optional = builtInSlug.getOptional("builtInSlug") + + /** + * Whether the framework is active. Rules of a disabled framework are not evaluated and + * do not count towards compliance. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun enabled(): Boolean = enabled.getRequired("enabled") + + /** + * The framework name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun name(): String = name.getRequired("name") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [avatar]. + * + * Unlike [avatar], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("avatar") @ExcludeMissing fun _avatar(): JsonField = avatar + + /** + * Returns the raw JSON value of [builtInSlug]. + * + * Unlike [builtInSlug], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("builtInSlug") + @ExcludeMissing + fun _builtInSlug(): JsonField = builtInSlug + + /** + * Returns the raw JSON value of [enabled]. + * + * Unlike [enabled], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("enabled") @ExcludeMissing fun _enabled(): JsonField = enabled + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Framework]. + * + * The following fields are required: + * ```java + * .id() + * .avatar() + * .builtInSlug() + * .enabled() + * .name() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Framework]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var avatar: JsonField? = null + private var builtInSlug: JsonField? = null + private var enabled: JsonField? = null + private var name: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(framework: Framework) = apply { + id = framework.id + avatar = framework.avatar + builtInSlug = framework.builtInSlug + enabled = framework.enabled + name = framework.name + additionalProperties = framework.additionalProperties.toMutableMap() + } + + /** The framework id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The icon shown for the framework. */ + fun avatar(avatar: Avatar?) = avatar(JsonField.ofNullable(avatar)) + + /** Alias for calling [Builder.avatar] with `avatar.orElse(null)`. */ + fun avatar(avatar: Optional) = avatar(avatar.getOrNull()) + + /** + * Sets [Builder.avatar] to an arbitrary JSON value. + * + * You should usually call [Builder.avatar] with a well-typed [Avatar] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun avatar(avatar: JsonField) = apply { this.avatar = avatar } + + /** + * Identifies a framework that ships with Openlayer, for example `eu_ai_act`, + * `iso_42001`, `nist_ai_rmf`, or `traiga`. `null` for frameworks you create + * yourself. + */ + fun builtInSlug(builtInSlug: String?) = + builtInSlug(JsonField.ofNullable(builtInSlug)) + + /** Alias for calling [Builder.builtInSlug] with `builtInSlug.orElse(null)`. */ + fun builtInSlug(builtInSlug: Optional) = + builtInSlug(builtInSlug.getOrNull()) + + /** + * Sets [Builder.builtInSlug] to an arbitrary JSON value. + * + * You should usually call [Builder.builtInSlug] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun builtInSlug(builtInSlug: JsonField) = apply { + this.builtInSlug = builtInSlug + } + + /** + * Whether the framework is active. Rules of a disabled framework are not evaluated + * and do not count towards compliance. + */ + fun enabled(enabled: Boolean) = enabled(JsonField.of(enabled)) + + /** + * Sets [Builder.enabled] to an arbitrary JSON value. + * + * You should usually call [Builder.enabled] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun enabled(enabled: JsonField) = apply { this.enabled = enabled } + + /** The framework name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun name(name: JsonField) = apply { this.name = name } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Framework]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .avatar() + * .builtInSlug() + * .enabled() + * .name() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Framework = + Framework( + checkRequired("id", id), + checkRequired("avatar", avatar), + checkRequired("builtInSlug", builtInSlug), + checkRequired("enabled", enabled), + checkRequired("name", name), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Framework = apply { + if (validated) { + return@apply + } + + id() + avatar().ifPresent { it.validate() } + builtInSlug() + enabled() + name() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (avatar.asKnown().getOrNull()?.validity() ?: 0) + + (if (builtInSlug.asKnown().isPresent) 1 else 0) + + (if (enabled.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + /** The icon shown for the framework. */ + class Avatar + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val type: JsonField, + private val value: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("value") + @ExcludeMissing + value: JsonField = JsonMissing.of(), + ) : this(type, value, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun type(): Type = type.getRequired("type") + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun value(): String = value.getRequired("value") + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + /** + * Returns the raw JSON value of [value]. + * + * Unlike [value], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Avatar]. + * + * The following fields are required: + * ```java + * .type() + * .value() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Avatar]. */ + class Builder internal constructor() { + + private var type: JsonField? = null + private var value: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(avatar: Avatar) = apply { + type = avatar.type + value = avatar.value + additionalProperties = avatar.additionalProperties.toMutableMap() + } + + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun type(type: JsonField) = apply { this.type = type } + + fun value(value: String) = value(JsonField.of(value)) + + /** + * Sets [Builder.value] to an arbitrary JSON value. + * + * You should usually call [Builder.value] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun value(value: JsonField) = apply { this.value = value } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Avatar]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .type() + * .value() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Avatar = + Avatar( + checkRequired("type", type), + checkRequired("value", value), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): Avatar = apply { + if (validated) { + return@apply + } + + type().validate() + value() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (type.asKnown().getOrNull()?.validity() ?: 0) + + (if (value.asKnown().isPresent) 1 else 0) + + class Type @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val EMOJI = of("emoji") + + @JvmField val IMAGE_URL = of("imageUrl") + + @JvmField val BUILTIN_IMAGE = of("builtinImage") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + EMOJI, + IMAGE_URL, + BUILTIN_IMAGE, + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + EMOJI, + IMAGE_URL, + BUILTIN_IMAGE, + /** + * An enum member indicating that [Type] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + EMOJI -> Value.EMOJI + IMAGE_URL -> Value.IMAGE_URL + BUILTIN_IMAGE -> Value.BUILTIN_IMAGE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + EMOJI -> Known.EMOJI + IMAGE_URL -> Known.IMAGE_URL + BUILTIN_IMAGE -> Known.BUILTIN_IMAGE + else -> throw OpenlayerInvalidDataException("Unknown Type: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object + * doesn't match its expected type. + */ + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Avatar && + type == other.type && + value == other.value && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(type, value, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Avatar{type=$type, value=$value, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Framework && + id == other.id && + avatar == other.avatar && + builtInSlug == other.builtInSlug && + enabled == other.enabled && + name == other.name && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(id, avatar, builtInSlug, enabled, name, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Framework{id=$id, avatar=$avatar, builtInSlug=$builtInSlug, enabled=$enabled, name=$name, additionalProperties=$additionalProperties}" + } + + class Result + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val deactivated: JsonField, + private val ruleId: JsonField, + private val status: JsonField, + private val workspaceId: JsonField, + private val assigneeId: JsonField, + private val blockedBy: JsonField>, + private val blocking: JsonField>, + private val dateLastEvaluated: JsonField, + private val dateOfLatestEvidence: JsonField, + private val dateOfNextEvaluation: JsonField, + private val dateOfRenewal: JsonField, + private val deactivatedReason: JsonField, + private val projectId: JsonField, + private val statusMessage: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("deactivated") + @ExcludeMissing + deactivated: JsonField = JsonMissing.of(), + @JsonProperty("ruleId") + @ExcludeMissing + ruleId: JsonField = JsonMissing.of(), + @JsonProperty("status") + @ExcludeMissing + status: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + @JsonProperty("assigneeId") + @ExcludeMissing + assigneeId: JsonField = JsonMissing.of(), + @JsonProperty("blockedBy") + @ExcludeMissing + blockedBy: JsonField> = JsonMissing.of(), + @JsonProperty("blocking") + @ExcludeMissing + blocking: JsonField> = JsonMissing.of(), + @JsonProperty("dateLastEvaluated") + @ExcludeMissing + dateLastEvaluated: JsonField = JsonMissing.of(), + @JsonProperty("dateOfLatestEvidence") + @ExcludeMissing + dateOfLatestEvidence: JsonField = JsonMissing.of(), + @JsonProperty("dateOfNextEvaluation") + @ExcludeMissing + dateOfNextEvaluation: JsonField = JsonMissing.of(), + @JsonProperty("dateOfRenewal") + @ExcludeMissing + dateOfRenewal: JsonField = JsonMissing.of(), + @JsonProperty("deactivatedReason") + @ExcludeMissing + deactivatedReason: JsonField = JsonMissing.of(), + @JsonProperty("projectId") + @ExcludeMissing + projectId: JsonField = JsonMissing.of(), + @JsonProperty("statusMessage") + @ExcludeMissing + statusMessage: JsonField = JsonMissing.of(), + ) : this( + id, + dateCreated, + dateUpdated, + deactivated, + ruleId, + status, + workspaceId, + assigneeId, + blockedBy, + blocking, + dateLastEvaluated, + dateOfLatestEvidence, + dateOfNextEvaluation, + dateOfRenewal, + deactivatedReason, + projectId, + statusMessage, + mutableMapOf(), + ) + + /** + * The rule result id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun id(): String = id.getRequired("id") + + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** + * The last update date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** + * Whether this result is excluded from compliance calculations. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun deactivated(): Boolean = deactivated.getRequired("deactivated") + + /** + * The rule this result belongs to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun ruleId(): String = ruleId.getRequired("ruleId") + + /** + * The compliance status of the rule for this entity. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun status(): Status = status.getRequired("status") + + /** + * The id of the workspace the rule result belongs to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun workspaceId(): String = workspaceId.getRequired("workspaceId") + + /** + * The user responsible for this result. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun assigneeId(): Optional = assigneeId.getOptional("assigneeId") + + /** + * Rule results that must pass before this one can be satisfied. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun blockedBy(): Optional> = blockedBy.getOptional("blockedBy") + + /** + * Rule results that this one blocks. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun blocking(): Optional> = blocking.getOptional("blocking") + + /** + * When the rule was last evaluated. Platform rules only. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun dateLastEvaluated(): Optional = + dateLastEvaluated.getOptional("dateLastEvaluated") + + /** + * When the most recent piece of evidence was attached. Evidence rules only. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun dateOfLatestEvidence(): Optional = + dateOfLatestEvidence.getOptional("dateOfLatestEvidence") + + /** + * When the rule will next be evaluated. Platform rules only. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun dateOfNextEvaluation(): Optional = + dateOfNextEvaluation.getOptional("dateOfNextEvaluation") + + /** + * When the evidence must be renewed. Evidence rules with a renewal cadence only. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun dateOfRenewal(): Optional = + dateOfRenewal.getOptional("dateOfRenewal") + + /** + * Why the result was excluded. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun deactivatedReason(): Optional = + deactivatedReason.getOptional("deactivatedReason") + + /** + * The project this result was evaluated for. `null` for workspace-scoped rules. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun projectId(): Optional = projectId.getOptional("projectId") + + /** + * A human-readable explanation of the status. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun statusMessage(): Optional = statusMessage.getOptional("statusMessage") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** + * Returns the raw JSON value of [deactivated]. + * + * Unlike [deactivated], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("deactivated") + @ExcludeMissing + fun _deactivated(): JsonField = deactivated + + /** + * Returns the raw JSON value of [ruleId]. + * + * Unlike [ruleId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("ruleId") @ExcludeMissing fun _ruleId(): JsonField = ruleId + + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + + /** + * Returns the raw JSON value of [workspaceId]. + * + * Unlike [workspaceId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("workspaceId") + @ExcludeMissing + fun _workspaceId(): JsonField = workspaceId + + /** + * Returns the raw JSON value of [assigneeId]. + * + * Unlike [assigneeId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("assigneeId") + @ExcludeMissing + fun _assigneeId(): JsonField = assigneeId + + /** + * Returns the raw JSON value of [blockedBy]. + * + * Unlike [blockedBy], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("blockedBy") + @ExcludeMissing + fun _blockedBy(): JsonField> = blockedBy + + /** + * Returns the raw JSON value of [blocking]. + * + * Unlike [blocking], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("blocking") + @ExcludeMissing + fun _blocking(): JsonField> = blocking + + /** + * Returns the raw JSON value of [dateLastEvaluated]. + * + * Unlike [dateLastEvaluated], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("dateLastEvaluated") + @ExcludeMissing + fun _dateLastEvaluated(): JsonField = dateLastEvaluated + + /** + * Returns the raw JSON value of [dateOfLatestEvidence]. + * + * Unlike [dateOfLatestEvidence], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("dateOfLatestEvidence") + @ExcludeMissing + fun _dateOfLatestEvidence(): JsonField = dateOfLatestEvidence + + /** + * Returns the raw JSON value of [dateOfNextEvaluation]. + * + * Unlike [dateOfNextEvaluation], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("dateOfNextEvaluation") + @ExcludeMissing + fun _dateOfNextEvaluation(): JsonField = dateOfNextEvaluation + + /** + * Returns the raw JSON value of [dateOfRenewal]. + * + * Unlike [dateOfRenewal], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("dateOfRenewal") + @ExcludeMissing + fun _dateOfRenewal(): JsonField = dateOfRenewal + + /** + * Returns the raw JSON value of [deactivatedReason]. + * + * Unlike [deactivatedReason], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("deactivatedReason") + @ExcludeMissing + fun _deactivatedReason(): JsonField = deactivatedReason + + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("projectId") + @ExcludeMissing + fun _projectId(): JsonField = projectId + + /** + * Returns the raw JSON value of [statusMessage]. + * + * Unlike [statusMessage], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("statusMessage") + @ExcludeMissing + fun _statusMessage(): JsonField = statusMessage + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Result]. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateUpdated() + * .deactivated() + * .ruleId() + * .status() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Result]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var deactivated: JsonField? = null + private var ruleId: JsonField? = null + private var status: JsonField? = null + private var workspaceId: JsonField? = null + private var assigneeId: JsonField = JsonMissing.of() + private var blockedBy: JsonField>? = null + private var blocking: JsonField>? = null + private var dateLastEvaluated: JsonField = JsonMissing.of() + private var dateOfLatestEvidence: JsonField = JsonMissing.of() + private var dateOfNextEvaluation: JsonField = JsonMissing.of() + private var dateOfRenewal: JsonField = JsonMissing.of() + private var deactivatedReason: JsonField = JsonMissing.of() + private var projectId: JsonField = JsonMissing.of() + private var statusMessage: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(result: Result) = apply { + id = result.id + dateCreated = result.dateCreated + dateUpdated = result.dateUpdated + deactivated = result.deactivated + ruleId = result.ruleId + status = result.status + workspaceId = result.workspaceId + assigneeId = result.assigneeId + blockedBy = result.blockedBy.map { it.toMutableList() } + blocking = result.blocking.map { it.toMutableList() } + dateLastEvaluated = result.dateLastEvaluated + dateOfLatestEvidence = result.dateOfLatestEvidence + dateOfNextEvaluation = result.dateOfNextEvaluation + dateOfRenewal = result.dateOfRenewal + deactivatedReason = result.deactivatedReason + projectId = result.projectId + statusMessage = result.statusMessage + additionalProperties = result.additionalProperties.toMutableMap() + } + + /** The rule result id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = + dateCreated(JsonField.of(dateCreated)) + + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The last update date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = + dateUpdated(JsonField.of(dateUpdated)) + + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** Whether this result is excluded from compliance calculations. */ + fun deactivated(deactivated: Boolean) = deactivated(JsonField.of(deactivated)) + + /** + * Sets [Builder.deactivated] to an arbitrary JSON value. + * + * You should usually call [Builder.deactivated] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun deactivated(deactivated: JsonField) = apply { + this.deactivated = deactivated + } + + /** The rule this result belongs to. */ + fun ruleId(ruleId: String) = ruleId(JsonField.of(ruleId)) + + /** + * Sets [Builder.ruleId] to an arbitrary JSON value. + * + * You should usually call [Builder.ruleId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun ruleId(ruleId: JsonField) = apply { this.ruleId = ruleId } + + /** The compliance status of the rule for this entity. */ + fun status(status: Status) = status(JsonField.of(status)) + + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun status(status: JsonField) = apply { this.status = status } + + /** The id of the workspace the rule result belongs to. */ + fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) + + /** + * Sets [Builder.workspaceId] to an arbitrary JSON value. + * + * You should usually call [Builder.workspaceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun workspaceId(workspaceId: JsonField) = apply { + this.workspaceId = workspaceId + } + + /** The user responsible for this result. */ + fun assigneeId(assigneeId: String?) = assigneeId(JsonField.ofNullable(assigneeId)) + + /** Alias for calling [Builder.assigneeId] with `assigneeId.orElse(null)`. */ + fun assigneeId(assigneeId: Optional) = assigneeId(assigneeId.getOrNull()) + + /** + * Sets [Builder.assigneeId] to an arbitrary JSON value. + * + * You should usually call [Builder.assigneeId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun assigneeId(assigneeId: JsonField) = apply { + this.assigneeId = assigneeId + } + + /** Rule results that must pass before this one can be satisfied. */ + fun blockedBy(blockedBy: List) = blockedBy(JsonField.of(blockedBy)) + + /** + * Sets [Builder.blockedBy] to an arbitrary JSON value. + * + * You should usually call [Builder.blockedBy] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun blockedBy(blockedBy: JsonField>) = apply { + this.blockedBy = blockedBy.map { it.toMutableList() } + } + + /** + * Adds a single [BlockedBy] to [Builder.blockedBy]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addBlockedBy(blockedBy: BlockedBy) = apply { + this.blockedBy = + (this.blockedBy ?: JsonField.of(mutableListOf())).also { + checkKnown("blockedBy", it).add(blockedBy) + } + } + + /** Rule results that this one blocks. */ + fun blocking(blocking: List) = blocking(JsonField.of(blocking)) + + /** + * Sets [Builder.blocking] to an arbitrary JSON value. + * + * You should usually call [Builder.blocking] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun blocking(blocking: JsonField>) = apply { + this.blocking = blocking.map { it.toMutableList() } + } + + /** + * Adds a single [Blocking] to [Builder.blocking]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addBlocking(blocking: Blocking) = apply { + this.blocking = + (this.blocking ?: JsonField.of(mutableListOf())).also { + checkKnown("blocking", it).add(blocking) + } + } + + /** When the rule was last evaluated. Platform rules only. */ + fun dateLastEvaluated(dateLastEvaluated: OffsetDateTime?) = + dateLastEvaluated(JsonField.ofNullable(dateLastEvaluated)) + + /** + * Alias for calling [Builder.dateLastEvaluated] with + * `dateLastEvaluated.orElse(null)`. + */ + fun dateLastEvaluated(dateLastEvaluated: Optional) = + dateLastEvaluated(dateLastEvaluated.getOrNull()) + + /** + * Sets [Builder.dateLastEvaluated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateLastEvaluated] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun dateLastEvaluated(dateLastEvaluated: JsonField) = apply { + this.dateLastEvaluated = dateLastEvaluated + } + + /** When the most recent piece of evidence was attached. Evidence rules only. */ + fun dateOfLatestEvidence(dateOfLatestEvidence: OffsetDateTime?) = + dateOfLatestEvidence(JsonField.ofNullable(dateOfLatestEvidence)) + + /** + * Alias for calling [Builder.dateOfLatestEvidence] with + * `dateOfLatestEvidence.orElse(null)`. + */ + fun dateOfLatestEvidence(dateOfLatestEvidence: Optional) = + dateOfLatestEvidence(dateOfLatestEvidence.getOrNull()) + + /** + * Sets [Builder.dateOfLatestEvidence] to an arbitrary JSON value. + * + * You should usually call [Builder.dateOfLatestEvidence] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun dateOfLatestEvidence(dateOfLatestEvidence: JsonField) = apply { + this.dateOfLatestEvidence = dateOfLatestEvidence + } + + /** When the rule will next be evaluated. Platform rules only. */ + fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime?) = + dateOfNextEvaluation(JsonField.ofNullable(dateOfNextEvaluation)) + + /** + * Alias for calling [Builder.dateOfNextEvaluation] with + * `dateOfNextEvaluation.orElse(null)`. + */ + fun dateOfNextEvaluation(dateOfNextEvaluation: Optional) = + dateOfNextEvaluation(dateOfNextEvaluation.getOrNull()) + + /** + * Sets [Builder.dateOfNextEvaluation] to an arbitrary JSON value. + * + * You should usually call [Builder.dateOfNextEvaluation] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun dateOfNextEvaluation(dateOfNextEvaluation: JsonField) = apply { + this.dateOfNextEvaluation = dateOfNextEvaluation + } + + /** + * When the evidence must be renewed. Evidence rules with a renewal cadence only. + */ + fun dateOfRenewal(dateOfRenewal: OffsetDateTime?) = + dateOfRenewal(JsonField.ofNullable(dateOfRenewal)) + + /** Alias for calling [Builder.dateOfRenewal] with `dateOfRenewal.orElse(null)`. */ + fun dateOfRenewal(dateOfRenewal: Optional) = + dateOfRenewal(dateOfRenewal.getOrNull()) + + /** + * Sets [Builder.dateOfRenewal] to an arbitrary JSON value. + * + * You should usually call [Builder.dateOfRenewal] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun dateOfRenewal(dateOfRenewal: JsonField) = apply { + this.dateOfRenewal = dateOfRenewal + } + + /** Why the result was excluded. */ + fun deactivatedReason(deactivatedReason: String?) = + deactivatedReason(JsonField.ofNullable(deactivatedReason)) + + /** + * Alias for calling [Builder.deactivatedReason] with + * `deactivatedReason.orElse(null)`. + */ + fun deactivatedReason(deactivatedReason: Optional) = + deactivatedReason(deactivatedReason.getOrNull()) + + /** + * Sets [Builder.deactivatedReason] to an arbitrary JSON value. + * + * You should usually call [Builder.deactivatedReason] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun deactivatedReason(deactivatedReason: JsonField) = apply { + this.deactivatedReason = deactivatedReason + } + + /** The project this result was evaluated for. `null` for workspace-scoped rules. */ + fun projectId(projectId: String?) = projectId(JsonField.ofNullable(projectId)) + + /** Alias for calling [Builder.projectId] with `projectId.orElse(null)`. */ + fun projectId(projectId: Optional) = projectId(projectId.getOrNull()) + + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun projectId(projectId: JsonField) = apply { this.projectId = projectId } + + /** A human-readable explanation of the status. */ + fun statusMessage(statusMessage: String?) = + statusMessage(JsonField.ofNullable(statusMessage)) + + /** Alias for calling [Builder.statusMessage] with `statusMessage.orElse(null)`. */ + fun statusMessage(statusMessage: Optional) = + statusMessage(statusMessage.getOrNull()) + + /** + * Sets [Builder.statusMessage] to an arbitrary JSON value. + * + * You should usually call [Builder.statusMessage] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun statusMessage(statusMessage: JsonField) = apply { + this.statusMessage = statusMessage + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Result]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateUpdated() + * .deactivated() + * .ruleId() + * .status() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Result = + Result( + checkRequired("id", id), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("deactivated", deactivated), + checkRequired("ruleId", ruleId), + checkRequired("status", status), + checkRequired("workspaceId", workspaceId), + assigneeId, + (blockedBy ?: JsonMissing.of()).map { it.toImmutable() }, + (blocking ?: JsonMissing.of()).map { it.toImmutable() }, + dateLastEvaluated, + dateOfLatestEvidence, + dateOfNextEvaluation, + dateOfRenewal, + deactivatedReason, + projectId, + statusMessage, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Result = apply { + if (validated) { + return@apply + } + + id() + dateCreated() + dateUpdated() + deactivated() + ruleId() + status().validate() + workspaceId() + assigneeId() + blockedBy().ifPresent { it.forEach { it.validate() } } + blocking().ifPresent { it.forEach { it.validate() } } + dateLastEvaluated() + dateOfLatestEvidence() + dateOfNextEvaluation() + dateOfRenewal() + deactivatedReason() + projectId() + statusMessage() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (deactivated.asKnown().isPresent) 1 else 0) + + (if (ruleId.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + (if (assigneeId.asKnown().isPresent) 1 else 0) + + (blockedBy.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (blocking.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (dateLastEvaluated.asKnown().isPresent) 1 else 0) + + (if (dateOfLatestEvidence.asKnown().isPresent) 1 else 0) + + (if (dateOfNextEvaluation.asKnown().isPresent) 1 else 0) + + (if (dateOfRenewal.asKnown().isPresent) 1 else 0) + + (if (deactivatedReason.asKnown().isPresent) 1 else 0) + + (if (projectId.asKnown().isPresent) 1 else 0) + + (if (statusMessage.asKnown().isPresent) 1 else 0) + + /** The compliance status of the rule for this entity. */ + class Status @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val RUNNING = of("running") + + @JvmField val PASSING = of("passing") + + @JvmField val FAILING = of("failing") + + @JvmField val SKIPPED = of("skipped") + + @JvmField val ERROR = of("error") + + @JvmField val PENDING = of("pending") + + @JvmField val DUE_SOON = of("due_soon") + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + /** An enum containing [Status]'s known values. */ + enum class Known { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + } + + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + /** + * An enum member indicating that [Status] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + PENDING -> Value.PENDING + DUE_SOON -> Value.DUE_SOON + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + PENDING -> Known.PENDING + DUE_SOON -> Known.DUE_SOON + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + class BlockedBy + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val status: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("status") + @ExcludeMissing + status: JsonField = JsonMissing.of(), + ) : this(id, status, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun id(): Optional = id.getOptional("id") + + /** + * The compliance status of the rule for this entity. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun status(): Optional = status.getOptional("status") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [BlockedBy]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BlockedBy]. */ + class Builder internal constructor() { + + private var id: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(blockedBy: BlockedBy) = apply { + id = blockedBy.id + status = blockedBy.status + additionalProperties = blockedBy.additionalProperties.toMutableMap() + } + + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The compliance status of the rule for this entity. */ + fun status(status: Status) = status(JsonField.of(status)) + + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun status(status: JsonField) = apply { this.status = status } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [BlockedBy]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): BlockedBy = + BlockedBy(id, status, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): BlockedBy = apply { + if (validated) { + return@apply + } + + id() + status().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + /** The compliance status of the rule for this entity. */ + class Status + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val RUNNING = of("running") + + @JvmField val PASSING = of("passing") + + @JvmField val FAILING = of("failing") + + @JvmField val SKIPPED = of("skipped") + + @JvmField val ERROR = of("error") + + @JvmField val PENDING = of("pending") + + @JvmField val DUE_SOON = of("due_soon") + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + /** An enum containing [Status]'s known values. */ + enum class Known { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + } + + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + /** + * An enum member indicating that [Status] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + PENDING -> Value.PENDING + DUE_SOON -> Value.DUE_SOON + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + PENDING -> Known.PENDING + DUE_SOON -> Known.DUE_SOON + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object + * doesn't match its expected type. + */ + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is BlockedBy && + id == other.id && + status == other.status && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(id, status, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BlockedBy{id=$id, status=$status, additionalProperties=$additionalProperties}" + } + + class Blocking + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val status: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("status") + @ExcludeMissing + status: JsonField = JsonMissing.of(), + ) : this(id, status, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun id(): Optional = id.getOptional("id") + + /** + * The compliance status of the rule for this entity. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun status(): Optional = status.getOptional("status") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Blocking]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Blocking]. */ + class Builder internal constructor() { + + private var id: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(blocking: Blocking) = apply { + id = blocking.id + status = blocking.status + additionalProperties = blocking.additionalProperties.toMutableMap() + } + + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The compliance status of the rule for this entity. */ + fun status(status: Status) = status(JsonField.of(status)) + + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun status(status: JsonField) = apply { this.status = status } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Blocking]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Blocking = + Blocking(id, status, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): Blocking = apply { + if (validated) { + return@apply + } + + id() + status().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + /** The compliance status of the rule for this entity. */ + class Status + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val RUNNING = of("running") + + @JvmField val PASSING = of("passing") + + @JvmField val FAILING = of("failing") + + @JvmField val SKIPPED = of("skipped") + + @JvmField val ERROR = of("error") + + @JvmField val PENDING = of("pending") + + @JvmField val DUE_SOON = of("due_soon") + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + /** An enum containing [Status]'s known values. */ + enum class Known { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + } + + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + /** + * An enum member indicating that [Status] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + PENDING -> Value.PENDING + DUE_SOON -> Value.DUE_SOON + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + PENDING -> Known.PENDING + DUE_SOON -> Known.DUE_SOON + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object + * doesn't match its expected type. + */ + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Blocking && + id == other.id && + status == other.status && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(id, status, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Blocking{id=$id, status=$status, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Result && + id == other.id && + dateCreated == other.dateCreated && + dateUpdated == other.dateUpdated && + deactivated == other.deactivated && + ruleId == other.ruleId && + status == other.status && + workspaceId == other.workspaceId && + assigneeId == other.assigneeId && + blockedBy == other.blockedBy && + blocking == other.blocking && + dateLastEvaluated == other.dateLastEvaluated && + dateOfLatestEvidence == other.dateOfLatestEvidence && + dateOfNextEvaluation == other.dateOfNextEvaluation && + dateOfRenewal == other.dateOfRenewal && + deactivatedReason == other.deactivatedReason && + projectId == other.projectId && + statusMessage == other.statusMessage && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + dateCreated, + dateUpdated, + deactivated, + ruleId, + status, + workspaceId, + assigneeId, + blockedBy, + blocking, + dateLastEvaluated, + dateOfLatestEvidence, + dateOfNextEvaluation, + dateOfRenewal, + deactivatedReason, + projectId, + statusMessage, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Result{id=$id, dateCreated=$dateCreated, dateUpdated=$dateUpdated, deactivated=$deactivated, ruleId=$ruleId, status=$status, workspaceId=$workspaceId, assigneeId=$assigneeId, blockedBy=$blockedBy, blocking=$blocking, dateLastEvaluated=$dateLastEvaluated, dateOfLatestEvidence=$dateOfLatestEvidence, dateOfNextEvaluation=$dateOfNextEvaluation, dateOfRenewal=$dateOfRenewal, deactivatedReason=$deactivatedReason, projectId=$projectId, statusMessage=$statusMessage, additionalProperties=$additionalProperties}" + } + + /** + * Pass-rate counts across all of the rule's entities, independent of any status filter + * applied to the request. + */ + class ResultsSummary + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val passing: JsonField, + private val total: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("passing") + @ExcludeMissing + passing: JsonField = JsonMissing.of(), + @JsonProperty("total") @ExcludeMissing total: JsonField = JsonMissing.of(), + ) : this(passing, total, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun passing(): Optional = passing.getOptional("passing") + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun total(): Optional = total.getOptional("total") + + /** + * Returns the raw JSON value of [passing]. + * + * Unlike [passing], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("passing") @ExcludeMissing fun _passing(): JsonField = passing + + /** + * Returns the raw JSON value of [total]. + * + * Unlike [total], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("total") @ExcludeMissing fun _total(): JsonField = total + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [ResultsSummary]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ResultsSummary]. */ + class Builder internal constructor() { + + private var passing: JsonField = JsonMissing.of() + private var total: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(resultsSummary: ResultsSummary) = apply { + passing = resultsSummary.passing + total = resultsSummary.total + additionalProperties = resultsSummary.additionalProperties.toMutableMap() + } + + fun passing(passing: Long) = passing(JsonField.of(passing)) + + /** + * Sets [Builder.passing] to an arbitrary JSON value. + * + * You should usually call [Builder.passing] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun passing(passing: JsonField) = apply { this.passing = passing } + + fun total(total: Long) = total(JsonField.of(total)) + + /** + * Sets [Builder.total] to an arbitrary JSON value. + * + * You should usually call [Builder.total] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun total(total: JsonField) = apply { this.total = total } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ResultsSummary]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): ResultsSummary = + ResultsSummary(passing, total, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): ResultsSummary = apply { + if (validated) { + return@apply + } + + passing() + total() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (passing.asKnown().isPresent) 1 else 0) + + (if (total.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ResultsSummary && + passing == other.passing && + total == other.total && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(passing, total, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ResultsSummary{passing=$passing, total=$total, additionalProperties=$additionalProperties}" + } + + class Tag + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val creatorId: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val immutable: JsonField, + private val name: JsonField, + private val workspaceId: JsonField, + private val color: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("creatorId") + @ExcludeMissing + creatorId: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("immutable") + @ExcludeMissing + immutable: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + @JsonProperty("color") @ExcludeMissing color: JsonField = JsonMissing.of(), + ) : this( + id, + creatorId, + dateCreated, + dateUpdated, + immutable, + name, + workspaceId, + color, + mutableMapOf(), + ) + + /** + * The rule tag id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun id(): String = id.getRequired("id") + + /** + * The user who created the tag. `null` for tags that ship with Openlayer. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun creatorId(): Optional = creatorId.getOptional("creatorId") + + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** + * The last update date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** + * Whether the tag is managed by Openlayer and cannot be edited or deleted. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun immutable(): Boolean = immutable.getRequired("immutable") + + /** + * The tag name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun name(): String = name.getRequired("name") + + /** + * The id of the workspace the tag belongs to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun workspaceId(): String = workspaceId.getRequired("workspaceId") + + /** + * The color the tag is displayed with. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun color(): Optional = color.getOptional("color") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [creatorId]. + * + * Unlike [creatorId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("creatorId") + @ExcludeMissing + fun _creatorId(): JsonField = creatorId + + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** + * Returns the raw JSON value of [immutable]. + * + * Unlike [immutable], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("immutable") + @ExcludeMissing + fun _immutable(): JsonField = immutable + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [workspaceId]. + * + * Unlike [workspaceId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("workspaceId") + @ExcludeMissing + fun _workspaceId(): JsonField = workspaceId + + /** + * Returns the raw JSON value of [color]. + * + * Unlike [color], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("color") @ExcludeMissing fun _color(): JsonField = color + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Tag]. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .immutable() + * .name() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Tag]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var creatorId: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var immutable: JsonField? = null + private var name: JsonField? = null + private var workspaceId: JsonField? = null + private var color: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(tag: Tag) = apply { + id = tag.id + creatorId = tag.creatorId + dateCreated = tag.dateCreated + dateUpdated = tag.dateUpdated + immutable = tag.immutable + name = tag.name + workspaceId = tag.workspaceId + color = tag.color + additionalProperties = tag.additionalProperties.toMutableMap() + } + + /** The rule tag id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The user who created the tag. `null` for tags that ship with Openlayer. */ + fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) + + /** Alias for calling [Builder.creatorId] with `creatorId.orElse(null)`. */ + fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) + + /** + * Sets [Builder.creatorId] to an arbitrary JSON value. + * + * You should usually call [Builder.creatorId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = + dateCreated(JsonField.of(dateCreated)) + + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The last update date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = + dateUpdated(JsonField.of(dateUpdated)) + + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** Whether the tag is managed by Openlayer and cannot be edited or deleted. */ + fun immutable(immutable: Boolean) = immutable(JsonField.of(immutable)) + + /** + * Sets [Builder.immutable] to an arbitrary JSON value. + * + * You should usually call [Builder.immutable] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun immutable(immutable: JsonField) = apply { this.immutable = immutable } + + /** The tag name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun name(name: JsonField) = apply { this.name = name } + + /** The id of the workspace the tag belongs to. */ + fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) + + /** + * Sets [Builder.workspaceId] to an arbitrary JSON value. + * + * You should usually call [Builder.workspaceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun workspaceId(workspaceId: JsonField) = apply { + this.workspaceId = workspaceId + } + + /** The color the tag is displayed with. */ + fun color(color: String?) = color(JsonField.ofNullable(color)) + + /** Alias for calling [Builder.color] with `color.orElse(null)`. */ + fun color(color: Optional) = color(color.getOrNull()) + + /** + * Sets [Builder.color] to an arbitrary JSON value. + * + * You should usually call [Builder.color] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun color(color: JsonField) = apply { this.color = color } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Tag]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .immutable() + * .name() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Tag = + Tag( + checkRequired("id", id), + checkRequired("creatorId", creatorId), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("immutable", immutable), + checkRequired("name", name), + checkRequired("workspaceId", workspaceId), + color, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Tag = apply { + if (validated) { + return@apply + } + + id() + creatorId() + dateCreated() + dateUpdated() + immutable() + name() + workspaceId() + color() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (creatorId.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (immutable.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + (if (color.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Tag && + id == other.id && + creatorId == other.creatorId && + dateCreated == other.dateCreated && + dateUpdated == other.dateUpdated && + immutable == other.immutable && + name == other.name && + workspaceId == other.workspaceId && + color == other.color && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + creatorId, + dateCreated, + dateUpdated, + immutable, + name, + workspaceId, + color, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Tag{id=$id, creatorId=$creatorId, dateCreated=$dateCreated, dateUpdated=$dateUpdated, immutable=$immutable, name=$name, workspaceId=$workspaceId, color=$color, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Item && + id == other.id && + dateCreated == other.dateCreated && + dateUpdated == other.dateUpdated && + name == other.name && + scope == other.scope && + type == other.type && + workspaceId == other.workspaceId && + assigneeId == other.assigneeId && + automationParams == other.automationParams && + automationType == other.automationType && + deactivated == other.deactivated && + description == other.description && + evidenceType == other.evidenceType && + frameworks == other.frameworks && + immutable == other.immutable && + renewalCadenceDays == other.renewalCadenceDays && + results == other.results && + resultsSummary == other.resultsSummary && + tagIds == other.tagIds && + tags == other.tags && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + dateCreated, + dateUpdated, + name, + scope, + type, + workspaceId, + assigneeId, + automationParams, + automationType, + deactivated, + description, + evidenceType, + frameworks, + immutable, + renewalCadenceDays, + results, + resultsSummary, + tagIds, + tags, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Item{id=$id, dateCreated=$dateCreated, dateUpdated=$dateUpdated, name=$name, scope=$scope, type=$type, workspaceId=$workspaceId, assigneeId=$assigneeId, automationParams=$automationParams, automationType=$automationType, deactivated=$deactivated, description=$description, evidenceType=$evidenceType, frameworks=$frameworks, immutable=$immutable, renewalCadenceDays=$renewalCadenceDays, results=$results, resultsSummary=$resultsSummary, tagIds=$tagIds, tags=$tags, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SectionListRulesResponse && + items == other.items && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(items, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "SectionListRulesResponse{items=$items, additionalProperties=$additionalProperties}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/subsections/SubsectionListRulesParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/subsections/SubsectionListRulesParams.kt new file mode 100644 index 00000000..9dc46a07 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/subsections/SubsectionListRulesParams.kt @@ -0,0 +1,507 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.frameworks.subsections + +import com.fasterxml.jackson.annotation.JsonCreator +import com.openlayer.api.core.Enum +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.Params +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.http.Headers +import com.openlayer.api.core.http.QueryParams +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * List the rules mapped to a subsection of a framework document. + * + * A subsection is usually the level at which a standard states an individual requirement, so this + * is the endpoint to use when you want to show which rules cover a specific clause. + */ +class SubsectionListRulesParams +private constructor( + private val frameworkId: String, + private val subsectionId: String?, + private val includeResults: Boolean?, + private val page: Long?, + private val perPage: Long?, + private val projectId: String?, + private val status: Status?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun frameworkId(): String = frameworkId + + fun subsectionId(): Optional = Optional.ofNullable(subsectionId) + + /** Whether to include each rule's results inline, in a `results` array. */ + fun includeResults(): Optional = Optional.ofNullable(includeResults) + + /** The page to return in a paginated query. */ + fun page(): Optional = Optional.ofNullable(page) + + /** Maximum number of items to return per page. */ + fun perPage(): Optional = Optional.ofNullable(perPage) + + /** Only include items that apply to this project. */ + fun projectId(): Optional = Optional.ofNullable(projectId) + + /** Only include items whose rule result has this compliance status. */ + fun status(): Optional = Optional.ofNullable(status) + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [SubsectionListRulesParams]. + * + * The following fields are required: + * ```java + * .frameworkId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [SubsectionListRulesParams]. */ + class Builder internal constructor() { + + private var frameworkId: String? = null + private var subsectionId: String? = null + private var includeResults: Boolean? = null + private var page: Long? = null + private var perPage: Long? = null + private var projectId: String? = null + private var status: Status? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(subsectionListRulesParams: SubsectionListRulesParams) = apply { + frameworkId = subsectionListRulesParams.frameworkId + subsectionId = subsectionListRulesParams.subsectionId + includeResults = subsectionListRulesParams.includeResults + page = subsectionListRulesParams.page + perPage = subsectionListRulesParams.perPage + projectId = subsectionListRulesParams.projectId + status = subsectionListRulesParams.status + additionalHeaders = subsectionListRulesParams.additionalHeaders.toBuilder() + additionalQueryParams = subsectionListRulesParams.additionalQueryParams.toBuilder() + } + + fun frameworkId(frameworkId: String) = apply { this.frameworkId = frameworkId } + + fun subsectionId(subsectionId: String?) = apply { this.subsectionId = subsectionId } + + /** Alias for calling [Builder.subsectionId] with `subsectionId.orElse(null)`. */ + fun subsectionId(subsectionId: Optional) = subsectionId(subsectionId.getOrNull()) + + /** Whether to include each rule's results inline, in a `results` array. */ + fun includeResults(includeResults: Boolean?) = apply { + this.includeResults = includeResults + } + + /** + * Alias for [Builder.includeResults]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun includeResults(includeResults: Boolean) = includeResults(includeResults as Boolean?) + + /** Alias for calling [Builder.includeResults] with `includeResults.orElse(null)`. */ + fun includeResults(includeResults: Optional) = + includeResults(includeResults.getOrNull()) + + /** The page to return in a paginated query. */ + fun page(page: Long?) = apply { this.page = page } + + /** + * Alias for [Builder.page]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun page(page: Long) = page(page as Long?) + + /** Alias for calling [Builder.page] with `page.orElse(null)`. */ + fun page(page: Optional) = page(page.getOrNull()) + + /** Maximum number of items to return per page. */ + fun perPage(perPage: Long?) = apply { this.perPage = perPage } + + /** + * Alias for [Builder.perPage]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun perPage(perPage: Long) = perPage(perPage as Long?) + + /** Alias for calling [Builder.perPage] with `perPage.orElse(null)`. */ + fun perPage(perPage: Optional) = perPage(perPage.getOrNull()) + + /** Only include items that apply to this project. */ + fun projectId(projectId: String?) = apply { this.projectId = projectId } + + /** Alias for calling [Builder.projectId] with `projectId.orElse(null)`. */ + fun projectId(projectId: Optional) = projectId(projectId.getOrNull()) + + /** Only include items whose rule result has this compliance status. */ + fun status(status: Status?) = apply { this.status = status } + + /** Alias for calling [Builder.status] with `status.orElse(null)`. */ + fun status(status: Optional) = status(status.getOrNull()) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [SubsectionListRulesParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .frameworkId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): SubsectionListRulesParams = + SubsectionListRulesParams( + checkRequired("frameworkId", frameworkId), + subsectionId, + includeResults, + page, + perPage, + projectId, + status, + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _pathParam(index: Int): String = + when (index) { + 0 -> frameworkId + 1 -> subsectionId ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + includeResults?.let { put("includeResults", it.toString()) } + page?.let { put("page", it.toString()) } + perPage?.let { put("perPage", it.toString()) } + projectId?.let { put("projectId", it) } + status?.let { put("status", it.toString()) } + putAll(additionalQueryParams) + } + .build() + + /** Only include items whose rule result has this compliance status. */ + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val RUNNING = of("running") + + @JvmField val PASSING = of("passing") + + @JvmField val FAILING = of("failing") + + @JvmField val SKIPPED = of("skipped") + + @JvmField val ERROR = of("error") + + @JvmField val PENDING = of("pending") + + @JvmField val DUE_SOON = of("due_soon") + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + /** An enum containing [Status]'s known values. */ + enum class Known { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + } + + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + /** An enum member indicating that [Status] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + PENDING -> Value.PENDING + DUE_SOON -> Value.DUE_SOON + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + PENDING -> Known.PENDING + DUE_SOON -> Known.DUE_SOON + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SubsectionListRulesParams && + frameworkId == other.frameworkId && + subsectionId == other.subsectionId && + includeResults == other.includeResults && + page == other.page && + perPage == other.perPage && + projectId == other.projectId && + status == other.status && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = + Objects.hash( + frameworkId, + subsectionId, + includeResults, + page, + perPage, + projectId, + status, + additionalHeaders, + additionalQueryParams, + ) + + override fun toString() = + "SubsectionListRulesParams{frameworkId=$frameworkId, subsectionId=$subsectionId, includeResults=$includeResults, page=$page, perPage=$perPage, projectId=$projectId, status=$status, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/subsections/SubsectionListRulesResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/subsections/SubsectionListRulesResponse.kt new file mode 100644 index 00000000..4bc0a73c --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/frameworks/subsections/SubsectionListRulesResponse.kt @@ -0,0 +1,5145 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.frameworks.subsections + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.openlayer.api.core.Enum +import com.openlayer.api.core.ExcludeMissing +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonMissing +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.checkKnown +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.toImmutable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.time.OffsetDateTime +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class SubsectionListRulesResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val items: JsonField>, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("items") @ExcludeMissing items: JsonField> = JsonMissing.of() + ) : this(items, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun items(): List = items.getRequired("items") + + /** + * Returns the raw JSON value of [items]. + * + * Unlike [items], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("items") @ExcludeMissing fun _items(): JsonField> = items + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [SubsectionListRulesResponse]. + * + * The following fields are required: + * ```java + * .items() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [SubsectionListRulesResponse]. */ + class Builder internal constructor() { + + private var items: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(subsectionListRulesResponse: SubsectionListRulesResponse) = apply { + items = subsectionListRulesResponse.items.map { it.toMutableList() } + additionalProperties = subsectionListRulesResponse.additionalProperties.toMutableMap() + } + + fun items(items: List) = items(JsonField.of(items)) + + /** + * Sets [Builder.items] to an arbitrary JSON value. + * + * You should usually call [Builder.items] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun items(items: JsonField>) = apply { + this.items = items.map { it.toMutableList() } + } + + /** + * Adds a single [Item] to [items]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addItem(item: Item) = apply { + items = + (items ?: JsonField.of(mutableListOf())).also { checkKnown("items", it).add(item) } + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [SubsectionListRulesResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .items() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): SubsectionListRulesResponse = + SubsectionListRulesResponse( + checkRequired("items", items).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): SubsectionListRulesResponse = apply { + if (validated) { + return@apply + } + + items().forEach { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (items.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + class Item + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val name: JsonField, + private val scope: JsonField, + private val type: JsonField, + private val workspaceId: JsonField, + private val assigneeId: JsonField, + private val automationParams: JsonField, + private val automationType: JsonField, + private val deactivated: JsonField, + private val description: JsonField, + private val evidenceType: JsonField, + private val frameworks: JsonField>, + private val immutable: JsonField, + private val renewalCadenceDays: JsonField, + private val results: JsonField>, + private val resultsSummary: JsonField, + private val tagIds: JsonField>, + private val tags: JsonField>, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("scope") @ExcludeMissing scope: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + @JsonProperty("assigneeId") + @ExcludeMissing + assigneeId: JsonField = JsonMissing.of(), + @JsonProperty("automationParams") + @ExcludeMissing + automationParams: JsonField = JsonMissing.of(), + @JsonProperty("automationType") + @ExcludeMissing + automationType: JsonField = JsonMissing.of(), + @JsonProperty("deactivated") + @ExcludeMissing + deactivated: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + description: JsonField = JsonMissing.of(), + @JsonProperty("evidenceType") + @ExcludeMissing + evidenceType: JsonField = JsonMissing.of(), + @JsonProperty("frameworks") + @ExcludeMissing + frameworks: JsonField> = JsonMissing.of(), + @JsonProperty("immutable") + @ExcludeMissing + immutable: JsonField = JsonMissing.of(), + @JsonProperty("renewalCadenceDays") + @ExcludeMissing + renewalCadenceDays: JsonField = JsonMissing.of(), + @JsonProperty("results") + @ExcludeMissing + results: JsonField> = JsonMissing.of(), + @JsonProperty("resultsSummary") + @ExcludeMissing + resultsSummary: JsonField = JsonMissing.of(), + @JsonProperty("tagIds") + @ExcludeMissing + tagIds: JsonField> = JsonMissing.of(), + @JsonProperty("tags") @ExcludeMissing tags: JsonField> = JsonMissing.of(), + ) : this( + id, + dateCreated, + dateUpdated, + name, + scope, + type, + workspaceId, + assigneeId, + automationParams, + automationType, + deactivated, + description, + evidenceType, + frameworks, + immutable, + renewalCadenceDays, + results, + resultsSummary, + tagIds, + tags, + mutableMapOf(), + ) + + /** + * The rule id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun id(): String = id.getRequired("id") + + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** + * The last update date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** + * The rule name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun name(): String = name.getRequired("name") + + /** + * Whether the rule is evaluated once for the whole workspace, or once per project the + * rule's frameworks apply to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun scope(): Scope = scope.getRequired("scope") + + /** + * `platform` rules are evaluated automatically from the state of your Openlayer workspace. + * `evidence` rules are satisfied by attaching evidence. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun type(): Type = type.getRequired("type") + + /** + * The id of the workspace the rule belongs to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun workspaceId(): String = workspaceId.getRequired("workspaceId") + + /** + * The user responsible for satisfying the rule. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun assigneeId(): Optional = assigneeId.getOptional("assigneeId") + + /** + * Configuration for the platform check, when the automation takes parameters. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun automationParams(): Optional = + automationParams.getOptional("automationParams") + + /** + * Which workspace signal a platform rule checks, for example `monitoring_mode_enabled`, + * `test_setup`, or `project_owner_set`. `null` for evidence rules. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun automationType(): Optional = automationType.getOptional("automationType") + + /** + * Whether the rule is excluded from compliance calculations. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun deactivated(): Optional = deactivated.getOptional("deactivated") + + /** + * What the rule requires. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun description(): Optional = description.getOptional("description") + + /** + * The kind of evidence that satisfies the rule. `null` for platform rules. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun evidenceType(): Optional = evidenceType.getOptional("evidenceType") + + /** + * The frameworks that include this rule. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun frameworks(): Optional> = frameworks.getOptional("frameworks") + + /** + * Whether the rule is managed by Openlayer and cannot be edited. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun immutable(): Optional = immutable.getOptional("immutable") + + /** + * How often evidence must be renewed, in days. Once evidence is older than this, the rule + * result becomes `due_soon` and then `failing`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun renewalCadenceDays(): Optional = + renewalCadenceDays.getOptional("renewalCadenceDays") + + /** + * The rule's results, one per entity the rule is evaluated against. Only returned when + * `includeResults` is `true`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun results(): Optional> = results.getOptional("results") + + /** + * Pass-rate counts across all of the rule's entities, independent of any status filter + * applied to the request. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun resultsSummary(): Optional = + resultsSummary.getOptional("resultsSummary") + + /** + * The ids of the rule tags to associate with the rule. Replaces the rule's tags. Read them + * back from `tags`, and list the tags available in the workspace with `GET + * /workspaces/{workspaceId}/rule-tags`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun tagIds(): Optional> = tagIds.getOptional("tagIds") + + /** + * The rule tags associated with the rule. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun tags(): Optional> = tags.getOptional("tags") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [scope]. + * + * Unlike [scope], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("scope") @ExcludeMissing fun _scope(): JsonField = scope + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + /** + * Returns the raw JSON value of [workspaceId]. + * + * Unlike [workspaceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("workspaceId") + @ExcludeMissing + fun _workspaceId(): JsonField = workspaceId + + /** + * Returns the raw JSON value of [assigneeId]. + * + * Unlike [assigneeId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("assigneeId") + @ExcludeMissing + fun _assigneeId(): JsonField = assigneeId + + /** + * Returns the raw JSON value of [automationParams]. + * + * Unlike [automationParams], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("automationParams") + @ExcludeMissing + fun _automationParams(): JsonField = automationParams + + /** + * Returns the raw JSON value of [automationType]. + * + * Unlike [automationType], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("automationType") + @ExcludeMissing + fun _automationType(): JsonField = automationType + + /** + * Returns the raw JSON value of [deactivated]. + * + * Unlike [deactivated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("deactivated") + @ExcludeMissing + fun _deactivated(): JsonField = deactivated + + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("description") + @ExcludeMissing + fun _description(): JsonField = description + + /** + * Returns the raw JSON value of [evidenceType]. + * + * Unlike [evidenceType], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("evidenceType") + @ExcludeMissing + fun _evidenceType(): JsonField = evidenceType + + /** + * Returns the raw JSON value of [frameworks]. + * + * Unlike [frameworks], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("frameworks") + @ExcludeMissing + fun _frameworks(): JsonField> = frameworks + + /** + * Returns the raw JSON value of [immutable]. + * + * Unlike [immutable], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("immutable") @ExcludeMissing fun _immutable(): JsonField = immutable + + /** + * Returns the raw JSON value of [renewalCadenceDays]. + * + * Unlike [renewalCadenceDays], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("renewalCadenceDays") + @ExcludeMissing + fun _renewalCadenceDays(): JsonField = renewalCadenceDays + + /** + * Returns the raw JSON value of [results]. + * + * Unlike [results], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("results") @ExcludeMissing fun _results(): JsonField> = results + + /** + * Returns the raw JSON value of [resultsSummary]. + * + * Unlike [resultsSummary], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("resultsSummary") + @ExcludeMissing + fun _resultsSummary(): JsonField = resultsSummary + + /** + * Returns the raw JSON value of [tagIds]. + * + * Unlike [tagIds], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("tagIds") @ExcludeMissing fun _tagIds(): JsonField> = tagIds + + /** + * Returns the raw JSON value of [tags]. + * + * Unlike [tags], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("tags") @ExcludeMissing fun _tags(): JsonField> = tags + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Item]. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateUpdated() + * .name() + * .scope() + * .type() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Item]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var name: JsonField? = null + private var scope: JsonField? = null + private var type: JsonField? = null + private var workspaceId: JsonField? = null + private var assigneeId: JsonField = JsonMissing.of() + private var automationParams: JsonField = JsonMissing.of() + private var automationType: JsonField = JsonMissing.of() + private var deactivated: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var evidenceType: JsonField = JsonMissing.of() + private var frameworks: JsonField>? = null + private var immutable: JsonField = JsonMissing.of() + private var renewalCadenceDays: JsonField = JsonMissing.of() + private var results: JsonField>? = null + private var resultsSummary: JsonField = JsonMissing.of() + private var tagIds: JsonField>? = null + private var tags: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(item: Item) = apply { + id = item.id + dateCreated = item.dateCreated + dateUpdated = item.dateUpdated + name = item.name + scope = item.scope + type = item.type + workspaceId = item.workspaceId + assigneeId = item.assigneeId + automationParams = item.automationParams + automationType = item.automationType + deactivated = item.deactivated + description = item.description + evidenceType = item.evidenceType + frameworks = item.frameworks.map { it.toMutableList() } + immutable = item.immutable + renewalCadenceDays = item.renewalCadenceDays + results = item.results.map { it.toMutableList() } + resultsSummary = item.resultsSummary + tagIds = item.tagIds.map { it.toMutableList() } + tags = item.tags.map { it.toMutableList() } + additionalProperties = item.additionalProperties.toMutableMap() + } + + /** The rule id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The last update date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** The rule name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun name(name: JsonField) = apply { this.name = name } + + /** + * Whether the rule is evaluated once for the whole workspace, or once per project the + * rule's frameworks apply to. + */ + fun scope(scope: Scope) = scope(JsonField.of(scope)) + + /** + * Sets [Builder.scope] to an arbitrary JSON value. + * + * You should usually call [Builder.scope] with a well-typed [Scope] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun scope(scope: JsonField) = apply { this.scope = scope } + + /** + * `platform` rules are evaluated automatically from the state of your Openlayer + * workspace. `evidence` rules are satisfied by attaching evidence. + */ + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun type(type: JsonField) = apply { this.type = type } + + /** The id of the workspace the rule belongs to. */ + fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) + + /** + * Sets [Builder.workspaceId] to an arbitrary JSON value. + * + * You should usually call [Builder.workspaceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun workspaceId(workspaceId: JsonField) = apply { + this.workspaceId = workspaceId + } + + /** The user responsible for satisfying the rule. */ + fun assigneeId(assigneeId: String?) = assigneeId(JsonField.ofNullable(assigneeId)) + + /** Alias for calling [Builder.assigneeId] with `assigneeId.orElse(null)`. */ + fun assigneeId(assigneeId: Optional) = assigneeId(assigneeId.getOrNull()) + + /** + * Sets [Builder.assigneeId] to an arbitrary JSON value. + * + * You should usually call [Builder.assigneeId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun assigneeId(assigneeId: JsonField) = apply { this.assigneeId = assigneeId } + + /** Configuration for the platform check, when the automation takes parameters. */ + fun automationParams(automationParams: AutomationParams?) = + automationParams(JsonField.ofNullable(automationParams)) + + /** + * Alias for calling [Builder.automationParams] with `automationParams.orElse(null)`. + */ + fun automationParams(automationParams: Optional) = + automationParams(automationParams.getOrNull()) + + /** + * Sets [Builder.automationParams] to an arbitrary JSON value. + * + * You should usually call [Builder.automationParams] with a well-typed + * [AutomationParams] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun automationParams(automationParams: JsonField) = apply { + this.automationParams = automationParams + } + + /** + * Which workspace signal a platform rule checks, for example `monitoring_mode_enabled`, + * `test_setup`, or `project_owner_set`. `null` for evidence rules. + */ + fun automationType(automationType: String?) = + automationType(JsonField.ofNullable(automationType)) + + /** Alias for calling [Builder.automationType] with `automationType.orElse(null)`. */ + fun automationType(automationType: Optional) = + automationType(automationType.getOrNull()) + + /** + * Sets [Builder.automationType] to an arbitrary JSON value. + * + * You should usually call [Builder.automationType] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun automationType(automationType: JsonField) = apply { + this.automationType = automationType + } + + /** Whether the rule is excluded from compliance calculations. */ + fun deactivated(deactivated: Boolean) = deactivated(JsonField.of(deactivated)) + + /** + * Sets [Builder.deactivated] to an arbitrary JSON value. + * + * You should usually call [Builder.deactivated] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun deactivated(deactivated: JsonField) = apply { + this.deactivated = deactivated + } + + /** What the rule requires. */ + fun description(description: String?) = description(JsonField.ofNullable(description)) + + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ + fun description(description: Optional) = description(description.getOrNull()) + + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun description(description: JsonField) = apply { + this.description = description + } + + /** The kind of evidence that satisfies the rule. `null` for platform rules. */ + fun evidenceType(evidenceType: EvidenceType?) = + evidenceType(JsonField.ofNullable(evidenceType)) + + /** Alias for calling [Builder.evidenceType] with `evidenceType.orElse(null)`. */ + fun evidenceType(evidenceType: Optional) = + evidenceType(evidenceType.getOrNull()) + + /** + * Sets [Builder.evidenceType] to an arbitrary JSON value. + * + * You should usually call [Builder.evidenceType] with a well-typed [EvidenceType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun evidenceType(evidenceType: JsonField) = apply { + this.evidenceType = evidenceType + } + + /** The frameworks that include this rule. */ + fun frameworks(frameworks: List) = frameworks(JsonField.of(frameworks)) + + /** + * Sets [Builder.frameworks] to an arbitrary JSON value. + * + * You should usually call [Builder.frameworks] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun frameworks(frameworks: JsonField>) = apply { + this.frameworks = frameworks.map { it.toMutableList() } + } + + /** + * Adds a single [Framework] to [frameworks]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addFramework(framework: Framework) = apply { + frameworks = + (frameworks ?: JsonField.of(mutableListOf())).also { + checkKnown("frameworks", it).add(framework) + } + } + + /** Whether the rule is managed by Openlayer and cannot be edited. */ + fun immutable(immutable: Boolean) = immutable(JsonField.of(immutable)) + + /** + * Sets [Builder.immutable] to an arbitrary JSON value. + * + * You should usually call [Builder.immutable] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun immutable(immutable: JsonField) = apply { this.immutable = immutable } + + /** + * How often evidence must be renewed, in days. Once evidence is older than this, the + * rule result becomes `due_soon` and then `failing`. + */ + fun renewalCadenceDays(renewalCadenceDays: Long?) = + renewalCadenceDays(JsonField.ofNullable(renewalCadenceDays)) + + /** + * Alias for [Builder.renewalCadenceDays]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun renewalCadenceDays(renewalCadenceDays: Long) = + renewalCadenceDays(renewalCadenceDays as Long?) + + /** + * Alias for calling [Builder.renewalCadenceDays] with + * `renewalCadenceDays.orElse(null)`. + */ + fun renewalCadenceDays(renewalCadenceDays: Optional) = + renewalCadenceDays(renewalCadenceDays.getOrNull()) + + /** + * Sets [Builder.renewalCadenceDays] to an arbitrary JSON value. + * + * You should usually call [Builder.renewalCadenceDays] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun renewalCadenceDays(renewalCadenceDays: JsonField) = apply { + this.renewalCadenceDays = renewalCadenceDays + } + + /** + * The rule's results, one per entity the rule is evaluated against. Only returned when + * `includeResults` is `true`. + */ + fun results(results: List) = results(JsonField.of(results)) + + /** + * Sets [Builder.results] to an arbitrary JSON value. + * + * You should usually call [Builder.results] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun results(results: JsonField>) = apply { + this.results = results.map { it.toMutableList() } + } + + /** + * Adds a single [Result] to [results]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addResult(result: Result) = apply { + results = + (results ?: JsonField.of(mutableListOf())).also { + checkKnown("results", it).add(result) + } + } + + /** + * Pass-rate counts across all of the rule's entities, independent of any status filter + * applied to the request. + */ + fun resultsSummary(resultsSummary: ResultsSummary?) = + resultsSummary(JsonField.ofNullable(resultsSummary)) + + /** Alias for calling [Builder.resultsSummary] with `resultsSummary.orElse(null)`. */ + fun resultsSummary(resultsSummary: Optional) = + resultsSummary(resultsSummary.getOrNull()) + + /** + * Sets [Builder.resultsSummary] to an arbitrary JSON value. + * + * You should usually call [Builder.resultsSummary] with a well-typed [ResultsSummary] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun resultsSummary(resultsSummary: JsonField) = apply { + this.resultsSummary = resultsSummary + } + + /** + * The ids of the rule tags to associate with the rule. Replaces the rule's tags. Read + * them back from `tags`, and list the tags available in the workspace with `GET + * /workspaces/{workspaceId}/rule-tags`. + */ + fun tagIds(tagIds: List?) = tagIds(JsonField.ofNullable(tagIds)) + + /** Alias for calling [Builder.tagIds] with `tagIds.orElse(null)`. */ + fun tagIds(tagIds: Optional>) = tagIds(tagIds.getOrNull()) + + /** + * Sets [Builder.tagIds] to an arbitrary JSON value. + * + * You should usually call [Builder.tagIds] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun tagIds(tagIds: JsonField>) = apply { + this.tagIds = tagIds.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [tagIds]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addTagId(tagId: String) = apply { + tagIds = + (tagIds ?: JsonField.of(mutableListOf())).also { + checkKnown("tagIds", it).add(tagId) + } + } + + /** The rule tags associated with the rule. */ + fun tags(tags: List?) = tags(JsonField.ofNullable(tags)) + + /** Alias for calling [Builder.tags] with `tags.orElse(null)`. */ + fun tags(tags: Optional>) = tags(tags.getOrNull()) + + /** + * Sets [Builder.tags] to an arbitrary JSON value. + * + * You should usually call [Builder.tags] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun tags(tags: JsonField>) = apply { + this.tags = tags.map { it.toMutableList() } + } + + /** + * Adds a single [Tag] to [tags]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addTag(tag: Tag) = apply { + tags = + (tags ?: JsonField.of(mutableListOf())).also { checkKnown("tags", it).add(tag) } + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Item]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateUpdated() + * .name() + * .scope() + * .type() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Item = + Item( + checkRequired("id", id), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("name", name), + checkRequired("scope", scope), + checkRequired("type", type), + checkRequired("workspaceId", workspaceId), + assigneeId, + automationParams, + automationType, + deactivated, + description, + evidenceType, + (frameworks ?: JsonMissing.of()).map { it.toImmutable() }, + immutable, + renewalCadenceDays, + (results ?: JsonMissing.of()).map { it.toImmutable() }, + resultsSummary, + (tagIds ?: JsonMissing.of()).map { it.toImmutable() }, + (tags ?: JsonMissing.of()).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Item = apply { + if (validated) { + return@apply + } + + id() + dateCreated() + dateUpdated() + name() + scope().validate() + type().validate() + workspaceId() + assigneeId() + automationParams().ifPresent { it.validate() } + automationType() + deactivated() + description() + evidenceType().ifPresent { it.validate() } + frameworks().ifPresent { it.forEach { it.validate() } } + immutable() + renewalCadenceDays() + results().ifPresent { it.forEach { it.validate() } } + resultsSummary().ifPresent { it.validate() } + tagIds() + tags().ifPresent { it.forEach { it.validate() } } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (scope.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + (if (assigneeId.asKnown().isPresent) 1 else 0) + + (automationParams.asKnown().getOrNull()?.validity() ?: 0) + + (if (automationType.asKnown().isPresent) 1 else 0) + + (if (deactivated.asKnown().isPresent) 1 else 0) + + (if (description.asKnown().isPresent) 1 else 0) + + (evidenceType.asKnown().getOrNull()?.validity() ?: 0) + + (frameworks.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (immutable.asKnown().isPresent) 1 else 0) + + (if (renewalCadenceDays.asKnown().isPresent) 1 else 0) + + (results.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (resultsSummary.asKnown().getOrNull()?.validity() ?: 0) + + (tagIds.asKnown().getOrNull()?.size ?: 0) + + (tags.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + /** + * Whether the rule is evaluated once for the whole workspace, or once per project the + * rule's frameworks apply to. + */ + class Scope @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val PROJECT = of("project") + + @JvmField val WORKSPACE = of("workspace") + + @JvmStatic fun of(value: String) = Scope(JsonField.of(value)) + } + + /** An enum containing [Scope]'s known values. */ + enum class Known { + PROJECT, + WORKSPACE, + } + + /** + * An enum containing [Scope]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Scope] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + PROJECT, + WORKSPACE, + /** + * An enum member indicating that [Scope] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + PROJECT -> Value.PROJECT + WORKSPACE -> Value.WORKSPACE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + PROJECT -> Known.PROJECT + WORKSPACE -> Known.WORKSPACE + else -> throw OpenlayerInvalidDataException("Unknown Scope: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Scope = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Scope && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** + * `platform` rules are evaluated automatically from the state of your Openlayer workspace. + * `evidence` rules are satisfied by attaching evidence. + */ + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val PLATFORM = of("platform") + + @JvmField val EVIDENCE = of("evidence") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + PLATFORM, + EVIDENCE, + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + PLATFORM, + EVIDENCE, + /** An enum member indicating that [Type] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + PLATFORM -> Value.PLATFORM + EVIDENCE -> Value.EVIDENCE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + PLATFORM -> Known.PLATFORM + EVIDENCE -> Known.EVIDENCE + else -> throw OpenlayerInvalidDataException("Unknown Type: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Configuration for the platform check, when the automation takes parameters. */ + class AutomationParams + @JsonCreator + private constructor( + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [AutomationParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [AutomationParams]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(automationParams: AutomationParams) = apply { + additionalProperties = automationParams.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [AutomationParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): AutomationParams = AutomationParams(additionalProperties.toImmutable()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): AutomationParams = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is AutomationParams && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = "AutomationParams{additionalProperties=$additionalProperties}" + } + + /** The kind of evidence that satisfies the rule. `null` for platform rules. */ + class EvidenceType @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val DOCUMENT = of("document") + + @JvmField val TEXT = of("text") + + @JvmField val URL = of("url") + + @JvmField val CATEGORY_VALUE = of("categoryValue") + + @JvmStatic fun of(value: String) = EvidenceType(JsonField.of(value)) + } + + /** An enum containing [EvidenceType]'s known values. */ + enum class Known { + DOCUMENT, + TEXT, + URL, + CATEGORY_VALUE, + } + + /** + * An enum containing [EvidenceType]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [EvidenceType] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DOCUMENT, + TEXT, + URL, + CATEGORY_VALUE, + /** + * An enum member indicating that [EvidenceType] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DOCUMENT -> Value.DOCUMENT + TEXT -> Value.TEXT + URL -> Value.URL + CATEGORY_VALUE -> Value.CATEGORY_VALUE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + DOCUMENT -> Known.DOCUMENT + TEXT -> Known.TEXT + URL -> Known.URL + CATEGORY_VALUE -> Known.CATEGORY_VALUE + else -> throw OpenlayerInvalidDataException("Unknown EvidenceType: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): EvidenceType = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is EvidenceType && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + class Framework + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val avatar: JsonField, + private val builtInSlug: JsonField, + private val enabled: JsonField, + private val name: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("avatar") + @ExcludeMissing + avatar: JsonField = JsonMissing.of(), + @JsonProperty("builtInSlug") + @ExcludeMissing + builtInSlug: JsonField = JsonMissing.of(), + @JsonProperty("enabled") + @ExcludeMissing + enabled: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + ) : this(id, avatar, builtInSlug, enabled, name, mutableMapOf()) + + /** + * The framework id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun id(): String = id.getRequired("id") + + /** + * The icon shown for the framework. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun avatar(): Optional = avatar.getOptional("avatar") + + /** + * Identifies a framework that ships with Openlayer, for example `eu_ai_act`, + * `iso_42001`, `nist_ai_rmf`, or `traiga`. `null` for frameworks you create yourself. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun builtInSlug(): Optional = builtInSlug.getOptional("builtInSlug") + + /** + * Whether the framework is active. Rules of a disabled framework are not evaluated and + * do not count towards compliance. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun enabled(): Boolean = enabled.getRequired("enabled") + + /** + * The framework name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun name(): String = name.getRequired("name") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [avatar]. + * + * Unlike [avatar], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("avatar") @ExcludeMissing fun _avatar(): JsonField = avatar + + /** + * Returns the raw JSON value of [builtInSlug]. + * + * Unlike [builtInSlug], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("builtInSlug") + @ExcludeMissing + fun _builtInSlug(): JsonField = builtInSlug + + /** + * Returns the raw JSON value of [enabled]. + * + * Unlike [enabled], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("enabled") @ExcludeMissing fun _enabled(): JsonField = enabled + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Framework]. + * + * The following fields are required: + * ```java + * .id() + * .avatar() + * .builtInSlug() + * .enabled() + * .name() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Framework]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var avatar: JsonField? = null + private var builtInSlug: JsonField? = null + private var enabled: JsonField? = null + private var name: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(framework: Framework) = apply { + id = framework.id + avatar = framework.avatar + builtInSlug = framework.builtInSlug + enabled = framework.enabled + name = framework.name + additionalProperties = framework.additionalProperties.toMutableMap() + } + + /** The framework id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The icon shown for the framework. */ + fun avatar(avatar: Avatar?) = avatar(JsonField.ofNullable(avatar)) + + /** Alias for calling [Builder.avatar] with `avatar.orElse(null)`. */ + fun avatar(avatar: Optional) = avatar(avatar.getOrNull()) + + /** + * Sets [Builder.avatar] to an arbitrary JSON value. + * + * You should usually call [Builder.avatar] with a well-typed [Avatar] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun avatar(avatar: JsonField) = apply { this.avatar = avatar } + + /** + * Identifies a framework that ships with Openlayer, for example `eu_ai_act`, + * `iso_42001`, `nist_ai_rmf`, or `traiga`. `null` for frameworks you create + * yourself. + */ + fun builtInSlug(builtInSlug: String?) = + builtInSlug(JsonField.ofNullable(builtInSlug)) + + /** Alias for calling [Builder.builtInSlug] with `builtInSlug.orElse(null)`. */ + fun builtInSlug(builtInSlug: Optional) = + builtInSlug(builtInSlug.getOrNull()) + + /** + * Sets [Builder.builtInSlug] to an arbitrary JSON value. + * + * You should usually call [Builder.builtInSlug] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun builtInSlug(builtInSlug: JsonField) = apply { + this.builtInSlug = builtInSlug + } + + /** + * Whether the framework is active. Rules of a disabled framework are not evaluated + * and do not count towards compliance. + */ + fun enabled(enabled: Boolean) = enabled(JsonField.of(enabled)) + + /** + * Sets [Builder.enabled] to an arbitrary JSON value. + * + * You should usually call [Builder.enabled] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun enabled(enabled: JsonField) = apply { this.enabled = enabled } + + /** The framework name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun name(name: JsonField) = apply { this.name = name } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Framework]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .avatar() + * .builtInSlug() + * .enabled() + * .name() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Framework = + Framework( + checkRequired("id", id), + checkRequired("avatar", avatar), + checkRequired("builtInSlug", builtInSlug), + checkRequired("enabled", enabled), + checkRequired("name", name), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Framework = apply { + if (validated) { + return@apply + } + + id() + avatar().ifPresent { it.validate() } + builtInSlug() + enabled() + name() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (avatar.asKnown().getOrNull()?.validity() ?: 0) + + (if (builtInSlug.asKnown().isPresent) 1 else 0) + + (if (enabled.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + /** The icon shown for the framework. */ + class Avatar + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val type: JsonField, + private val value: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("value") + @ExcludeMissing + value: JsonField = JsonMissing.of(), + ) : this(type, value, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun type(): Type = type.getRequired("type") + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun value(): String = value.getRequired("value") + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + /** + * Returns the raw JSON value of [value]. + * + * Unlike [value], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Avatar]. + * + * The following fields are required: + * ```java + * .type() + * .value() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Avatar]. */ + class Builder internal constructor() { + + private var type: JsonField? = null + private var value: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(avatar: Avatar) = apply { + type = avatar.type + value = avatar.value + additionalProperties = avatar.additionalProperties.toMutableMap() + } + + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun type(type: JsonField) = apply { this.type = type } + + fun value(value: String) = value(JsonField.of(value)) + + /** + * Sets [Builder.value] to an arbitrary JSON value. + * + * You should usually call [Builder.value] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun value(value: JsonField) = apply { this.value = value } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Avatar]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .type() + * .value() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Avatar = + Avatar( + checkRequired("type", type), + checkRequired("value", value), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): Avatar = apply { + if (validated) { + return@apply + } + + type().validate() + value() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (type.asKnown().getOrNull()?.validity() ?: 0) + + (if (value.asKnown().isPresent) 1 else 0) + + class Type @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val EMOJI = of("emoji") + + @JvmField val IMAGE_URL = of("imageUrl") + + @JvmField val BUILTIN_IMAGE = of("builtinImage") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + EMOJI, + IMAGE_URL, + BUILTIN_IMAGE, + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + EMOJI, + IMAGE_URL, + BUILTIN_IMAGE, + /** + * An enum member indicating that [Type] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + EMOJI -> Value.EMOJI + IMAGE_URL -> Value.IMAGE_URL + BUILTIN_IMAGE -> Value.BUILTIN_IMAGE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + EMOJI -> Known.EMOJI + IMAGE_URL -> Known.IMAGE_URL + BUILTIN_IMAGE -> Known.BUILTIN_IMAGE + else -> throw OpenlayerInvalidDataException("Unknown Type: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object + * doesn't match its expected type. + */ + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Avatar && + type == other.type && + value == other.value && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(type, value, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Avatar{type=$type, value=$value, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Framework && + id == other.id && + avatar == other.avatar && + builtInSlug == other.builtInSlug && + enabled == other.enabled && + name == other.name && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(id, avatar, builtInSlug, enabled, name, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Framework{id=$id, avatar=$avatar, builtInSlug=$builtInSlug, enabled=$enabled, name=$name, additionalProperties=$additionalProperties}" + } + + class Result + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val deactivated: JsonField, + private val ruleId: JsonField, + private val status: JsonField, + private val workspaceId: JsonField, + private val assigneeId: JsonField, + private val blockedBy: JsonField>, + private val blocking: JsonField>, + private val dateLastEvaluated: JsonField, + private val dateOfLatestEvidence: JsonField, + private val dateOfNextEvaluation: JsonField, + private val dateOfRenewal: JsonField, + private val deactivatedReason: JsonField, + private val projectId: JsonField, + private val statusMessage: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("deactivated") + @ExcludeMissing + deactivated: JsonField = JsonMissing.of(), + @JsonProperty("ruleId") + @ExcludeMissing + ruleId: JsonField = JsonMissing.of(), + @JsonProperty("status") + @ExcludeMissing + status: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + @JsonProperty("assigneeId") + @ExcludeMissing + assigneeId: JsonField = JsonMissing.of(), + @JsonProperty("blockedBy") + @ExcludeMissing + blockedBy: JsonField> = JsonMissing.of(), + @JsonProperty("blocking") + @ExcludeMissing + blocking: JsonField> = JsonMissing.of(), + @JsonProperty("dateLastEvaluated") + @ExcludeMissing + dateLastEvaluated: JsonField = JsonMissing.of(), + @JsonProperty("dateOfLatestEvidence") + @ExcludeMissing + dateOfLatestEvidence: JsonField = JsonMissing.of(), + @JsonProperty("dateOfNextEvaluation") + @ExcludeMissing + dateOfNextEvaluation: JsonField = JsonMissing.of(), + @JsonProperty("dateOfRenewal") + @ExcludeMissing + dateOfRenewal: JsonField = JsonMissing.of(), + @JsonProperty("deactivatedReason") + @ExcludeMissing + deactivatedReason: JsonField = JsonMissing.of(), + @JsonProperty("projectId") + @ExcludeMissing + projectId: JsonField = JsonMissing.of(), + @JsonProperty("statusMessage") + @ExcludeMissing + statusMessage: JsonField = JsonMissing.of(), + ) : this( + id, + dateCreated, + dateUpdated, + deactivated, + ruleId, + status, + workspaceId, + assigneeId, + blockedBy, + blocking, + dateLastEvaluated, + dateOfLatestEvidence, + dateOfNextEvaluation, + dateOfRenewal, + deactivatedReason, + projectId, + statusMessage, + mutableMapOf(), + ) + + /** + * The rule result id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun id(): String = id.getRequired("id") + + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** + * The last update date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** + * Whether this result is excluded from compliance calculations. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun deactivated(): Boolean = deactivated.getRequired("deactivated") + + /** + * The rule this result belongs to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun ruleId(): String = ruleId.getRequired("ruleId") + + /** + * The compliance status of the rule for this entity. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun status(): Status = status.getRequired("status") + + /** + * The id of the workspace the rule result belongs to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun workspaceId(): String = workspaceId.getRequired("workspaceId") + + /** + * The user responsible for this result. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun assigneeId(): Optional = assigneeId.getOptional("assigneeId") + + /** + * Rule results that must pass before this one can be satisfied. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun blockedBy(): Optional> = blockedBy.getOptional("blockedBy") + + /** + * Rule results that this one blocks. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun blocking(): Optional> = blocking.getOptional("blocking") + + /** + * When the rule was last evaluated. Platform rules only. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun dateLastEvaluated(): Optional = + dateLastEvaluated.getOptional("dateLastEvaluated") + + /** + * When the most recent piece of evidence was attached. Evidence rules only. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun dateOfLatestEvidence(): Optional = + dateOfLatestEvidence.getOptional("dateOfLatestEvidence") + + /** + * When the rule will next be evaluated. Platform rules only. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun dateOfNextEvaluation(): Optional = + dateOfNextEvaluation.getOptional("dateOfNextEvaluation") + + /** + * When the evidence must be renewed. Evidence rules with a renewal cadence only. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun dateOfRenewal(): Optional = + dateOfRenewal.getOptional("dateOfRenewal") + + /** + * Why the result was excluded. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun deactivatedReason(): Optional = + deactivatedReason.getOptional("deactivatedReason") + + /** + * The project this result was evaluated for. `null` for workspace-scoped rules. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun projectId(): Optional = projectId.getOptional("projectId") + + /** + * A human-readable explanation of the status. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun statusMessage(): Optional = statusMessage.getOptional("statusMessage") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** + * Returns the raw JSON value of [deactivated]. + * + * Unlike [deactivated], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("deactivated") + @ExcludeMissing + fun _deactivated(): JsonField = deactivated + + /** + * Returns the raw JSON value of [ruleId]. + * + * Unlike [ruleId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("ruleId") @ExcludeMissing fun _ruleId(): JsonField = ruleId + + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + + /** + * Returns the raw JSON value of [workspaceId]. + * + * Unlike [workspaceId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("workspaceId") + @ExcludeMissing + fun _workspaceId(): JsonField = workspaceId + + /** + * Returns the raw JSON value of [assigneeId]. + * + * Unlike [assigneeId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("assigneeId") + @ExcludeMissing + fun _assigneeId(): JsonField = assigneeId + + /** + * Returns the raw JSON value of [blockedBy]. + * + * Unlike [blockedBy], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("blockedBy") + @ExcludeMissing + fun _blockedBy(): JsonField> = blockedBy + + /** + * Returns the raw JSON value of [blocking]. + * + * Unlike [blocking], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("blocking") + @ExcludeMissing + fun _blocking(): JsonField> = blocking + + /** + * Returns the raw JSON value of [dateLastEvaluated]. + * + * Unlike [dateLastEvaluated], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("dateLastEvaluated") + @ExcludeMissing + fun _dateLastEvaluated(): JsonField = dateLastEvaluated + + /** + * Returns the raw JSON value of [dateOfLatestEvidence]. + * + * Unlike [dateOfLatestEvidence], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("dateOfLatestEvidence") + @ExcludeMissing + fun _dateOfLatestEvidence(): JsonField = dateOfLatestEvidence + + /** + * Returns the raw JSON value of [dateOfNextEvaluation]. + * + * Unlike [dateOfNextEvaluation], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("dateOfNextEvaluation") + @ExcludeMissing + fun _dateOfNextEvaluation(): JsonField = dateOfNextEvaluation + + /** + * Returns the raw JSON value of [dateOfRenewal]. + * + * Unlike [dateOfRenewal], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("dateOfRenewal") + @ExcludeMissing + fun _dateOfRenewal(): JsonField = dateOfRenewal + + /** + * Returns the raw JSON value of [deactivatedReason]. + * + * Unlike [deactivatedReason], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("deactivatedReason") + @ExcludeMissing + fun _deactivatedReason(): JsonField = deactivatedReason + + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("projectId") + @ExcludeMissing + fun _projectId(): JsonField = projectId + + /** + * Returns the raw JSON value of [statusMessage]. + * + * Unlike [statusMessage], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("statusMessage") + @ExcludeMissing + fun _statusMessage(): JsonField = statusMessage + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Result]. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateUpdated() + * .deactivated() + * .ruleId() + * .status() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Result]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var deactivated: JsonField? = null + private var ruleId: JsonField? = null + private var status: JsonField? = null + private var workspaceId: JsonField? = null + private var assigneeId: JsonField = JsonMissing.of() + private var blockedBy: JsonField>? = null + private var blocking: JsonField>? = null + private var dateLastEvaluated: JsonField = JsonMissing.of() + private var dateOfLatestEvidence: JsonField = JsonMissing.of() + private var dateOfNextEvaluation: JsonField = JsonMissing.of() + private var dateOfRenewal: JsonField = JsonMissing.of() + private var deactivatedReason: JsonField = JsonMissing.of() + private var projectId: JsonField = JsonMissing.of() + private var statusMessage: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(result: Result) = apply { + id = result.id + dateCreated = result.dateCreated + dateUpdated = result.dateUpdated + deactivated = result.deactivated + ruleId = result.ruleId + status = result.status + workspaceId = result.workspaceId + assigneeId = result.assigneeId + blockedBy = result.blockedBy.map { it.toMutableList() } + blocking = result.blocking.map { it.toMutableList() } + dateLastEvaluated = result.dateLastEvaluated + dateOfLatestEvidence = result.dateOfLatestEvidence + dateOfNextEvaluation = result.dateOfNextEvaluation + dateOfRenewal = result.dateOfRenewal + deactivatedReason = result.deactivatedReason + projectId = result.projectId + statusMessage = result.statusMessage + additionalProperties = result.additionalProperties.toMutableMap() + } + + /** The rule result id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = + dateCreated(JsonField.of(dateCreated)) + + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The last update date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = + dateUpdated(JsonField.of(dateUpdated)) + + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** Whether this result is excluded from compliance calculations. */ + fun deactivated(deactivated: Boolean) = deactivated(JsonField.of(deactivated)) + + /** + * Sets [Builder.deactivated] to an arbitrary JSON value. + * + * You should usually call [Builder.deactivated] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun deactivated(deactivated: JsonField) = apply { + this.deactivated = deactivated + } + + /** The rule this result belongs to. */ + fun ruleId(ruleId: String) = ruleId(JsonField.of(ruleId)) + + /** + * Sets [Builder.ruleId] to an arbitrary JSON value. + * + * You should usually call [Builder.ruleId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun ruleId(ruleId: JsonField) = apply { this.ruleId = ruleId } + + /** The compliance status of the rule for this entity. */ + fun status(status: Status) = status(JsonField.of(status)) + + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun status(status: JsonField) = apply { this.status = status } + + /** The id of the workspace the rule result belongs to. */ + fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) + + /** + * Sets [Builder.workspaceId] to an arbitrary JSON value. + * + * You should usually call [Builder.workspaceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun workspaceId(workspaceId: JsonField) = apply { + this.workspaceId = workspaceId + } + + /** The user responsible for this result. */ + fun assigneeId(assigneeId: String?) = assigneeId(JsonField.ofNullable(assigneeId)) + + /** Alias for calling [Builder.assigneeId] with `assigneeId.orElse(null)`. */ + fun assigneeId(assigneeId: Optional) = assigneeId(assigneeId.getOrNull()) + + /** + * Sets [Builder.assigneeId] to an arbitrary JSON value. + * + * You should usually call [Builder.assigneeId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun assigneeId(assigneeId: JsonField) = apply { + this.assigneeId = assigneeId + } + + /** Rule results that must pass before this one can be satisfied. */ + fun blockedBy(blockedBy: List) = blockedBy(JsonField.of(blockedBy)) + + /** + * Sets [Builder.blockedBy] to an arbitrary JSON value. + * + * You should usually call [Builder.blockedBy] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun blockedBy(blockedBy: JsonField>) = apply { + this.blockedBy = blockedBy.map { it.toMutableList() } + } + + /** + * Adds a single [BlockedBy] to [Builder.blockedBy]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addBlockedBy(blockedBy: BlockedBy) = apply { + this.blockedBy = + (this.blockedBy ?: JsonField.of(mutableListOf())).also { + checkKnown("blockedBy", it).add(blockedBy) + } + } + + /** Rule results that this one blocks. */ + fun blocking(blocking: List) = blocking(JsonField.of(blocking)) + + /** + * Sets [Builder.blocking] to an arbitrary JSON value. + * + * You should usually call [Builder.blocking] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun blocking(blocking: JsonField>) = apply { + this.blocking = blocking.map { it.toMutableList() } + } + + /** + * Adds a single [Blocking] to [Builder.blocking]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addBlocking(blocking: Blocking) = apply { + this.blocking = + (this.blocking ?: JsonField.of(mutableListOf())).also { + checkKnown("blocking", it).add(blocking) + } + } + + /** When the rule was last evaluated. Platform rules only. */ + fun dateLastEvaluated(dateLastEvaluated: OffsetDateTime?) = + dateLastEvaluated(JsonField.ofNullable(dateLastEvaluated)) + + /** + * Alias for calling [Builder.dateLastEvaluated] with + * `dateLastEvaluated.orElse(null)`. + */ + fun dateLastEvaluated(dateLastEvaluated: Optional) = + dateLastEvaluated(dateLastEvaluated.getOrNull()) + + /** + * Sets [Builder.dateLastEvaluated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateLastEvaluated] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun dateLastEvaluated(dateLastEvaluated: JsonField) = apply { + this.dateLastEvaluated = dateLastEvaluated + } + + /** When the most recent piece of evidence was attached. Evidence rules only. */ + fun dateOfLatestEvidence(dateOfLatestEvidence: OffsetDateTime?) = + dateOfLatestEvidence(JsonField.ofNullable(dateOfLatestEvidence)) + + /** + * Alias for calling [Builder.dateOfLatestEvidence] with + * `dateOfLatestEvidence.orElse(null)`. + */ + fun dateOfLatestEvidence(dateOfLatestEvidence: Optional) = + dateOfLatestEvidence(dateOfLatestEvidence.getOrNull()) + + /** + * Sets [Builder.dateOfLatestEvidence] to an arbitrary JSON value. + * + * You should usually call [Builder.dateOfLatestEvidence] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun dateOfLatestEvidence(dateOfLatestEvidence: JsonField) = apply { + this.dateOfLatestEvidence = dateOfLatestEvidence + } + + /** When the rule will next be evaluated. Platform rules only. */ + fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime?) = + dateOfNextEvaluation(JsonField.ofNullable(dateOfNextEvaluation)) + + /** + * Alias for calling [Builder.dateOfNextEvaluation] with + * `dateOfNextEvaluation.orElse(null)`. + */ + fun dateOfNextEvaluation(dateOfNextEvaluation: Optional) = + dateOfNextEvaluation(dateOfNextEvaluation.getOrNull()) + + /** + * Sets [Builder.dateOfNextEvaluation] to an arbitrary JSON value. + * + * You should usually call [Builder.dateOfNextEvaluation] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun dateOfNextEvaluation(dateOfNextEvaluation: JsonField) = apply { + this.dateOfNextEvaluation = dateOfNextEvaluation + } + + /** + * When the evidence must be renewed. Evidence rules with a renewal cadence only. + */ + fun dateOfRenewal(dateOfRenewal: OffsetDateTime?) = + dateOfRenewal(JsonField.ofNullable(dateOfRenewal)) + + /** Alias for calling [Builder.dateOfRenewal] with `dateOfRenewal.orElse(null)`. */ + fun dateOfRenewal(dateOfRenewal: Optional) = + dateOfRenewal(dateOfRenewal.getOrNull()) + + /** + * Sets [Builder.dateOfRenewal] to an arbitrary JSON value. + * + * You should usually call [Builder.dateOfRenewal] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun dateOfRenewal(dateOfRenewal: JsonField) = apply { + this.dateOfRenewal = dateOfRenewal + } + + /** Why the result was excluded. */ + fun deactivatedReason(deactivatedReason: String?) = + deactivatedReason(JsonField.ofNullable(deactivatedReason)) + + /** + * Alias for calling [Builder.deactivatedReason] with + * `deactivatedReason.orElse(null)`. + */ + fun deactivatedReason(deactivatedReason: Optional) = + deactivatedReason(deactivatedReason.getOrNull()) + + /** + * Sets [Builder.deactivatedReason] to an arbitrary JSON value. + * + * You should usually call [Builder.deactivatedReason] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun deactivatedReason(deactivatedReason: JsonField) = apply { + this.deactivatedReason = deactivatedReason + } + + /** The project this result was evaluated for. `null` for workspace-scoped rules. */ + fun projectId(projectId: String?) = projectId(JsonField.ofNullable(projectId)) + + /** Alias for calling [Builder.projectId] with `projectId.orElse(null)`. */ + fun projectId(projectId: Optional) = projectId(projectId.getOrNull()) + + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun projectId(projectId: JsonField) = apply { this.projectId = projectId } + + /** A human-readable explanation of the status. */ + fun statusMessage(statusMessage: String?) = + statusMessage(JsonField.ofNullable(statusMessage)) + + /** Alias for calling [Builder.statusMessage] with `statusMessage.orElse(null)`. */ + fun statusMessage(statusMessage: Optional) = + statusMessage(statusMessage.getOrNull()) + + /** + * Sets [Builder.statusMessage] to an arbitrary JSON value. + * + * You should usually call [Builder.statusMessage] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun statusMessage(statusMessage: JsonField) = apply { + this.statusMessage = statusMessage + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Result]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateUpdated() + * .deactivated() + * .ruleId() + * .status() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Result = + Result( + checkRequired("id", id), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("deactivated", deactivated), + checkRequired("ruleId", ruleId), + checkRequired("status", status), + checkRequired("workspaceId", workspaceId), + assigneeId, + (blockedBy ?: JsonMissing.of()).map { it.toImmutable() }, + (blocking ?: JsonMissing.of()).map { it.toImmutable() }, + dateLastEvaluated, + dateOfLatestEvidence, + dateOfNextEvaluation, + dateOfRenewal, + deactivatedReason, + projectId, + statusMessage, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Result = apply { + if (validated) { + return@apply + } + + id() + dateCreated() + dateUpdated() + deactivated() + ruleId() + status().validate() + workspaceId() + assigneeId() + blockedBy().ifPresent { it.forEach { it.validate() } } + blocking().ifPresent { it.forEach { it.validate() } } + dateLastEvaluated() + dateOfLatestEvidence() + dateOfNextEvaluation() + dateOfRenewal() + deactivatedReason() + projectId() + statusMessage() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (deactivated.asKnown().isPresent) 1 else 0) + + (if (ruleId.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + (if (assigneeId.asKnown().isPresent) 1 else 0) + + (blockedBy.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (blocking.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (dateLastEvaluated.asKnown().isPresent) 1 else 0) + + (if (dateOfLatestEvidence.asKnown().isPresent) 1 else 0) + + (if (dateOfNextEvaluation.asKnown().isPresent) 1 else 0) + + (if (dateOfRenewal.asKnown().isPresent) 1 else 0) + + (if (deactivatedReason.asKnown().isPresent) 1 else 0) + + (if (projectId.asKnown().isPresent) 1 else 0) + + (if (statusMessage.asKnown().isPresent) 1 else 0) + + /** The compliance status of the rule for this entity. */ + class Status @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val RUNNING = of("running") + + @JvmField val PASSING = of("passing") + + @JvmField val FAILING = of("failing") + + @JvmField val SKIPPED = of("skipped") + + @JvmField val ERROR = of("error") + + @JvmField val PENDING = of("pending") + + @JvmField val DUE_SOON = of("due_soon") + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + /** An enum containing [Status]'s known values. */ + enum class Known { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + } + + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + /** + * An enum member indicating that [Status] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + PENDING -> Value.PENDING + DUE_SOON -> Value.DUE_SOON + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + PENDING -> Known.PENDING + DUE_SOON -> Known.DUE_SOON + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + class BlockedBy + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val status: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("status") + @ExcludeMissing + status: JsonField = JsonMissing.of(), + ) : this(id, status, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun id(): Optional = id.getOptional("id") + + /** + * The compliance status of the rule for this entity. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun status(): Optional = status.getOptional("status") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [BlockedBy]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BlockedBy]. */ + class Builder internal constructor() { + + private var id: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(blockedBy: BlockedBy) = apply { + id = blockedBy.id + status = blockedBy.status + additionalProperties = blockedBy.additionalProperties.toMutableMap() + } + + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The compliance status of the rule for this entity. */ + fun status(status: Status) = status(JsonField.of(status)) + + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun status(status: JsonField) = apply { this.status = status } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [BlockedBy]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): BlockedBy = + BlockedBy(id, status, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): BlockedBy = apply { + if (validated) { + return@apply + } + + id() + status().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + /** The compliance status of the rule for this entity. */ + class Status + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val RUNNING = of("running") + + @JvmField val PASSING = of("passing") + + @JvmField val FAILING = of("failing") + + @JvmField val SKIPPED = of("skipped") + + @JvmField val ERROR = of("error") + + @JvmField val PENDING = of("pending") + + @JvmField val DUE_SOON = of("due_soon") + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + /** An enum containing [Status]'s known values. */ + enum class Known { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + } + + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + /** + * An enum member indicating that [Status] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + PENDING -> Value.PENDING + DUE_SOON -> Value.DUE_SOON + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + PENDING -> Known.PENDING + DUE_SOON -> Known.DUE_SOON + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object + * doesn't match its expected type. + */ + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is BlockedBy && + id == other.id && + status == other.status && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(id, status, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BlockedBy{id=$id, status=$status, additionalProperties=$additionalProperties}" + } + + class Blocking + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val status: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("status") + @ExcludeMissing + status: JsonField = JsonMissing.of(), + ) : this(id, status, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun id(): Optional = id.getOptional("id") + + /** + * The compliance status of the rule for this entity. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun status(): Optional = status.getOptional("status") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Blocking]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Blocking]. */ + class Builder internal constructor() { + + private var id: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(blocking: Blocking) = apply { + id = blocking.id + status = blocking.status + additionalProperties = blocking.additionalProperties.toMutableMap() + } + + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The compliance status of the rule for this entity. */ + fun status(status: Status) = status(JsonField.of(status)) + + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun status(status: JsonField) = apply { this.status = status } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Blocking]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Blocking = + Blocking(id, status, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): Blocking = apply { + if (validated) { + return@apply + } + + id() + status().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + /** The compliance status of the rule for this entity. */ + class Status + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val RUNNING = of("running") + + @JvmField val PASSING = of("passing") + + @JvmField val FAILING = of("failing") + + @JvmField val SKIPPED = of("skipped") + + @JvmField val ERROR = of("error") + + @JvmField val PENDING = of("pending") + + @JvmField val DUE_SOON = of("due_soon") + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + /** An enum containing [Status]'s known values. */ + enum class Known { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + } + + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + /** + * An enum member indicating that [Status] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + PENDING -> Value.PENDING + DUE_SOON -> Value.DUE_SOON + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + PENDING -> Known.PENDING + DUE_SOON -> Known.DUE_SOON + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object + * doesn't match its expected type. + */ + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Blocking && + id == other.id && + status == other.status && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(id, status, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Blocking{id=$id, status=$status, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Result && + id == other.id && + dateCreated == other.dateCreated && + dateUpdated == other.dateUpdated && + deactivated == other.deactivated && + ruleId == other.ruleId && + status == other.status && + workspaceId == other.workspaceId && + assigneeId == other.assigneeId && + blockedBy == other.blockedBy && + blocking == other.blocking && + dateLastEvaluated == other.dateLastEvaluated && + dateOfLatestEvidence == other.dateOfLatestEvidence && + dateOfNextEvaluation == other.dateOfNextEvaluation && + dateOfRenewal == other.dateOfRenewal && + deactivatedReason == other.deactivatedReason && + projectId == other.projectId && + statusMessage == other.statusMessage && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + dateCreated, + dateUpdated, + deactivated, + ruleId, + status, + workspaceId, + assigneeId, + blockedBy, + blocking, + dateLastEvaluated, + dateOfLatestEvidence, + dateOfNextEvaluation, + dateOfRenewal, + deactivatedReason, + projectId, + statusMessage, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Result{id=$id, dateCreated=$dateCreated, dateUpdated=$dateUpdated, deactivated=$deactivated, ruleId=$ruleId, status=$status, workspaceId=$workspaceId, assigneeId=$assigneeId, blockedBy=$blockedBy, blocking=$blocking, dateLastEvaluated=$dateLastEvaluated, dateOfLatestEvidence=$dateOfLatestEvidence, dateOfNextEvaluation=$dateOfNextEvaluation, dateOfRenewal=$dateOfRenewal, deactivatedReason=$deactivatedReason, projectId=$projectId, statusMessage=$statusMessage, additionalProperties=$additionalProperties}" + } + + /** + * Pass-rate counts across all of the rule's entities, independent of any status filter + * applied to the request. + */ + class ResultsSummary + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val passing: JsonField, + private val total: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("passing") + @ExcludeMissing + passing: JsonField = JsonMissing.of(), + @JsonProperty("total") @ExcludeMissing total: JsonField = JsonMissing.of(), + ) : this(passing, total, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun passing(): Optional = passing.getOptional("passing") + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun total(): Optional = total.getOptional("total") + + /** + * Returns the raw JSON value of [passing]. + * + * Unlike [passing], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("passing") @ExcludeMissing fun _passing(): JsonField = passing + + /** + * Returns the raw JSON value of [total]. + * + * Unlike [total], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("total") @ExcludeMissing fun _total(): JsonField = total + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [ResultsSummary]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ResultsSummary]. */ + class Builder internal constructor() { + + private var passing: JsonField = JsonMissing.of() + private var total: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(resultsSummary: ResultsSummary) = apply { + passing = resultsSummary.passing + total = resultsSummary.total + additionalProperties = resultsSummary.additionalProperties.toMutableMap() + } + + fun passing(passing: Long) = passing(JsonField.of(passing)) + + /** + * Sets [Builder.passing] to an arbitrary JSON value. + * + * You should usually call [Builder.passing] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun passing(passing: JsonField) = apply { this.passing = passing } + + fun total(total: Long) = total(JsonField.of(total)) + + /** + * Sets [Builder.total] to an arbitrary JSON value. + * + * You should usually call [Builder.total] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun total(total: JsonField) = apply { this.total = total } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ResultsSummary]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): ResultsSummary = + ResultsSummary(passing, total, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): ResultsSummary = apply { + if (validated) { + return@apply + } + + passing() + total() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (passing.asKnown().isPresent) 1 else 0) + + (if (total.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ResultsSummary && + passing == other.passing && + total == other.total && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(passing, total, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ResultsSummary{passing=$passing, total=$total, additionalProperties=$additionalProperties}" + } + + class Tag + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val creatorId: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val immutable: JsonField, + private val name: JsonField, + private val workspaceId: JsonField, + private val color: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("creatorId") + @ExcludeMissing + creatorId: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("immutable") + @ExcludeMissing + immutable: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + @JsonProperty("color") @ExcludeMissing color: JsonField = JsonMissing.of(), + ) : this( + id, + creatorId, + dateCreated, + dateUpdated, + immutable, + name, + workspaceId, + color, + mutableMapOf(), + ) + + /** + * The rule tag id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun id(): String = id.getRequired("id") + + /** + * The user who created the tag. `null` for tags that ship with Openlayer. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun creatorId(): Optional = creatorId.getOptional("creatorId") + + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** + * The last update date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** + * Whether the tag is managed by Openlayer and cannot be edited or deleted. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun immutable(): Boolean = immutable.getRequired("immutable") + + /** + * The tag name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun name(): String = name.getRequired("name") + + /** + * The id of the workspace the tag belongs to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun workspaceId(): String = workspaceId.getRequired("workspaceId") + + /** + * The color the tag is displayed with. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun color(): Optional = color.getOptional("color") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [creatorId]. + * + * Unlike [creatorId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("creatorId") + @ExcludeMissing + fun _creatorId(): JsonField = creatorId + + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** + * Returns the raw JSON value of [immutable]. + * + * Unlike [immutable], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("immutable") + @ExcludeMissing + fun _immutable(): JsonField = immutable + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [workspaceId]. + * + * Unlike [workspaceId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("workspaceId") + @ExcludeMissing + fun _workspaceId(): JsonField = workspaceId + + /** + * Returns the raw JSON value of [color]. + * + * Unlike [color], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("color") @ExcludeMissing fun _color(): JsonField = color + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Tag]. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .immutable() + * .name() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Tag]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var creatorId: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var immutable: JsonField? = null + private var name: JsonField? = null + private var workspaceId: JsonField? = null + private var color: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(tag: Tag) = apply { + id = tag.id + creatorId = tag.creatorId + dateCreated = tag.dateCreated + dateUpdated = tag.dateUpdated + immutable = tag.immutable + name = tag.name + workspaceId = tag.workspaceId + color = tag.color + additionalProperties = tag.additionalProperties.toMutableMap() + } + + /** The rule tag id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The user who created the tag. `null` for tags that ship with Openlayer. */ + fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) + + /** Alias for calling [Builder.creatorId] with `creatorId.orElse(null)`. */ + fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) + + /** + * Sets [Builder.creatorId] to an arbitrary JSON value. + * + * You should usually call [Builder.creatorId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = + dateCreated(JsonField.of(dateCreated)) + + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The last update date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = + dateUpdated(JsonField.of(dateUpdated)) + + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** Whether the tag is managed by Openlayer and cannot be edited or deleted. */ + fun immutable(immutable: Boolean) = immutable(JsonField.of(immutable)) + + /** + * Sets [Builder.immutable] to an arbitrary JSON value. + * + * You should usually call [Builder.immutable] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun immutable(immutable: JsonField) = apply { this.immutable = immutable } + + /** The tag name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun name(name: JsonField) = apply { this.name = name } + + /** The id of the workspace the tag belongs to. */ + fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) + + /** + * Sets [Builder.workspaceId] to an arbitrary JSON value. + * + * You should usually call [Builder.workspaceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun workspaceId(workspaceId: JsonField) = apply { + this.workspaceId = workspaceId + } + + /** The color the tag is displayed with. */ + fun color(color: String?) = color(JsonField.ofNullable(color)) + + /** Alias for calling [Builder.color] with `color.orElse(null)`. */ + fun color(color: Optional) = color(color.getOrNull()) + + /** + * Sets [Builder.color] to an arbitrary JSON value. + * + * You should usually call [Builder.color] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun color(color: JsonField) = apply { this.color = color } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Tag]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .immutable() + * .name() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Tag = + Tag( + checkRequired("id", id), + checkRequired("creatorId", creatorId), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("immutable", immutable), + checkRequired("name", name), + checkRequired("workspaceId", workspaceId), + color, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Tag = apply { + if (validated) { + return@apply + } + + id() + creatorId() + dateCreated() + dateUpdated() + immutable() + name() + workspaceId() + color() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (creatorId.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (immutable.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + (if (color.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Tag && + id == other.id && + creatorId == other.creatorId && + dateCreated == other.dateCreated && + dateUpdated == other.dateUpdated && + immutable == other.immutable && + name == other.name && + workspaceId == other.workspaceId && + color == other.color && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + creatorId, + dateCreated, + dateUpdated, + immutable, + name, + workspaceId, + color, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Tag{id=$id, creatorId=$creatorId, dateCreated=$dateCreated, dateUpdated=$dateUpdated, immutable=$immutable, name=$name, workspaceId=$workspaceId, color=$color, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Item && + id == other.id && + dateCreated == other.dateCreated && + dateUpdated == other.dateUpdated && + name == other.name && + scope == other.scope && + type == other.type && + workspaceId == other.workspaceId && + assigneeId == other.assigneeId && + automationParams == other.automationParams && + automationType == other.automationType && + deactivated == other.deactivated && + description == other.description && + evidenceType == other.evidenceType && + frameworks == other.frameworks && + immutable == other.immutable && + renewalCadenceDays == other.renewalCadenceDays && + results == other.results && + resultsSummary == other.resultsSummary && + tagIds == other.tagIds && + tags == other.tags && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + dateCreated, + dateUpdated, + name, + scope, + type, + workspaceId, + assigneeId, + automationParams, + automationType, + deactivated, + description, + evidenceType, + frameworks, + immutable, + renewalCadenceDays, + results, + resultsSummary, + tagIds, + tags, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Item{id=$id, dateCreated=$dateCreated, dateUpdated=$dateUpdated, name=$name, scope=$scope, type=$type, workspaceId=$workspaceId, assigneeId=$assigneeId, automationParams=$automationParams, automationType=$automationType, deactivated=$deactivated, description=$description, evidenceType=$evidenceType, frameworks=$frameworks, immutable=$immutable, renewalCadenceDays=$renewalCadenceDays, results=$results, resultsSummary=$resultsSummary, tagIds=$tagIds, tags=$tags, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SubsectionListRulesResponse && + items == other.items && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(items, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "SubsectionListRulesResponse{items=$items, additionalProperties=$additionalProperties}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultCreateEvidenceParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultCreateEvidenceParams.kt new file mode 100644 index 00000000..3fe2f9f3 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultCreateEvidenceParams.kt @@ -0,0 +1,725 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.ruleresults + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.openlayer.api.core.ExcludeMissing +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonMissing +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.Params +import com.openlayer.api.core.http.Headers +import com.openlayer.api.core.http.QueryParams +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * Attach evidence to a rule result, satisfying an evidence rule. + * + * Send the field that matches the rule's `evidenceType`: `storageUri` for an uploaded document, + * `text` for a written statement, or `url` for a link. + * + * For a document, upload the file first with `POST /storage/presigned-url` and send the resulting + * storage URI as `storageUri`. + * + * Attaching evidence re-evaluates the rule result. If the rule sets `renewalCadenceDays`, the + * renewal window restarts from this evidence. + */ +class RuleResultCreateEvidenceParams +private constructor( + private val ruleResultId: String?, + private val body: Body, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun ruleResultId(): Optional = Optional.ofNullable(ruleResultId) + + /** + * A description of what the evidence shows. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun description(): Optional = body.description() + + /** + * The evidence name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun name(): Optional = body.name() + + /** + * Where the uploaded file is stored. Set when the rule's `evidenceType` is `document`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun storageUri(): Optional = body.storageUri() + + /** + * The evidence text. Set when the rule's `evidenceType` is `text`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun text(): Optional = body.text() + + /** + * A link to the evidence. Set when the rule's `evidenceType` is `url`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun url(): Optional = body.url() + + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _description(): JsonField = body._description() + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _name(): JsonField = body._name() + + /** + * Returns the raw JSON value of [storageUri]. + * + * Unlike [storageUri], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _storageUri(): JsonField = body._storageUri() + + /** + * Returns the raw JSON value of [text]. + * + * Unlike [text], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _text(): JsonField = body._text() + + /** + * Returns the raw JSON value of [url]. + * + * Unlike [url], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _url(): JsonField = body._url() + + fun _additionalBodyProperties(): Map = body._additionalProperties() + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): RuleResultCreateEvidenceParams = builder().build() + + /** + * Returns a mutable builder for constructing an instance of + * [RuleResultCreateEvidenceParams]. + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [RuleResultCreateEvidenceParams]. */ + class Builder internal constructor() { + + private var ruleResultId: String? = null + private var body: Body.Builder = Body.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(ruleResultCreateEvidenceParams: RuleResultCreateEvidenceParams) = apply { + ruleResultId = ruleResultCreateEvidenceParams.ruleResultId + body = ruleResultCreateEvidenceParams.body.toBuilder() + additionalHeaders = ruleResultCreateEvidenceParams.additionalHeaders.toBuilder() + additionalQueryParams = ruleResultCreateEvidenceParams.additionalQueryParams.toBuilder() + } + + fun ruleResultId(ruleResultId: String?) = apply { this.ruleResultId = ruleResultId } + + /** Alias for calling [Builder.ruleResultId] with `ruleResultId.orElse(null)`. */ + fun ruleResultId(ruleResultId: Optional) = ruleResultId(ruleResultId.getOrNull()) + + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [description] + * - [name] + * - [storageUri] + * - [text] + * - [url] + * - etc. + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + + /** A description of what the evidence shows. */ + fun description(description: String?) = apply { body.description(description) } + + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ + fun description(description: Optional) = description(description.getOrNull()) + + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun description(description: JsonField) = apply { body.description(description) } + + /** The evidence name. */ + fun name(name: String?) = apply { body.name(name) } + + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ + fun name(name: Optional) = name(name.getOrNull()) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun name(name: JsonField) = apply { body.name(name) } + + /** Where the uploaded file is stored. Set when the rule's `evidenceType` is `document`. */ + fun storageUri(storageUri: String?) = apply { body.storageUri(storageUri) } + + /** Alias for calling [Builder.storageUri] with `storageUri.orElse(null)`. */ + fun storageUri(storageUri: Optional) = storageUri(storageUri.getOrNull()) + + /** + * Sets [Builder.storageUri] to an arbitrary JSON value. + * + * You should usually call [Builder.storageUri] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun storageUri(storageUri: JsonField) = apply { body.storageUri(storageUri) } + + /** The evidence text. Set when the rule's `evidenceType` is `text`. */ + fun text(text: String?) = apply { body.text(text) } + + /** Alias for calling [Builder.text] with `text.orElse(null)`. */ + fun text(text: Optional) = text(text.getOrNull()) + + /** + * Sets [Builder.text] to an arbitrary JSON value. + * + * You should usually call [Builder.text] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun text(text: JsonField) = apply { body.text(text) } + + /** A link to the evidence. Set when the rule's `evidenceType` is `url`. */ + fun url(url: String?) = apply { body.url(url) } + + /** Alias for calling [Builder.url] with `url.orElse(null)`. */ + fun url(url: Optional) = url(url.getOrNull()) + + /** + * Sets [Builder.url] to an arbitrary JSON value. + * + * You should usually call [Builder.url] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun url(url: JsonField) = apply { body.url(url) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [RuleResultCreateEvidenceParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): RuleResultCreateEvidenceParams = + RuleResultCreateEvidenceParams( + ruleResultId, + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _body(): Body = body + + fun _pathParam(index: Int): String = + when (index) { + 0 -> ruleResultId ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val description: JsonField, + private val name: JsonField, + private val storageUri: JsonField, + private val text: JsonField, + private val url: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("description") + @ExcludeMissing + description: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("storageUri") + @ExcludeMissing + storageUri: JsonField = JsonMissing.of(), + @JsonProperty("text") @ExcludeMissing text: JsonField = JsonMissing.of(), + @JsonProperty("url") @ExcludeMissing url: JsonField = JsonMissing.of(), + ) : this(description, name, storageUri, text, url, mutableMapOf()) + + /** + * A description of what the evidence shows. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun description(): Optional = description.getOptional("description") + + /** + * The evidence name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun name(): Optional = name.getOptional("name") + + /** + * Where the uploaded file is stored. Set when the rule's `evidenceType` is `document`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun storageUri(): Optional = storageUri.getOptional("storageUri") + + /** + * The evidence text. Set when the rule's `evidenceType` is `text`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun text(): Optional = text.getOptional("text") + + /** + * A link to the evidence. Set when the rule's `evidenceType` is `url`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun url(): Optional = url.getOptional("url") + + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("description") + @ExcludeMissing + fun _description(): JsonField = description + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [storageUri]. + * + * Unlike [storageUri], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("storageUri") + @ExcludeMissing + fun _storageUri(): JsonField = storageUri + + /** + * Returns the raw JSON value of [text]. + * + * Unlike [text], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("text") @ExcludeMissing fun _text(): JsonField = text + + /** + * Returns the raw JSON value of [url]. + * + * Unlike [url], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("url") @ExcludeMissing fun _url(): JsonField = url + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Body]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var description: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var storageUri: JsonField = JsonMissing.of() + private var text: JsonField = JsonMissing.of() + private var url: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + description = body.description + name = body.name + storageUri = body.storageUri + text = body.text + url = body.url + additionalProperties = body.additionalProperties.toMutableMap() + } + + /** A description of what the evidence shows. */ + fun description(description: String?) = description(JsonField.ofNullable(description)) + + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ + fun description(description: Optional) = description(description.getOrNull()) + + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun description(description: JsonField) = apply { + this.description = description + } + + /** The evidence name. */ + fun name(name: String?) = name(JsonField.ofNullable(name)) + + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ + fun name(name: Optional) = name(name.getOrNull()) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun name(name: JsonField) = apply { this.name = name } + + /** + * Where the uploaded file is stored. Set when the rule's `evidenceType` is `document`. + */ + fun storageUri(storageUri: String?) = storageUri(JsonField.ofNullable(storageUri)) + + /** Alias for calling [Builder.storageUri] with `storageUri.orElse(null)`. */ + fun storageUri(storageUri: Optional) = storageUri(storageUri.getOrNull()) + + /** + * Sets [Builder.storageUri] to an arbitrary JSON value. + * + * You should usually call [Builder.storageUri] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun storageUri(storageUri: JsonField) = apply { this.storageUri = storageUri } + + /** The evidence text. Set when the rule's `evidenceType` is `text`. */ + fun text(text: String?) = text(JsonField.ofNullable(text)) + + /** Alias for calling [Builder.text] with `text.orElse(null)`. */ + fun text(text: Optional) = text(text.getOrNull()) + + /** + * Sets [Builder.text] to an arbitrary JSON value. + * + * You should usually call [Builder.text] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun text(text: JsonField) = apply { this.text = text } + + /** A link to the evidence. Set when the rule's `evidenceType` is `url`. */ + fun url(url: String?) = url(JsonField.ofNullable(url)) + + /** Alias for calling [Builder.url] with `url.orElse(null)`. */ + fun url(url: Optional) = url(url.getOrNull()) + + /** + * Sets [Builder.url] to an arbitrary JSON value. + * + * You should usually call [Builder.url] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun url(url: JsonField) = apply { this.url = url } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Body = + Body(description, name, storageUri, text, url, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Body = apply { + if (validated) { + return@apply + } + + description() + name() + storageUri() + text() + url() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (description.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (storageUri.asKnown().isPresent) 1 else 0) + + (if (text.asKnown().isPresent) 1 else 0) + + (if (url.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Body && + description == other.description && + name == other.name && + storageUri == other.storageUri && + text == other.text && + url == other.url && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(description, name, storageUri, text, url, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Body{description=$description, name=$name, storageUri=$storageUri, text=$text, url=$url, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is RuleResultCreateEvidenceParams && + ruleResultId == other.ruleResultId && + body == other.body && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = + Objects.hash(ruleResultId, body, additionalHeaders, additionalQueryParams) + + override fun toString() = + "RuleResultCreateEvidenceParams{ruleResultId=$ruleResultId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultCreateEvidenceResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultCreateEvidenceResponse.kt new file mode 100644 index 00000000..854b6853 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultCreateEvidenceResponse.kt @@ -0,0 +1,530 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.ruleresults + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.openlayer.api.core.ExcludeMissing +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonMissing +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.checkRequired +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.time.OffsetDateTime +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class RuleResultCreateEvidenceResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val id: JsonField, + private val creatorId: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val description: JsonField, + private val name: JsonField, + private val storageUri: JsonField, + private val text: JsonField, + private val url: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("creatorId") @ExcludeMissing creatorId: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + description: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("storageUri") + @ExcludeMissing + storageUri: JsonField = JsonMissing.of(), + @JsonProperty("text") @ExcludeMissing text: JsonField = JsonMissing.of(), + @JsonProperty("url") @ExcludeMissing url: JsonField = JsonMissing.of(), + ) : this( + id, + creatorId, + dateCreated, + dateUpdated, + description, + name, + storageUri, + text, + url, + mutableMapOf(), + ) + + /** + * The evidence id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun id(): String = id.getRequired("id") + + /** + * The user who attached the evidence. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun creatorId(): Optional = creatorId.getOptional("creatorId") + + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** + * The last update date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** + * A description of what the evidence shows. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun description(): Optional = description.getOptional("description") + + /** + * The evidence name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun name(): Optional = name.getOptional("name") + + /** + * Where the uploaded file is stored. Set when the rule's `evidenceType` is `document`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun storageUri(): Optional = storageUri.getOptional("storageUri") + + /** + * The evidence text. Set when the rule's `evidenceType` is `text`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun text(): Optional = text.getOptional("text") + + /** + * A link to the evidence. Set when the rule's `evidenceType` is `url`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun url(): Optional = url.getOptional("url") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [creatorId]. + * + * Unlike [creatorId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("creatorId") @ExcludeMissing fun _creatorId(): JsonField = creatorId + + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [storageUri]. + * + * Unlike [storageUri], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("storageUri") @ExcludeMissing fun _storageUri(): JsonField = storageUri + + /** + * Returns the raw JSON value of [text]. + * + * Unlike [text], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("text") @ExcludeMissing fun _text(): JsonField = text + + /** + * Returns the raw JSON value of [url]. + * + * Unlike [url], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("url") @ExcludeMissing fun _url(): JsonField = url + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [RuleResultCreateEvidenceResponse]. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [RuleResultCreateEvidenceResponse]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var creatorId: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var description: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var storageUri: JsonField = JsonMissing.of() + private var text: JsonField = JsonMissing.of() + private var url: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(ruleResultCreateEvidenceResponse: RuleResultCreateEvidenceResponse) = + apply { + id = ruleResultCreateEvidenceResponse.id + creatorId = ruleResultCreateEvidenceResponse.creatorId + dateCreated = ruleResultCreateEvidenceResponse.dateCreated + dateUpdated = ruleResultCreateEvidenceResponse.dateUpdated + description = ruleResultCreateEvidenceResponse.description + name = ruleResultCreateEvidenceResponse.name + storageUri = ruleResultCreateEvidenceResponse.storageUri + text = ruleResultCreateEvidenceResponse.text + url = ruleResultCreateEvidenceResponse.url + additionalProperties = + ruleResultCreateEvidenceResponse.additionalProperties.toMutableMap() + } + + /** The evidence id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The user who attached the evidence. */ + fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) + + /** Alias for calling [Builder.creatorId] with `creatorId.orElse(null)`. */ + fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) + + /** + * Sets [Builder.creatorId] to an arbitrary JSON value. + * + * You should usually call [Builder.creatorId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The last update date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** A description of what the evidence shows. */ + fun description(description: String?) = description(JsonField.ofNullable(description)) + + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ + fun description(description: Optional) = description(description.getOrNull()) + + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun description(description: JsonField) = apply { this.description = description } + + /** The evidence name. */ + fun name(name: String?) = name(JsonField.ofNullable(name)) + + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ + fun name(name: Optional) = name(name.getOrNull()) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun name(name: JsonField) = apply { this.name = name } + + /** Where the uploaded file is stored. Set when the rule's `evidenceType` is `document`. */ + fun storageUri(storageUri: String?) = storageUri(JsonField.ofNullable(storageUri)) + + /** Alias for calling [Builder.storageUri] with `storageUri.orElse(null)`. */ + fun storageUri(storageUri: Optional) = storageUri(storageUri.getOrNull()) + + /** + * Sets [Builder.storageUri] to an arbitrary JSON value. + * + * You should usually call [Builder.storageUri] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun storageUri(storageUri: JsonField) = apply { this.storageUri = storageUri } + + /** The evidence text. Set when the rule's `evidenceType` is `text`. */ + fun text(text: String?) = text(JsonField.ofNullable(text)) + + /** Alias for calling [Builder.text] with `text.orElse(null)`. */ + fun text(text: Optional) = text(text.getOrNull()) + + /** + * Sets [Builder.text] to an arbitrary JSON value. + * + * You should usually call [Builder.text] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun text(text: JsonField) = apply { this.text = text } + + /** A link to the evidence. Set when the rule's `evidenceType` is `url`. */ + fun url(url: String?) = url(JsonField.ofNullable(url)) + + /** Alias for calling [Builder.url] with `url.orElse(null)`. */ + fun url(url: Optional) = url(url.getOrNull()) + + /** + * Sets [Builder.url] to an arbitrary JSON value. + * + * You should usually call [Builder.url] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun url(url: JsonField) = apply { this.url = url } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [RuleResultCreateEvidenceResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): RuleResultCreateEvidenceResponse = + RuleResultCreateEvidenceResponse( + checkRequired("id", id), + checkRequired("creatorId", creatorId), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + description, + name, + storageUri, + text, + url, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): RuleResultCreateEvidenceResponse = apply { + if (validated) { + return@apply + } + + id() + creatorId() + dateCreated() + dateUpdated() + description() + name() + storageUri() + text() + url() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (creatorId.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (description.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (storageUri.asKnown().isPresent) 1 else 0) + + (if (text.asKnown().isPresent) 1 else 0) + + (if (url.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is RuleResultCreateEvidenceResponse && + id == other.id && + creatorId == other.creatorId && + dateCreated == other.dateCreated && + dateUpdated == other.dateUpdated && + description == other.description && + name == other.name && + storageUri == other.storageUri && + text == other.text && + url == other.url && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + creatorId, + dateCreated, + dateUpdated, + description, + name, + storageUri, + text, + url, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "RuleResultCreateEvidenceResponse{id=$id, creatorId=$creatorId, dateCreated=$dateCreated, dateUpdated=$dateUpdated, description=$description, name=$name, storageUri=$storageUri, text=$text, url=$url, additionalProperties=$additionalProperties}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultListEvidenceParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultListEvidenceParams.kt new file mode 100644 index 00000000..3e7cb7bf --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultListEvidenceParams.kt @@ -0,0 +1,250 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.ruleresults + +import com.openlayer.api.core.Params +import com.openlayer.api.core.http.Headers +import com.openlayer.api.core.http.QueryParams +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * List the evidence attached to a rule result. + * + * Which field carries the evidence depends on the rule's `evidenceType`: `storageUri` for uploaded + * documents, `text` for written statements, and `url` for links. + */ +class RuleResultListEvidenceParams +private constructor( + private val ruleResultId: String?, + private val page: Long?, + private val perPage: Long?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun ruleResultId(): Optional = Optional.ofNullable(ruleResultId) + + /** The page to return in a paginated query. */ + fun page(): Optional = Optional.ofNullable(page) + + /** Maximum number of items to return per page. */ + fun perPage(): Optional = Optional.ofNullable(perPage) + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): RuleResultListEvidenceParams = builder().build() + + /** + * Returns a mutable builder for constructing an instance of [RuleResultListEvidenceParams]. + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [RuleResultListEvidenceParams]. */ + class Builder internal constructor() { + + private var ruleResultId: String? = null + private var page: Long? = null + private var perPage: Long? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(ruleResultListEvidenceParams: RuleResultListEvidenceParams) = apply { + ruleResultId = ruleResultListEvidenceParams.ruleResultId + page = ruleResultListEvidenceParams.page + perPage = ruleResultListEvidenceParams.perPage + additionalHeaders = ruleResultListEvidenceParams.additionalHeaders.toBuilder() + additionalQueryParams = ruleResultListEvidenceParams.additionalQueryParams.toBuilder() + } + + fun ruleResultId(ruleResultId: String?) = apply { this.ruleResultId = ruleResultId } + + /** Alias for calling [Builder.ruleResultId] with `ruleResultId.orElse(null)`. */ + fun ruleResultId(ruleResultId: Optional) = ruleResultId(ruleResultId.getOrNull()) + + /** The page to return in a paginated query. */ + fun page(page: Long?) = apply { this.page = page } + + /** + * Alias for [Builder.page]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun page(page: Long) = page(page as Long?) + + /** Alias for calling [Builder.page] with `page.orElse(null)`. */ + fun page(page: Optional) = page(page.getOrNull()) + + /** Maximum number of items to return per page. */ + fun perPage(perPage: Long?) = apply { this.perPage = perPage } + + /** + * Alias for [Builder.perPage]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun perPage(perPage: Long) = perPage(perPage as Long?) + + /** Alias for calling [Builder.perPage] with `perPage.orElse(null)`. */ + fun perPage(perPage: Optional) = perPage(perPage.getOrNull()) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [RuleResultListEvidenceParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): RuleResultListEvidenceParams = + RuleResultListEvidenceParams( + ruleResultId, + page, + perPage, + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _pathParam(index: Int): String = + when (index) { + 0 -> ruleResultId ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + page?.let { put("page", it.toString()) } + perPage?.let { put("perPage", it.toString()) } + putAll(additionalQueryParams) + } + .build() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is RuleResultListEvidenceParams && + ruleResultId == other.ruleResultId && + page == other.page && + perPage == other.perPage && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = + Objects.hash(ruleResultId, page, perPage, additionalHeaders, additionalQueryParams) + + override fun toString() = + "RuleResultListEvidenceParams{ruleResultId=$ruleResultId, page=$page, perPage=$perPage, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultListEvidenceResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultListEvidenceResponse.kt new file mode 100644 index 00000000..8d9119bd --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultListEvidenceResponse.kt @@ -0,0 +1,724 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.ruleresults + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.openlayer.api.core.ExcludeMissing +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonMissing +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.checkKnown +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.toImmutable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.time.OffsetDateTime +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class RuleResultListEvidenceResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val items: JsonField>, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("items") @ExcludeMissing items: JsonField> = JsonMissing.of() + ) : this(items, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun items(): List = items.getRequired("items") + + /** + * Returns the raw JSON value of [items]. + * + * Unlike [items], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("items") @ExcludeMissing fun _items(): JsonField> = items + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [RuleResultListEvidenceResponse]. + * + * The following fields are required: + * ```java + * .items() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [RuleResultListEvidenceResponse]. */ + class Builder internal constructor() { + + private var items: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(ruleResultListEvidenceResponse: RuleResultListEvidenceResponse) = apply { + items = ruleResultListEvidenceResponse.items.map { it.toMutableList() } + additionalProperties = + ruleResultListEvidenceResponse.additionalProperties.toMutableMap() + } + + fun items(items: List) = items(JsonField.of(items)) + + /** + * Sets [Builder.items] to an arbitrary JSON value. + * + * You should usually call [Builder.items] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun items(items: JsonField>) = apply { + this.items = items.map { it.toMutableList() } + } + + /** + * Adds a single [Item] to [items]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addItem(item: Item) = apply { + items = + (items ?: JsonField.of(mutableListOf())).also { checkKnown("items", it).add(item) } + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [RuleResultListEvidenceResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .items() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): RuleResultListEvidenceResponse = + RuleResultListEvidenceResponse( + checkRequired("items", items).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): RuleResultListEvidenceResponse = apply { + if (validated) { + return@apply + } + + items().forEach { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (items.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + class Item + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val creatorId: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val description: JsonField, + private val name: JsonField, + private val storageUri: JsonField, + private val text: JsonField, + private val url: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("creatorId") + @ExcludeMissing + creatorId: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + description: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("storageUri") + @ExcludeMissing + storageUri: JsonField = JsonMissing.of(), + @JsonProperty("text") @ExcludeMissing text: JsonField = JsonMissing.of(), + @JsonProperty("url") @ExcludeMissing url: JsonField = JsonMissing.of(), + ) : this( + id, + creatorId, + dateCreated, + dateUpdated, + description, + name, + storageUri, + text, + url, + mutableMapOf(), + ) + + /** + * The evidence id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun id(): String = id.getRequired("id") + + /** + * The user who attached the evidence. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun creatorId(): Optional = creatorId.getOptional("creatorId") + + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** + * The last update date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** + * A description of what the evidence shows. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun description(): Optional = description.getOptional("description") + + /** + * The evidence name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun name(): Optional = name.getOptional("name") + + /** + * Where the uploaded file is stored. Set when the rule's `evidenceType` is `document`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun storageUri(): Optional = storageUri.getOptional("storageUri") + + /** + * The evidence text. Set when the rule's `evidenceType` is `text`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun text(): Optional = text.getOptional("text") + + /** + * A link to the evidence. Set when the rule's `evidenceType` is `url`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun url(): Optional = url.getOptional("url") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [creatorId]. + * + * Unlike [creatorId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("creatorId") @ExcludeMissing fun _creatorId(): JsonField = creatorId + + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("description") + @ExcludeMissing + fun _description(): JsonField = description + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [storageUri]. + * + * Unlike [storageUri], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("storageUri") + @ExcludeMissing + fun _storageUri(): JsonField = storageUri + + /** + * Returns the raw JSON value of [text]. + * + * Unlike [text], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("text") @ExcludeMissing fun _text(): JsonField = text + + /** + * Returns the raw JSON value of [url]. + * + * Unlike [url], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("url") @ExcludeMissing fun _url(): JsonField = url + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Item]. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Item]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var creatorId: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var description: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var storageUri: JsonField = JsonMissing.of() + private var text: JsonField = JsonMissing.of() + private var url: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(item: Item) = apply { + id = item.id + creatorId = item.creatorId + dateCreated = item.dateCreated + dateUpdated = item.dateUpdated + description = item.description + name = item.name + storageUri = item.storageUri + text = item.text + url = item.url + additionalProperties = item.additionalProperties.toMutableMap() + } + + /** The evidence id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The user who attached the evidence. */ + fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) + + /** Alias for calling [Builder.creatorId] with `creatorId.orElse(null)`. */ + fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) + + /** + * Sets [Builder.creatorId] to an arbitrary JSON value. + * + * You should usually call [Builder.creatorId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The last update date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** A description of what the evidence shows. */ + fun description(description: String?) = description(JsonField.ofNullable(description)) + + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ + fun description(description: Optional) = description(description.getOrNull()) + + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun description(description: JsonField) = apply { + this.description = description + } + + /** The evidence name. */ + fun name(name: String?) = name(JsonField.ofNullable(name)) + + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ + fun name(name: Optional) = name(name.getOrNull()) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun name(name: JsonField) = apply { this.name = name } + + /** + * Where the uploaded file is stored. Set when the rule's `evidenceType` is `document`. + */ + fun storageUri(storageUri: String?) = storageUri(JsonField.ofNullable(storageUri)) + + /** Alias for calling [Builder.storageUri] with `storageUri.orElse(null)`. */ + fun storageUri(storageUri: Optional) = storageUri(storageUri.getOrNull()) + + /** + * Sets [Builder.storageUri] to an arbitrary JSON value. + * + * You should usually call [Builder.storageUri] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun storageUri(storageUri: JsonField) = apply { this.storageUri = storageUri } + + /** The evidence text. Set when the rule's `evidenceType` is `text`. */ + fun text(text: String?) = text(JsonField.ofNullable(text)) + + /** Alias for calling [Builder.text] with `text.orElse(null)`. */ + fun text(text: Optional) = text(text.getOrNull()) + + /** + * Sets [Builder.text] to an arbitrary JSON value. + * + * You should usually call [Builder.text] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun text(text: JsonField) = apply { this.text = text } + + /** A link to the evidence. Set when the rule's `evidenceType` is `url`. */ + fun url(url: String?) = url(JsonField.ofNullable(url)) + + /** Alias for calling [Builder.url] with `url.orElse(null)`. */ + fun url(url: Optional) = url(url.getOrNull()) + + /** + * Sets [Builder.url] to an arbitrary JSON value. + * + * You should usually call [Builder.url] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun url(url: JsonField) = apply { this.url = url } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Item]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Item = + Item( + checkRequired("id", id), + checkRequired("creatorId", creatorId), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + description, + name, + storageUri, + text, + url, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Item = apply { + if (validated) { + return@apply + } + + id() + creatorId() + dateCreated() + dateUpdated() + description() + name() + storageUri() + text() + url() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (creatorId.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (description.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (storageUri.asKnown().isPresent) 1 else 0) + + (if (text.asKnown().isPresent) 1 else 0) + + (if (url.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Item && + id == other.id && + creatorId == other.creatorId && + dateCreated == other.dateCreated && + dateUpdated == other.dateUpdated && + description == other.description && + name == other.name && + storageUri == other.storageUri && + text == other.text && + url == other.url && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + creatorId, + dateCreated, + dateUpdated, + description, + name, + storageUri, + text, + url, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Item{id=$id, creatorId=$creatorId, dateCreated=$dateCreated, dateUpdated=$dateUpdated, description=$description, name=$name, storageUri=$storageUri, text=$text, url=$url, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is RuleResultListEvidenceResponse && + items == other.items && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(items, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "RuleResultListEvidenceResponse{items=$items, additionalProperties=$additionalProperties}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultListParams.kt new file mode 100644 index 00000000..e33fbfa4 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultListParams.kt @@ -0,0 +1,868 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.ruleresults + +import com.fasterxml.jackson.annotation.JsonCreator +import com.openlayer.api.core.Enum +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.Params +import com.openlayer.api.core.http.Headers +import com.openlayer.api.core.http.QueryParams +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * List rule results across a workspace. + * + * A rule result is the compliance status of one rule for one entity: a project for project-scoped + * rules, or the workspace itself for workspace-scoped rules. This is the endpoint to poll or export + * when you want your current compliance state, filtered to a framework, a project, or a status. + */ +class RuleResultListParams +private constructor( + private val workspaceId: String?, + private val enabledFrameworkOnly: Boolean?, + private val frameworkId: String?, + private val includeUnframed: Boolean?, + private val page: Long?, + private val perPage: Long?, + private val projectId: String?, + private val ruleId: String?, + private val scope: Scope?, + private val searchQuery: String?, + private val status: Status?, + private val type: Type?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun workspaceId(): Optional = Optional.ofNullable(workspaceId) + + /** Only include items belonging to at least one enabled framework. */ + fun enabledFrameworkOnly(): Optional = Optional.ofNullable(enabledFrameworkOnly) + + /** Only include items belonging to this framework. */ + fun frameworkId(): Optional = Optional.ofNullable(frameworkId) + + /** Whether to include rules that are not part of any framework. */ + fun includeUnframed(): Optional = Optional.ofNullable(includeUnframed) + + /** The page to return in a paginated query. */ + fun page(): Optional = Optional.ofNullable(page) + + /** Maximum number of items to return per page. */ + fun perPage(): Optional = Optional.ofNullable(perPage) + + /** Only include items that apply to this project. */ + fun projectId(): Optional = Optional.ofNullable(projectId) + + /** Only include results of this rule. */ + fun ruleId(): Optional = Optional.ofNullable(ruleId) + + /** Only include rules with this scope. */ + fun scope(): Optional = Optional.ofNullable(scope) + + /** Filter by a free-text search over names and descriptions. */ + fun searchQuery(): Optional = Optional.ofNullable(searchQuery) + + /** Only include items whose rule result has this compliance status. */ + fun status(): Optional = Optional.ofNullable(status) + + /** Only include rules of this type. */ + fun type(): Optional = Optional.ofNullable(type) + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): RuleResultListParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [RuleResultListParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [RuleResultListParams]. */ + class Builder internal constructor() { + + private var workspaceId: String? = null + private var enabledFrameworkOnly: Boolean? = null + private var frameworkId: String? = null + private var includeUnframed: Boolean? = null + private var page: Long? = null + private var perPage: Long? = null + private var projectId: String? = null + private var ruleId: String? = null + private var scope: Scope? = null + private var searchQuery: String? = null + private var status: Status? = null + private var type: Type? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(ruleResultListParams: RuleResultListParams) = apply { + workspaceId = ruleResultListParams.workspaceId + enabledFrameworkOnly = ruleResultListParams.enabledFrameworkOnly + frameworkId = ruleResultListParams.frameworkId + includeUnframed = ruleResultListParams.includeUnframed + page = ruleResultListParams.page + perPage = ruleResultListParams.perPage + projectId = ruleResultListParams.projectId + ruleId = ruleResultListParams.ruleId + scope = ruleResultListParams.scope + searchQuery = ruleResultListParams.searchQuery + status = ruleResultListParams.status + type = ruleResultListParams.type + additionalHeaders = ruleResultListParams.additionalHeaders.toBuilder() + additionalQueryParams = ruleResultListParams.additionalQueryParams.toBuilder() + } + + fun workspaceId(workspaceId: String?) = apply { this.workspaceId = workspaceId } + + /** Alias for calling [Builder.workspaceId] with `workspaceId.orElse(null)`. */ + fun workspaceId(workspaceId: Optional) = workspaceId(workspaceId.getOrNull()) + + /** Only include items belonging to at least one enabled framework. */ + fun enabledFrameworkOnly(enabledFrameworkOnly: Boolean?) = apply { + this.enabledFrameworkOnly = enabledFrameworkOnly + } + + /** + * Alias for [Builder.enabledFrameworkOnly]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun enabledFrameworkOnly(enabledFrameworkOnly: Boolean) = + enabledFrameworkOnly(enabledFrameworkOnly as Boolean?) + + /** + * Alias for calling [Builder.enabledFrameworkOnly] with + * `enabledFrameworkOnly.orElse(null)`. + */ + fun enabledFrameworkOnly(enabledFrameworkOnly: Optional) = + enabledFrameworkOnly(enabledFrameworkOnly.getOrNull()) + + /** Only include items belonging to this framework. */ + fun frameworkId(frameworkId: String?) = apply { this.frameworkId = frameworkId } + + /** Alias for calling [Builder.frameworkId] with `frameworkId.orElse(null)`. */ + fun frameworkId(frameworkId: Optional) = frameworkId(frameworkId.getOrNull()) + + /** Whether to include rules that are not part of any framework. */ + fun includeUnframed(includeUnframed: Boolean?) = apply { + this.includeUnframed = includeUnframed + } + + /** + * Alias for [Builder.includeUnframed]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun includeUnframed(includeUnframed: Boolean) = includeUnframed(includeUnframed as Boolean?) + + /** Alias for calling [Builder.includeUnframed] with `includeUnframed.orElse(null)`. */ + fun includeUnframed(includeUnframed: Optional) = + includeUnframed(includeUnframed.getOrNull()) + + /** The page to return in a paginated query. */ + fun page(page: Long?) = apply { this.page = page } + + /** + * Alias for [Builder.page]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun page(page: Long) = page(page as Long?) + + /** Alias for calling [Builder.page] with `page.orElse(null)`. */ + fun page(page: Optional) = page(page.getOrNull()) + + /** Maximum number of items to return per page. */ + fun perPage(perPage: Long?) = apply { this.perPage = perPage } + + /** + * Alias for [Builder.perPage]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun perPage(perPage: Long) = perPage(perPage as Long?) + + /** Alias for calling [Builder.perPage] with `perPage.orElse(null)`. */ + fun perPage(perPage: Optional) = perPage(perPage.getOrNull()) + + /** Only include items that apply to this project. */ + fun projectId(projectId: String?) = apply { this.projectId = projectId } + + /** Alias for calling [Builder.projectId] with `projectId.orElse(null)`. */ + fun projectId(projectId: Optional) = projectId(projectId.getOrNull()) + + /** Only include results of this rule. */ + fun ruleId(ruleId: String?) = apply { this.ruleId = ruleId } + + /** Alias for calling [Builder.ruleId] with `ruleId.orElse(null)`. */ + fun ruleId(ruleId: Optional) = ruleId(ruleId.getOrNull()) + + /** Only include rules with this scope. */ + fun scope(scope: Scope?) = apply { this.scope = scope } + + /** Alias for calling [Builder.scope] with `scope.orElse(null)`. */ + fun scope(scope: Optional) = scope(scope.getOrNull()) + + /** Filter by a free-text search over names and descriptions. */ + fun searchQuery(searchQuery: String?) = apply { this.searchQuery = searchQuery } + + /** Alias for calling [Builder.searchQuery] with `searchQuery.orElse(null)`. */ + fun searchQuery(searchQuery: Optional) = searchQuery(searchQuery.getOrNull()) + + /** Only include items whose rule result has this compliance status. */ + fun status(status: Status?) = apply { this.status = status } + + /** Alias for calling [Builder.status] with `status.orElse(null)`. */ + fun status(status: Optional) = status(status.getOrNull()) + + /** Only include rules of this type. */ + fun type(type: Type?) = apply { this.type = type } + + /** Alias for calling [Builder.type] with `type.orElse(null)`. */ + fun type(type: Optional) = type(type.getOrNull()) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [RuleResultListParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): RuleResultListParams = + RuleResultListParams( + workspaceId, + enabledFrameworkOnly, + frameworkId, + includeUnframed, + page, + perPage, + projectId, + ruleId, + scope, + searchQuery, + status, + type, + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _pathParam(index: Int): String = + when (index) { + 0 -> workspaceId ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + enabledFrameworkOnly?.let { put("enabledFrameworkOnly", it.toString()) } + frameworkId?.let { put("frameworkId", it) } + includeUnframed?.let { put("includeUnframed", it.toString()) } + page?.let { put("page", it.toString()) } + perPage?.let { put("perPage", it.toString()) } + projectId?.let { put("projectId", it) } + ruleId?.let { put("ruleId", it) } + scope?.let { put("scope", it.toString()) } + searchQuery?.let { put("searchQuery", it) } + status?.let { put("status", it.toString()) } + type?.let { put("type", it.toString()) } + putAll(additionalQueryParams) + } + .build() + + /** Only include rules with this scope. */ + class Scope @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val PROJECT = of("project") + + @JvmField val WORKSPACE = of("workspace") + + @JvmStatic fun of(value: String) = Scope(JsonField.of(value)) + } + + /** An enum containing [Scope]'s known values. */ + enum class Known { + PROJECT, + WORKSPACE, + } + + /** + * An enum containing [Scope]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Scope] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + PROJECT, + WORKSPACE, + /** An enum member indicating that [Scope] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + PROJECT -> Value.PROJECT + WORKSPACE -> Value.WORKSPACE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + PROJECT -> Known.PROJECT + WORKSPACE -> Known.WORKSPACE + else -> throw OpenlayerInvalidDataException("Unknown Scope: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Scope = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Scope && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Only include items whose rule result has this compliance status. */ + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val RUNNING = of("running") + + @JvmField val PASSING = of("passing") + + @JvmField val FAILING = of("failing") + + @JvmField val SKIPPED = of("skipped") + + @JvmField val ERROR = of("error") + + @JvmField val PENDING = of("pending") + + @JvmField val DUE_SOON = of("due_soon") + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + /** An enum containing [Status]'s known values. */ + enum class Known { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + } + + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + /** An enum member indicating that [Status] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + PENDING -> Value.PENDING + DUE_SOON -> Value.DUE_SOON + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + PENDING -> Known.PENDING + DUE_SOON -> Known.DUE_SOON + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Only include rules of this type. */ + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val PLATFORM = of("platform") + + @JvmField val EVIDENCE = of("evidence") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + PLATFORM, + EVIDENCE, + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + PLATFORM, + EVIDENCE, + /** An enum member indicating that [Type] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + PLATFORM -> Value.PLATFORM + EVIDENCE -> Value.EVIDENCE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + PLATFORM -> Known.PLATFORM + EVIDENCE -> Known.EVIDENCE + else -> throw OpenlayerInvalidDataException("Unknown Type: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is RuleResultListParams && + workspaceId == other.workspaceId && + enabledFrameworkOnly == other.enabledFrameworkOnly && + frameworkId == other.frameworkId && + includeUnframed == other.includeUnframed && + page == other.page && + perPage == other.perPage && + projectId == other.projectId && + ruleId == other.ruleId && + scope == other.scope && + searchQuery == other.searchQuery && + status == other.status && + type == other.type && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = + Objects.hash( + workspaceId, + enabledFrameworkOnly, + frameworkId, + includeUnframed, + page, + perPage, + projectId, + ruleId, + scope, + searchQuery, + status, + type, + additionalHeaders, + additionalQueryParams, + ) + + override fun toString() = + "RuleResultListParams{workspaceId=$workspaceId, enabledFrameworkOnly=$enabledFrameworkOnly, frameworkId=$frameworkId, includeUnframed=$includeUnframed, page=$page, perPage=$perPage, projectId=$projectId, ruleId=$ruleId, scope=$scope, searchQuery=$searchQuery, status=$status, type=$type, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultListResponse.kt new file mode 100644 index 00000000..c0941b8a --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultListResponse.kt @@ -0,0 +1,2027 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.ruleresults + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.openlayer.api.core.Enum +import com.openlayer.api.core.ExcludeMissing +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonMissing +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.checkKnown +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.toImmutable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.time.OffsetDateTime +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class RuleResultListResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val items: JsonField>, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("items") @ExcludeMissing items: JsonField> = JsonMissing.of() + ) : this(items, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun items(): List = items.getRequired("items") + + /** + * Returns the raw JSON value of [items]. + * + * Unlike [items], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("items") @ExcludeMissing fun _items(): JsonField> = items + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [RuleResultListResponse]. + * + * The following fields are required: + * ```java + * .items() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [RuleResultListResponse]. */ + class Builder internal constructor() { + + private var items: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(ruleResultListResponse: RuleResultListResponse) = apply { + items = ruleResultListResponse.items.map { it.toMutableList() } + additionalProperties = ruleResultListResponse.additionalProperties.toMutableMap() + } + + fun items(items: List) = items(JsonField.of(items)) + + /** + * Sets [Builder.items] to an arbitrary JSON value. + * + * You should usually call [Builder.items] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun items(items: JsonField>) = apply { + this.items = items.map { it.toMutableList() } + } + + /** + * Adds a single [Item] to [items]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addItem(item: Item) = apply { + items = + (items ?: JsonField.of(mutableListOf())).also { checkKnown("items", it).add(item) } + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [RuleResultListResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .items() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): RuleResultListResponse = + RuleResultListResponse( + checkRequired("items", items).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): RuleResultListResponse = apply { + if (validated) { + return@apply + } + + items().forEach { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (items.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + class Item + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val deactivated: JsonField, + private val ruleId: JsonField, + private val status: JsonField, + private val workspaceId: JsonField, + private val assigneeId: JsonField, + private val blockedBy: JsonField>, + private val blocking: JsonField>, + private val dateLastEvaluated: JsonField, + private val dateOfLatestEvidence: JsonField, + private val dateOfNextEvaluation: JsonField, + private val dateOfRenewal: JsonField, + private val deactivatedReason: JsonField, + private val projectId: JsonField, + private val statusMessage: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("deactivated") + @ExcludeMissing + deactivated: JsonField = JsonMissing.of(), + @JsonProperty("ruleId") @ExcludeMissing ruleId: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + @JsonProperty("assigneeId") + @ExcludeMissing + assigneeId: JsonField = JsonMissing.of(), + @JsonProperty("blockedBy") + @ExcludeMissing + blockedBy: JsonField> = JsonMissing.of(), + @JsonProperty("blocking") + @ExcludeMissing + blocking: JsonField> = JsonMissing.of(), + @JsonProperty("dateLastEvaluated") + @ExcludeMissing + dateLastEvaluated: JsonField = JsonMissing.of(), + @JsonProperty("dateOfLatestEvidence") + @ExcludeMissing + dateOfLatestEvidence: JsonField = JsonMissing.of(), + @JsonProperty("dateOfNextEvaluation") + @ExcludeMissing + dateOfNextEvaluation: JsonField = JsonMissing.of(), + @JsonProperty("dateOfRenewal") + @ExcludeMissing + dateOfRenewal: JsonField = JsonMissing.of(), + @JsonProperty("deactivatedReason") + @ExcludeMissing + deactivatedReason: JsonField = JsonMissing.of(), + @JsonProperty("projectId") + @ExcludeMissing + projectId: JsonField = JsonMissing.of(), + @JsonProperty("statusMessage") + @ExcludeMissing + statusMessage: JsonField = JsonMissing.of(), + ) : this( + id, + dateCreated, + dateUpdated, + deactivated, + ruleId, + status, + workspaceId, + assigneeId, + blockedBy, + blocking, + dateLastEvaluated, + dateOfLatestEvidence, + dateOfNextEvaluation, + dateOfRenewal, + deactivatedReason, + projectId, + statusMessage, + mutableMapOf(), + ) + + /** + * The rule result id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun id(): String = id.getRequired("id") + + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** + * The last update date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** + * Whether this result is excluded from compliance calculations. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun deactivated(): Boolean = deactivated.getRequired("deactivated") + + /** + * The rule this result belongs to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun ruleId(): String = ruleId.getRequired("ruleId") + + /** + * The compliance status of the rule for this entity. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun status(): Status = status.getRequired("status") + + /** + * The id of the workspace the rule result belongs to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun workspaceId(): String = workspaceId.getRequired("workspaceId") + + /** + * The user responsible for this result. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun assigneeId(): Optional = assigneeId.getOptional("assigneeId") + + /** + * Rule results that must pass before this one can be satisfied. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun blockedBy(): Optional> = blockedBy.getOptional("blockedBy") + + /** + * Rule results that this one blocks. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun blocking(): Optional> = blocking.getOptional("blocking") + + /** + * When the rule was last evaluated. Platform rules only. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun dateLastEvaluated(): Optional = + dateLastEvaluated.getOptional("dateLastEvaluated") + + /** + * When the most recent piece of evidence was attached. Evidence rules only. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun dateOfLatestEvidence(): Optional = + dateOfLatestEvidence.getOptional("dateOfLatestEvidence") + + /** + * When the rule will next be evaluated. Platform rules only. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun dateOfNextEvaluation(): Optional = + dateOfNextEvaluation.getOptional("dateOfNextEvaluation") + + /** + * When the evidence must be renewed. Evidence rules with a renewal cadence only. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun dateOfRenewal(): Optional = dateOfRenewal.getOptional("dateOfRenewal") + + /** + * Why the result was excluded. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun deactivatedReason(): Optional = + deactivatedReason.getOptional("deactivatedReason") + + /** + * The project this result was evaluated for. `null` for workspace-scoped rules. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun projectId(): Optional = projectId.getOptional("projectId") + + /** + * A human-readable explanation of the status. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun statusMessage(): Optional = statusMessage.getOptional("statusMessage") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** + * Returns the raw JSON value of [deactivated]. + * + * Unlike [deactivated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("deactivated") + @ExcludeMissing + fun _deactivated(): JsonField = deactivated + + /** + * Returns the raw JSON value of [ruleId]. + * + * Unlike [ruleId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("ruleId") @ExcludeMissing fun _ruleId(): JsonField = ruleId + + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + + /** + * Returns the raw JSON value of [workspaceId]. + * + * Unlike [workspaceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("workspaceId") + @ExcludeMissing + fun _workspaceId(): JsonField = workspaceId + + /** + * Returns the raw JSON value of [assigneeId]. + * + * Unlike [assigneeId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("assigneeId") + @ExcludeMissing + fun _assigneeId(): JsonField = assigneeId + + /** + * Returns the raw JSON value of [blockedBy]. + * + * Unlike [blockedBy], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("blockedBy") + @ExcludeMissing + fun _blockedBy(): JsonField> = blockedBy + + /** + * Returns the raw JSON value of [blocking]. + * + * Unlike [blocking], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("blocking") + @ExcludeMissing + fun _blocking(): JsonField> = blocking + + /** + * Returns the raw JSON value of [dateLastEvaluated]. + * + * Unlike [dateLastEvaluated], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("dateLastEvaluated") + @ExcludeMissing + fun _dateLastEvaluated(): JsonField = dateLastEvaluated + + /** + * Returns the raw JSON value of [dateOfLatestEvidence]. + * + * Unlike [dateOfLatestEvidence], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("dateOfLatestEvidence") + @ExcludeMissing + fun _dateOfLatestEvidence(): JsonField = dateOfLatestEvidence + + /** + * Returns the raw JSON value of [dateOfNextEvaluation]. + * + * Unlike [dateOfNextEvaluation], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("dateOfNextEvaluation") + @ExcludeMissing + fun _dateOfNextEvaluation(): JsonField = dateOfNextEvaluation + + /** + * Returns the raw JSON value of [dateOfRenewal]. + * + * Unlike [dateOfRenewal], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("dateOfRenewal") + @ExcludeMissing + fun _dateOfRenewal(): JsonField = dateOfRenewal + + /** + * Returns the raw JSON value of [deactivatedReason]. + * + * Unlike [deactivatedReason], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("deactivatedReason") + @ExcludeMissing + fun _deactivatedReason(): JsonField = deactivatedReason + + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("projectId") @ExcludeMissing fun _projectId(): JsonField = projectId + + /** + * Returns the raw JSON value of [statusMessage]. + * + * Unlike [statusMessage], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("statusMessage") + @ExcludeMissing + fun _statusMessage(): JsonField = statusMessage + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Item]. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateUpdated() + * .deactivated() + * .ruleId() + * .status() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Item]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var deactivated: JsonField? = null + private var ruleId: JsonField? = null + private var status: JsonField? = null + private var workspaceId: JsonField? = null + private var assigneeId: JsonField = JsonMissing.of() + private var blockedBy: JsonField>? = null + private var blocking: JsonField>? = null + private var dateLastEvaluated: JsonField = JsonMissing.of() + private var dateOfLatestEvidence: JsonField = JsonMissing.of() + private var dateOfNextEvaluation: JsonField = JsonMissing.of() + private var dateOfRenewal: JsonField = JsonMissing.of() + private var deactivatedReason: JsonField = JsonMissing.of() + private var projectId: JsonField = JsonMissing.of() + private var statusMessage: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(item: Item) = apply { + id = item.id + dateCreated = item.dateCreated + dateUpdated = item.dateUpdated + deactivated = item.deactivated + ruleId = item.ruleId + status = item.status + workspaceId = item.workspaceId + assigneeId = item.assigneeId + blockedBy = item.blockedBy.map { it.toMutableList() } + blocking = item.blocking.map { it.toMutableList() } + dateLastEvaluated = item.dateLastEvaluated + dateOfLatestEvidence = item.dateOfLatestEvidence + dateOfNextEvaluation = item.dateOfNextEvaluation + dateOfRenewal = item.dateOfRenewal + deactivatedReason = item.deactivatedReason + projectId = item.projectId + statusMessage = item.statusMessage + additionalProperties = item.additionalProperties.toMutableMap() + } + + /** The rule result id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The last update date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** Whether this result is excluded from compliance calculations. */ + fun deactivated(deactivated: Boolean) = deactivated(JsonField.of(deactivated)) + + /** + * Sets [Builder.deactivated] to an arbitrary JSON value. + * + * You should usually call [Builder.deactivated] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun deactivated(deactivated: JsonField) = apply { + this.deactivated = deactivated + } + + /** The rule this result belongs to. */ + fun ruleId(ruleId: String) = ruleId(JsonField.of(ruleId)) + + /** + * Sets [Builder.ruleId] to an arbitrary JSON value. + * + * You should usually call [Builder.ruleId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun ruleId(ruleId: JsonField) = apply { this.ruleId = ruleId } + + /** The compliance status of the rule for this entity. */ + fun status(status: Status) = status(JsonField.of(status)) + + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun status(status: JsonField) = apply { this.status = status } + + /** The id of the workspace the rule result belongs to. */ + fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) + + /** + * Sets [Builder.workspaceId] to an arbitrary JSON value. + * + * You should usually call [Builder.workspaceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun workspaceId(workspaceId: JsonField) = apply { + this.workspaceId = workspaceId + } + + /** The user responsible for this result. */ + fun assigneeId(assigneeId: String?) = assigneeId(JsonField.ofNullable(assigneeId)) + + /** Alias for calling [Builder.assigneeId] with `assigneeId.orElse(null)`. */ + fun assigneeId(assigneeId: Optional) = assigneeId(assigneeId.getOrNull()) + + /** + * Sets [Builder.assigneeId] to an arbitrary JSON value. + * + * You should usually call [Builder.assigneeId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun assigneeId(assigneeId: JsonField) = apply { this.assigneeId = assigneeId } + + /** Rule results that must pass before this one can be satisfied. */ + fun blockedBy(blockedBy: List) = blockedBy(JsonField.of(blockedBy)) + + /** + * Sets [Builder.blockedBy] to an arbitrary JSON value. + * + * You should usually call [Builder.blockedBy] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun blockedBy(blockedBy: JsonField>) = apply { + this.blockedBy = blockedBy.map { it.toMutableList() } + } + + /** + * Adds a single [BlockedBy] to [Builder.blockedBy]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addBlockedBy(blockedBy: BlockedBy) = apply { + this.blockedBy = + (this.blockedBy ?: JsonField.of(mutableListOf())).also { + checkKnown("blockedBy", it).add(blockedBy) + } + } + + /** Rule results that this one blocks. */ + fun blocking(blocking: List) = blocking(JsonField.of(blocking)) + + /** + * Sets [Builder.blocking] to an arbitrary JSON value. + * + * You should usually call [Builder.blocking] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun blocking(blocking: JsonField>) = apply { + this.blocking = blocking.map { it.toMutableList() } + } + + /** + * Adds a single [Blocking] to [Builder.blocking]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addBlocking(blocking: Blocking) = apply { + this.blocking = + (this.blocking ?: JsonField.of(mutableListOf())).also { + checkKnown("blocking", it).add(blocking) + } + } + + /** When the rule was last evaluated. Platform rules only. */ + fun dateLastEvaluated(dateLastEvaluated: OffsetDateTime?) = + dateLastEvaluated(JsonField.ofNullable(dateLastEvaluated)) + + /** + * Alias for calling [Builder.dateLastEvaluated] with `dateLastEvaluated.orElse(null)`. + */ + fun dateLastEvaluated(dateLastEvaluated: Optional) = + dateLastEvaluated(dateLastEvaluated.getOrNull()) + + /** + * Sets [Builder.dateLastEvaluated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateLastEvaluated] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun dateLastEvaluated(dateLastEvaluated: JsonField) = apply { + this.dateLastEvaluated = dateLastEvaluated + } + + /** When the most recent piece of evidence was attached. Evidence rules only. */ + fun dateOfLatestEvidence(dateOfLatestEvidence: OffsetDateTime?) = + dateOfLatestEvidence(JsonField.ofNullable(dateOfLatestEvidence)) + + /** + * Alias for calling [Builder.dateOfLatestEvidence] with + * `dateOfLatestEvidence.orElse(null)`. + */ + fun dateOfLatestEvidence(dateOfLatestEvidence: Optional) = + dateOfLatestEvidence(dateOfLatestEvidence.getOrNull()) + + /** + * Sets [Builder.dateOfLatestEvidence] to an arbitrary JSON value. + * + * You should usually call [Builder.dateOfLatestEvidence] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun dateOfLatestEvidence(dateOfLatestEvidence: JsonField) = apply { + this.dateOfLatestEvidence = dateOfLatestEvidence + } + + /** When the rule will next be evaluated. Platform rules only. */ + fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime?) = + dateOfNextEvaluation(JsonField.ofNullable(dateOfNextEvaluation)) + + /** + * Alias for calling [Builder.dateOfNextEvaluation] with + * `dateOfNextEvaluation.orElse(null)`. + */ + fun dateOfNextEvaluation(dateOfNextEvaluation: Optional) = + dateOfNextEvaluation(dateOfNextEvaluation.getOrNull()) + + /** + * Sets [Builder.dateOfNextEvaluation] to an arbitrary JSON value. + * + * You should usually call [Builder.dateOfNextEvaluation] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun dateOfNextEvaluation(dateOfNextEvaluation: JsonField) = apply { + this.dateOfNextEvaluation = dateOfNextEvaluation + } + + /** When the evidence must be renewed. Evidence rules with a renewal cadence only. */ + fun dateOfRenewal(dateOfRenewal: OffsetDateTime?) = + dateOfRenewal(JsonField.ofNullable(dateOfRenewal)) + + /** Alias for calling [Builder.dateOfRenewal] with `dateOfRenewal.orElse(null)`. */ + fun dateOfRenewal(dateOfRenewal: Optional) = + dateOfRenewal(dateOfRenewal.getOrNull()) + + /** + * Sets [Builder.dateOfRenewal] to an arbitrary JSON value. + * + * You should usually call [Builder.dateOfRenewal] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun dateOfRenewal(dateOfRenewal: JsonField) = apply { + this.dateOfRenewal = dateOfRenewal + } + + /** Why the result was excluded. */ + fun deactivatedReason(deactivatedReason: String?) = + deactivatedReason(JsonField.ofNullable(deactivatedReason)) + + /** + * Alias for calling [Builder.deactivatedReason] with `deactivatedReason.orElse(null)`. + */ + fun deactivatedReason(deactivatedReason: Optional) = + deactivatedReason(deactivatedReason.getOrNull()) + + /** + * Sets [Builder.deactivatedReason] to an arbitrary JSON value. + * + * You should usually call [Builder.deactivatedReason] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun deactivatedReason(deactivatedReason: JsonField) = apply { + this.deactivatedReason = deactivatedReason + } + + /** The project this result was evaluated for. `null` for workspace-scoped rules. */ + fun projectId(projectId: String?) = projectId(JsonField.ofNullable(projectId)) + + /** Alias for calling [Builder.projectId] with `projectId.orElse(null)`. */ + fun projectId(projectId: Optional) = projectId(projectId.getOrNull()) + + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun projectId(projectId: JsonField) = apply { this.projectId = projectId } + + /** A human-readable explanation of the status. */ + fun statusMessage(statusMessage: String?) = + statusMessage(JsonField.ofNullable(statusMessage)) + + /** Alias for calling [Builder.statusMessage] with `statusMessage.orElse(null)`. */ + fun statusMessage(statusMessage: Optional) = + statusMessage(statusMessage.getOrNull()) + + /** + * Sets [Builder.statusMessage] to an arbitrary JSON value. + * + * You should usually call [Builder.statusMessage] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun statusMessage(statusMessage: JsonField) = apply { + this.statusMessage = statusMessage + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Item]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateUpdated() + * .deactivated() + * .ruleId() + * .status() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Item = + Item( + checkRequired("id", id), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("deactivated", deactivated), + checkRequired("ruleId", ruleId), + checkRequired("status", status), + checkRequired("workspaceId", workspaceId), + assigneeId, + (blockedBy ?: JsonMissing.of()).map { it.toImmutable() }, + (blocking ?: JsonMissing.of()).map { it.toImmutable() }, + dateLastEvaluated, + dateOfLatestEvidence, + dateOfNextEvaluation, + dateOfRenewal, + deactivatedReason, + projectId, + statusMessage, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Item = apply { + if (validated) { + return@apply + } + + id() + dateCreated() + dateUpdated() + deactivated() + ruleId() + status().validate() + workspaceId() + assigneeId() + blockedBy().ifPresent { it.forEach { it.validate() } } + blocking().ifPresent { it.forEach { it.validate() } } + dateLastEvaluated() + dateOfLatestEvidence() + dateOfNextEvaluation() + dateOfRenewal() + deactivatedReason() + projectId() + statusMessage() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (deactivated.asKnown().isPresent) 1 else 0) + + (if (ruleId.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + (if (assigneeId.asKnown().isPresent) 1 else 0) + + (blockedBy.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (blocking.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (dateLastEvaluated.asKnown().isPresent) 1 else 0) + + (if (dateOfLatestEvidence.asKnown().isPresent) 1 else 0) + + (if (dateOfNextEvaluation.asKnown().isPresent) 1 else 0) + + (if (dateOfRenewal.asKnown().isPresent) 1 else 0) + + (if (deactivatedReason.asKnown().isPresent) 1 else 0) + + (if (projectId.asKnown().isPresent) 1 else 0) + + (if (statusMessage.asKnown().isPresent) 1 else 0) + + /** The compliance status of the rule for this entity. */ + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val RUNNING = of("running") + + @JvmField val PASSING = of("passing") + + @JvmField val FAILING = of("failing") + + @JvmField val SKIPPED = of("skipped") + + @JvmField val ERROR = of("error") + + @JvmField val PENDING = of("pending") + + @JvmField val DUE_SOON = of("due_soon") + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + /** An enum containing [Status]'s known values. */ + enum class Known { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + } + + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + /** + * An enum member indicating that [Status] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + PENDING -> Value.PENDING + DUE_SOON -> Value.DUE_SOON + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + PENDING -> Known.PENDING + DUE_SOON -> Known.DUE_SOON + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + class BlockedBy + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val status: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + ) : this(id, status, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun id(): Optional = id.getOptional("id") + + /** + * The compliance status of the rule for this entity. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun status(): Optional = status.getOptional("status") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [BlockedBy]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BlockedBy]. */ + class Builder internal constructor() { + + private var id: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(blockedBy: BlockedBy) = apply { + id = blockedBy.id + status = blockedBy.status + additionalProperties = blockedBy.additionalProperties.toMutableMap() + } + + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The compliance status of the rule for this entity. */ + fun status(status: Status) = status(JsonField.of(status)) + + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun status(status: JsonField) = apply { this.status = status } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [BlockedBy]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): BlockedBy = BlockedBy(id, status, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): BlockedBy = apply { + if (validated) { + return@apply + } + + id() + status().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + /** The compliance status of the rule for this entity. */ + class Status @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val RUNNING = of("running") + + @JvmField val PASSING = of("passing") + + @JvmField val FAILING = of("failing") + + @JvmField val SKIPPED = of("skipped") + + @JvmField val ERROR = of("error") + + @JvmField val PENDING = of("pending") + + @JvmField val DUE_SOON = of("due_soon") + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + /** An enum containing [Status]'s known values. */ + enum class Known { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + } + + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + /** + * An enum member indicating that [Status] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + PENDING -> Value.PENDING + DUE_SOON -> Value.DUE_SOON + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + PENDING -> Known.PENDING + DUE_SOON -> Known.DUE_SOON + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is BlockedBy && + id == other.id && + status == other.status && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(id, status, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BlockedBy{id=$id, status=$status, additionalProperties=$additionalProperties}" + } + + class Blocking + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val status: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + ) : this(id, status, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun id(): Optional = id.getOptional("id") + + /** + * The compliance status of the rule for this entity. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun status(): Optional = status.getOptional("status") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Blocking]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Blocking]. */ + class Builder internal constructor() { + + private var id: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(blocking: Blocking) = apply { + id = blocking.id + status = blocking.status + additionalProperties = blocking.additionalProperties.toMutableMap() + } + + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The compliance status of the rule for this entity. */ + fun status(status: Status) = status(JsonField.of(status)) + + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun status(status: JsonField) = apply { this.status = status } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Blocking]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Blocking = Blocking(id, status, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Blocking = apply { + if (validated) { + return@apply + } + + id() + status().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + /** The compliance status of the rule for this entity. */ + class Status @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val RUNNING = of("running") + + @JvmField val PASSING = of("passing") + + @JvmField val FAILING = of("failing") + + @JvmField val SKIPPED = of("skipped") + + @JvmField val ERROR = of("error") + + @JvmField val PENDING = of("pending") + + @JvmField val DUE_SOON = of("due_soon") + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + /** An enum containing [Status]'s known values. */ + enum class Known { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + } + + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + /** + * An enum member indicating that [Status] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + PENDING -> Value.PENDING + DUE_SOON -> Value.DUE_SOON + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + PENDING -> Known.PENDING + DUE_SOON -> Known.DUE_SOON + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Blocking && + id == other.id && + status == other.status && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(id, status, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Blocking{id=$id, status=$status, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Item && + id == other.id && + dateCreated == other.dateCreated && + dateUpdated == other.dateUpdated && + deactivated == other.deactivated && + ruleId == other.ruleId && + status == other.status && + workspaceId == other.workspaceId && + assigneeId == other.assigneeId && + blockedBy == other.blockedBy && + blocking == other.blocking && + dateLastEvaluated == other.dateLastEvaluated && + dateOfLatestEvidence == other.dateOfLatestEvidence && + dateOfNextEvaluation == other.dateOfNextEvaluation && + dateOfRenewal == other.dateOfRenewal && + deactivatedReason == other.deactivatedReason && + projectId == other.projectId && + statusMessage == other.statusMessage && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + dateCreated, + dateUpdated, + deactivated, + ruleId, + status, + workspaceId, + assigneeId, + blockedBy, + blocking, + dateLastEvaluated, + dateOfLatestEvidence, + dateOfNextEvaluation, + dateOfRenewal, + deactivatedReason, + projectId, + statusMessage, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Item{id=$id, dateCreated=$dateCreated, dateUpdated=$dateUpdated, deactivated=$deactivated, ruleId=$ruleId, status=$status, workspaceId=$workspaceId, assigneeId=$assigneeId, blockedBy=$blockedBy, blocking=$blocking, dateLastEvaluated=$dateLastEvaluated, dateOfLatestEvidence=$dateOfLatestEvidence, dateOfNextEvaluation=$dateOfNextEvaluation, dateOfRenewal=$dateOfRenewal, deactivatedReason=$deactivatedReason, projectId=$projectId, statusMessage=$statusMessage, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is RuleResultListResponse && + items == other.items && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(items, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "RuleResultListResponse{items=$items, additionalProperties=$additionalProperties}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultRetrieveParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultRetrieveParams.kt new file mode 100644 index 00000000..dccd0ae3 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultRetrieveParams.kt @@ -0,0 +1,200 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.ruleresults + +import com.openlayer.api.core.Params +import com.openlayer.api.core.http.Headers +import com.openlayer.api.core.http.QueryParams +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * Retrieve a rule result by its id. + * + * Alongside the status, the response carries the evaluation and renewal dates that explain it: + * `dateLastEvaluated` and `dateOfNextEvaluation` for platform rules, `dateOfLatestEvidence` and + * `dateOfRenewal` for evidence rules. + */ +class RuleResultRetrieveParams +private constructor( + private val ruleResultId: String?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun ruleResultId(): Optional = Optional.ofNullable(ruleResultId) + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): RuleResultRetrieveParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [RuleResultRetrieveParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [RuleResultRetrieveParams]. */ + class Builder internal constructor() { + + private var ruleResultId: String? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(ruleResultRetrieveParams: RuleResultRetrieveParams) = apply { + ruleResultId = ruleResultRetrieveParams.ruleResultId + additionalHeaders = ruleResultRetrieveParams.additionalHeaders.toBuilder() + additionalQueryParams = ruleResultRetrieveParams.additionalQueryParams.toBuilder() + } + + fun ruleResultId(ruleResultId: String?) = apply { this.ruleResultId = ruleResultId } + + /** Alias for calling [Builder.ruleResultId] with `ruleResultId.orElse(null)`. */ + fun ruleResultId(ruleResultId: Optional) = ruleResultId(ruleResultId.getOrNull()) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [RuleResultRetrieveParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): RuleResultRetrieveParams = + RuleResultRetrieveParams( + ruleResultId, + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _pathParam(index: Int): String = + when (index) { + 0 -> ruleResultId ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is RuleResultRetrieveParams && + ruleResultId == other.ruleResultId && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = + Objects.hash(ruleResultId, additionalHeaders, additionalQueryParams) + + override fun toString() = + "RuleResultRetrieveParams{ruleResultId=$ruleResultId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultRetrieveResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultRetrieveResponse.kt new file mode 100644 index 00000000..39250d95 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultRetrieveResponse.kt @@ -0,0 +1,1809 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.ruleresults + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.openlayer.api.core.Enum +import com.openlayer.api.core.ExcludeMissing +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonMissing +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.checkKnown +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.toImmutable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.time.OffsetDateTime +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class RuleResultRetrieveResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val id: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val deactivated: JsonField, + private val ruleId: JsonField, + private val status: JsonField, + private val workspaceId: JsonField, + private val assigneeId: JsonField, + private val blockedBy: JsonField>, + private val blocking: JsonField>, + private val dateLastEvaluated: JsonField, + private val dateOfLatestEvidence: JsonField, + private val dateOfNextEvaluation: JsonField, + private val dateOfRenewal: JsonField, + private val deactivatedReason: JsonField, + private val projectId: JsonField, + private val statusMessage: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("deactivated") + @ExcludeMissing + deactivated: JsonField = JsonMissing.of(), + @JsonProperty("ruleId") @ExcludeMissing ruleId: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + @JsonProperty("assigneeId") + @ExcludeMissing + assigneeId: JsonField = JsonMissing.of(), + @JsonProperty("blockedBy") + @ExcludeMissing + blockedBy: JsonField> = JsonMissing.of(), + @JsonProperty("blocking") + @ExcludeMissing + blocking: JsonField> = JsonMissing.of(), + @JsonProperty("dateLastEvaluated") + @ExcludeMissing + dateLastEvaluated: JsonField = JsonMissing.of(), + @JsonProperty("dateOfLatestEvidence") + @ExcludeMissing + dateOfLatestEvidence: JsonField = JsonMissing.of(), + @JsonProperty("dateOfNextEvaluation") + @ExcludeMissing + dateOfNextEvaluation: JsonField = JsonMissing.of(), + @JsonProperty("dateOfRenewal") + @ExcludeMissing + dateOfRenewal: JsonField = JsonMissing.of(), + @JsonProperty("deactivatedReason") + @ExcludeMissing + deactivatedReason: JsonField = JsonMissing.of(), + @JsonProperty("projectId") @ExcludeMissing projectId: JsonField = JsonMissing.of(), + @JsonProperty("statusMessage") + @ExcludeMissing + statusMessage: JsonField = JsonMissing.of(), + ) : this( + id, + dateCreated, + dateUpdated, + deactivated, + ruleId, + status, + workspaceId, + assigneeId, + blockedBy, + blocking, + dateLastEvaluated, + dateOfLatestEvidence, + dateOfNextEvaluation, + dateOfRenewal, + deactivatedReason, + projectId, + statusMessage, + mutableMapOf(), + ) + + /** + * The rule result id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun id(): String = id.getRequired("id") + + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** + * The last update date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** + * Whether this result is excluded from compliance calculations. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun deactivated(): Boolean = deactivated.getRequired("deactivated") + + /** + * The rule this result belongs to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun ruleId(): String = ruleId.getRequired("ruleId") + + /** + * The compliance status of the rule for this entity. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun status(): Status = status.getRequired("status") + + /** + * The id of the workspace the rule result belongs to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun workspaceId(): String = workspaceId.getRequired("workspaceId") + + /** + * The user responsible for this result. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun assigneeId(): Optional = assigneeId.getOptional("assigneeId") + + /** + * Rule results that must pass before this one can be satisfied. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun blockedBy(): Optional> = blockedBy.getOptional("blockedBy") + + /** + * Rule results that this one blocks. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun blocking(): Optional> = blocking.getOptional("blocking") + + /** + * When the rule was last evaluated. Platform rules only. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun dateLastEvaluated(): Optional = + dateLastEvaluated.getOptional("dateLastEvaluated") + + /** + * When the most recent piece of evidence was attached. Evidence rules only. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun dateOfLatestEvidence(): Optional = + dateOfLatestEvidence.getOptional("dateOfLatestEvidence") + + /** + * When the rule will next be evaluated. Platform rules only. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun dateOfNextEvaluation(): Optional = + dateOfNextEvaluation.getOptional("dateOfNextEvaluation") + + /** + * When the evidence must be renewed. Evidence rules with a renewal cadence only. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun dateOfRenewal(): Optional = dateOfRenewal.getOptional("dateOfRenewal") + + /** + * Why the result was excluded. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun deactivatedReason(): Optional = deactivatedReason.getOptional("deactivatedReason") + + /** + * The project this result was evaluated for. `null` for workspace-scoped rules. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun projectId(): Optional = projectId.getOptional("projectId") + + /** + * A human-readable explanation of the status. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun statusMessage(): Optional = statusMessage.getOptional("statusMessage") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** + * Returns the raw JSON value of [deactivated]. + * + * Unlike [deactivated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("deactivated") + @ExcludeMissing + fun _deactivated(): JsonField = deactivated + + /** + * Returns the raw JSON value of [ruleId]. + * + * Unlike [ruleId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("ruleId") @ExcludeMissing fun _ruleId(): JsonField = ruleId + + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + + /** + * Returns the raw JSON value of [workspaceId]. + * + * Unlike [workspaceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("workspaceId") @ExcludeMissing fun _workspaceId(): JsonField = workspaceId + + /** + * Returns the raw JSON value of [assigneeId]. + * + * Unlike [assigneeId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("assigneeId") @ExcludeMissing fun _assigneeId(): JsonField = assigneeId + + /** + * Returns the raw JSON value of [blockedBy]. + * + * Unlike [blockedBy], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("blockedBy") + @ExcludeMissing + fun _blockedBy(): JsonField> = blockedBy + + /** + * Returns the raw JSON value of [blocking]. + * + * Unlike [blocking], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("blocking") @ExcludeMissing fun _blocking(): JsonField> = blocking + + /** + * Returns the raw JSON value of [dateLastEvaluated]. + * + * Unlike [dateLastEvaluated], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("dateLastEvaluated") + @ExcludeMissing + fun _dateLastEvaluated(): JsonField = dateLastEvaluated + + /** + * Returns the raw JSON value of [dateOfLatestEvidence]. + * + * Unlike [dateOfLatestEvidence], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("dateOfLatestEvidence") + @ExcludeMissing + fun _dateOfLatestEvidence(): JsonField = dateOfLatestEvidence + + /** + * Returns the raw JSON value of [dateOfNextEvaluation]. + * + * Unlike [dateOfNextEvaluation], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("dateOfNextEvaluation") + @ExcludeMissing + fun _dateOfNextEvaluation(): JsonField = dateOfNextEvaluation + + /** + * Returns the raw JSON value of [dateOfRenewal]. + * + * Unlike [dateOfRenewal], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateOfRenewal") + @ExcludeMissing + fun _dateOfRenewal(): JsonField = dateOfRenewal + + /** + * Returns the raw JSON value of [deactivatedReason]. + * + * Unlike [deactivatedReason], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("deactivatedReason") + @ExcludeMissing + fun _deactivatedReason(): JsonField = deactivatedReason + + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("projectId") @ExcludeMissing fun _projectId(): JsonField = projectId + + /** + * Returns the raw JSON value of [statusMessage]. + * + * Unlike [statusMessage], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("statusMessage") + @ExcludeMissing + fun _statusMessage(): JsonField = statusMessage + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [RuleResultRetrieveResponse]. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateUpdated() + * .deactivated() + * .ruleId() + * .status() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [RuleResultRetrieveResponse]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var deactivated: JsonField? = null + private var ruleId: JsonField? = null + private var status: JsonField? = null + private var workspaceId: JsonField? = null + private var assigneeId: JsonField = JsonMissing.of() + private var blockedBy: JsonField>? = null + private var blocking: JsonField>? = null + private var dateLastEvaluated: JsonField = JsonMissing.of() + private var dateOfLatestEvidence: JsonField = JsonMissing.of() + private var dateOfNextEvaluation: JsonField = JsonMissing.of() + private var dateOfRenewal: JsonField = JsonMissing.of() + private var deactivatedReason: JsonField = JsonMissing.of() + private var projectId: JsonField = JsonMissing.of() + private var statusMessage: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(ruleResultRetrieveResponse: RuleResultRetrieveResponse) = apply { + id = ruleResultRetrieveResponse.id + dateCreated = ruleResultRetrieveResponse.dateCreated + dateUpdated = ruleResultRetrieveResponse.dateUpdated + deactivated = ruleResultRetrieveResponse.deactivated + ruleId = ruleResultRetrieveResponse.ruleId + status = ruleResultRetrieveResponse.status + workspaceId = ruleResultRetrieveResponse.workspaceId + assigneeId = ruleResultRetrieveResponse.assigneeId + blockedBy = ruleResultRetrieveResponse.blockedBy.map { it.toMutableList() } + blocking = ruleResultRetrieveResponse.blocking.map { it.toMutableList() } + dateLastEvaluated = ruleResultRetrieveResponse.dateLastEvaluated + dateOfLatestEvidence = ruleResultRetrieveResponse.dateOfLatestEvidence + dateOfNextEvaluation = ruleResultRetrieveResponse.dateOfNextEvaluation + dateOfRenewal = ruleResultRetrieveResponse.dateOfRenewal + deactivatedReason = ruleResultRetrieveResponse.deactivatedReason + projectId = ruleResultRetrieveResponse.projectId + statusMessage = ruleResultRetrieveResponse.statusMessage + additionalProperties = ruleResultRetrieveResponse.additionalProperties.toMutableMap() + } + + /** The rule result id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The last update date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** Whether this result is excluded from compliance calculations. */ + fun deactivated(deactivated: Boolean) = deactivated(JsonField.of(deactivated)) + + /** + * Sets [Builder.deactivated] to an arbitrary JSON value. + * + * You should usually call [Builder.deactivated] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun deactivated(deactivated: JsonField) = apply { this.deactivated = deactivated } + + /** The rule this result belongs to. */ + fun ruleId(ruleId: String) = ruleId(JsonField.of(ruleId)) + + /** + * Sets [Builder.ruleId] to an arbitrary JSON value. + * + * You should usually call [Builder.ruleId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun ruleId(ruleId: JsonField) = apply { this.ruleId = ruleId } + + /** The compliance status of the rule for this entity. */ + fun status(status: Status) = status(JsonField.of(status)) + + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun status(status: JsonField) = apply { this.status = status } + + /** The id of the workspace the rule result belongs to. */ + fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) + + /** + * Sets [Builder.workspaceId] to an arbitrary JSON value. + * + * You should usually call [Builder.workspaceId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun workspaceId(workspaceId: JsonField) = apply { this.workspaceId = workspaceId } + + /** The user responsible for this result. */ + fun assigneeId(assigneeId: String?) = assigneeId(JsonField.ofNullable(assigneeId)) + + /** Alias for calling [Builder.assigneeId] with `assigneeId.orElse(null)`. */ + fun assigneeId(assigneeId: Optional) = assigneeId(assigneeId.getOrNull()) + + /** + * Sets [Builder.assigneeId] to an arbitrary JSON value. + * + * You should usually call [Builder.assigneeId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun assigneeId(assigneeId: JsonField) = apply { this.assigneeId = assigneeId } + + /** Rule results that must pass before this one can be satisfied. */ + fun blockedBy(blockedBy: List) = blockedBy(JsonField.of(blockedBy)) + + /** + * Sets [Builder.blockedBy] to an arbitrary JSON value. + * + * You should usually call [Builder.blockedBy] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun blockedBy(blockedBy: JsonField>) = apply { + this.blockedBy = blockedBy.map { it.toMutableList() } + } + + /** + * Adds a single [BlockedBy] to [Builder.blockedBy]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addBlockedBy(blockedBy: BlockedBy) = apply { + this.blockedBy = + (this.blockedBy ?: JsonField.of(mutableListOf())).also { + checkKnown("blockedBy", it).add(blockedBy) + } + } + + /** Rule results that this one blocks. */ + fun blocking(blocking: List) = blocking(JsonField.of(blocking)) + + /** + * Sets [Builder.blocking] to an arbitrary JSON value. + * + * You should usually call [Builder.blocking] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun blocking(blocking: JsonField>) = apply { + this.blocking = blocking.map { it.toMutableList() } + } + + /** + * Adds a single [Blocking] to [Builder.blocking]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addBlocking(blocking: Blocking) = apply { + this.blocking = + (this.blocking ?: JsonField.of(mutableListOf())).also { + checkKnown("blocking", it).add(blocking) + } + } + + /** When the rule was last evaluated. Platform rules only. */ + fun dateLastEvaluated(dateLastEvaluated: OffsetDateTime?) = + dateLastEvaluated(JsonField.ofNullable(dateLastEvaluated)) + + /** Alias for calling [Builder.dateLastEvaluated] with `dateLastEvaluated.orElse(null)`. */ + fun dateLastEvaluated(dateLastEvaluated: Optional) = + dateLastEvaluated(dateLastEvaluated.getOrNull()) + + /** + * Sets [Builder.dateLastEvaluated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateLastEvaluated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun dateLastEvaluated(dateLastEvaluated: JsonField) = apply { + this.dateLastEvaluated = dateLastEvaluated + } + + /** When the most recent piece of evidence was attached. Evidence rules only. */ + fun dateOfLatestEvidence(dateOfLatestEvidence: OffsetDateTime?) = + dateOfLatestEvidence(JsonField.ofNullable(dateOfLatestEvidence)) + + /** + * Alias for calling [Builder.dateOfLatestEvidence] with + * `dateOfLatestEvidence.orElse(null)`. + */ + fun dateOfLatestEvidence(dateOfLatestEvidence: Optional) = + dateOfLatestEvidence(dateOfLatestEvidence.getOrNull()) + + /** + * Sets [Builder.dateOfLatestEvidence] to an arbitrary JSON value. + * + * You should usually call [Builder.dateOfLatestEvidence] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun dateOfLatestEvidence(dateOfLatestEvidence: JsonField) = apply { + this.dateOfLatestEvidence = dateOfLatestEvidence + } + + /** When the rule will next be evaluated. Platform rules only. */ + fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime?) = + dateOfNextEvaluation(JsonField.ofNullable(dateOfNextEvaluation)) + + /** + * Alias for calling [Builder.dateOfNextEvaluation] with + * `dateOfNextEvaluation.orElse(null)`. + */ + fun dateOfNextEvaluation(dateOfNextEvaluation: Optional) = + dateOfNextEvaluation(dateOfNextEvaluation.getOrNull()) + + /** + * Sets [Builder.dateOfNextEvaluation] to an arbitrary JSON value. + * + * You should usually call [Builder.dateOfNextEvaluation] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun dateOfNextEvaluation(dateOfNextEvaluation: JsonField) = apply { + this.dateOfNextEvaluation = dateOfNextEvaluation + } + + /** When the evidence must be renewed. Evidence rules with a renewal cadence only. */ + fun dateOfRenewal(dateOfRenewal: OffsetDateTime?) = + dateOfRenewal(JsonField.ofNullable(dateOfRenewal)) + + /** Alias for calling [Builder.dateOfRenewal] with `dateOfRenewal.orElse(null)`. */ + fun dateOfRenewal(dateOfRenewal: Optional) = + dateOfRenewal(dateOfRenewal.getOrNull()) + + /** + * Sets [Builder.dateOfRenewal] to an arbitrary JSON value. + * + * You should usually call [Builder.dateOfRenewal] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun dateOfRenewal(dateOfRenewal: JsonField) = apply { + this.dateOfRenewal = dateOfRenewal + } + + /** Why the result was excluded. */ + fun deactivatedReason(deactivatedReason: String?) = + deactivatedReason(JsonField.ofNullable(deactivatedReason)) + + /** Alias for calling [Builder.deactivatedReason] with `deactivatedReason.orElse(null)`. */ + fun deactivatedReason(deactivatedReason: Optional) = + deactivatedReason(deactivatedReason.getOrNull()) + + /** + * Sets [Builder.deactivatedReason] to an arbitrary JSON value. + * + * You should usually call [Builder.deactivatedReason] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun deactivatedReason(deactivatedReason: JsonField) = apply { + this.deactivatedReason = deactivatedReason + } + + /** The project this result was evaluated for. `null` for workspace-scoped rules. */ + fun projectId(projectId: String?) = projectId(JsonField.ofNullable(projectId)) + + /** Alias for calling [Builder.projectId] with `projectId.orElse(null)`. */ + fun projectId(projectId: Optional) = projectId(projectId.getOrNull()) + + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun projectId(projectId: JsonField) = apply { this.projectId = projectId } + + /** A human-readable explanation of the status. */ + fun statusMessage(statusMessage: String?) = + statusMessage(JsonField.ofNullable(statusMessage)) + + /** Alias for calling [Builder.statusMessage] with `statusMessage.orElse(null)`. */ + fun statusMessage(statusMessage: Optional) = + statusMessage(statusMessage.getOrNull()) + + /** + * Sets [Builder.statusMessage] to an arbitrary JSON value. + * + * You should usually call [Builder.statusMessage] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun statusMessage(statusMessage: JsonField) = apply { + this.statusMessage = statusMessage + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [RuleResultRetrieveResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateUpdated() + * .deactivated() + * .ruleId() + * .status() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): RuleResultRetrieveResponse = + RuleResultRetrieveResponse( + checkRequired("id", id), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("deactivated", deactivated), + checkRequired("ruleId", ruleId), + checkRequired("status", status), + checkRequired("workspaceId", workspaceId), + assigneeId, + (blockedBy ?: JsonMissing.of()).map { it.toImmutable() }, + (blocking ?: JsonMissing.of()).map { it.toImmutable() }, + dateLastEvaluated, + dateOfLatestEvidence, + dateOfNextEvaluation, + dateOfRenewal, + deactivatedReason, + projectId, + statusMessage, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): RuleResultRetrieveResponse = apply { + if (validated) { + return@apply + } + + id() + dateCreated() + dateUpdated() + deactivated() + ruleId() + status().validate() + workspaceId() + assigneeId() + blockedBy().ifPresent { it.forEach { it.validate() } } + blocking().ifPresent { it.forEach { it.validate() } } + dateLastEvaluated() + dateOfLatestEvidence() + dateOfNextEvaluation() + dateOfRenewal() + deactivatedReason() + projectId() + statusMessage() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (deactivated.asKnown().isPresent) 1 else 0) + + (if (ruleId.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + (if (assigneeId.asKnown().isPresent) 1 else 0) + + (blockedBy.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (blocking.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (dateLastEvaluated.asKnown().isPresent) 1 else 0) + + (if (dateOfLatestEvidence.asKnown().isPresent) 1 else 0) + + (if (dateOfNextEvaluation.asKnown().isPresent) 1 else 0) + + (if (dateOfRenewal.asKnown().isPresent) 1 else 0) + + (if (deactivatedReason.asKnown().isPresent) 1 else 0) + + (if (projectId.asKnown().isPresent) 1 else 0) + + (if (statusMessage.asKnown().isPresent) 1 else 0) + + /** The compliance status of the rule for this entity. */ + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val RUNNING = of("running") + + @JvmField val PASSING = of("passing") + + @JvmField val FAILING = of("failing") + + @JvmField val SKIPPED = of("skipped") + + @JvmField val ERROR = of("error") + + @JvmField val PENDING = of("pending") + + @JvmField val DUE_SOON = of("due_soon") + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + /** An enum containing [Status]'s known values. */ + enum class Known { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + } + + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + /** An enum member indicating that [Status] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + PENDING -> Value.PENDING + DUE_SOON -> Value.DUE_SOON + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + PENDING -> Known.PENDING + DUE_SOON -> Known.DUE_SOON + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + class BlockedBy + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val status: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + ) : this(id, status, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun id(): Optional = id.getOptional("id") + + /** + * The compliance status of the rule for this entity. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun status(): Optional = status.getOptional("status") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [BlockedBy]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BlockedBy]. */ + class Builder internal constructor() { + + private var id: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(blockedBy: BlockedBy) = apply { + id = blockedBy.id + status = blockedBy.status + additionalProperties = blockedBy.additionalProperties.toMutableMap() + } + + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The compliance status of the rule for this entity. */ + fun status(status: Status) = status(JsonField.of(status)) + + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun status(status: JsonField) = apply { this.status = status } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [BlockedBy]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): BlockedBy = BlockedBy(id, status, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): BlockedBy = apply { + if (validated) { + return@apply + } + + id() + status().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + (status.asKnown().getOrNull()?.validity() ?: 0) + + /** The compliance status of the rule for this entity. */ + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val RUNNING = of("running") + + @JvmField val PASSING = of("passing") + + @JvmField val FAILING = of("failing") + + @JvmField val SKIPPED = of("skipped") + + @JvmField val ERROR = of("error") + + @JvmField val PENDING = of("pending") + + @JvmField val DUE_SOON = of("due_soon") + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + /** An enum containing [Status]'s known values. */ + enum class Known { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + } + + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + /** + * An enum member indicating that [Status] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + PENDING -> Value.PENDING + DUE_SOON -> Value.DUE_SOON + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + PENDING -> Known.PENDING + DUE_SOON -> Known.DUE_SOON + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is BlockedBy && + id == other.id && + status == other.status && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(id, status, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BlockedBy{id=$id, status=$status, additionalProperties=$additionalProperties}" + } + + class Blocking + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val status: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + ) : this(id, status, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun id(): Optional = id.getOptional("id") + + /** + * The compliance status of the rule for this entity. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun status(): Optional = status.getOptional("status") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Blocking]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Blocking]. */ + class Builder internal constructor() { + + private var id: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(blocking: Blocking) = apply { + id = blocking.id + status = blocking.status + additionalProperties = blocking.additionalProperties.toMutableMap() + } + + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The compliance status of the rule for this entity. */ + fun status(status: Status) = status(JsonField.of(status)) + + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun status(status: JsonField) = apply { this.status = status } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Blocking]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Blocking = Blocking(id, status, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Blocking = apply { + if (validated) { + return@apply + } + + id() + status().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + (status.asKnown().getOrNull()?.validity() ?: 0) + + /** The compliance status of the rule for this entity. */ + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val RUNNING = of("running") + + @JvmField val PASSING = of("passing") + + @JvmField val FAILING = of("failing") + + @JvmField val SKIPPED = of("skipped") + + @JvmField val ERROR = of("error") + + @JvmField val PENDING = of("pending") + + @JvmField val DUE_SOON = of("due_soon") + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + /** An enum containing [Status]'s known values. */ + enum class Known { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + } + + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + /** + * An enum member indicating that [Status] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + PENDING -> Value.PENDING + DUE_SOON -> Value.DUE_SOON + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + PENDING -> Known.PENDING + DUE_SOON -> Known.DUE_SOON + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Blocking && + id == other.id && + status == other.status && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(id, status, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Blocking{id=$id, status=$status, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is RuleResultRetrieveResponse && + id == other.id && + dateCreated == other.dateCreated && + dateUpdated == other.dateUpdated && + deactivated == other.deactivated && + ruleId == other.ruleId && + status == other.status && + workspaceId == other.workspaceId && + assigneeId == other.assigneeId && + blockedBy == other.blockedBy && + blocking == other.blocking && + dateLastEvaluated == other.dateLastEvaluated && + dateOfLatestEvidence == other.dateOfLatestEvidence && + dateOfNextEvaluation == other.dateOfNextEvaluation && + dateOfRenewal == other.dateOfRenewal && + deactivatedReason == other.deactivatedReason && + projectId == other.projectId && + statusMessage == other.statusMessage && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + dateCreated, + dateUpdated, + deactivated, + ruleId, + status, + workspaceId, + assigneeId, + blockedBy, + blocking, + dateLastEvaluated, + dateOfLatestEvidence, + dateOfNextEvaluation, + dateOfRenewal, + deactivatedReason, + projectId, + statusMessage, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "RuleResultRetrieveResponse{id=$id, dateCreated=$dateCreated, dateUpdated=$dateUpdated, deactivated=$deactivated, ruleId=$ruleId, status=$status, workspaceId=$workspaceId, assigneeId=$assigneeId, blockedBy=$blockedBy, blocking=$blocking, dateLastEvaluated=$dateLastEvaluated, dateOfLatestEvidence=$dateOfLatestEvidence, dateOfNextEvaluation=$dateOfNextEvaluation, dateOfRenewal=$dateOfRenewal, deactivatedReason=$deactivatedReason, projectId=$projectId, statusMessage=$statusMessage, additionalProperties=$additionalProperties}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultUpdateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultUpdateParams.kt new file mode 100644 index 00000000..4a966354 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultUpdateParams.kt @@ -0,0 +1,1490 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.ruleresults + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.openlayer.api.core.Enum +import com.openlayer.api.core.ExcludeMissing +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonMissing +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.Params +import com.openlayer.api.core.checkKnown +import com.openlayer.api.core.http.Headers +import com.openlayer.api.core.http.QueryParams +import com.openlayer.api.core.toImmutable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * Update a rule result. Only the fields you send are changed. + * + * Use this to assign an owner, or to exclude a single result from compliance without deactivating + * the rule everywhere. `deactivatedReason` is required when setting `deactivated` to `true`. + * + * A result's `status` is computed by Openlayer and cannot be set directly. + */ +class RuleResultUpdateParams +private constructor( + private val ruleResultId: String?, + private val body: Body, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun ruleResultId(): Optional = Optional.ofNullable(ruleResultId) + + /** + * The user responsible for this result. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun assigneeId(): Optional = body.assigneeId() + + /** + * Rule results that must pass before this one can be satisfied. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun blockedBy(): Optional> = body.blockedBy() + + /** + * Rule results that this one blocks. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun blocking(): Optional> = body.blocking() + + /** + * Whether this result is excluded from compliance calculations. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun deactivated(): Optional = body.deactivated() + + /** + * Why the result was excluded. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun deactivatedReason(): Optional = body.deactivatedReason() + + /** + * Returns the raw JSON value of [assigneeId]. + * + * Unlike [assigneeId], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _assigneeId(): JsonField = body._assigneeId() + + /** + * Returns the raw JSON value of [blockedBy]. + * + * Unlike [blockedBy], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _blockedBy(): JsonField> = body._blockedBy() + + /** + * Returns the raw JSON value of [blocking]. + * + * Unlike [blocking], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _blocking(): JsonField> = body._blocking() + + /** + * Returns the raw JSON value of [deactivated]. + * + * Unlike [deactivated], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _deactivated(): JsonField = body._deactivated() + + /** + * Returns the raw JSON value of [deactivatedReason]. + * + * Unlike [deactivatedReason], this method doesn't throw if the JSON field has an unexpected + * type. + */ + fun _deactivatedReason(): JsonField = body._deactivatedReason() + + fun _additionalBodyProperties(): Map = body._additionalProperties() + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): RuleResultUpdateParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [RuleResultUpdateParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [RuleResultUpdateParams]. */ + class Builder internal constructor() { + + private var ruleResultId: String? = null + private var body: Body.Builder = Body.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(ruleResultUpdateParams: RuleResultUpdateParams) = apply { + ruleResultId = ruleResultUpdateParams.ruleResultId + body = ruleResultUpdateParams.body.toBuilder() + additionalHeaders = ruleResultUpdateParams.additionalHeaders.toBuilder() + additionalQueryParams = ruleResultUpdateParams.additionalQueryParams.toBuilder() + } + + fun ruleResultId(ruleResultId: String?) = apply { this.ruleResultId = ruleResultId } + + /** Alias for calling [Builder.ruleResultId] with `ruleResultId.orElse(null)`. */ + fun ruleResultId(ruleResultId: Optional) = ruleResultId(ruleResultId.getOrNull()) + + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [assigneeId] + * - [blockedBy] + * - [blocking] + * - [deactivated] + * - [deactivatedReason] + * - etc. + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + + /** The user responsible for this result. */ + fun assigneeId(assigneeId: String?) = apply { body.assigneeId(assigneeId) } + + /** Alias for calling [Builder.assigneeId] with `assigneeId.orElse(null)`. */ + fun assigneeId(assigneeId: Optional) = assigneeId(assigneeId.getOrNull()) + + /** + * Sets [Builder.assigneeId] to an arbitrary JSON value. + * + * You should usually call [Builder.assigneeId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun assigneeId(assigneeId: JsonField) = apply { body.assigneeId(assigneeId) } + + /** Rule results that must pass before this one can be satisfied. */ + fun blockedBy(blockedBy: List) = apply { body.blockedBy(blockedBy) } + + /** + * Sets [Builder.blockedBy] to an arbitrary JSON value. + * + * You should usually call [Builder.blockedBy] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun blockedBy(blockedBy: JsonField>) = apply { body.blockedBy(blockedBy) } + + /** + * Adds a single [BlockedBy] to [Builder.blockedBy]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addBlockedBy(blockedBy: BlockedBy) = apply { body.addBlockedBy(blockedBy) } + + /** Rule results that this one blocks. */ + fun blocking(blocking: List) = apply { body.blocking(blocking) } + + /** + * Sets [Builder.blocking] to an arbitrary JSON value. + * + * You should usually call [Builder.blocking] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun blocking(blocking: JsonField>) = apply { body.blocking(blocking) } + + /** + * Adds a single [Blocking] to [Builder.blocking]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addBlocking(blocking: Blocking) = apply { body.addBlocking(blocking) } + + /** Whether this result is excluded from compliance calculations. */ + fun deactivated(deactivated: Boolean) = apply { body.deactivated(deactivated) } + + /** + * Sets [Builder.deactivated] to an arbitrary JSON value. + * + * You should usually call [Builder.deactivated] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun deactivated(deactivated: JsonField) = apply { body.deactivated(deactivated) } + + /** Why the result was excluded. */ + fun deactivatedReason(deactivatedReason: String?) = apply { + body.deactivatedReason(deactivatedReason) + } + + /** Alias for calling [Builder.deactivatedReason] with `deactivatedReason.orElse(null)`. */ + fun deactivatedReason(deactivatedReason: Optional) = + deactivatedReason(deactivatedReason.getOrNull()) + + /** + * Sets [Builder.deactivatedReason] to an arbitrary JSON value. + * + * You should usually call [Builder.deactivatedReason] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun deactivatedReason(deactivatedReason: JsonField) = apply { + body.deactivatedReason(deactivatedReason) + } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [RuleResultUpdateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): RuleResultUpdateParams = + RuleResultUpdateParams( + ruleResultId, + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _body(): Body = body + + fun _pathParam(index: Int): String = + when (index) { + 0 -> ruleResultId ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val assigneeId: JsonField, + private val blockedBy: JsonField>, + private val blocking: JsonField>, + private val deactivated: JsonField, + private val deactivatedReason: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("assigneeId") + @ExcludeMissing + assigneeId: JsonField = JsonMissing.of(), + @JsonProperty("blockedBy") + @ExcludeMissing + blockedBy: JsonField> = JsonMissing.of(), + @JsonProperty("blocking") + @ExcludeMissing + blocking: JsonField> = JsonMissing.of(), + @JsonProperty("deactivated") + @ExcludeMissing + deactivated: JsonField = JsonMissing.of(), + @JsonProperty("deactivatedReason") + @ExcludeMissing + deactivatedReason: JsonField = JsonMissing.of(), + ) : this(assigneeId, blockedBy, blocking, deactivated, deactivatedReason, mutableMapOf()) + + /** + * The user responsible for this result. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun assigneeId(): Optional = assigneeId.getOptional("assigneeId") + + /** + * Rule results that must pass before this one can be satisfied. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun blockedBy(): Optional> = blockedBy.getOptional("blockedBy") + + /** + * Rule results that this one blocks. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun blocking(): Optional> = blocking.getOptional("blocking") + + /** + * Whether this result is excluded from compliance calculations. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun deactivated(): Optional = deactivated.getOptional("deactivated") + + /** + * Why the result was excluded. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun deactivatedReason(): Optional = + deactivatedReason.getOptional("deactivatedReason") + + /** + * Returns the raw JSON value of [assigneeId]. + * + * Unlike [assigneeId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("assigneeId") + @ExcludeMissing + fun _assigneeId(): JsonField = assigneeId + + /** + * Returns the raw JSON value of [blockedBy]. + * + * Unlike [blockedBy], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("blockedBy") + @ExcludeMissing + fun _blockedBy(): JsonField> = blockedBy + + /** + * Returns the raw JSON value of [blocking]. + * + * Unlike [blocking], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("blocking") + @ExcludeMissing + fun _blocking(): JsonField> = blocking + + /** + * Returns the raw JSON value of [deactivated]. + * + * Unlike [deactivated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("deactivated") + @ExcludeMissing + fun _deactivated(): JsonField = deactivated + + /** + * Returns the raw JSON value of [deactivatedReason]. + * + * Unlike [deactivatedReason], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("deactivatedReason") + @ExcludeMissing + fun _deactivatedReason(): JsonField = deactivatedReason + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Body]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var assigneeId: JsonField = JsonMissing.of() + private var blockedBy: JsonField>? = null + private var blocking: JsonField>? = null + private var deactivated: JsonField = JsonMissing.of() + private var deactivatedReason: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + assigneeId = body.assigneeId + blockedBy = body.blockedBy.map { it.toMutableList() } + blocking = body.blocking.map { it.toMutableList() } + deactivated = body.deactivated + deactivatedReason = body.deactivatedReason + additionalProperties = body.additionalProperties.toMutableMap() + } + + /** The user responsible for this result. */ + fun assigneeId(assigneeId: String?) = assigneeId(JsonField.ofNullable(assigneeId)) + + /** Alias for calling [Builder.assigneeId] with `assigneeId.orElse(null)`. */ + fun assigneeId(assigneeId: Optional) = assigneeId(assigneeId.getOrNull()) + + /** + * Sets [Builder.assigneeId] to an arbitrary JSON value. + * + * You should usually call [Builder.assigneeId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun assigneeId(assigneeId: JsonField) = apply { this.assigneeId = assigneeId } + + /** Rule results that must pass before this one can be satisfied. */ + fun blockedBy(blockedBy: List) = blockedBy(JsonField.of(blockedBy)) + + /** + * Sets [Builder.blockedBy] to an arbitrary JSON value. + * + * You should usually call [Builder.blockedBy] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun blockedBy(blockedBy: JsonField>) = apply { + this.blockedBy = blockedBy.map { it.toMutableList() } + } + + /** + * Adds a single [BlockedBy] to [Builder.blockedBy]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addBlockedBy(blockedBy: BlockedBy) = apply { + this.blockedBy = + (this.blockedBy ?: JsonField.of(mutableListOf())).also { + checkKnown("blockedBy", it).add(blockedBy) + } + } + + /** Rule results that this one blocks. */ + fun blocking(blocking: List) = blocking(JsonField.of(blocking)) + + /** + * Sets [Builder.blocking] to an arbitrary JSON value. + * + * You should usually call [Builder.blocking] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun blocking(blocking: JsonField>) = apply { + this.blocking = blocking.map { it.toMutableList() } + } + + /** + * Adds a single [Blocking] to [Builder.blocking]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addBlocking(blocking: Blocking) = apply { + this.blocking = + (this.blocking ?: JsonField.of(mutableListOf())).also { + checkKnown("blocking", it).add(blocking) + } + } + + /** Whether this result is excluded from compliance calculations. */ + fun deactivated(deactivated: Boolean) = deactivated(JsonField.of(deactivated)) + + /** + * Sets [Builder.deactivated] to an arbitrary JSON value. + * + * You should usually call [Builder.deactivated] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun deactivated(deactivated: JsonField) = apply { + this.deactivated = deactivated + } + + /** Why the result was excluded. */ + fun deactivatedReason(deactivatedReason: String?) = + deactivatedReason(JsonField.ofNullable(deactivatedReason)) + + /** + * Alias for calling [Builder.deactivatedReason] with `deactivatedReason.orElse(null)`. + */ + fun deactivatedReason(deactivatedReason: Optional) = + deactivatedReason(deactivatedReason.getOrNull()) + + /** + * Sets [Builder.deactivatedReason] to an arbitrary JSON value. + * + * You should usually call [Builder.deactivatedReason] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun deactivatedReason(deactivatedReason: JsonField) = apply { + this.deactivatedReason = deactivatedReason + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Body = + Body( + assigneeId, + (blockedBy ?: JsonMissing.of()).map { it.toImmutable() }, + (blocking ?: JsonMissing.of()).map { it.toImmutable() }, + deactivated, + deactivatedReason, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Body = apply { + if (validated) { + return@apply + } + + assigneeId() + blockedBy().ifPresent { it.forEach { it.validate() } } + blocking().ifPresent { it.forEach { it.validate() } } + deactivated() + deactivatedReason() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (assigneeId.asKnown().isPresent) 1 else 0) + + (blockedBy.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (blocking.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (deactivated.asKnown().isPresent) 1 else 0) + + (if (deactivatedReason.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Body && + assigneeId == other.assigneeId && + blockedBy == other.blockedBy && + blocking == other.blocking && + deactivated == other.deactivated && + deactivatedReason == other.deactivatedReason && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + assigneeId, + blockedBy, + blocking, + deactivated, + deactivatedReason, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Body{assigneeId=$assigneeId, blockedBy=$blockedBy, blocking=$blocking, deactivated=$deactivated, deactivatedReason=$deactivatedReason, additionalProperties=$additionalProperties}" + } + + class BlockedBy + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val status: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + ) : this(id, status, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun id(): Optional = id.getOptional("id") + + /** + * The compliance status of the rule for this entity. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun status(): Optional = status.getOptional("status") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [BlockedBy]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BlockedBy]. */ + class Builder internal constructor() { + + private var id: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(blockedBy: BlockedBy) = apply { + id = blockedBy.id + status = blockedBy.status + additionalProperties = blockedBy.additionalProperties.toMutableMap() + } + + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The compliance status of the rule for this entity. */ + fun status(status: Status) = status(JsonField.of(status)) + + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun status(status: JsonField) = apply { this.status = status } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [BlockedBy]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): BlockedBy = BlockedBy(id, status, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): BlockedBy = apply { + if (validated) { + return@apply + } + + id() + status().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + (status.asKnown().getOrNull()?.validity() ?: 0) + + /** The compliance status of the rule for this entity. */ + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val RUNNING = of("running") + + @JvmField val PASSING = of("passing") + + @JvmField val FAILING = of("failing") + + @JvmField val SKIPPED = of("skipped") + + @JvmField val ERROR = of("error") + + @JvmField val PENDING = of("pending") + + @JvmField val DUE_SOON = of("due_soon") + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + /** An enum containing [Status]'s known values. */ + enum class Known { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + } + + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + /** + * An enum member indicating that [Status] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + PENDING -> Value.PENDING + DUE_SOON -> Value.DUE_SOON + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + PENDING -> Known.PENDING + DUE_SOON -> Known.DUE_SOON + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is BlockedBy && + id == other.id && + status == other.status && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(id, status, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BlockedBy{id=$id, status=$status, additionalProperties=$additionalProperties}" + } + + class Blocking + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val status: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + ) : this(id, status, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun id(): Optional = id.getOptional("id") + + /** + * The compliance status of the rule for this entity. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun status(): Optional = status.getOptional("status") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Blocking]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Blocking]. */ + class Builder internal constructor() { + + private var id: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(blocking: Blocking) = apply { + id = blocking.id + status = blocking.status + additionalProperties = blocking.additionalProperties.toMutableMap() + } + + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The compliance status of the rule for this entity. */ + fun status(status: Status) = status(JsonField.of(status)) + + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun status(status: JsonField) = apply { this.status = status } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Blocking]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Blocking = Blocking(id, status, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Blocking = apply { + if (validated) { + return@apply + } + + id() + status().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + (status.asKnown().getOrNull()?.validity() ?: 0) + + /** The compliance status of the rule for this entity. */ + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val RUNNING = of("running") + + @JvmField val PASSING = of("passing") + + @JvmField val FAILING = of("failing") + + @JvmField val SKIPPED = of("skipped") + + @JvmField val ERROR = of("error") + + @JvmField val PENDING = of("pending") + + @JvmField val DUE_SOON = of("due_soon") + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + /** An enum containing [Status]'s known values. */ + enum class Known { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + } + + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + /** + * An enum member indicating that [Status] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + PENDING -> Value.PENDING + DUE_SOON -> Value.DUE_SOON + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + PENDING -> Known.PENDING + DUE_SOON -> Known.DUE_SOON + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Blocking && + id == other.id && + status == other.status && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(id, status, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Blocking{id=$id, status=$status, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is RuleResultUpdateParams && + ruleResultId == other.ruleResultId && + body == other.body && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = + Objects.hash(ruleResultId, body, additionalHeaders, additionalQueryParams) + + override fun toString() = + "RuleResultUpdateParams{ruleResultId=$ruleResultId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultUpdateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultUpdateResponse.kt new file mode 100644 index 00000000..e1ea6740 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultUpdateResponse.kt @@ -0,0 +1,1809 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.ruleresults + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.openlayer.api.core.Enum +import com.openlayer.api.core.ExcludeMissing +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonMissing +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.checkKnown +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.toImmutable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.time.OffsetDateTime +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class RuleResultUpdateResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val id: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val deactivated: JsonField, + private val ruleId: JsonField, + private val status: JsonField, + private val workspaceId: JsonField, + private val assigneeId: JsonField, + private val blockedBy: JsonField>, + private val blocking: JsonField>, + private val dateLastEvaluated: JsonField, + private val dateOfLatestEvidence: JsonField, + private val dateOfNextEvaluation: JsonField, + private val dateOfRenewal: JsonField, + private val deactivatedReason: JsonField, + private val projectId: JsonField, + private val statusMessage: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("deactivated") + @ExcludeMissing + deactivated: JsonField = JsonMissing.of(), + @JsonProperty("ruleId") @ExcludeMissing ruleId: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + @JsonProperty("assigneeId") + @ExcludeMissing + assigneeId: JsonField = JsonMissing.of(), + @JsonProperty("blockedBy") + @ExcludeMissing + blockedBy: JsonField> = JsonMissing.of(), + @JsonProperty("blocking") + @ExcludeMissing + blocking: JsonField> = JsonMissing.of(), + @JsonProperty("dateLastEvaluated") + @ExcludeMissing + dateLastEvaluated: JsonField = JsonMissing.of(), + @JsonProperty("dateOfLatestEvidence") + @ExcludeMissing + dateOfLatestEvidence: JsonField = JsonMissing.of(), + @JsonProperty("dateOfNextEvaluation") + @ExcludeMissing + dateOfNextEvaluation: JsonField = JsonMissing.of(), + @JsonProperty("dateOfRenewal") + @ExcludeMissing + dateOfRenewal: JsonField = JsonMissing.of(), + @JsonProperty("deactivatedReason") + @ExcludeMissing + deactivatedReason: JsonField = JsonMissing.of(), + @JsonProperty("projectId") @ExcludeMissing projectId: JsonField = JsonMissing.of(), + @JsonProperty("statusMessage") + @ExcludeMissing + statusMessage: JsonField = JsonMissing.of(), + ) : this( + id, + dateCreated, + dateUpdated, + deactivated, + ruleId, + status, + workspaceId, + assigneeId, + blockedBy, + blocking, + dateLastEvaluated, + dateOfLatestEvidence, + dateOfNextEvaluation, + dateOfRenewal, + deactivatedReason, + projectId, + statusMessage, + mutableMapOf(), + ) + + /** + * The rule result id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun id(): String = id.getRequired("id") + + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** + * The last update date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** + * Whether this result is excluded from compliance calculations. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun deactivated(): Boolean = deactivated.getRequired("deactivated") + + /** + * The rule this result belongs to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun ruleId(): String = ruleId.getRequired("ruleId") + + /** + * The compliance status of the rule for this entity. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun status(): Status = status.getRequired("status") + + /** + * The id of the workspace the rule result belongs to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun workspaceId(): String = workspaceId.getRequired("workspaceId") + + /** + * The user responsible for this result. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun assigneeId(): Optional = assigneeId.getOptional("assigneeId") + + /** + * Rule results that must pass before this one can be satisfied. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun blockedBy(): Optional> = blockedBy.getOptional("blockedBy") + + /** + * Rule results that this one blocks. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun blocking(): Optional> = blocking.getOptional("blocking") + + /** + * When the rule was last evaluated. Platform rules only. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun dateLastEvaluated(): Optional = + dateLastEvaluated.getOptional("dateLastEvaluated") + + /** + * When the most recent piece of evidence was attached. Evidence rules only. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun dateOfLatestEvidence(): Optional = + dateOfLatestEvidence.getOptional("dateOfLatestEvidence") + + /** + * When the rule will next be evaluated. Platform rules only. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun dateOfNextEvaluation(): Optional = + dateOfNextEvaluation.getOptional("dateOfNextEvaluation") + + /** + * When the evidence must be renewed. Evidence rules with a renewal cadence only. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun dateOfRenewal(): Optional = dateOfRenewal.getOptional("dateOfRenewal") + + /** + * Why the result was excluded. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun deactivatedReason(): Optional = deactivatedReason.getOptional("deactivatedReason") + + /** + * The project this result was evaluated for. `null` for workspace-scoped rules. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun projectId(): Optional = projectId.getOptional("projectId") + + /** + * A human-readable explanation of the status. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun statusMessage(): Optional = statusMessage.getOptional("statusMessage") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** + * Returns the raw JSON value of [deactivated]. + * + * Unlike [deactivated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("deactivated") + @ExcludeMissing + fun _deactivated(): JsonField = deactivated + + /** + * Returns the raw JSON value of [ruleId]. + * + * Unlike [ruleId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("ruleId") @ExcludeMissing fun _ruleId(): JsonField = ruleId + + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + + /** + * Returns the raw JSON value of [workspaceId]. + * + * Unlike [workspaceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("workspaceId") @ExcludeMissing fun _workspaceId(): JsonField = workspaceId + + /** + * Returns the raw JSON value of [assigneeId]. + * + * Unlike [assigneeId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("assigneeId") @ExcludeMissing fun _assigneeId(): JsonField = assigneeId + + /** + * Returns the raw JSON value of [blockedBy]. + * + * Unlike [blockedBy], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("blockedBy") + @ExcludeMissing + fun _blockedBy(): JsonField> = blockedBy + + /** + * Returns the raw JSON value of [blocking]. + * + * Unlike [blocking], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("blocking") @ExcludeMissing fun _blocking(): JsonField> = blocking + + /** + * Returns the raw JSON value of [dateLastEvaluated]. + * + * Unlike [dateLastEvaluated], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("dateLastEvaluated") + @ExcludeMissing + fun _dateLastEvaluated(): JsonField = dateLastEvaluated + + /** + * Returns the raw JSON value of [dateOfLatestEvidence]. + * + * Unlike [dateOfLatestEvidence], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("dateOfLatestEvidence") + @ExcludeMissing + fun _dateOfLatestEvidence(): JsonField = dateOfLatestEvidence + + /** + * Returns the raw JSON value of [dateOfNextEvaluation]. + * + * Unlike [dateOfNextEvaluation], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("dateOfNextEvaluation") + @ExcludeMissing + fun _dateOfNextEvaluation(): JsonField = dateOfNextEvaluation + + /** + * Returns the raw JSON value of [dateOfRenewal]. + * + * Unlike [dateOfRenewal], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateOfRenewal") + @ExcludeMissing + fun _dateOfRenewal(): JsonField = dateOfRenewal + + /** + * Returns the raw JSON value of [deactivatedReason]. + * + * Unlike [deactivatedReason], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("deactivatedReason") + @ExcludeMissing + fun _deactivatedReason(): JsonField = deactivatedReason + + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("projectId") @ExcludeMissing fun _projectId(): JsonField = projectId + + /** + * Returns the raw JSON value of [statusMessage]. + * + * Unlike [statusMessage], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("statusMessage") + @ExcludeMissing + fun _statusMessage(): JsonField = statusMessage + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [RuleResultUpdateResponse]. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateUpdated() + * .deactivated() + * .ruleId() + * .status() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [RuleResultUpdateResponse]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var deactivated: JsonField? = null + private var ruleId: JsonField? = null + private var status: JsonField? = null + private var workspaceId: JsonField? = null + private var assigneeId: JsonField = JsonMissing.of() + private var blockedBy: JsonField>? = null + private var blocking: JsonField>? = null + private var dateLastEvaluated: JsonField = JsonMissing.of() + private var dateOfLatestEvidence: JsonField = JsonMissing.of() + private var dateOfNextEvaluation: JsonField = JsonMissing.of() + private var dateOfRenewal: JsonField = JsonMissing.of() + private var deactivatedReason: JsonField = JsonMissing.of() + private var projectId: JsonField = JsonMissing.of() + private var statusMessage: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(ruleResultUpdateResponse: RuleResultUpdateResponse) = apply { + id = ruleResultUpdateResponse.id + dateCreated = ruleResultUpdateResponse.dateCreated + dateUpdated = ruleResultUpdateResponse.dateUpdated + deactivated = ruleResultUpdateResponse.deactivated + ruleId = ruleResultUpdateResponse.ruleId + status = ruleResultUpdateResponse.status + workspaceId = ruleResultUpdateResponse.workspaceId + assigneeId = ruleResultUpdateResponse.assigneeId + blockedBy = ruleResultUpdateResponse.blockedBy.map { it.toMutableList() } + blocking = ruleResultUpdateResponse.blocking.map { it.toMutableList() } + dateLastEvaluated = ruleResultUpdateResponse.dateLastEvaluated + dateOfLatestEvidence = ruleResultUpdateResponse.dateOfLatestEvidence + dateOfNextEvaluation = ruleResultUpdateResponse.dateOfNextEvaluation + dateOfRenewal = ruleResultUpdateResponse.dateOfRenewal + deactivatedReason = ruleResultUpdateResponse.deactivatedReason + projectId = ruleResultUpdateResponse.projectId + statusMessage = ruleResultUpdateResponse.statusMessage + additionalProperties = ruleResultUpdateResponse.additionalProperties.toMutableMap() + } + + /** The rule result id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The last update date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** Whether this result is excluded from compliance calculations. */ + fun deactivated(deactivated: Boolean) = deactivated(JsonField.of(deactivated)) + + /** + * Sets [Builder.deactivated] to an arbitrary JSON value. + * + * You should usually call [Builder.deactivated] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun deactivated(deactivated: JsonField) = apply { this.deactivated = deactivated } + + /** The rule this result belongs to. */ + fun ruleId(ruleId: String) = ruleId(JsonField.of(ruleId)) + + /** + * Sets [Builder.ruleId] to an arbitrary JSON value. + * + * You should usually call [Builder.ruleId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun ruleId(ruleId: JsonField) = apply { this.ruleId = ruleId } + + /** The compliance status of the rule for this entity. */ + fun status(status: Status) = status(JsonField.of(status)) + + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun status(status: JsonField) = apply { this.status = status } + + /** The id of the workspace the rule result belongs to. */ + fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) + + /** + * Sets [Builder.workspaceId] to an arbitrary JSON value. + * + * You should usually call [Builder.workspaceId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun workspaceId(workspaceId: JsonField) = apply { this.workspaceId = workspaceId } + + /** The user responsible for this result. */ + fun assigneeId(assigneeId: String?) = assigneeId(JsonField.ofNullable(assigneeId)) + + /** Alias for calling [Builder.assigneeId] with `assigneeId.orElse(null)`. */ + fun assigneeId(assigneeId: Optional) = assigneeId(assigneeId.getOrNull()) + + /** + * Sets [Builder.assigneeId] to an arbitrary JSON value. + * + * You should usually call [Builder.assigneeId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun assigneeId(assigneeId: JsonField) = apply { this.assigneeId = assigneeId } + + /** Rule results that must pass before this one can be satisfied. */ + fun blockedBy(blockedBy: List) = blockedBy(JsonField.of(blockedBy)) + + /** + * Sets [Builder.blockedBy] to an arbitrary JSON value. + * + * You should usually call [Builder.blockedBy] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun blockedBy(blockedBy: JsonField>) = apply { + this.blockedBy = blockedBy.map { it.toMutableList() } + } + + /** + * Adds a single [BlockedBy] to [Builder.blockedBy]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addBlockedBy(blockedBy: BlockedBy) = apply { + this.blockedBy = + (this.blockedBy ?: JsonField.of(mutableListOf())).also { + checkKnown("blockedBy", it).add(blockedBy) + } + } + + /** Rule results that this one blocks. */ + fun blocking(blocking: List) = blocking(JsonField.of(blocking)) + + /** + * Sets [Builder.blocking] to an arbitrary JSON value. + * + * You should usually call [Builder.blocking] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun blocking(blocking: JsonField>) = apply { + this.blocking = blocking.map { it.toMutableList() } + } + + /** + * Adds a single [Blocking] to [Builder.blocking]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addBlocking(blocking: Blocking) = apply { + this.blocking = + (this.blocking ?: JsonField.of(mutableListOf())).also { + checkKnown("blocking", it).add(blocking) + } + } + + /** When the rule was last evaluated. Platform rules only. */ + fun dateLastEvaluated(dateLastEvaluated: OffsetDateTime?) = + dateLastEvaluated(JsonField.ofNullable(dateLastEvaluated)) + + /** Alias for calling [Builder.dateLastEvaluated] with `dateLastEvaluated.orElse(null)`. */ + fun dateLastEvaluated(dateLastEvaluated: Optional) = + dateLastEvaluated(dateLastEvaluated.getOrNull()) + + /** + * Sets [Builder.dateLastEvaluated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateLastEvaluated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun dateLastEvaluated(dateLastEvaluated: JsonField) = apply { + this.dateLastEvaluated = dateLastEvaluated + } + + /** When the most recent piece of evidence was attached. Evidence rules only. */ + fun dateOfLatestEvidence(dateOfLatestEvidence: OffsetDateTime?) = + dateOfLatestEvidence(JsonField.ofNullable(dateOfLatestEvidence)) + + /** + * Alias for calling [Builder.dateOfLatestEvidence] with + * `dateOfLatestEvidence.orElse(null)`. + */ + fun dateOfLatestEvidence(dateOfLatestEvidence: Optional) = + dateOfLatestEvidence(dateOfLatestEvidence.getOrNull()) + + /** + * Sets [Builder.dateOfLatestEvidence] to an arbitrary JSON value. + * + * You should usually call [Builder.dateOfLatestEvidence] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun dateOfLatestEvidence(dateOfLatestEvidence: JsonField) = apply { + this.dateOfLatestEvidence = dateOfLatestEvidence + } + + /** When the rule will next be evaluated. Platform rules only. */ + fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime?) = + dateOfNextEvaluation(JsonField.ofNullable(dateOfNextEvaluation)) + + /** + * Alias for calling [Builder.dateOfNextEvaluation] with + * `dateOfNextEvaluation.orElse(null)`. + */ + fun dateOfNextEvaluation(dateOfNextEvaluation: Optional) = + dateOfNextEvaluation(dateOfNextEvaluation.getOrNull()) + + /** + * Sets [Builder.dateOfNextEvaluation] to an arbitrary JSON value. + * + * You should usually call [Builder.dateOfNextEvaluation] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun dateOfNextEvaluation(dateOfNextEvaluation: JsonField) = apply { + this.dateOfNextEvaluation = dateOfNextEvaluation + } + + /** When the evidence must be renewed. Evidence rules with a renewal cadence only. */ + fun dateOfRenewal(dateOfRenewal: OffsetDateTime?) = + dateOfRenewal(JsonField.ofNullable(dateOfRenewal)) + + /** Alias for calling [Builder.dateOfRenewal] with `dateOfRenewal.orElse(null)`. */ + fun dateOfRenewal(dateOfRenewal: Optional) = + dateOfRenewal(dateOfRenewal.getOrNull()) + + /** + * Sets [Builder.dateOfRenewal] to an arbitrary JSON value. + * + * You should usually call [Builder.dateOfRenewal] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun dateOfRenewal(dateOfRenewal: JsonField) = apply { + this.dateOfRenewal = dateOfRenewal + } + + /** Why the result was excluded. */ + fun deactivatedReason(deactivatedReason: String?) = + deactivatedReason(JsonField.ofNullable(deactivatedReason)) + + /** Alias for calling [Builder.deactivatedReason] with `deactivatedReason.orElse(null)`. */ + fun deactivatedReason(deactivatedReason: Optional) = + deactivatedReason(deactivatedReason.getOrNull()) + + /** + * Sets [Builder.deactivatedReason] to an arbitrary JSON value. + * + * You should usually call [Builder.deactivatedReason] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun deactivatedReason(deactivatedReason: JsonField) = apply { + this.deactivatedReason = deactivatedReason + } + + /** The project this result was evaluated for. `null` for workspace-scoped rules. */ + fun projectId(projectId: String?) = projectId(JsonField.ofNullable(projectId)) + + /** Alias for calling [Builder.projectId] with `projectId.orElse(null)`. */ + fun projectId(projectId: Optional) = projectId(projectId.getOrNull()) + + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun projectId(projectId: JsonField) = apply { this.projectId = projectId } + + /** A human-readable explanation of the status. */ + fun statusMessage(statusMessage: String?) = + statusMessage(JsonField.ofNullable(statusMessage)) + + /** Alias for calling [Builder.statusMessage] with `statusMessage.orElse(null)`. */ + fun statusMessage(statusMessage: Optional) = + statusMessage(statusMessage.getOrNull()) + + /** + * Sets [Builder.statusMessage] to an arbitrary JSON value. + * + * You should usually call [Builder.statusMessage] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun statusMessage(statusMessage: JsonField) = apply { + this.statusMessage = statusMessage + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [RuleResultUpdateResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateUpdated() + * .deactivated() + * .ruleId() + * .status() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): RuleResultUpdateResponse = + RuleResultUpdateResponse( + checkRequired("id", id), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("deactivated", deactivated), + checkRequired("ruleId", ruleId), + checkRequired("status", status), + checkRequired("workspaceId", workspaceId), + assigneeId, + (blockedBy ?: JsonMissing.of()).map { it.toImmutable() }, + (blocking ?: JsonMissing.of()).map { it.toImmutable() }, + dateLastEvaluated, + dateOfLatestEvidence, + dateOfNextEvaluation, + dateOfRenewal, + deactivatedReason, + projectId, + statusMessage, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): RuleResultUpdateResponse = apply { + if (validated) { + return@apply + } + + id() + dateCreated() + dateUpdated() + deactivated() + ruleId() + status().validate() + workspaceId() + assigneeId() + blockedBy().ifPresent { it.forEach { it.validate() } } + blocking().ifPresent { it.forEach { it.validate() } } + dateLastEvaluated() + dateOfLatestEvidence() + dateOfNextEvaluation() + dateOfRenewal() + deactivatedReason() + projectId() + statusMessage() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (deactivated.asKnown().isPresent) 1 else 0) + + (if (ruleId.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + (if (assigneeId.asKnown().isPresent) 1 else 0) + + (blockedBy.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (blocking.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (dateLastEvaluated.asKnown().isPresent) 1 else 0) + + (if (dateOfLatestEvidence.asKnown().isPresent) 1 else 0) + + (if (dateOfNextEvaluation.asKnown().isPresent) 1 else 0) + + (if (dateOfRenewal.asKnown().isPresent) 1 else 0) + + (if (deactivatedReason.asKnown().isPresent) 1 else 0) + + (if (projectId.asKnown().isPresent) 1 else 0) + + (if (statusMessage.asKnown().isPresent) 1 else 0) + + /** The compliance status of the rule for this entity. */ + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val RUNNING = of("running") + + @JvmField val PASSING = of("passing") + + @JvmField val FAILING = of("failing") + + @JvmField val SKIPPED = of("skipped") + + @JvmField val ERROR = of("error") + + @JvmField val PENDING = of("pending") + + @JvmField val DUE_SOON = of("due_soon") + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + /** An enum containing [Status]'s known values. */ + enum class Known { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + } + + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + /** An enum member indicating that [Status] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + PENDING -> Value.PENDING + DUE_SOON -> Value.DUE_SOON + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + PENDING -> Known.PENDING + DUE_SOON -> Known.DUE_SOON + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + class BlockedBy + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val status: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + ) : this(id, status, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun id(): Optional = id.getOptional("id") + + /** + * The compliance status of the rule for this entity. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun status(): Optional = status.getOptional("status") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [BlockedBy]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BlockedBy]. */ + class Builder internal constructor() { + + private var id: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(blockedBy: BlockedBy) = apply { + id = blockedBy.id + status = blockedBy.status + additionalProperties = blockedBy.additionalProperties.toMutableMap() + } + + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The compliance status of the rule for this entity. */ + fun status(status: Status) = status(JsonField.of(status)) + + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun status(status: JsonField) = apply { this.status = status } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [BlockedBy]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): BlockedBy = BlockedBy(id, status, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): BlockedBy = apply { + if (validated) { + return@apply + } + + id() + status().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + (status.asKnown().getOrNull()?.validity() ?: 0) + + /** The compliance status of the rule for this entity. */ + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val RUNNING = of("running") + + @JvmField val PASSING = of("passing") + + @JvmField val FAILING = of("failing") + + @JvmField val SKIPPED = of("skipped") + + @JvmField val ERROR = of("error") + + @JvmField val PENDING = of("pending") + + @JvmField val DUE_SOON = of("due_soon") + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + /** An enum containing [Status]'s known values. */ + enum class Known { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + } + + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + /** + * An enum member indicating that [Status] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + PENDING -> Value.PENDING + DUE_SOON -> Value.DUE_SOON + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + PENDING -> Known.PENDING + DUE_SOON -> Known.DUE_SOON + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is BlockedBy && + id == other.id && + status == other.status && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(id, status, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BlockedBy{id=$id, status=$status, additionalProperties=$additionalProperties}" + } + + class Blocking + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val status: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + ) : this(id, status, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun id(): Optional = id.getOptional("id") + + /** + * The compliance status of the rule for this entity. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun status(): Optional = status.getOptional("status") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Blocking]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Blocking]. */ + class Builder internal constructor() { + + private var id: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(blocking: Blocking) = apply { + id = blocking.id + status = blocking.status + additionalProperties = blocking.additionalProperties.toMutableMap() + } + + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The compliance status of the rule for this entity. */ + fun status(status: Status) = status(JsonField.of(status)) + + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun status(status: JsonField) = apply { this.status = status } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Blocking]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Blocking = Blocking(id, status, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Blocking = apply { + if (validated) { + return@apply + } + + id() + status().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + (status.asKnown().getOrNull()?.validity() ?: 0) + + /** The compliance status of the rule for this entity. */ + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val RUNNING = of("running") + + @JvmField val PASSING = of("passing") + + @JvmField val FAILING = of("failing") + + @JvmField val SKIPPED = of("skipped") + + @JvmField val ERROR = of("error") + + @JvmField val PENDING = of("pending") + + @JvmField val DUE_SOON = of("due_soon") + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + /** An enum containing [Status]'s known values. */ + enum class Known { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + } + + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + /** + * An enum member indicating that [Status] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + PENDING -> Value.PENDING + DUE_SOON -> Value.DUE_SOON + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + PENDING -> Known.PENDING + DUE_SOON -> Known.DUE_SOON + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Blocking && + id == other.id && + status == other.status && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(id, status, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Blocking{id=$id, status=$status, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is RuleResultUpdateResponse && + id == other.id && + dateCreated == other.dateCreated && + dateUpdated == other.dateUpdated && + deactivated == other.deactivated && + ruleId == other.ruleId && + status == other.status && + workspaceId == other.workspaceId && + assigneeId == other.assigneeId && + blockedBy == other.blockedBy && + blocking == other.blocking && + dateLastEvaluated == other.dateLastEvaluated && + dateOfLatestEvidence == other.dateOfLatestEvidence && + dateOfNextEvaluation == other.dateOfNextEvaluation && + dateOfRenewal == other.dateOfRenewal && + deactivatedReason == other.deactivatedReason && + projectId == other.projectId && + statusMessage == other.statusMessage && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + dateCreated, + dateUpdated, + deactivated, + ruleId, + status, + workspaceId, + assigneeId, + blockedBy, + blocking, + dateLastEvaluated, + dateOfLatestEvidence, + dateOfNextEvaluation, + dateOfRenewal, + deactivatedReason, + projectId, + statusMessage, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "RuleResultUpdateResponse{id=$id, dateCreated=$dateCreated, dateUpdated=$dateUpdated, deactivated=$deactivated, ruleId=$ruleId, status=$status, workspaceId=$workspaceId, assigneeId=$assigneeId, blockedBy=$blockedBy, blocking=$blocking, dateLastEvaluated=$dateLastEvaluated, dateOfLatestEvidence=$dateOfLatestEvidence, dateOfNextEvaluation=$dateOfNextEvaluation, dateOfRenewal=$dateOfRenewal, deactivatedReason=$deactivatedReason, projectId=$projectId, statusMessage=$statusMessage, additionalProperties=$additionalProperties}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/rules/RuleCreateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/rules/RuleCreateParams.kt new file mode 100644 index 00000000..32b93c55 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/rules/RuleCreateParams.kt @@ -0,0 +1,1870 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.rules + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.openlayer.api.core.Enum +import com.openlayer.api.core.ExcludeMissing +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonMissing +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.Params +import com.openlayer.api.core.checkKnown +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.http.Headers +import com.openlayer.api.core.http.QueryParams +import com.openlayer.api.core.toImmutable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * Create a governance rule in a workspace. + * + * A rule is one requirement. Its `type` decides how it is satisfied, and the two types accept + * different fields: + * - `platform` rules are evaluated automatically from the state of your workspace. Set + * `automationType` to the signal to check. Their `scope` must be `project`, and `evidenceType` + * and `renewalCadenceDays` must be omitted or `null`. + * - `evidence` rules are satisfied by attaching evidence. Set `evidenceType` to the kind of + * evidence that satisfies them. `automationType` and `automationParams` must be omitted or + * `null`. + * + * A new rule belongs to no framework. Map it to one from the Openlayer app. + */ +class RuleCreateParams +private constructor( + private val workspaceId: String?, + private val body: Body, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun workspaceId(): Optional = Optional.ofNullable(workspaceId) + + /** + * The rule name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun name(): String = body.name() + + /** + * Whether the rule is evaluated once for the whole workspace, or once per project the rule's + * frameworks apply to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun scope(): Scope = body.scope() + + /** + * `platform` rules are evaluated automatically from the state of your Openlayer workspace. + * `evidence` rules are satisfied by attaching evidence. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun type(): Type = body.type() + + /** + * The user responsible for satisfying the rule. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun assigneeId(): Optional = body.assigneeId() + + /** + * Configuration for the platform check, when the automation takes parameters. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun automationParams(): Optional = body.automationParams() + + /** + * Which workspace signal a platform rule checks, for example `monitoring_mode_enabled`, + * `test_setup`, or `project_owner_set`. `null` for evidence rules. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun automationType(): Optional = body.automationType() + + /** + * Whether the rule is excluded from compliance calculations. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun deactivated(): Optional = body.deactivated() + + /** + * What the rule requires. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun description(): Optional = body.description() + + /** + * The kind of evidence that satisfies the rule. `null` for platform rules. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun evidenceType(): Optional = body.evidenceType() + + /** + * How often evidence must be renewed, in days. Once evidence is older than this, the rule + * result becomes `due_soon` and then `failing`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun renewalCadenceDays(): Optional = body.renewalCadenceDays() + + /** + * The ids of the rule tags to associate with the rule. Replaces the rule's tags. Read them back + * from `tags`, and list the tags available in the workspace with `GET + * /workspaces/{workspaceId}/rule-tags`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun tagIds(): Optional> = body.tagIds() + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _name(): JsonField = body._name() + + /** + * Returns the raw JSON value of [scope]. + * + * Unlike [scope], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _scope(): JsonField = body._scope() + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _type(): JsonField = body._type() + + /** + * Returns the raw JSON value of [assigneeId]. + * + * Unlike [assigneeId], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _assigneeId(): JsonField = body._assigneeId() + + /** + * Returns the raw JSON value of [automationParams]. + * + * Unlike [automationParams], this method doesn't throw if the JSON field has an unexpected + * type. + */ + fun _automationParams(): JsonField = body._automationParams() + + /** + * Returns the raw JSON value of [automationType]. + * + * Unlike [automationType], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _automationType(): JsonField = body._automationType() + + /** + * Returns the raw JSON value of [deactivated]. + * + * Unlike [deactivated], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _deactivated(): JsonField = body._deactivated() + + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _description(): JsonField = body._description() + + /** + * Returns the raw JSON value of [evidenceType]. + * + * Unlike [evidenceType], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _evidenceType(): JsonField = body._evidenceType() + + /** + * Returns the raw JSON value of [renewalCadenceDays]. + * + * Unlike [renewalCadenceDays], this method doesn't throw if the JSON field has an unexpected + * type. + */ + fun _renewalCadenceDays(): JsonField = body._renewalCadenceDays() + + /** + * Returns the raw JSON value of [tagIds]. + * + * Unlike [tagIds], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _tagIds(): JsonField> = body._tagIds() + + fun _additionalBodyProperties(): Map = body._additionalProperties() + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [RuleCreateParams]. + * + * The following fields are required: + * ```java + * .name() + * .scope() + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [RuleCreateParams]. */ + class Builder internal constructor() { + + private var workspaceId: String? = null + private var body: Body.Builder = Body.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(ruleCreateParams: RuleCreateParams) = apply { + workspaceId = ruleCreateParams.workspaceId + body = ruleCreateParams.body.toBuilder() + additionalHeaders = ruleCreateParams.additionalHeaders.toBuilder() + additionalQueryParams = ruleCreateParams.additionalQueryParams.toBuilder() + } + + fun workspaceId(workspaceId: String?) = apply { this.workspaceId = workspaceId } + + /** Alias for calling [Builder.workspaceId] with `workspaceId.orElse(null)`. */ + fun workspaceId(workspaceId: Optional) = workspaceId(workspaceId.getOrNull()) + + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [name] + * - [scope] + * - [type] + * - [assigneeId] + * - [automationParams] + * - etc. + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + + /** The rule name. */ + fun name(name: String) = apply { body.name(name) } + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun name(name: JsonField) = apply { body.name(name) } + + /** + * Whether the rule is evaluated once for the whole workspace, or once per project the + * rule's frameworks apply to. + */ + fun scope(scope: Scope) = apply { body.scope(scope) } + + /** + * Sets [Builder.scope] to an arbitrary JSON value. + * + * You should usually call [Builder.scope] with a well-typed [Scope] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun scope(scope: JsonField) = apply { body.scope(scope) } + + /** + * `platform` rules are evaluated automatically from the state of your Openlayer workspace. + * `evidence` rules are satisfied by attaching evidence. + */ + fun type(type: Type) = apply { body.type(type) } + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun type(type: JsonField) = apply { body.type(type) } + + /** The user responsible for satisfying the rule. */ + fun assigneeId(assigneeId: String?) = apply { body.assigneeId(assigneeId) } + + /** Alias for calling [Builder.assigneeId] with `assigneeId.orElse(null)`. */ + fun assigneeId(assigneeId: Optional) = assigneeId(assigneeId.getOrNull()) + + /** + * Sets [Builder.assigneeId] to an arbitrary JSON value. + * + * You should usually call [Builder.assigneeId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun assigneeId(assigneeId: JsonField) = apply { body.assigneeId(assigneeId) } + + /** Configuration for the platform check, when the automation takes parameters. */ + fun automationParams(automationParams: AutomationParams?) = apply { + body.automationParams(automationParams) + } + + /** Alias for calling [Builder.automationParams] with `automationParams.orElse(null)`. */ + fun automationParams(automationParams: Optional) = + automationParams(automationParams.getOrNull()) + + /** + * Sets [Builder.automationParams] to an arbitrary JSON value. + * + * You should usually call [Builder.automationParams] with a well-typed [AutomationParams] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun automationParams(automationParams: JsonField) = apply { + body.automationParams(automationParams) + } + + /** + * Which workspace signal a platform rule checks, for example `monitoring_mode_enabled`, + * `test_setup`, or `project_owner_set`. `null` for evidence rules. + */ + fun automationType(automationType: String?) = apply { body.automationType(automationType) } + + /** Alias for calling [Builder.automationType] with `automationType.orElse(null)`. */ + fun automationType(automationType: Optional) = + automationType(automationType.getOrNull()) + + /** + * Sets [Builder.automationType] to an arbitrary JSON value. + * + * You should usually call [Builder.automationType] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun automationType(automationType: JsonField) = apply { + body.automationType(automationType) + } + + /** Whether the rule is excluded from compliance calculations. */ + fun deactivated(deactivated: Boolean) = apply { body.deactivated(deactivated) } + + /** + * Sets [Builder.deactivated] to an arbitrary JSON value. + * + * You should usually call [Builder.deactivated] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun deactivated(deactivated: JsonField) = apply { body.deactivated(deactivated) } + + /** What the rule requires. */ + fun description(description: String?) = apply { body.description(description) } + + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ + fun description(description: Optional) = description(description.getOrNull()) + + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun description(description: JsonField) = apply { body.description(description) } + + /** The kind of evidence that satisfies the rule. `null` for platform rules. */ + fun evidenceType(evidenceType: EvidenceType?) = apply { body.evidenceType(evidenceType) } + + /** Alias for calling [Builder.evidenceType] with `evidenceType.orElse(null)`. */ + fun evidenceType(evidenceType: Optional) = + evidenceType(evidenceType.getOrNull()) + + /** + * Sets [Builder.evidenceType] to an arbitrary JSON value. + * + * You should usually call [Builder.evidenceType] with a well-typed [EvidenceType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun evidenceType(evidenceType: JsonField) = apply { + body.evidenceType(evidenceType) + } + + /** + * How often evidence must be renewed, in days. Once evidence is older than this, the rule + * result becomes `due_soon` and then `failing`. + */ + fun renewalCadenceDays(renewalCadenceDays: Long?) = apply { + body.renewalCadenceDays(renewalCadenceDays) + } + + /** + * Alias for [Builder.renewalCadenceDays]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun renewalCadenceDays(renewalCadenceDays: Long) = + renewalCadenceDays(renewalCadenceDays as Long?) + + /** + * Alias for calling [Builder.renewalCadenceDays] with `renewalCadenceDays.orElse(null)`. + */ + fun renewalCadenceDays(renewalCadenceDays: Optional) = + renewalCadenceDays(renewalCadenceDays.getOrNull()) + + /** + * Sets [Builder.renewalCadenceDays] to an arbitrary JSON value. + * + * You should usually call [Builder.renewalCadenceDays] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun renewalCadenceDays(renewalCadenceDays: JsonField) = apply { + body.renewalCadenceDays(renewalCadenceDays) + } + + /** + * The ids of the rule tags to associate with the rule. Replaces the rule's tags. Read them + * back from `tags`, and list the tags available in the workspace with `GET + * /workspaces/{workspaceId}/rule-tags`. + */ + fun tagIds(tagIds: List?) = apply { body.tagIds(tagIds) } + + /** Alias for calling [Builder.tagIds] with `tagIds.orElse(null)`. */ + fun tagIds(tagIds: Optional>) = tagIds(tagIds.getOrNull()) + + /** + * Sets [Builder.tagIds] to an arbitrary JSON value. + * + * You should usually call [Builder.tagIds] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun tagIds(tagIds: JsonField>) = apply { body.tagIds(tagIds) } + + /** + * Adds a single [String] to [tagIds]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addTagId(tagId: String) = apply { body.addTagId(tagId) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [RuleCreateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .name() + * .scope() + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): RuleCreateParams = + RuleCreateParams( + workspaceId, + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _body(): Body = body + + fun _pathParam(index: Int): String = + when (index) { + 0 -> workspaceId ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val name: JsonField, + private val scope: JsonField, + private val type: JsonField, + private val assigneeId: JsonField, + private val automationParams: JsonField, + private val automationType: JsonField, + private val deactivated: JsonField, + private val description: JsonField, + private val evidenceType: JsonField, + private val renewalCadenceDays: JsonField, + private val tagIds: JsonField>, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("scope") @ExcludeMissing scope: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("assigneeId") + @ExcludeMissing + assigneeId: JsonField = JsonMissing.of(), + @JsonProperty("automationParams") + @ExcludeMissing + automationParams: JsonField = JsonMissing.of(), + @JsonProperty("automationType") + @ExcludeMissing + automationType: JsonField = JsonMissing.of(), + @JsonProperty("deactivated") + @ExcludeMissing + deactivated: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + description: JsonField = JsonMissing.of(), + @JsonProperty("evidenceType") + @ExcludeMissing + evidenceType: JsonField = JsonMissing.of(), + @JsonProperty("renewalCadenceDays") + @ExcludeMissing + renewalCadenceDays: JsonField = JsonMissing.of(), + @JsonProperty("tagIds") + @ExcludeMissing + tagIds: JsonField> = JsonMissing.of(), + ) : this( + name, + scope, + type, + assigneeId, + automationParams, + automationType, + deactivated, + description, + evidenceType, + renewalCadenceDays, + tagIds, + mutableMapOf(), + ) + + /** + * The rule name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun name(): String = name.getRequired("name") + + /** + * Whether the rule is evaluated once for the whole workspace, or once per project the + * rule's frameworks apply to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun scope(): Scope = scope.getRequired("scope") + + /** + * `platform` rules are evaluated automatically from the state of your Openlayer workspace. + * `evidence` rules are satisfied by attaching evidence. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun type(): Type = type.getRequired("type") + + /** + * The user responsible for satisfying the rule. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun assigneeId(): Optional = assigneeId.getOptional("assigneeId") + + /** + * Configuration for the platform check, when the automation takes parameters. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun automationParams(): Optional = + automationParams.getOptional("automationParams") + + /** + * Which workspace signal a platform rule checks, for example `monitoring_mode_enabled`, + * `test_setup`, or `project_owner_set`. `null` for evidence rules. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun automationType(): Optional = automationType.getOptional("automationType") + + /** + * Whether the rule is excluded from compliance calculations. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun deactivated(): Optional = deactivated.getOptional("deactivated") + + /** + * What the rule requires. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun description(): Optional = description.getOptional("description") + + /** + * The kind of evidence that satisfies the rule. `null` for platform rules. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun evidenceType(): Optional = evidenceType.getOptional("evidenceType") + + /** + * How often evidence must be renewed, in days. Once evidence is older than this, the rule + * result becomes `due_soon` and then `failing`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun renewalCadenceDays(): Optional = + renewalCadenceDays.getOptional("renewalCadenceDays") + + /** + * The ids of the rule tags to associate with the rule. Replaces the rule's tags. Read them + * back from `tags`, and list the tags available in the workspace with `GET + * /workspaces/{workspaceId}/rule-tags`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun tagIds(): Optional> = tagIds.getOptional("tagIds") + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [scope]. + * + * Unlike [scope], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("scope") @ExcludeMissing fun _scope(): JsonField = scope + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + /** + * Returns the raw JSON value of [assigneeId]. + * + * Unlike [assigneeId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("assigneeId") + @ExcludeMissing + fun _assigneeId(): JsonField = assigneeId + + /** + * Returns the raw JSON value of [automationParams]. + * + * Unlike [automationParams], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("automationParams") + @ExcludeMissing + fun _automationParams(): JsonField = automationParams + + /** + * Returns the raw JSON value of [automationType]. + * + * Unlike [automationType], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("automationType") + @ExcludeMissing + fun _automationType(): JsonField = automationType + + /** + * Returns the raw JSON value of [deactivated]. + * + * Unlike [deactivated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("deactivated") + @ExcludeMissing + fun _deactivated(): JsonField = deactivated + + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("description") + @ExcludeMissing + fun _description(): JsonField = description + + /** + * Returns the raw JSON value of [evidenceType]. + * + * Unlike [evidenceType], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("evidenceType") + @ExcludeMissing + fun _evidenceType(): JsonField = evidenceType + + /** + * Returns the raw JSON value of [renewalCadenceDays]. + * + * Unlike [renewalCadenceDays], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("renewalCadenceDays") + @ExcludeMissing + fun _renewalCadenceDays(): JsonField = renewalCadenceDays + + /** + * Returns the raw JSON value of [tagIds]. + * + * Unlike [tagIds], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("tagIds") @ExcludeMissing fun _tagIds(): JsonField> = tagIds + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Body]. + * + * The following fields are required: + * ```java + * .name() + * .scope() + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var name: JsonField? = null + private var scope: JsonField? = null + private var type: JsonField? = null + private var assigneeId: JsonField = JsonMissing.of() + private var automationParams: JsonField = JsonMissing.of() + private var automationType: JsonField = JsonMissing.of() + private var deactivated: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var evidenceType: JsonField = JsonMissing.of() + private var renewalCadenceDays: JsonField = JsonMissing.of() + private var tagIds: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + name = body.name + scope = body.scope + type = body.type + assigneeId = body.assigneeId + automationParams = body.automationParams + automationType = body.automationType + deactivated = body.deactivated + description = body.description + evidenceType = body.evidenceType + renewalCadenceDays = body.renewalCadenceDays + tagIds = body.tagIds.map { it.toMutableList() } + additionalProperties = body.additionalProperties.toMutableMap() + } + + /** The rule name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun name(name: JsonField) = apply { this.name = name } + + /** + * Whether the rule is evaluated once for the whole workspace, or once per project the + * rule's frameworks apply to. + */ + fun scope(scope: Scope) = scope(JsonField.of(scope)) + + /** + * Sets [Builder.scope] to an arbitrary JSON value. + * + * You should usually call [Builder.scope] with a well-typed [Scope] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun scope(scope: JsonField) = apply { this.scope = scope } + + /** + * `platform` rules are evaluated automatically from the state of your Openlayer + * workspace. `evidence` rules are satisfied by attaching evidence. + */ + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun type(type: JsonField) = apply { this.type = type } + + /** The user responsible for satisfying the rule. */ + fun assigneeId(assigneeId: String?) = assigneeId(JsonField.ofNullable(assigneeId)) + + /** Alias for calling [Builder.assigneeId] with `assigneeId.orElse(null)`. */ + fun assigneeId(assigneeId: Optional) = assigneeId(assigneeId.getOrNull()) + + /** + * Sets [Builder.assigneeId] to an arbitrary JSON value. + * + * You should usually call [Builder.assigneeId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun assigneeId(assigneeId: JsonField) = apply { this.assigneeId = assigneeId } + + /** Configuration for the platform check, when the automation takes parameters. */ + fun automationParams(automationParams: AutomationParams?) = + automationParams(JsonField.ofNullable(automationParams)) + + /** + * Alias for calling [Builder.automationParams] with `automationParams.orElse(null)`. + */ + fun automationParams(automationParams: Optional) = + automationParams(automationParams.getOrNull()) + + /** + * Sets [Builder.automationParams] to an arbitrary JSON value. + * + * You should usually call [Builder.automationParams] with a well-typed + * [AutomationParams] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun automationParams(automationParams: JsonField) = apply { + this.automationParams = automationParams + } + + /** + * Which workspace signal a platform rule checks, for example `monitoring_mode_enabled`, + * `test_setup`, or `project_owner_set`. `null` for evidence rules. + */ + fun automationType(automationType: String?) = + automationType(JsonField.ofNullable(automationType)) + + /** Alias for calling [Builder.automationType] with `automationType.orElse(null)`. */ + fun automationType(automationType: Optional) = + automationType(automationType.getOrNull()) + + /** + * Sets [Builder.automationType] to an arbitrary JSON value. + * + * You should usually call [Builder.automationType] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun automationType(automationType: JsonField) = apply { + this.automationType = automationType + } + + /** Whether the rule is excluded from compliance calculations. */ + fun deactivated(deactivated: Boolean) = deactivated(JsonField.of(deactivated)) + + /** + * Sets [Builder.deactivated] to an arbitrary JSON value. + * + * You should usually call [Builder.deactivated] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun deactivated(deactivated: JsonField) = apply { + this.deactivated = deactivated + } + + /** What the rule requires. */ + fun description(description: String?) = description(JsonField.ofNullable(description)) + + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ + fun description(description: Optional) = description(description.getOrNull()) + + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun description(description: JsonField) = apply { + this.description = description + } + + /** The kind of evidence that satisfies the rule. `null` for platform rules. */ + fun evidenceType(evidenceType: EvidenceType?) = + evidenceType(JsonField.ofNullable(evidenceType)) + + /** Alias for calling [Builder.evidenceType] with `evidenceType.orElse(null)`. */ + fun evidenceType(evidenceType: Optional) = + evidenceType(evidenceType.getOrNull()) + + /** + * Sets [Builder.evidenceType] to an arbitrary JSON value. + * + * You should usually call [Builder.evidenceType] with a well-typed [EvidenceType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun evidenceType(evidenceType: JsonField) = apply { + this.evidenceType = evidenceType + } + + /** + * How often evidence must be renewed, in days. Once evidence is older than this, the + * rule result becomes `due_soon` and then `failing`. + */ + fun renewalCadenceDays(renewalCadenceDays: Long?) = + renewalCadenceDays(JsonField.ofNullable(renewalCadenceDays)) + + /** + * Alias for [Builder.renewalCadenceDays]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun renewalCadenceDays(renewalCadenceDays: Long) = + renewalCadenceDays(renewalCadenceDays as Long?) + + /** + * Alias for calling [Builder.renewalCadenceDays] with + * `renewalCadenceDays.orElse(null)`. + */ + fun renewalCadenceDays(renewalCadenceDays: Optional) = + renewalCadenceDays(renewalCadenceDays.getOrNull()) + + /** + * Sets [Builder.renewalCadenceDays] to an arbitrary JSON value. + * + * You should usually call [Builder.renewalCadenceDays] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun renewalCadenceDays(renewalCadenceDays: JsonField) = apply { + this.renewalCadenceDays = renewalCadenceDays + } + + /** + * The ids of the rule tags to associate with the rule. Replaces the rule's tags. Read + * them back from `tags`, and list the tags available in the workspace with `GET + * /workspaces/{workspaceId}/rule-tags`. + */ + fun tagIds(tagIds: List?) = tagIds(JsonField.ofNullable(tagIds)) + + /** Alias for calling [Builder.tagIds] with `tagIds.orElse(null)`. */ + fun tagIds(tagIds: Optional>) = tagIds(tagIds.getOrNull()) + + /** + * Sets [Builder.tagIds] to an arbitrary JSON value. + * + * You should usually call [Builder.tagIds] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun tagIds(tagIds: JsonField>) = apply { + this.tagIds = tagIds.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [tagIds]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addTagId(tagId: String) = apply { + tagIds = + (tagIds ?: JsonField.of(mutableListOf())).also { + checkKnown("tagIds", it).add(tagId) + } + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .name() + * .scope() + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Body = + Body( + checkRequired("name", name), + checkRequired("scope", scope), + checkRequired("type", type), + assigneeId, + automationParams, + automationType, + deactivated, + description, + evidenceType, + renewalCadenceDays, + (tagIds ?: JsonMissing.of()).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Body = apply { + if (validated) { + return@apply + } + + name() + scope().validate() + type().validate() + assigneeId() + automationParams().ifPresent { it.validate() } + automationType() + deactivated() + description() + evidenceType().ifPresent { it.validate() } + renewalCadenceDays() + tagIds() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (name.asKnown().isPresent) 1 else 0) + + (scope.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + (if (assigneeId.asKnown().isPresent) 1 else 0) + + (automationParams.asKnown().getOrNull()?.validity() ?: 0) + + (if (automationType.asKnown().isPresent) 1 else 0) + + (if (deactivated.asKnown().isPresent) 1 else 0) + + (if (description.asKnown().isPresent) 1 else 0) + + (evidenceType.asKnown().getOrNull()?.validity() ?: 0) + + (if (renewalCadenceDays.asKnown().isPresent) 1 else 0) + + (tagIds.asKnown().getOrNull()?.size ?: 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Body && + name == other.name && + scope == other.scope && + type == other.type && + assigneeId == other.assigneeId && + automationParams == other.automationParams && + automationType == other.automationType && + deactivated == other.deactivated && + description == other.description && + evidenceType == other.evidenceType && + renewalCadenceDays == other.renewalCadenceDays && + tagIds == other.tagIds && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + name, + scope, + type, + assigneeId, + automationParams, + automationType, + deactivated, + description, + evidenceType, + renewalCadenceDays, + tagIds, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Body{name=$name, scope=$scope, type=$type, assigneeId=$assigneeId, automationParams=$automationParams, automationType=$automationType, deactivated=$deactivated, description=$description, evidenceType=$evidenceType, renewalCadenceDays=$renewalCadenceDays, tagIds=$tagIds, additionalProperties=$additionalProperties}" + } + + /** + * Whether the rule is evaluated once for the whole workspace, or once per project the rule's + * frameworks apply to. + */ + class Scope @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val PROJECT = of("project") + + @JvmField val WORKSPACE = of("workspace") + + @JvmStatic fun of(value: String) = Scope(JsonField.of(value)) + } + + /** An enum containing [Scope]'s known values. */ + enum class Known { + PROJECT, + WORKSPACE, + } + + /** + * An enum containing [Scope]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Scope] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + PROJECT, + WORKSPACE, + /** An enum member indicating that [Scope] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + PROJECT -> Value.PROJECT + WORKSPACE -> Value.WORKSPACE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + PROJECT -> Known.PROJECT + WORKSPACE -> Known.WORKSPACE + else -> throw OpenlayerInvalidDataException("Unknown Scope: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Scope = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Scope && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** + * `platform` rules are evaluated automatically from the state of your Openlayer workspace. + * `evidence` rules are satisfied by attaching evidence. + */ + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val PLATFORM = of("platform") + + @JvmField val EVIDENCE = of("evidence") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + PLATFORM, + EVIDENCE, + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + PLATFORM, + EVIDENCE, + /** An enum member indicating that [Type] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + PLATFORM -> Value.PLATFORM + EVIDENCE -> Value.EVIDENCE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + PLATFORM -> Known.PLATFORM + EVIDENCE -> Known.EVIDENCE + else -> throw OpenlayerInvalidDataException("Unknown Type: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Configuration for the platform check, when the automation takes parameters. */ + class AutomationParams + @JsonCreator + private constructor( + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [AutomationParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [AutomationParams]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(automationParams: AutomationParams) = apply { + additionalProperties = automationParams.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [AutomationParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): AutomationParams = AutomationParams(additionalProperties.toImmutable()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): AutomationParams = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is AutomationParams && additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = "AutomationParams{additionalProperties=$additionalProperties}" + } + + /** The kind of evidence that satisfies the rule. `null` for platform rules. */ + class EvidenceType @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val DOCUMENT = of("document") + + @JvmField val TEXT = of("text") + + @JvmField val URL = of("url") + + @JvmField val CATEGORY_VALUE = of("categoryValue") + + @JvmStatic fun of(value: String) = EvidenceType(JsonField.of(value)) + } + + /** An enum containing [EvidenceType]'s known values. */ + enum class Known { + DOCUMENT, + TEXT, + URL, + CATEGORY_VALUE, + } + + /** + * An enum containing [EvidenceType]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [EvidenceType] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DOCUMENT, + TEXT, + URL, + CATEGORY_VALUE, + /** + * An enum member indicating that [EvidenceType] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DOCUMENT -> Value.DOCUMENT + TEXT -> Value.TEXT + URL -> Value.URL + CATEGORY_VALUE -> Value.CATEGORY_VALUE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + DOCUMENT -> Known.DOCUMENT + TEXT -> Known.TEXT + URL -> Known.URL + CATEGORY_VALUE -> Known.CATEGORY_VALUE + else -> throw OpenlayerInvalidDataException("Unknown EvidenceType: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): EvidenceType = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is EvidenceType && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is RuleCreateParams && + workspaceId == other.workspaceId && + body == other.body && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = + Objects.hash(workspaceId, body, additionalHeaders, additionalQueryParams) + + override fun toString() = + "RuleCreateParams{workspaceId=$workspaceId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/rules/RuleCreateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/rules/RuleCreateResponse.kt new file mode 100644 index 00000000..33094bd0 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/rules/RuleCreateResponse.kt @@ -0,0 +1,4821 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.rules + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.openlayer.api.core.Enum +import com.openlayer.api.core.ExcludeMissing +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonMissing +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.checkKnown +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.toImmutable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.time.OffsetDateTime +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class RuleCreateResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val id: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val name: JsonField, + private val scope: JsonField, + private val type: JsonField, + private val workspaceId: JsonField, + private val assigneeId: JsonField, + private val automationParams: JsonField, + private val automationType: JsonField, + private val deactivated: JsonField, + private val description: JsonField, + private val evidenceType: JsonField, + private val frameworks: JsonField>, + private val immutable: JsonField, + private val renewalCadenceDays: JsonField, + private val results: JsonField>, + private val resultsSummary: JsonField, + private val tagIds: JsonField>, + private val tags: JsonField>, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("scope") @ExcludeMissing scope: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + @JsonProperty("assigneeId") + @ExcludeMissing + assigneeId: JsonField = JsonMissing.of(), + @JsonProperty("automationParams") + @ExcludeMissing + automationParams: JsonField = JsonMissing.of(), + @JsonProperty("automationType") + @ExcludeMissing + automationType: JsonField = JsonMissing.of(), + @JsonProperty("deactivated") + @ExcludeMissing + deactivated: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + description: JsonField = JsonMissing.of(), + @JsonProperty("evidenceType") + @ExcludeMissing + evidenceType: JsonField = JsonMissing.of(), + @JsonProperty("frameworks") + @ExcludeMissing + frameworks: JsonField> = JsonMissing.of(), + @JsonProperty("immutable") @ExcludeMissing immutable: JsonField = JsonMissing.of(), + @JsonProperty("renewalCadenceDays") + @ExcludeMissing + renewalCadenceDays: JsonField = JsonMissing.of(), + @JsonProperty("results") + @ExcludeMissing + results: JsonField> = JsonMissing.of(), + @JsonProperty("resultsSummary") + @ExcludeMissing + resultsSummary: JsonField = JsonMissing.of(), + @JsonProperty("tagIds") @ExcludeMissing tagIds: JsonField> = JsonMissing.of(), + @JsonProperty("tags") @ExcludeMissing tags: JsonField> = JsonMissing.of(), + ) : this( + id, + dateCreated, + dateUpdated, + name, + scope, + type, + workspaceId, + assigneeId, + automationParams, + automationType, + deactivated, + description, + evidenceType, + frameworks, + immutable, + renewalCadenceDays, + results, + resultsSummary, + tagIds, + tags, + mutableMapOf(), + ) + + /** + * The rule id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun id(): String = id.getRequired("id") + + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** + * The last update date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** + * The rule name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun name(): String = name.getRequired("name") + + /** + * Whether the rule is evaluated once for the whole workspace, or once per project the rule's + * frameworks apply to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun scope(): Scope = scope.getRequired("scope") + + /** + * `platform` rules are evaluated automatically from the state of your Openlayer workspace. + * `evidence` rules are satisfied by attaching evidence. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun type(): Type = type.getRequired("type") + + /** + * The id of the workspace the rule belongs to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun workspaceId(): String = workspaceId.getRequired("workspaceId") + + /** + * The user responsible for satisfying the rule. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun assigneeId(): Optional = assigneeId.getOptional("assigneeId") + + /** + * Configuration for the platform check, when the automation takes parameters. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun automationParams(): Optional = + automationParams.getOptional("automationParams") + + /** + * Which workspace signal a platform rule checks, for example `monitoring_mode_enabled`, + * `test_setup`, or `project_owner_set`. `null` for evidence rules. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun automationType(): Optional = automationType.getOptional("automationType") + + /** + * Whether the rule is excluded from compliance calculations. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun deactivated(): Optional = deactivated.getOptional("deactivated") + + /** + * What the rule requires. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun description(): Optional = description.getOptional("description") + + /** + * The kind of evidence that satisfies the rule. `null` for platform rules. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun evidenceType(): Optional = evidenceType.getOptional("evidenceType") + + /** + * The frameworks that include this rule. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun frameworks(): Optional> = frameworks.getOptional("frameworks") + + /** + * Whether the rule is managed by Openlayer and cannot be edited. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun immutable(): Optional = immutable.getOptional("immutable") + + /** + * How often evidence must be renewed, in days. Once evidence is older than this, the rule + * result becomes `due_soon` and then `failing`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun renewalCadenceDays(): Optional = renewalCadenceDays.getOptional("renewalCadenceDays") + + /** + * The rule's results, one per entity the rule is evaluated against. Only returned when + * `includeResults` is `true`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun results(): Optional> = results.getOptional("results") + + /** + * Pass-rate counts across all of the rule's entities, independent of any status filter applied + * to the request. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun resultsSummary(): Optional = resultsSummary.getOptional("resultsSummary") + + /** + * The ids of the rule tags to associate with the rule. Replaces the rule's tags. Read them back + * from `tags`, and list the tags available in the workspace with `GET + * /workspaces/{workspaceId}/rule-tags`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun tagIds(): Optional> = tagIds.getOptional("tagIds") + + /** + * The rule tags associated with the rule. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun tags(): Optional> = tags.getOptional("tags") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [scope]. + * + * Unlike [scope], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("scope") @ExcludeMissing fun _scope(): JsonField = scope + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + /** + * Returns the raw JSON value of [workspaceId]. + * + * Unlike [workspaceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("workspaceId") @ExcludeMissing fun _workspaceId(): JsonField = workspaceId + + /** + * Returns the raw JSON value of [assigneeId]. + * + * Unlike [assigneeId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("assigneeId") @ExcludeMissing fun _assigneeId(): JsonField = assigneeId + + /** + * Returns the raw JSON value of [automationParams]. + * + * Unlike [automationParams], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("automationParams") + @ExcludeMissing + fun _automationParams(): JsonField = automationParams + + /** + * Returns the raw JSON value of [automationType]. + * + * Unlike [automationType], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("automationType") + @ExcludeMissing + fun _automationType(): JsonField = automationType + + /** + * Returns the raw JSON value of [deactivated]. + * + * Unlike [deactivated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("deactivated") + @ExcludeMissing + fun _deactivated(): JsonField = deactivated + + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description + + /** + * Returns the raw JSON value of [evidenceType]. + * + * Unlike [evidenceType], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("evidenceType") + @ExcludeMissing + fun _evidenceType(): JsonField = evidenceType + + /** + * Returns the raw JSON value of [frameworks]. + * + * Unlike [frameworks], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("frameworks") + @ExcludeMissing + fun _frameworks(): JsonField> = frameworks + + /** + * Returns the raw JSON value of [immutable]. + * + * Unlike [immutable], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("immutable") @ExcludeMissing fun _immutable(): JsonField = immutable + + /** + * Returns the raw JSON value of [renewalCadenceDays]. + * + * Unlike [renewalCadenceDays], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("renewalCadenceDays") + @ExcludeMissing + fun _renewalCadenceDays(): JsonField = renewalCadenceDays + + /** + * Returns the raw JSON value of [results]. + * + * Unlike [results], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("results") @ExcludeMissing fun _results(): JsonField> = results + + /** + * Returns the raw JSON value of [resultsSummary]. + * + * Unlike [resultsSummary], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("resultsSummary") + @ExcludeMissing + fun _resultsSummary(): JsonField = resultsSummary + + /** + * Returns the raw JSON value of [tagIds]. + * + * Unlike [tagIds], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("tagIds") @ExcludeMissing fun _tagIds(): JsonField> = tagIds + + /** + * Returns the raw JSON value of [tags]. + * + * Unlike [tags], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("tags") @ExcludeMissing fun _tags(): JsonField> = tags + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [RuleCreateResponse]. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateUpdated() + * .name() + * .scope() + * .type() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [RuleCreateResponse]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var name: JsonField? = null + private var scope: JsonField? = null + private var type: JsonField? = null + private var workspaceId: JsonField? = null + private var assigneeId: JsonField = JsonMissing.of() + private var automationParams: JsonField = JsonMissing.of() + private var automationType: JsonField = JsonMissing.of() + private var deactivated: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var evidenceType: JsonField = JsonMissing.of() + private var frameworks: JsonField>? = null + private var immutable: JsonField = JsonMissing.of() + private var renewalCadenceDays: JsonField = JsonMissing.of() + private var results: JsonField>? = null + private var resultsSummary: JsonField = JsonMissing.of() + private var tagIds: JsonField>? = null + private var tags: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(ruleCreateResponse: RuleCreateResponse) = apply { + id = ruleCreateResponse.id + dateCreated = ruleCreateResponse.dateCreated + dateUpdated = ruleCreateResponse.dateUpdated + name = ruleCreateResponse.name + scope = ruleCreateResponse.scope + type = ruleCreateResponse.type + workspaceId = ruleCreateResponse.workspaceId + assigneeId = ruleCreateResponse.assigneeId + automationParams = ruleCreateResponse.automationParams + automationType = ruleCreateResponse.automationType + deactivated = ruleCreateResponse.deactivated + description = ruleCreateResponse.description + evidenceType = ruleCreateResponse.evidenceType + frameworks = ruleCreateResponse.frameworks.map { it.toMutableList() } + immutable = ruleCreateResponse.immutable + renewalCadenceDays = ruleCreateResponse.renewalCadenceDays + results = ruleCreateResponse.results.map { it.toMutableList() } + resultsSummary = ruleCreateResponse.resultsSummary + tagIds = ruleCreateResponse.tagIds.map { it.toMutableList() } + tags = ruleCreateResponse.tags.map { it.toMutableList() } + additionalProperties = ruleCreateResponse.additionalProperties.toMutableMap() + } + + /** The rule id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The last update date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** The rule name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun name(name: JsonField) = apply { this.name = name } + + /** + * Whether the rule is evaluated once for the whole workspace, or once per project the + * rule's frameworks apply to. + */ + fun scope(scope: Scope) = scope(JsonField.of(scope)) + + /** + * Sets [Builder.scope] to an arbitrary JSON value. + * + * You should usually call [Builder.scope] with a well-typed [Scope] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun scope(scope: JsonField) = apply { this.scope = scope } + + /** + * `platform` rules are evaluated automatically from the state of your Openlayer workspace. + * `evidence` rules are satisfied by attaching evidence. + */ + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun type(type: JsonField) = apply { this.type = type } + + /** The id of the workspace the rule belongs to. */ + fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) + + /** + * Sets [Builder.workspaceId] to an arbitrary JSON value. + * + * You should usually call [Builder.workspaceId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun workspaceId(workspaceId: JsonField) = apply { this.workspaceId = workspaceId } + + /** The user responsible for satisfying the rule. */ + fun assigneeId(assigneeId: String?) = assigneeId(JsonField.ofNullable(assigneeId)) + + /** Alias for calling [Builder.assigneeId] with `assigneeId.orElse(null)`. */ + fun assigneeId(assigneeId: Optional) = assigneeId(assigneeId.getOrNull()) + + /** + * Sets [Builder.assigneeId] to an arbitrary JSON value. + * + * You should usually call [Builder.assigneeId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun assigneeId(assigneeId: JsonField) = apply { this.assigneeId = assigneeId } + + /** Configuration for the platform check, when the automation takes parameters. */ + fun automationParams(automationParams: AutomationParams?) = + automationParams(JsonField.ofNullable(automationParams)) + + /** Alias for calling [Builder.automationParams] with `automationParams.orElse(null)`. */ + fun automationParams(automationParams: Optional) = + automationParams(automationParams.getOrNull()) + + /** + * Sets [Builder.automationParams] to an arbitrary JSON value. + * + * You should usually call [Builder.automationParams] with a well-typed [AutomationParams] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun automationParams(automationParams: JsonField) = apply { + this.automationParams = automationParams + } + + /** + * Which workspace signal a platform rule checks, for example `monitoring_mode_enabled`, + * `test_setup`, or `project_owner_set`. `null` for evidence rules. + */ + fun automationType(automationType: String?) = + automationType(JsonField.ofNullable(automationType)) + + /** Alias for calling [Builder.automationType] with `automationType.orElse(null)`. */ + fun automationType(automationType: Optional) = + automationType(automationType.getOrNull()) + + /** + * Sets [Builder.automationType] to an arbitrary JSON value. + * + * You should usually call [Builder.automationType] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun automationType(automationType: JsonField) = apply { + this.automationType = automationType + } + + /** Whether the rule is excluded from compliance calculations. */ + fun deactivated(deactivated: Boolean) = deactivated(JsonField.of(deactivated)) + + /** + * Sets [Builder.deactivated] to an arbitrary JSON value. + * + * You should usually call [Builder.deactivated] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun deactivated(deactivated: JsonField) = apply { this.deactivated = deactivated } + + /** What the rule requires. */ + fun description(description: String?) = description(JsonField.ofNullable(description)) + + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ + fun description(description: Optional) = description(description.getOrNull()) + + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun description(description: JsonField) = apply { this.description = description } + + /** The kind of evidence that satisfies the rule. `null` for platform rules. */ + fun evidenceType(evidenceType: EvidenceType?) = + evidenceType(JsonField.ofNullable(evidenceType)) + + /** Alias for calling [Builder.evidenceType] with `evidenceType.orElse(null)`. */ + fun evidenceType(evidenceType: Optional) = + evidenceType(evidenceType.getOrNull()) + + /** + * Sets [Builder.evidenceType] to an arbitrary JSON value. + * + * You should usually call [Builder.evidenceType] with a well-typed [EvidenceType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun evidenceType(evidenceType: JsonField) = apply { + this.evidenceType = evidenceType + } + + /** The frameworks that include this rule. */ + fun frameworks(frameworks: List) = frameworks(JsonField.of(frameworks)) + + /** + * Sets [Builder.frameworks] to an arbitrary JSON value. + * + * You should usually call [Builder.frameworks] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun frameworks(frameworks: JsonField>) = apply { + this.frameworks = frameworks.map { it.toMutableList() } + } + + /** + * Adds a single [Framework] to [frameworks]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addFramework(framework: Framework) = apply { + frameworks = + (frameworks ?: JsonField.of(mutableListOf())).also { + checkKnown("frameworks", it).add(framework) + } + } + + /** Whether the rule is managed by Openlayer and cannot be edited. */ + fun immutable(immutable: Boolean) = immutable(JsonField.of(immutable)) + + /** + * Sets [Builder.immutable] to an arbitrary JSON value. + * + * You should usually call [Builder.immutable] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun immutable(immutable: JsonField) = apply { this.immutable = immutable } + + /** + * How often evidence must be renewed, in days. Once evidence is older than this, the rule + * result becomes `due_soon` and then `failing`. + */ + fun renewalCadenceDays(renewalCadenceDays: Long?) = + renewalCadenceDays(JsonField.ofNullable(renewalCadenceDays)) + + /** + * Alias for [Builder.renewalCadenceDays]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun renewalCadenceDays(renewalCadenceDays: Long) = + renewalCadenceDays(renewalCadenceDays as Long?) + + /** + * Alias for calling [Builder.renewalCadenceDays] with `renewalCadenceDays.orElse(null)`. + */ + fun renewalCadenceDays(renewalCadenceDays: Optional) = + renewalCadenceDays(renewalCadenceDays.getOrNull()) + + /** + * Sets [Builder.renewalCadenceDays] to an arbitrary JSON value. + * + * You should usually call [Builder.renewalCadenceDays] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun renewalCadenceDays(renewalCadenceDays: JsonField) = apply { + this.renewalCadenceDays = renewalCadenceDays + } + + /** + * The rule's results, one per entity the rule is evaluated against. Only returned when + * `includeResults` is `true`. + */ + fun results(results: List) = results(JsonField.of(results)) + + /** + * Sets [Builder.results] to an arbitrary JSON value. + * + * You should usually call [Builder.results] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun results(results: JsonField>) = apply { + this.results = results.map { it.toMutableList() } + } + + /** + * Adds a single [Result] to [results]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addResult(result: Result) = apply { + results = + (results ?: JsonField.of(mutableListOf())).also { + checkKnown("results", it).add(result) + } + } + + /** + * Pass-rate counts across all of the rule's entities, independent of any status filter + * applied to the request. + */ + fun resultsSummary(resultsSummary: ResultsSummary?) = + resultsSummary(JsonField.ofNullable(resultsSummary)) + + /** Alias for calling [Builder.resultsSummary] with `resultsSummary.orElse(null)`. */ + fun resultsSummary(resultsSummary: Optional) = + resultsSummary(resultsSummary.getOrNull()) + + /** + * Sets [Builder.resultsSummary] to an arbitrary JSON value. + * + * You should usually call [Builder.resultsSummary] with a well-typed [ResultsSummary] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun resultsSummary(resultsSummary: JsonField) = apply { + this.resultsSummary = resultsSummary + } + + /** + * The ids of the rule tags to associate with the rule. Replaces the rule's tags. Read them + * back from `tags`, and list the tags available in the workspace with `GET + * /workspaces/{workspaceId}/rule-tags`. + */ + fun tagIds(tagIds: List?) = tagIds(JsonField.ofNullable(tagIds)) + + /** Alias for calling [Builder.tagIds] with `tagIds.orElse(null)`. */ + fun tagIds(tagIds: Optional>) = tagIds(tagIds.getOrNull()) + + /** + * Sets [Builder.tagIds] to an arbitrary JSON value. + * + * You should usually call [Builder.tagIds] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun tagIds(tagIds: JsonField>) = apply { + this.tagIds = tagIds.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [tagIds]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addTagId(tagId: String) = apply { + tagIds = + (tagIds ?: JsonField.of(mutableListOf())).also { + checkKnown("tagIds", it).add(tagId) + } + } + + /** The rule tags associated with the rule. */ + fun tags(tags: List?) = tags(JsonField.ofNullable(tags)) + + /** Alias for calling [Builder.tags] with `tags.orElse(null)`. */ + fun tags(tags: Optional>) = tags(tags.getOrNull()) + + /** + * Sets [Builder.tags] to an arbitrary JSON value. + * + * You should usually call [Builder.tags] with a well-typed `List` value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun tags(tags: JsonField>) = apply { this.tags = tags.map { it.toMutableList() } } + + /** + * Adds a single [Tag] to [tags]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addTag(tag: Tag) = apply { + tags = (tags ?: JsonField.of(mutableListOf())).also { checkKnown("tags", it).add(tag) } + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [RuleCreateResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateUpdated() + * .name() + * .scope() + * .type() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): RuleCreateResponse = + RuleCreateResponse( + checkRequired("id", id), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("name", name), + checkRequired("scope", scope), + checkRequired("type", type), + checkRequired("workspaceId", workspaceId), + assigneeId, + automationParams, + automationType, + deactivated, + description, + evidenceType, + (frameworks ?: JsonMissing.of()).map { it.toImmutable() }, + immutable, + renewalCadenceDays, + (results ?: JsonMissing.of()).map { it.toImmutable() }, + resultsSummary, + (tagIds ?: JsonMissing.of()).map { it.toImmutable() }, + (tags ?: JsonMissing.of()).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): RuleCreateResponse = apply { + if (validated) { + return@apply + } + + id() + dateCreated() + dateUpdated() + name() + scope().validate() + type().validate() + workspaceId() + assigneeId() + automationParams().ifPresent { it.validate() } + automationType() + deactivated() + description() + evidenceType().ifPresent { it.validate() } + frameworks().ifPresent { it.forEach { it.validate() } } + immutable() + renewalCadenceDays() + results().ifPresent { it.forEach { it.validate() } } + resultsSummary().ifPresent { it.validate() } + tagIds() + tags().ifPresent { it.forEach { it.validate() } } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (scope.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + (if (assigneeId.asKnown().isPresent) 1 else 0) + + (automationParams.asKnown().getOrNull()?.validity() ?: 0) + + (if (automationType.asKnown().isPresent) 1 else 0) + + (if (deactivated.asKnown().isPresent) 1 else 0) + + (if (description.asKnown().isPresent) 1 else 0) + + (evidenceType.asKnown().getOrNull()?.validity() ?: 0) + + (frameworks.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (immutable.asKnown().isPresent) 1 else 0) + + (if (renewalCadenceDays.asKnown().isPresent) 1 else 0) + + (results.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (resultsSummary.asKnown().getOrNull()?.validity() ?: 0) + + (tagIds.asKnown().getOrNull()?.size ?: 0) + + (tags.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + /** + * Whether the rule is evaluated once for the whole workspace, or once per project the rule's + * frameworks apply to. + */ + class Scope @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val PROJECT = of("project") + + @JvmField val WORKSPACE = of("workspace") + + @JvmStatic fun of(value: String) = Scope(JsonField.of(value)) + } + + /** An enum containing [Scope]'s known values. */ + enum class Known { + PROJECT, + WORKSPACE, + } + + /** + * An enum containing [Scope]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Scope] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + PROJECT, + WORKSPACE, + /** An enum member indicating that [Scope] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + PROJECT -> Value.PROJECT + WORKSPACE -> Value.WORKSPACE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + PROJECT -> Known.PROJECT + WORKSPACE -> Known.WORKSPACE + else -> throw OpenlayerInvalidDataException("Unknown Scope: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Scope = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Scope && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** + * `platform` rules are evaluated automatically from the state of your Openlayer workspace. + * `evidence` rules are satisfied by attaching evidence. + */ + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val PLATFORM = of("platform") + + @JvmField val EVIDENCE = of("evidence") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + PLATFORM, + EVIDENCE, + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + PLATFORM, + EVIDENCE, + /** An enum member indicating that [Type] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + PLATFORM -> Value.PLATFORM + EVIDENCE -> Value.EVIDENCE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + PLATFORM -> Known.PLATFORM + EVIDENCE -> Known.EVIDENCE + else -> throw OpenlayerInvalidDataException("Unknown Type: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Configuration for the platform check, when the automation takes parameters. */ + class AutomationParams + @JsonCreator + private constructor( + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [AutomationParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [AutomationParams]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(automationParams: AutomationParams) = apply { + additionalProperties = automationParams.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [AutomationParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): AutomationParams = AutomationParams(additionalProperties.toImmutable()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): AutomationParams = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is AutomationParams && additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = "AutomationParams{additionalProperties=$additionalProperties}" + } + + /** The kind of evidence that satisfies the rule. `null` for platform rules. */ + class EvidenceType @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val DOCUMENT = of("document") + + @JvmField val TEXT = of("text") + + @JvmField val URL = of("url") + + @JvmField val CATEGORY_VALUE = of("categoryValue") + + @JvmStatic fun of(value: String) = EvidenceType(JsonField.of(value)) + } + + /** An enum containing [EvidenceType]'s known values. */ + enum class Known { + DOCUMENT, + TEXT, + URL, + CATEGORY_VALUE, + } + + /** + * An enum containing [EvidenceType]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [EvidenceType] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DOCUMENT, + TEXT, + URL, + CATEGORY_VALUE, + /** + * An enum member indicating that [EvidenceType] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DOCUMENT -> Value.DOCUMENT + TEXT -> Value.TEXT + URL -> Value.URL + CATEGORY_VALUE -> Value.CATEGORY_VALUE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + DOCUMENT -> Known.DOCUMENT + TEXT -> Known.TEXT + URL -> Known.URL + CATEGORY_VALUE -> Known.CATEGORY_VALUE + else -> throw OpenlayerInvalidDataException("Unknown EvidenceType: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): EvidenceType = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is EvidenceType && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + class Framework + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val avatar: JsonField, + private val builtInSlug: JsonField, + private val enabled: JsonField, + private val name: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("avatar") @ExcludeMissing avatar: JsonField = JsonMissing.of(), + @JsonProperty("builtInSlug") + @ExcludeMissing + builtInSlug: JsonField = JsonMissing.of(), + @JsonProperty("enabled") @ExcludeMissing enabled: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + ) : this(id, avatar, builtInSlug, enabled, name, mutableMapOf()) + + /** + * The framework id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun id(): String = id.getRequired("id") + + /** + * The icon shown for the framework. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun avatar(): Optional = avatar.getOptional("avatar") + + /** + * Identifies a framework that ships with Openlayer, for example `eu_ai_act`, `iso_42001`, + * `nist_ai_rmf`, or `traiga`. `null` for frameworks you create yourself. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun builtInSlug(): Optional = builtInSlug.getOptional("builtInSlug") + + /** + * Whether the framework is active. Rules of a disabled framework are not evaluated and do + * not count towards compliance. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun enabled(): Boolean = enabled.getRequired("enabled") + + /** + * The framework name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun name(): String = name.getRequired("name") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [avatar]. + * + * Unlike [avatar], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("avatar") @ExcludeMissing fun _avatar(): JsonField = avatar + + /** + * Returns the raw JSON value of [builtInSlug]. + * + * Unlike [builtInSlug], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("builtInSlug") + @ExcludeMissing + fun _builtInSlug(): JsonField = builtInSlug + + /** + * Returns the raw JSON value of [enabled]. + * + * Unlike [enabled], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("enabled") @ExcludeMissing fun _enabled(): JsonField = enabled + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Framework]. + * + * The following fields are required: + * ```java + * .id() + * .avatar() + * .builtInSlug() + * .enabled() + * .name() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Framework]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var avatar: JsonField? = null + private var builtInSlug: JsonField? = null + private var enabled: JsonField? = null + private var name: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(framework: Framework) = apply { + id = framework.id + avatar = framework.avatar + builtInSlug = framework.builtInSlug + enabled = framework.enabled + name = framework.name + additionalProperties = framework.additionalProperties.toMutableMap() + } + + /** The framework id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The icon shown for the framework. */ + fun avatar(avatar: Avatar?) = avatar(JsonField.ofNullable(avatar)) + + /** Alias for calling [Builder.avatar] with `avatar.orElse(null)`. */ + fun avatar(avatar: Optional) = avatar(avatar.getOrNull()) + + /** + * Sets [Builder.avatar] to an arbitrary JSON value. + * + * You should usually call [Builder.avatar] with a well-typed [Avatar] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun avatar(avatar: JsonField) = apply { this.avatar = avatar } + + /** + * Identifies a framework that ships with Openlayer, for example `eu_ai_act`, + * `iso_42001`, `nist_ai_rmf`, or `traiga`. `null` for frameworks you create yourself. + */ + fun builtInSlug(builtInSlug: String?) = builtInSlug(JsonField.ofNullable(builtInSlug)) + + /** Alias for calling [Builder.builtInSlug] with `builtInSlug.orElse(null)`. */ + fun builtInSlug(builtInSlug: Optional) = builtInSlug(builtInSlug.getOrNull()) + + /** + * Sets [Builder.builtInSlug] to an arbitrary JSON value. + * + * You should usually call [Builder.builtInSlug] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun builtInSlug(builtInSlug: JsonField) = apply { + this.builtInSlug = builtInSlug + } + + /** + * Whether the framework is active. Rules of a disabled framework are not evaluated and + * do not count towards compliance. + */ + fun enabled(enabled: Boolean) = enabled(JsonField.of(enabled)) + + /** + * Sets [Builder.enabled] to an arbitrary JSON value. + * + * You should usually call [Builder.enabled] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun enabled(enabled: JsonField) = apply { this.enabled = enabled } + + /** The framework name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun name(name: JsonField) = apply { this.name = name } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Framework]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .avatar() + * .builtInSlug() + * .enabled() + * .name() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Framework = + Framework( + checkRequired("id", id), + checkRequired("avatar", avatar), + checkRequired("builtInSlug", builtInSlug), + checkRequired("enabled", enabled), + checkRequired("name", name), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Framework = apply { + if (validated) { + return@apply + } + + id() + avatar().ifPresent { it.validate() } + builtInSlug() + enabled() + name() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (avatar.asKnown().getOrNull()?.validity() ?: 0) + + (if (builtInSlug.asKnown().isPresent) 1 else 0) + + (if (enabled.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + /** The icon shown for the framework. */ + class Avatar + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val type: JsonField, + private val value: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("value") @ExcludeMissing value: JsonField = JsonMissing.of(), + ) : this(type, value, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun type(): Type = type.getRequired("type") + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun value(): String = value.getRequired("value") + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + /** + * Returns the raw JSON value of [value]. + * + * Unlike [value], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Avatar]. + * + * The following fields are required: + * ```java + * .type() + * .value() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Avatar]. */ + class Builder internal constructor() { + + private var type: JsonField? = null + private var value: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(avatar: Avatar) = apply { + type = avatar.type + value = avatar.value + additionalProperties = avatar.additionalProperties.toMutableMap() + } + + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun type(type: JsonField) = apply { this.type = type } + + fun value(value: String) = value(JsonField.of(value)) + + /** + * Sets [Builder.value] to an arbitrary JSON value. + * + * You should usually call [Builder.value] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun value(value: JsonField) = apply { this.value = value } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Avatar]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .type() + * .value() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Avatar = + Avatar( + checkRequired("type", type), + checkRequired("value", value), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Avatar = apply { + if (validated) { + return@apply + } + + type().validate() + value() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (type.asKnown().getOrNull()?.validity() ?: 0) + + (if (value.asKnown().isPresent) 1 else 0) + + class Type @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val EMOJI = of("emoji") + + @JvmField val IMAGE_URL = of("imageUrl") + + @JvmField val BUILTIN_IMAGE = of("builtinImage") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + EMOJI, + IMAGE_URL, + BUILTIN_IMAGE, + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + EMOJI, + IMAGE_URL, + BUILTIN_IMAGE, + /** + * An enum member indicating that [Type] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + EMOJI -> Value.EMOJI + IMAGE_URL -> Value.IMAGE_URL + BUILTIN_IMAGE -> Value.BUILTIN_IMAGE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + EMOJI -> Known.EMOJI + IMAGE_URL -> Known.IMAGE_URL + BUILTIN_IMAGE -> Known.BUILTIN_IMAGE + else -> throw OpenlayerInvalidDataException("Unknown Type: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Avatar && + type == other.type && + value == other.value && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(type, value, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Avatar{type=$type, value=$value, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Framework && + id == other.id && + avatar == other.avatar && + builtInSlug == other.builtInSlug && + enabled == other.enabled && + name == other.name && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(id, avatar, builtInSlug, enabled, name, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Framework{id=$id, avatar=$avatar, builtInSlug=$builtInSlug, enabled=$enabled, name=$name, additionalProperties=$additionalProperties}" + } + + class Result + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val deactivated: JsonField, + private val ruleId: JsonField, + private val status: JsonField, + private val workspaceId: JsonField, + private val assigneeId: JsonField, + private val blockedBy: JsonField>, + private val blocking: JsonField>, + private val dateLastEvaluated: JsonField, + private val dateOfLatestEvidence: JsonField, + private val dateOfNextEvaluation: JsonField, + private val dateOfRenewal: JsonField, + private val deactivatedReason: JsonField, + private val projectId: JsonField, + private val statusMessage: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("deactivated") + @ExcludeMissing + deactivated: JsonField = JsonMissing.of(), + @JsonProperty("ruleId") @ExcludeMissing ruleId: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + @JsonProperty("assigneeId") + @ExcludeMissing + assigneeId: JsonField = JsonMissing.of(), + @JsonProperty("blockedBy") + @ExcludeMissing + blockedBy: JsonField> = JsonMissing.of(), + @JsonProperty("blocking") + @ExcludeMissing + blocking: JsonField> = JsonMissing.of(), + @JsonProperty("dateLastEvaluated") + @ExcludeMissing + dateLastEvaluated: JsonField = JsonMissing.of(), + @JsonProperty("dateOfLatestEvidence") + @ExcludeMissing + dateOfLatestEvidence: JsonField = JsonMissing.of(), + @JsonProperty("dateOfNextEvaluation") + @ExcludeMissing + dateOfNextEvaluation: JsonField = JsonMissing.of(), + @JsonProperty("dateOfRenewal") + @ExcludeMissing + dateOfRenewal: JsonField = JsonMissing.of(), + @JsonProperty("deactivatedReason") + @ExcludeMissing + deactivatedReason: JsonField = JsonMissing.of(), + @JsonProperty("projectId") + @ExcludeMissing + projectId: JsonField = JsonMissing.of(), + @JsonProperty("statusMessage") + @ExcludeMissing + statusMessage: JsonField = JsonMissing.of(), + ) : this( + id, + dateCreated, + dateUpdated, + deactivated, + ruleId, + status, + workspaceId, + assigneeId, + blockedBy, + blocking, + dateLastEvaluated, + dateOfLatestEvidence, + dateOfNextEvaluation, + dateOfRenewal, + deactivatedReason, + projectId, + statusMessage, + mutableMapOf(), + ) + + /** + * The rule result id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun id(): String = id.getRequired("id") + + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** + * The last update date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** + * Whether this result is excluded from compliance calculations. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun deactivated(): Boolean = deactivated.getRequired("deactivated") + + /** + * The rule this result belongs to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun ruleId(): String = ruleId.getRequired("ruleId") + + /** + * The compliance status of the rule for this entity. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun status(): Status = status.getRequired("status") + + /** + * The id of the workspace the rule result belongs to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun workspaceId(): String = workspaceId.getRequired("workspaceId") + + /** + * The user responsible for this result. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun assigneeId(): Optional = assigneeId.getOptional("assigneeId") + + /** + * Rule results that must pass before this one can be satisfied. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun blockedBy(): Optional> = blockedBy.getOptional("blockedBy") + + /** + * Rule results that this one blocks. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun blocking(): Optional> = blocking.getOptional("blocking") + + /** + * When the rule was last evaluated. Platform rules only. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun dateLastEvaluated(): Optional = + dateLastEvaluated.getOptional("dateLastEvaluated") + + /** + * When the most recent piece of evidence was attached. Evidence rules only. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun dateOfLatestEvidence(): Optional = + dateOfLatestEvidence.getOptional("dateOfLatestEvidence") + + /** + * When the rule will next be evaluated. Platform rules only. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun dateOfNextEvaluation(): Optional = + dateOfNextEvaluation.getOptional("dateOfNextEvaluation") + + /** + * When the evidence must be renewed. Evidence rules with a renewal cadence only. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun dateOfRenewal(): Optional = dateOfRenewal.getOptional("dateOfRenewal") + + /** + * Why the result was excluded. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun deactivatedReason(): Optional = + deactivatedReason.getOptional("deactivatedReason") + + /** + * The project this result was evaluated for. `null` for workspace-scoped rules. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun projectId(): Optional = projectId.getOptional("projectId") + + /** + * A human-readable explanation of the status. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun statusMessage(): Optional = statusMessage.getOptional("statusMessage") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** + * Returns the raw JSON value of [deactivated]. + * + * Unlike [deactivated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("deactivated") + @ExcludeMissing + fun _deactivated(): JsonField = deactivated + + /** + * Returns the raw JSON value of [ruleId]. + * + * Unlike [ruleId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("ruleId") @ExcludeMissing fun _ruleId(): JsonField = ruleId + + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + + /** + * Returns the raw JSON value of [workspaceId]. + * + * Unlike [workspaceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("workspaceId") + @ExcludeMissing + fun _workspaceId(): JsonField = workspaceId + + /** + * Returns the raw JSON value of [assigneeId]. + * + * Unlike [assigneeId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("assigneeId") + @ExcludeMissing + fun _assigneeId(): JsonField = assigneeId + + /** + * Returns the raw JSON value of [blockedBy]. + * + * Unlike [blockedBy], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("blockedBy") + @ExcludeMissing + fun _blockedBy(): JsonField> = blockedBy + + /** + * Returns the raw JSON value of [blocking]. + * + * Unlike [blocking], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("blocking") + @ExcludeMissing + fun _blocking(): JsonField> = blocking + + /** + * Returns the raw JSON value of [dateLastEvaluated]. + * + * Unlike [dateLastEvaluated], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("dateLastEvaluated") + @ExcludeMissing + fun _dateLastEvaluated(): JsonField = dateLastEvaluated + + /** + * Returns the raw JSON value of [dateOfLatestEvidence]. + * + * Unlike [dateOfLatestEvidence], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("dateOfLatestEvidence") + @ExcludeMissing + fun _dateOfLatestEvidence(): JsonField = dateOfLatestEvidence + + /** + * Returns the raw JSON value of [dateOfNextEvaluation]. + * + * Unlike [dateOfNextEvaluation], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("dateOfNextEvaluation") + @ExcludeMissing + fun _dateOfNextEvaluation(): JsonField = dateOfNextEvaluation + + /** + * Returns the raw JSON value of [dateOfRenewal]. + * + * Unlike [dateOfRenewal], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("dateOfRenewal") + @ExcludeMissing + fun _dateOfRenewal(): JsonField = dateOfRenewal + + /** + * Returns the raw JSON value of [deactivatedReason]. + * + * Unlike [deactivatedReason], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("deactivatedReason") + @ExcludeMissing + fun _deactivatedReason(): JsonField = deactivatedReason + + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("projectId") @ExcludeMissing fun _projectId(): JsonField = projectId + + /** + * Returns the raw JSON value of [statusMessage]. + * + * Unlike [statusMessage], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("statusMessage") + @ExcludeMissing + fun _statusMessage(): JsonField = statusMessage + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Result]. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateUpdated() + * .deactivated() + * .ruleId() + * .status() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Result]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var deactivated: JsonField? = null + private var ruleId: JsonField? = null + private var status: JsonField? = null + private var workspaceId: JsonField? = null + private var assigneeId: JsonField = JsonMissing.of() + private var blockedBy: JsonField>? = null + private var blocking: JsonField>? = null + private var dateLastEvaluated: JsonField = JsonMissing.of() + private var dateOfLatestEvidence: JsonField = JsonMissing.of() + private var dateOfNextEvaluation: JsonField = JsonMissing.of() + private var dateOfRenewal: JsonField = JsonMissing.of() + private var deactivatedReason: JsonField = JsonMissing.of() + private var projectId: JsonField = JsonMissing.of() + private var statusMessage: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(result: Result) = apply { + id = result.id + dateCreated = result.dateCreated + dateUpdated = result.dateUpdated + deactivated = result.deactivated + ruleId = result.ruleId + status = result.status + workspaceId = result.workspaceId + assigneeId = result.assigneeId + blockedBy = result.blockedBy.map { it.toMutableList() } + blocking = result.blocking.map { it.toMutableList() } + dateLastEvaluated = result.dateLastEvaluated + dateOfLatestEvidence = result.dateOfLatestEvidence + dateOfNextEvaluation = result.dateOfNextEvaluation + dateOfRenewal = result.dateOfRenewal + deactivatedReason = result.deactivatedReason + projectId = result.projectId + statusMessage = result.statusMessage + additionalProperties = result.additionalProperties.toMutableMap() + } + + /** The rule result id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The last update date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** Whether this result is excluded from compliance calculations. */ + fun deactivated(deactivated: Boolean) = deactivated(JsonField.of(deactivated)) + + /** + * Sets [Builder.deactivated] to an arbitrary JSON value. + * + * You should usually call [Builder.deactivated] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun deactivated(deactivated: JsonField) = apply { + this.deactivated = deactivated + } + + /** The rule this result belongs to. */ + fun ruleId(ruleId: String) = ruleId(JsonField.of(ruleId)) + + /** + * Sets [Builder.ruleId] to an arbitrary JSON value. + * + * You should usually call [Builder.ruleId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun ruleId(ruleId: JsonField) = apply { this.ruleId = ruleId } + + /** The compliance status of the rule for this entity. */ + fun status(status: Status) = status(JsonField.of(status)) + + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun status(status: JsonField) = apply { this.status = status } + + /** The id of the workspace the rule result belongs to. */ + fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) + + /** + * Sets [Builder.workspaceId] to an arbitrary JSON value. + * + * You should usually call [Builder.workspaceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun workspaceId(workspaceId: JsonField) = apply { + this.workspaceId = workspaceId + } + + /** The user responsible for this result. */ + fun assigneeId(assigneeId: String?) = assigneeId(JsonField.ofNullable(assigneeId)) + + /** Alias for calling [Builder.assigneeId] with `assigneeId.orElse(null)`. */ + fun assigneeId(assigneeId: Optional) = assigneeId(assigneeId.getOrNull()) + + /** + * Sets [Builder.assigneeId] to an arbitrary JSON value. + * + * You should usually call [Builder.assigneeId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun assigneeId(assigneeId: JsonField) = apply { this.assigneeId = assigneeId } + + /** Rule results that must pass before this one can be satisfied. */ + fun blockedBy(blockedBy: List) = blockedBy(JsonField.of(blockedBy)) + + /** + * Sets [Builder.blockedBy] to an arbitrary JSON value. + * + * You should usually call [Builder.blockedBy] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun blockedBy(blockedBy: JsonField>) = apply { + this.blockedBy = blockedBy.map { it.toMutableList() } + } + + /** + * Adds a single [BlockedBy] to [Builder.blockedBy]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addBlockedBy(blockedBy: BlockedBy) = apply { + this.blockedBy = + (this.blockedBy ?: JsonField.of(mutableListOf())).also { + checkKnown("blockedBy", it).add(blockedBy) + } + } + + /** Rule results that this one blocks. */ + fun blocking(blocking: List) = blocking(JsonField.of(blocking)) + + /** + * Sets [Builder.blocking] to an arbitrary JSON value. + * + * You should usually call [Builder.blocking] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun blocking(blocking: JsonField>) = apply { + this.blocking = blocking.map { it.toMutableList() } + } + + /** + * Adds a single [Blocking] to [Builder.blocking]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addBlocking(blocking: Blocking) = apply { + this.blocking = + (this.blocking ?: JsonField.of(mutableListOf())).also { + checkKnown("blocking", it).add(blocking) + } + } + + /** When the rule was last evaluated. Platform rules only. */ + fun dateLastEvaluated(dateLastEvaluated: OffsetDateTime?) = + dateLastEvaluated(JsonField.ofNullable(dateLastEvaluated)) + + /** + * Alias for calling [Builder.dateLastEvaluated] with `dateLastEvaluated.orElse(null)`. + */ + fun dateLastEvaluated(dateLastEvaluated: Optional) = + dateLastEvaluated(dateLastEvaluated.getOrNull()) + + /** + * Sets [Builder.dateLastEvaluated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateLastEvaluated] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun dateLastEvaluated(dateLastEvaluated: JsonField) = apply { + this.dateLastEvaluated = dateLastEvaluated + } + + /** When the most recent piece of evidence was attached. Evidence rules only. */ + fun dateOfLatestEvidence(dateOfLatestEvidence: OffsetDateTime?) = + dateOfLatestEvidence(JsonField.ofNullable(dateOfLatestEvidence)) + + /** + * Alias for calling [Builder.dateOfLatestEvidence] with + * `dateOfLatestEvidence.orElse(null)`. + */ + fun dateOfLatestEvidence(dateOfLatestEvidence: Optional) = + dateOfLatestEvidence(dateOfLatestEvidence.getOrNull()) + + /** + * Sets [Builder.dateOfLatestEvidence] to an arbitrary JSON value. + * + * You should usually call [Builder.dateOfLatestEvidence] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun dateOfLatestEvidence(dateOfLatestEvidence: JsonField) = apply { + this.dateOfLatestEvidence = dateOfLatestEvidence + } + + /** When the rule will next be evaluated. Platform rules only. */ + fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime?) = + dateOfNextEvaluation(JsonField.ofNullable(dateOfNextEvaluation)) + + /** + * Alias for calling [Builder.dateOfNextEvaluation] with + * `dateOfNextEvaluation.orElse(null)`. + */ + fun dateOfNextEvaluation(dateOfNextEvaluation: Optional) = + dateOfNextEvaluation(dateOfNextEvaluation.getOrNull()) + + /** + * Sets [Builder.dateOfNextEvaluation] to an arbitrary JSON value. + * + * You should usually call [Builder.dateOfNextEvaluation] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun dateOfNextEvaluation(dateOfNextEvaluation: JsonField) = apply { + this.dateOfNextEvaluation = dateOfNextEvaluation + } + + /** When the evidence must be renewed. Evidence rules with a renewal cadence only. */ + fun dateOfRenewal(dateOfRenewal: OffsetDateTime?) = + dateOfRenewal(JsonField.ofNullable(dateOfRenewal)) + + /** Alias for calling [Builder.dateOfRenewal] with `dateOfRenewal.orElse(null)`. */ + fun dateOfRenewal(dateOfRenewal: Optional) = + dateOfRenewal(dateOfRenewal.getOrNull()) + + /** + * Sets [Builder.dateOfRenewal] to an arbitrary JSON value. + * + * You should usually call [Builder.dateOfRenewal] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun dateOfRenewal(dateOfRenewal: JsonField) = apply { + this.dateOfRenewal = dateOfRenewal + } + + /** Why the result was excluded. */ + fun deactivatedReason(deactivatedReason: String?) = + deactivatedReason(JsonField.ofNullable(deactivatedReason)) + + /** + * Alias for calling [Builder.deactivatedReason] with `deactivatedReason.orElse(null)`. + */ + fun deactivatedReason(deactivatedReason: Optional) = + deactivatedReason(deactivatedReason.getOrNull()) + + /** + * Sets [Builder.deactivatedReason] to an arbitrary JSON value. + * + * You should usually call [Builder.deactivatedReason] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun deactivatedReason(deactivatedReason: JsonField) = apply { + this.deactivatedReason = deactivatedReason + } + + /** The project this result was evaluated for. `null` for workspace-scoped rules. */ + fun projectId(projectId: String?) = projectId(JsonField.ofNullable(projectId)) + + /** Alias for calling [Builder.projectId] with `projectId.orElse(null)`. */ + fun projectId(projectId: Optional) = projectId(projectId.getOrNull()) + + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun projectId(projectId: JsonField) = apply { this.projectId = projectId } + + /** A human-readable explanation of the status. */ + fun statusMessage(statusMessage: String?) = + statusMessage(JsonField.ofNullable(statusMessage)) + + /** Alias for calling [Builder.statusMessage] with `statusMessage.orElse(null)`. */ + fun statusMessage(statusMessage: Optional) = + statusMessage(statusMessage.getOrNull()) + + /** + * Sets [Builder.statusMessage] to an arbitrary JSON value. + * + * You should usually call [Builder.statusMessage] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun statusMessage(statusMessage: JsonField) = apply { + this.statusMessage = statusMessage + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Result]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateUpdated() + * .deactivated() + * .ruleId() + * .status() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Result = + Result( + checkRequired("id", id), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("deactivated", deactivated), + checkRequired("ruleId", ruleId), + checkRequired("status", status), + checkRequired("workspaceId", workspaceId), + assigneeId, + (blockedBy ?: JsonMissing.of()).map { it.toImmutable() }, + (blocking ?: JsonMissing.of()).map { it.toImmutable() }, + dateLastEvaluated, + dateOfLatestEvidence, + dateOfNextEvaluation, + dateOfRenewal, + deactivatedReason, + projectId, + statusMessage, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Result = apply { + if (validated) { + return@apply + } + + id() + dateCreated() + dateUpdated() + deactivated() + ruleId() + status().validate() + workspaceId() + assigneeId() + blockedBy().ifPresent { it.forEach { it.validate() } } + blocking().ifPresent { it.forEach { it.validate() } } + dateLastEvaluated() + dateOfLatestEvidence() + dateOfNextEvaluation() + dateOfRenewal() + deactivatedReason() + projectId() + statusMessage() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (deactivated.asKnown().isPresent) 1 else 0) + + (if (ruleId.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + (if (assigneeId.asKnown().isPresent) 1 else 0) + + (blockedBy.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (blocking.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (dateLastEvaluated.asKnown().isPresent) 1 else 0) + + (if (dateOfLatestEvidence.asKnown().isPresent) 1 else 0) + + (if (dateOfNextEvaluation.asKnown().isPresent) 1 else 0) + + (if (dateOfRenewal.asKnown().isPresent) 1 else 0) + + (if (deactivatedReason.asKnown().isPresent) 1 else 0) + + (if (projectId.asKnown().isPresent) 1 else 0) + + (if (statusMessage.asKnown().isPresent) 1 else 0) + + /** The compliance status of the rule for this entity. */ + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val RUNNING = of("running") + + @JvmField val PASSING = of("passing") + + @JvmField val FAILING = of("failing") + + @JvmField val SKIPPED = of("skipped") + + @JvmField val ERROR = of("error") + + @JvmField val PENDING = of("pending") + + @JvmField val DUE_SOON = of("due_soon") + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + /** An enum containing [Status]'s known values. */ + enum class Known { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + } + + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + /** + * An enum member indicating that [Status] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + PENDING -> Value.PENDING + DUE_SOON -> Value.DUE_SOON + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + PENDING -> Known.PENDING + DUE_SOON -> Known.DUE_SOON + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + class BlockedBy + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val status: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + ) : this(id, status, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun id(): Optional = id.getOptional("id") + + /** + * The compliance status of the rule for this entity. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun status(): Optional = status.getOptional("status") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [BlockedBy]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BlockedBy]. */ + class Builder internal constructor() { + + private var id: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(blockedBy: BlockedBy) = apply { + id = blockedBy.id + status = blockedBy.status + additionalProperties = blockedBy.additionalProperties.toMutableMap() + } + + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The compliance status of the rule for this entity. */ + fun status(status: Status) = status(JsonField.of(status)) + + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun status(status: JsonField) = apply { this.status = status } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [BlockedBy]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): BlockedBy = BlockedBy(id, status, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): BlockedBy = apply { + if (validated) { + return@apply + } + + id() + status().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + /** The compliance status of the rule for this entity. */ + class Status @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val RUNNING = of("running") + + @JvmField val PASSING = of("passing") + + @JvmField val FAILING = of("failing") + + @JvmField val SKIPPED = of("skipped") + + @JvmField val ERROR = of("error") + + @JvmField val PENDING = of("pending") + + @JvmField val DUE_SOON = of("due_soon") + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + /** An enum containing [Status]'s known values. */ + enum class Known { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + } + + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + /** + * An enum member indicating that [Status] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + PENDING -> Value.PENDING + DUE_SOON -> Value.DUE_SOON + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + PENDING -> Known.PENDING + DUE_SOON -> Known.DUE_SOON + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is BlockedBy && + id == other.id && + status == other.status && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(id, status, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BlockedBy{id=$id, status=$status, additionalProperties=$additionalProperties}" + } + + class Blocking + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val status: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + ) : this(id, status, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun id(): Optional = id.getOptional("id") + + /** + * The compliance status of the rule for this entity. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun status(): Optional = status.getOptional("status") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Blocking]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Blocking]. */ + class Builder internal constructor() { + + private var id: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(blocking: Blocking) = apply { + id = blocking.id + status = blocking.status + additionalProperties = blocking.additionalProperties.toMutableMap() + } + + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The compliance status of the rule for this entity. */ + fun status(status: Status) = status(JsonField.of(status)) + + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun status(status: JsonField) = apply { this.status = status } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Blocking]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Blocking = Blocking(id, status, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Blocking = apply { + if (validated) { + return@apply + } + + id() + status().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + /** The compliance status of the rule for this entity. */ + class Status @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val RUNNING = of("running") + + @JvmField val PASSING = of("passing") + + @JvmField val FAILING = of("failing") + + @JvmField val SKIPPED = of("skipped") + + @JvmField val ERROR = of("error") + + @JvmField val PENDING = of("pending") + + @JvmField val DUE_SOON = of("due_soon") + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + /** An enum containing [Status]'s known values. */ + enum class Known { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + } + + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + /** + * An enum member indicating that [Status] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + PENDING -> Value.PENDING + DUE_SOON -> Value.DUE_SOON + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + PENDING -> Known.PENDING + DUE_SOON -> Known.DUE_SOON + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Blocking && + id == other.id && + status == other.status && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(id, status, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Blocking{id=$id, status=$status, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Result && + id == other.id && + dateCreated == other.dateCreated && + dateUpdated == other.dateUpdated && + deactivated == other.deactivated && + ruleId == other.ruleId && + status == other.status && + workspaceId == other.workspaceId && + assigneeId == other.assigneeId && + blockedBy == other.blockedBy && + blocking == other.blocking && + dateLastEvaluated == other.dateLastEvaluated && + dateOfLatestEvidence == other.dateOfLatestEvidence && + dateOfNextEvaluation == other.dateOfNextEvaluation && + dateOfRenewal == other.dateOfRenewal && + deactivatedReason == other.deactivatedReason && + projectId == other.projectId && + statusMessage == other.statusMessage && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + dateCreated, + dateUpdated, + deactivated, + ruleId, + status, + workspaceId, + assigneeId, + blockedBy, + blocking, + dateLastEvaluated, + dateOfLatestEvidence, + dateOfNextEvaluation, + dateOfRenewal, + deactivatedReason, + projectId, + statusMessage, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Result{id=$id, dateCreated=$dateCreated, dateUpdated=$dateUpdated, deactivated=$deactivated, ruleId=$ruleId, status=$status, workspaceId=$workspaceId, assigneeId=$assigneeId, blockedBy=$blockedBy, blocking=$blocking, dateLastEvaluated=$dateLastEvaluated, dateOfLatestEvidence=$dateOfLatestEvidence, dateOfNextEvaluation=$dateOfNextEvaluation, dateOfRenewal=$dateOfRenewal, deactivatedReason=$deactivatedReason, projectId=$projectId, statusMessage=$statusMessage, additionalProperties=$additionalProperties}" + } + + /** + * Pass-rate counts across all of the rule's entities, independent of any status filter applied + * to the request. + */ + class ResultsSummary + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val passing: JsonField, + private val total: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("passing") @ExcludeMissing passing: JsonField = JsonMissing.of(), + @JsonProperty("total") @ExcludeMissing total: JsonField = JsonMissing.of(), + ) : this(passing, total, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun passing(): Optional = passing.getOptional("passing") + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun total(): Optional = total.getOptional("total") + + /** + * Returns the raw JSON value of [passing]. + * + * Unlike [passing], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("passing") @ExcludeMissing fun _passing(): JsonField = passing + + /** + * Returns the raw JSON value of [total]. + * + * Unlike [total], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("total") @ExcludeMissing fun _total(): JsonField = total + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [ResultsSummary]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ResultsSummary]. */ + class Builder internal constructor() { + + private var passing: JsonField = JsonMissing.of() + private var total: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(resultsSummary: ResultsSummary) = apply { + passing = resultsSummary.passing + total = resultsSummary.total + additionalProperties = resultsSummary.additionalProperties.toMutableMap() + } + + fun passing(passing: Long) = passing(JsonField.of(passing)) + + /** + * Sets [Builder.passing] to an arbitrary JSON value. + * + * You should usually call [Builder.passing] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun passing(passing: JsonField) = apply { this.passing = passing } + + fun total(total: Long) = total(JsonField.of(total)) + + /** + * Sets [Builder.total] to an arbitrary JSON value. + * + * You should usually call [Builder.total] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun total(total: JsonField) = apply { this.total = total } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ResultsSummary]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): ResultsSummary = + ResultsSummary(passing, total, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): ResultsSummary = apply { + if (validated) { + return@apply + } + + passing() + total() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (passing.asKnown().isPresent) 1 else 0) + (if (total.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ResultsSummary && + passing == other.passing && + total == other.total && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(passing, total, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ResultsSummary{passing=$passing, total=$total, additionalProperties=$additionalProperties}" + } + + class Tag + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val creatorId: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val immutable: JsonField, + private val name: JsonField, + private val workspaceId: JsonField, + private val color: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("creatorId") + @ExcludeMissing + creatorId: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("immutable") + @ExcludeMissing + immutable: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + @JsonProperty("color") @ExcludeMissing color: JsonField = JsonMissing.of(), + ) : this( + id, + creatorId, + dateCreated, + dateUpdated, + immutable, + name, + workspaceId, + color, + mutableMapOf(), + ) + + /** + * The rule tag id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun id(): String = id.getRequired("id") + + /** + * The user who created the tag. `null` for tags that ship with Openlayer. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun creatorId(): Optional = creatorId.getOptional("creatorId") + + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** + * The last update date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** + * Whether the tag is managed by Openlayer and cannot be edited or deleted. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun immutable(): Boolean = immutable.getRequired("immutable") + + /** + * The tag name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun name(): String = name.getRequired("name") + + /** + * The id of the workspace the tag belongs to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun workspaceId(): String = workspaceId.getRequired("workspaceId") + + /** + * The color the tag is displayed with. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun color(): Optional = color.getOptional("color") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [creatorId]. + * + * Unlike [creatorId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("creatorId") @ExcludeMissing fun _creatorId(): JsonField = creatorId + + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** + * Returns the raw JSON value of [immutable]. + * + * Unlike [immutable], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("immutable") @ExcludeMissing fun _immutable(): JsonField = immutable + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [workspaceId]. + * + * Unlike [workspaceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("workspaceId") + @ExcludeMissing + fun _workspaceId(): JsonField = workspaceId + + /** + * Returns the raw JSON value of [color]. + * + * Unlike [color], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("color") @ExcludeMissing fun _color(): JsonField = color + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Tag]. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .immutable() + * .name() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Tag]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var creatorId: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var immutable: JsonField? = null + private var name: JsonField? = null + private var workspaceId: JsonField? = null + private var color: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(tag: Tag) = apply { + id = tag.id + creatorId = tag.creatorId + dateCreated = tag.dateCreated + dateUpdated = tag.dateUpdated + immutable = tag.immutable + name = tag.name + workspaceId = tag.workspaceId + color = tag.color + additionalProperties = tag.additionalProperties.toMutableMap() + } + + /** The rule tag id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The user who created the tag. `null` for tags that ship with Openlayer. */ + fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) + + /** Alias for calling [Builder.creatorId] with `creatorId.orElse(null)`. */ + fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) + + /** + * Sets [Builder.creatorId] to an arbitrary JSON value. + * + * You should usually call [Builder.creatorId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The last update date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** Whether the tag is managed by Openlayer and cannot be edited or deleted. */ + fun immutable(immutable: Boolean) = immutable(JsonField.of(immutable)) + + /** + * Sets [Builder.immutable] to an arbitrary JSON value. + * + * You should usually call [Builder.immutable] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun immutable(immutable: JsonField) = apply { this.immutable = immutable } + + /** The tag name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun name(name: JsonField) = apply { this.name = name } + + /** The id of the workspace the tag belongs to. */ + fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) + + /** + * Sets [Builder.workspaceId] to an arbitrary JSON value. + * + * You should usually call [Builder.workspaceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun workspaceId(workspaceId: JsonField) = apply { + this.workspaceId = workspaceId + } + + /** The color the tag is displayed with. */ + fun color(color: String?) = color(JsonField.ofNullable(color)) + + /** Alias for calling [Builder.color] with `color.orElse(null)`. */ + fun color(color: Optional) = color(color.getOrNull()) + + /** + * Sets [Builder.color] to an arbitrary JSON value. + * + * You should usually call [Builder.color] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun color(color: JsonField) = apply { this.color = color } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Tag]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .immutable() + * .name() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Tag = + Tag( + checkRequired("id", id), + checkRequired("creatorId", creatorId), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("immutable", immutable), + checkRequired("name", name), + checkRequired("workspaceId", workspaceId), + color, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Tag = apply { + if (validated) { + return@apply + } + + id() + creatorId() + dateCreated() + dateUpdated() + immutable() + name() + workspaceId() + color() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (creatorId.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (immutable.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + (if (color.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Tag && + id == other.id && + creatorId == other.creatorId && + dateCreated == other.dateCreated && + dateUpdated == other.dateUpdated && + immutable == other.immutable && + name == other.name && + workspaceId == other.workspaceId && + color == other.color && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + creatorId, + dateCreated, + dateUpdated, + immutable, + name, + workspaceId, + color, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Tag{id=$id, creatorId=$creatorId, dateCreated=$dateCreated, dateUpdated=$dateUpdated, immutable=$immutable, name=$name, workspaceId=$workspaceId, color=$color, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is RuleCreateResponse && + id == other.id && + dateCreated == other.dateCreated && + dateUpdated == other.dateUpdated && + name == other.name && + scope == other.scope && + type == other.type && + workspaceId == other.workspaceId && + assigneeId == other.assigneeId && + automationParams == other.automationParams && + automationType == other.automationType && + deactivated == other.deactivated && + description == other.description && + evidenceType == other.evidenceType && + frameworks == other.frameworks && + immutable == other.immutable && + renewalCadenceDays == other.renewalCadenceDays && + results == other.results && + resultsSummary == other.resultsSummary && + tagIds == other.tagIds && + tags == other.tags && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + dateCreated, + dateUpdated, + name, + scope, + type, + workspaceId, + assigneeId, + automationParams, + automationType, + deactivated, + description, + evidenceType, + frameworks, + immutable, + renewalCadenceDays, + results, + resultsSummary, + tagIds, + tags, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "RuleCreateResponse{id=$id, dateCreated=$dateCreated, dateUpdated=$dateUpdated, name=$name, scope=$scope, type=$type, workspaceId=$workspaceId, assigneeId=$assigneeId, automationParams=$automationParams, automationType=$automationType, deactivated=$deactivated, description=$description, evidenceType=$evidenceType, frameworks=$frameworks, immutable=$immutable, renewalCadenceDays=$renewalCadenceDays, results=$results, resultsSummary=$resultsSummary, tagIds=$tagIds, tags=$tags, additionalProperties=$additionalProperties}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/rules/RuleDeleteParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/rules/RuleDeleteParams.kt new file mode 100644 index 00000000..33c3e16d --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/rules/RuleDeleteParams.kt @@ -0,0 +1,235 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.rules + +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.Params +import com.openlayer.api.core.http.Headers +import com.openlayer.api.core.http.QueryParams +import com.openlayer.api.core.toImmutable +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * Delete a governance rule and its rule results. + * + * Only rules you created can be deleted. Rules that ship with Openlayer report `immutable: true` + * and cannot be deleted -- exclude one from compliance by setting `deactivated` with `PUT + * /rules/{ruleId}` instead. + */ +class RuleDeleteParams +private constructor( + private val ruleId: String?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, + private val additionalBodyProperties: Map, +) : Params { + + fun ruleId(): Optional = Optional.ofNullable(ruleId) + + /** Additional body properties to send with the request. */ + fun _additionalBodyProperties(): Map = additionalBodyProperties + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): RuleDeleteParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [RuleDeleteParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [RuleDeleteParams]. */ + class Builder internal constructor() { + + private var ruleId: String? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(ruleDeleteParams: RuleDeleteParams) = apply { + ruleId = ruleDeleteParams.ruleId + additionalHeaders = ruleDeleteParams.additionalHeaders.toBuilder() + additionalQueryParams = ruleDeleteParams.additionalQueryParams.toBuilder() + additionalBodyProperties = ruleDeleteParams.additionalBodyProperties.toMutableMap() + } + + fun ruleId(ruleId: String?) = apply { this.ruleId = ruleId } + + /** Alias for calling [Builder.ruleId] with `ruleId.orElse(null)`. */ + fun ruleId(ruleId: Optional) = ruleId(ruleId.getOrNull()) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.clear() + putAllAdditionalBodyProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + additionalBodyProperties.put(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { + additionalBodyProperties.remove(key) + } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalBodyProperty) + } + + /** + * Returns an immutable instance of [RuleDeleteParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): RuleDeleteParams = + RuleDeleteParams( + ruleId, + additionalHeaders.build(), + additionalQueryParams.build(), + additionalBodyProperties.toImmutable(), + ) + } + + fun _body(): Optional> = + Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) + + fun _pathParam(index: Int): String = + when (index) { + 0 -> ruleId ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is RuleDeleteParams && + ruleId == other.ruleId && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams && + additionalBodyProperties == other.additionalBodyProperties + } + + override fun hashCode(): Int = + Objects.hash(ruleId, additionalHeaders, additionalQueryParams, additionalBodyProperties) + + override fun toString() = + "RuleDeleteParams{ruleId=$ruleId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/rules/RuleListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/rules/RuleListParams.kt new file mode 100644 index 00000000..e5fdd058 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/rules/RuleListParams.kt @@ -0,0 +1,1316 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.rules + +import com.fasterxml.jackson.annotation.JsonCreator +import com.openlayer.api.core.Enum +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.Params +import com.openlayer.api.core.http.Headers +import com.openlayer.api.core.http.QueryParams +import com.openlayer.api.core.toImmutable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * List the governance rules in a workspace. + * + * A rule is a single requirement Openlayer tracks. `platform` rules are evaluated automatically + * from the state of your workspace; `evidence` rules are satisfied by attaching evidence. A rule + * can belong to several frameworks at once, and rules that belong to none are returned too unless + * you pass `includeUnframed=false`. + * + * Pass `includeResults=true` to get each rule's compliance results inline instead of fetching them + * separately. + */ +class RuleListParams +private constructor( + private val workspaceId: String?, + private val asc: Boolean?, + private val assigneeId: String?, + private val deactivated: Boolean?, + private val enabledFrameworkOnly: Boolean?, + private val frameworkId: String?, + private val group: Group?, + private val includeResults: Boolean?, + private val includeUnframed: Boolean?, + private val page: Long?, + private val perPage: Long?, + private val projectId: String?, + private val scope: Scope?, + private val searchQuery: String?, + private val sortBy: SortBy?, + private val status: Status?, + private val tags: List?, + private val type: Type?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun workspaceId(): Optional = Optional.ofNullable(workspaceId) + + /** Whether to sort in ascending order. */ + fun asc(): Optional = Optional.ofNullable(asc) + + /** Only include rules assigned to this user. */ + fun assigneeId(): Optional = Optional.ofNullable(assigneeId) + + /** Only include rules that are deactivated (or active). */ + fun deactivated(): Optional = Optional.ofNullable(deactivated) + + /** Only include items belonging to at least one enabled framework. */ + fun enabledFrameworkOnly(): Optional = Optional.ofNullable(enabledFrameworkOnly) + + /** Only include items belonging to this framework. */ + fun frameworkId(): Optional = Optional.ofNullable(frameworkId) + + /** + * Only include rules in one bucket of the compliance workflow. `open` covers rules that still + * need attention, `done` covers rules that are fully satisfied, and `excluded` covers rules + * that have been deactivated. + */ + fun group(): Optional = Optional.ofNullable(group) + + /** Whether to include each rule's results inline, in a `results` array. */ + fun includeResults(): Optional = Optional.ofNullable(includeResults) + + /** Whether to include rules that are not part of any framework. */ + fun includeUnframed(): Optional = Optional.ofNullable(includeUnframed) + + /** The page to return in a paginated query. */ + fun page(): Optional = Optional.ofNullable(page) + + /** Maximum number of items to return per page. */ + fun perPage(): Optional = Optional.ofNullable(perPage) + + /** Only include items that apply to this project. */ + fun projectId(): Optional = Optional.ofNullable(projectId) + + /** Only include rules with this scope. */ + fun scope(): Optional = Optional.ofNullable(scope) + + /** Filter by a free-text search over names and descriptions. */ + fun searchQuery(): Optional = Optional.ofNullable(searchQuery) + + /** The field to sort on. */ + fun sortBy(): Optional = Optional.ofNullable(sortBy) + + /** Only include items whose rule result has this compliance status. */ + fun status(): Optional = Optional.ofNullable(status) + + /** + * Only include rules carrying all of these rule tags. Pass tag ids, which you can look up with + * [List rule tags](/api-reference/rest/governance/list-rule-tags). + */ + fun tags(): Optional> = Optional.ofNullable(tags) + + /** Only include rules of this type. */ + fun type(): Optional = Optional.ofNullable(type) + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): RuleListParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [RuleListParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [RuleListParams]. */ + class Builder internal constructor() { + + private var workspaceId: String? = null + private var asc: Boolean? = null + private var assigneeId: String? = null + private var deactivated: Boolean? = null + private var enabledFrameworkOnly: Boolean? = null + private var frameworkId: String? = null + private var group: Group? = null + private var includeResults: Boolean? = null + private var includeUnframed: Boolean? = null + private var page: Long? = null + private var perPage: Long? = null + private var projectId: String? = null + private var scope: Scope? = null + private var searchQuery: String? = null + private var sortBy: SortBy? = null + private var status: Status? = null + private var tags: MutableList? = null + private var type: Type? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(ruleListParams: RuleListParams) = apply { + workspaceId = ruleListParams.workspaceId + asc = ruleListParams.asc + assigneeId = ruleListParams.assigneeId + deactivated = ruleListParams.deactivated + enabledFrameworkOnly = ruleListParams.enabledFrameworkOnly + frameworkId = ruleListParams.frameworkId + group = ruleListParams.group + includeResults = ruleListParams.includeResults + includeUnframed = ruleListParams.includeUnframed + page = ruleListParams.page + perPage = ruleListParams.perPage + projectId = ruleListParams.projectId + scope = ruleListParams.scope + searchQuery = ruleListParams.searchQuery + sortBy = ruleListParams.sortBy + status = ruleListParams.status + tags = ruleListParams.tags?.toMutableList() + type = ruleListParams.type + additionalHeaders = ruleListParams.additionalHeaders.toBuilder() + additionalQueryParams = ruleListParams.additionalQueryParams.toBuilder() + } + + fun workspaceId(workspaceId: String?) = apply { this.workspaceId = workspaceId } + + /** Alias for calling [Builder.workspaceId] with `workspaceId.orElse(null)`. */ + fun workspaceId(workspaceId: Optional) = workspaceId(workspaceId.getOrNull()) + + /** Whether to sort in ascending order. */ + fun asc(asc: Boolean?) = apply { this.asc = asc } + + /** + * Alias for [Builder.asc]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun asc(asc: Boolean) = asc(asc as Boolean?) + + /** Alias for calling [Builder.asc] with `asc.orElse(null)`. */ + fun asc(asc: Optional) = asc(asc.getOrNull()) + + /** Only include rules assigned to this user. */ + fun assigneeId(assigneeId: String?) = apply { this.assigneeId = assigneeId } + + /** Alias for calling [Builder.assigneeId] with `assigneeId.orElse(null)`. */ + fun assigneeId(assigneeId: Optional) = assigneeId(assigneeId.getOrNull()) + + /** Only include rules that are deactivated (or active). */ + fun deactivated(deactivated: Boolean?) = apply { this.deactivated = deactivated } + + /** + * Alias for [Builder.deactivated]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun deactivated(deactivated: Boolean) = deactivated(deactivated as Boolean?) + + /** Alias for calling [Builder.deactivated] with `deactivated.orElse(null)`. */ + fun deactivated(deactivated: Optional) = deactivated(deactivated.getOrNull()) + + /** Only include items belonging to at least one enabled framework. */ + fun enabledFrameworkOnly(enabledFrameworkOnly: Boolean?) = apply { + this.enabledFrameworkOnly = enabledFrameworkOnly + } + + /** + * Alias for [Builder.enabledFrameworkOnly]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun enabledFrameworkOnly(enabledFrameworkOnly: Boolean) = + enabledFrameworkOnly(enabledFrameworkOnly as Boolean?) + + /** + * Alias for calling [Builder.enabledFrameworkOnly] with + * `enabledFrameworkOnly.orElse(null)`. + */ + fun enabledFrameworkOnly(enabledFrameworkOnly: Optional) = + enabledFrameworkOnly(enabledFrameworkOnly.getOrNull()) + + /** Only include items belonging to this framework. */ + fun frameworkId(frameworkId: String?) = apply { this.frameworkId = frameworkId } + + /** Alias for calling [Builder.frameworkId] with `frameworkId.orElse(null)`. */ + fun frameworkId(frameworkId: Optional) = frameworkId(frameworkId.getOrNull()) + + /** + * Only include rules in one bucket of the compliance workflow. `open` covers rules that + * still need attention, `done` covers rules that are fully satisfied, and `excluded` covers + * rules that have been deactivated. + */ + fun group(group: Group?) = apply { this.group = group } + + /** Alias for calling [Builder.group] with `group.orElse(null)`. */ + fun group(group: Optional) = group(group.getOrNull()) + + /** Whether to include each rule's results inline, in a `results` array. */ + fun includeResults(includeResults: Boolean?) = apply { + this.includeResults = includeResults + } + + /** + * Alias for [Builder.includeResults]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun includeResults(includeResults: Boolean) = includeResults(includeResults as Boolean?) + + /** Alias for calling [Builder.includeResults] with `includeResults.orElse(null)`. */ + fun includeResults(includeResults: Optional) = + includeResults(includeResults.getOrNull()) + + /** Whether to include rules that are not part of any framework. */ + fun includeUnframed(includeUnframed: Boolean?) = apply { + this.includeUnframed = includeUnframed + } + + /** + * Alias for [Builder.includeUnframed]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun includeUnframed(includeUnframed: Boolean) = includeUnframed(includeUnframed as Boolean?) + + /** Alias for calling [Builder.includeUnframed] with `includeUnframed.orElse(null)`. */ + fun includeUnframed(includeUnframed: Optional) = + includeUnframed(includeUnframed.getOrNull()) + + /** The page to return in a paginated query. */ + fun page(page: Long?) = apply { this.page = page } + + /** + * Alias for [Builder.page]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun page(page: Long) = page(page as Long?) + + /** Alias for calling [Builder.page] with `page.orElse(null)`. */ + fun page(page: Optional) = page(page.getOrNull()) + + /** Maximum number of items to return per page. */ + fun perPage(perPage: Long?) = apply { this.perPage = perPage } + + /** + * Alias for [Builder.perPage]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun perPage(perPage: Long) = perPage(perPage as Long?) + + /** Alias for calling [Builder.perPage] with `perPage.orElse(null)`. */ + fun perPage(perPage: Optional) = perPage(perPage.getOrNull()) + + /** Only include items that apply to this project. */ + fun projectId(projectId: String?) = apply { this.projectId = projectId } + + /** Alias for calling [Builder.projectId] with `projectId.orElse(null)`. */ + fun projectId(projectId: Optional) = projectId(projectId.getOrNull()) + + /** Only include rules with this scope. */ + fun scope(scope: Scope?) = apply { this.scope = scope } + + /** Alias for calling [Builder.scope] with `scope.orElse(null)`. */ + fun scope(scope: Optional) = scope(scope.getOrNull()) + + /** Filter by a free-text search over names and descriptions. */ + fun searchQuery(searchQuery: String?) = apply { this.searchQuery = searchQuery } + + /** Alias for calling [Builder.searchQuery] with `searchQuery.orElse(null)`. */ + fun searchQuery(searchQuery: Optional) = searchQuery(searchQuery.getOrNull()) + + /** The field to sort on. */ + fun sortBy(sortBy: SortBy?) = apply { this.sortBy = sortBy } + + /** Alias for calling [Builder.sortBy] with `sortBy.orElse(null)`. */ + fun sortBy(sortBy: Optional) = sortBy(sortBy.getOrNull()) + + /** Only include items whose rule result has this compliance status. */ + fun status(status: Status?) = apply { this.status = status } + + /** Alias for calling [Builder.status] with `status.orElse(null)`. */ + fun status(status: Optional) = status(status.getOrNull()) + + /** + * Only include rules carrying all of these rule tags. Pass tag ids, which you can look up + * with [List rule tags](/api-reference/rest/governance/list-rule-tags). + */ + fun tags(tags: List?) = apply { this.tags = tags?.toMutableList() } + + /** Alias for calling [Builder.tags] with `tags.orElse(null)`. */ + fun tags(tags: Optional>) = tags(tags.getOrNull()) + + /** + * Adds a single [String] to [tags]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addTag(tag: String) = apply { tags = (tags ?: mutableListOf()).apply { add(tag) } } + + /** Only include rules of this type. */ + fun type(type: Type?) = apply { this.type = type } + + /** Alias for calling [Builder.type] with `type.orElse(null)`. */ + fun type(type: Optional) = type(type.getOrNull()) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [RuleListParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): RuleListParams = + RuleListParams( + workspaceId, + asc, + assigneeId, + deactivated, + enabledFrameworkOnly, + frameworkId, + group, + includeResults, + includeUnframed, + page, + perPage, + projectId, + scope, + searchQuery, + sortBy, + status, + tags?.toImmutable(), + type, + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _pathParam(index: Int): String = + when (index) { + 0 -> workspaceId ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + asc?.let { put("asc", it.toString()) } + assigneeId?.let { put("assigneeId", it) } + deactivated?.let { put("deactivated", it.toString()) } + enabledFrameworkOnly?.let { put("enabledFrameworkOnly", it.toString()) } + frameworkId?.let { put("frameworkId", it) } + group?.let { put("group", it.toString()) } + includeResults?.let { put("includeResults", it.toString()) } + includeUnframed?.let { put("includeUnframed", it.toString()) } + page?.let { put("page", it.toString()) } + perPage?.let { put("perPage", it.toString()) } + projectId?.let { put("projectId", it) } + scope?.let { put("scope", it.toString()) } + searchQuery?.let { put("searchQuery", it) } + sortBy?.let { put("sortBy", it.toString()) } + status?.let { put("status", it.toString()) } + tags?.let { put("tags", it.joinToString(",")) } + type?.let { put("type", it.toString()) } + putAll(additionalQueryParams) + } + .build() + + /** + * Only include rules in one bucket of the compliance workflow. `open` covers rules that still + * need attention, `done` covers rules that are fully satisfied, and `excluded` covers rules + * that have been deactivated. + */ + class Group @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val OPEN = of("open") + + @JvmField val EXCLUDED = of("excluded") + + @JvmField val DONE = of("done") + + @JvmStatic fun of(value: String) = Group(JsonField.of(value)) + } + + /** An enum containing [Group]'s known values. */ + enum class Known { + OPEN, + EXCLUDED, + DONE, + } + + /** + * An enum containing [Group]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Group] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + OPEN, + EXCLUDED, + DONE, + /** An enum member indicating that [Group] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + OPEN -> Value.OPEN + EXCLUDED -> Value.EXCLUDED + DONE -> Value.DONE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + OPEN -> Known.OPEN + EXCLUDED -> Known.EXCLUDED + DONE -> Known.DONE + else -> throw OpenlayerInvalidDataException("Unknown Group: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Group = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Group && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Only include rules with this scope. */ + class Scope @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val PROJECT = of("project") + + @JvmField val WORKSPACE = of("workspace") + + @JvmStatic fun of(value: String) = Scope(JsonField.of(value)) + } + + /** An enum containing [Scope]'s known values. */ + enum class Known { + PROJECT, + WORKSPACE, + } + + /** + * An enum containing [Scope]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Scope] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + PROJECT, + WORKSPACE, + /** An enum member indicating that [Scope] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + PROJECT -> Value.PROJECT + WORKSPACE -> Value.WORKSPACE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + PROJECT -> Known.PROJECT + WORKSPACE -> Known.WORKSPACE + else -> throw OpenlayerInvalidDataException("Unknown Scope: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Scope = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Scope && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** The field to sort on. */ + class SortBy @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val NAME = of("name") + + @JvmField val STATUS = of("status") + + @JvmField val FRAMEWORKS = of("frameworks") + + @JvmField val SCOPE = of("scope") + + @JvmField val DATE_CREATED = of("dateCreated") + + @JvmStatic fun of(value: String) = SortBy(JsonField.of(value)) + } + + /** An enum containing [SortBy]'s known values. */ + enum class Known { + NAME, + STATUS, + FRAMEWORKS, + SCOPE, + DATE_CREATED, + } + + /** + * An enum containing [SortBy]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [SortBy] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + NAME, + STATUS, + FRAMEWORKS, + SCOPE, + DATE_CREATED, + /** An enum member indicating that [SortBy] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + NAME -> Value.NAME + STATUS -> Value.STATUS + FRAMEWORKS -> Value.FRAMEWORKS + SCOPE -> Value.SCOPE + DATE_CREATED -> Value.DATE_CREATED + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + NAME -> Known.NAME + STATUS -> Known.STATUS + FRAMEWORKS -> Known.FRAMEWORKS + SCOPE -> Known.SCOPE + DATE_CREATED -> Known.DATE_CREATED + else -> throw OpenlayerInvalidDataException("Unknown SortBy: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): SortBy = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SortBy && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Only include items whose rule result has this compliance status. */ + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val RUNNING = of("running") + + @JvmField val PASSING = of("passing") + + @JvmField val FAILING = of("failing") + + @JvmField val SKIPPED = of("skipped") + + @JvmField val ERROR = of("error") + + @JvmField val PENDING = of("pending") + + @JvmField val DUE_SOON = of("due_soon") + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + /** An enum containing [Status]'s known values. */ + enum class Known { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + } + + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + /** An enum member indicating that [Status] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + PENDING -> Value.PENDING + DUE_SOON -> Value.DUE_SOON + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + PENDING -> Known.PENDING + DUE_SOON -> Known.DUE_SOON + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Only include rules of this type. */ + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val PLATFORM = of("platform") + + @JvmField val EVIDENCE = of("evidence") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + PLATFORM, + EVIDENCE, + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + PLATFORM, + EVIDENCE, + /** An enum member indicating that [Type] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + PLATFORM -> Value.PLATFORM + EVIDENCE -> Value.EVIDENCE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + PLATFORM -> Known.PLATFORM + EVIDENCE -> Known.EVIDENCE + else -> throw OpenlayerInvalidDataException("Unknown Type: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is RuleListParams && + workspaceId == other.workspaceId && + asc == other.asc && + assigneeId == other.assigneeId && + deactivated == other.deactivated && + enabledFrameworkOnly == other.enabledFrameworkOnly && + frameworkId == other.frameworkId && + group == other.group && + includeResults == other.includeResults && + includeUnframed == other.includeUnframed && + page == other.page && + perPage == other.perPage && + projectId == other.projectId && + scope == other.scope && + searchQuery == other.searchQuery && + sortBy == other.sortBy && + status == other.status && + tags == other.tags && + type == other.type && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = + Objects.hash( + workspaceId, + asc, + assigneeId, + deactivated, + enabledFrameworkOnly, + frameworkId, + group, + includeResults, + includeUnframed, + page, + perPage, + projectId, + scope, + searchQuery, + sortBy, + status, + tags, + type, + additionalHeaders, + additionalQueryParams, + ) + + override fun toString() = + "RuleListParams{workspaceId=$workspaceId, asc=$asc, assigneeId=$assigneeId, deactivated=$deactivated, enabledFrameworkOnly=$enabledFrameworkOnly, frameworkId=$frameworkId, group=$group, includeResults=$includeResults, includeUnframed=$includeUnframed, page=$page, perPage=$perPage, projectId=$projectId, scope=$scope, searchQuery=$searchQuery, sortBy=$sortBy, status=$status, tags=$tags, type=$type, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/rules/RuleListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/rules/RuleListResponse.kt new file mode 100644 index 00000000..3647927a --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/rules/RuleListResponse.kt @@ -0,0 +1,5145 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.rules + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.openlayer.api.core.Enum +import com.openlayer.api.core.ExcludeMissing +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonMissing +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.checkKnown +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.toImmutable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.time.OffsetDateTime +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class RuleListResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val items: JsonField>, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("items") @ExcludeMissing items: JsonField> = JsonMissing.of() + ) : this(items, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun items(): List = items.getRequired("items") + + /** + * Returns the raw JSON value of [items]. + * + * Unlike [items], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("items") @ExcludeMissing fun _items(): JsonField> = items + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [RuleListResponse]. + * + * The following fields are required: + * ```java + * .items() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [RuleListResponse]. */ + class Builder internal constructor() { + + private var items: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(ruleListResponse: RuleListResponse) = apply { + items = ruleListResponse.items.map { it.toMutableList() } + additionalProperties = ruleListResponse.additionalProperties.toMutableMap() + } + + fun items(items: List) = items(JsonField.of(items)) + + /** + * Sets [Builder.items] to an arbitrary JSON value. + * + * You should usually call [Builder.items] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun items(items: JsonField>) = apply { + this.items = items.map { it.toMutableList() } + } + + /** + * Adds a single [Item] to [items]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addItem(item: Item) = apply { + items = + (items ?: JsonField.of(mutableListOf())).also { checkKnown("items", it).add(item) } + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [RuleListResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .items() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): RuleListResponse = + RuleListResponse( + checkRequired("items", items).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): RuleListResponse = apply { + if (validated) { + return@apply + } + + items().forEach { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (items.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + class Item + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val name: JsonField, + private val scope: JsonField, + private val type: JsonField, + private val workspaceId: JsonField, + private val assigneeId: JsonField, + private val automationParams: JsonField, + private val automationType: JsonField, + private val deactivated: JsonField, + private val description: JsonField, + private val evidenceType: JsonField, + private val frameworks: JsonField>, + private val immutable: JsonField, + private val renewalCadenceDays: JsonField, + private val results: JsonField>, + private val resultsSummary: JsonField, + private val tagIds: JsonField>, + private val tags: JsonField>, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("scope") @ExcludeMissing scope: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + @JsonProperty("assigneeId") + @ExcludeMissing + assigneeId: JsonField = JsonMissing.of(), + @JsonProperty("automationParams") + @ExcludeMissing + automationParams: JsonField = JsonMissing.of(), + @JsonProperty("automationType") + @ExcludeMissing + automationType: JsonField = JsonMissing.of(), + @JsonProperty("deactivated") + @ExcludeMissing + deactivated: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + description: JsonField = JsonMissing.of(), + @JsonProperty("evidenceType") + @ExcludeMissing + evidenceType: JsonField = JsonMissing.of(), + @JsonProperty("frameworks") + @ExcludeMissing + frameworks: JsonField> = JsonMissing.of(), + @JsonProperty("immutable") + @ExcludeMissing + immutable: JsonField = JsonMissing.of(), + @JsonProperty("renewalCadenceDays") + @ExcludeMissing + renewalCadenceDays: JsonField = JsonMissing.of(), + @JsonProperty("results") + @ExcludeMissing + results: JsonField> = JsonMissing.of(), + @JsonProperty("resultsSummary") + @ExcludeMissing + resultsSummary: JsonField = JsonMissing.of(), + @JsonProperty("tagIds") + @ExcludeMissing + tagIds: JsonField> = JsonMissing.of(), + @JsonProperty("tags") @ExcludeMissing tags: JsonField> = JsonMissing.of(), + ) : this( + id, + dateCreated, + dateUpdated, + name, + scope, + type, + workspaceId, + assigneeId, + automationParams, + automationType, + deactivated, + description, + evidenceType, + frameworks, + immutable, + renewalCadenceDays, + results, + resultsSummary, + tagIds, + tags, + mutableMapOf(), + ) + + /** + * The rule id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun id(): String = id.getRequired("id") + + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** + * The last update date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** + * The rule name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun name(): String = name.getRequired("name") + + /** + * Whether the rule is evaluated once for the whole workspace, or once per project the + * rule's frameworks apply to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun scope(): Scope = scope.getRequired("scope") + + /** + * `platform` rules are evaluated automatically from the state of your Openlayer workspace. + * `evidence` rules are satisfied by attaching evidence. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun type(): Type = type.getRequired("type") + + /** + * The id of the workspace the rule belongs to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun workspaceId(): String = workspaceId.getRequired("workspaceId") + + /** + * The user responsible for satisfying the rule. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun assigneeId(): Optional = assigneeId.getOptional("assigneeId") + + /** + * Configuration for the platform check, when the automation takes parameters. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun automationParams(): Optional = + automationParams.getOptional("automationParams") + + /** + * Which workspace signal a platform rule checks, for example `monitoring_mode_enabled`, + * `test_setup`, or `project_owner_set`. `null` for evidence rules. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun automationType(): Optional = automationType.getOptional("automationType") + + /** + * Whether the rule is excluded from compliance calculations. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun deactivated(): Optional = deactivated.getOptional("deactivated") + + /** + * What the rule requires. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun description(): Optional = description.getOptional("description") + + /** + * The kind of evidence that satisfies the rule. `null` for platform rules. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun evidenceType(): Optional = evidenceType.getOptional("evidenceType") + + /** + * The frameworks that include this rule. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun frameworks(): Optional> = frameworks.getOptional("frameworks") + + /** + * Whether the rule is managed by Openlayer and cannot be edited. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun immutable(): Optional = immutable.getOptional("immutable") + + /** + * How often evidence must be renewed, in days. Once evidence is older than this, the rule + * result becomes `due_soon` and then `failing`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun renewalCadenceDays(): Optional = + renewalCadenceDays.getOptional("renewalCadenceDays") + + /** + * The rule's results, one per entity the rule is evaluated against. Only returned when + * `includeResults` is `true`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun results(): Optional> = results.getOptional("results") + + /** + * Pass-rate counts across all of the rule's entities, independent of any status filter + * applied to the request. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun resultsSummary(): Optional = + resultsSummary.getOptional("resultsSummary") + + /** + * The ids of the rule tags to associate with the rule. Replaces the rule's tags. Read them + * back from `tags`, and list the tags available in the workspace with `GET + * /workspaces/{workspaceId}/rule-tags`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun tagIds(): Optional> = tagIds.getOptional("tagIds") + + /** + * The rule tags associated with the rule. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun tags(): Optional> = tags.getOptional("tags") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [scope]. + * + * Unlike [scope], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("scope") @ExcludeMissing fun _scope(): JsonField = scope + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + /** + * Returns the raw JSON value of [workspaceId]. + * + * Unlike [workspaceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("workspaceId") + @ExcludeMissing + fun _workspaceId(): JsonField = workspaceId + + /** + * Returns the raw JSON value of [assigneeId]. + * + * Unlike [assigneeId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("assigneeId") + @ExcludeMissing + fun _assigneeId(): JsonField = assigneeId + + /** + * Returns the raw JSON value of [automationParams]. + * + * Unlike [automationParams], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("automationParams") + @ExcludeMissing + fun _automationParams(): JsonField = automationParams + + /** + * Returns the raw JSON value of [automationType]. + * + * Unlike [automationType], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("automationType") + @ExcludeMissing + fun _automationType(): JsonField = automationType + + /** + * Returns the raw JSON value of [deactivated]. + * + * Unlike [deactivated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("deactivated") + @ExcludeMissing + fun _deactivated(): JsonField = deactivated + + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("description") + @ExcludeMissing + fun _description(): JsonField = description + + /** + * Returns the raw JSON value of [evidenceType]. + * + * Unlike [evidenceType], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("evidenceType") + @ExcludeMissing + fun _evidenceType(): JsonField = evidenceType + + /** + * Returns the raw JSON value of [frameworks]. + * + * Unlike [frameworks], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("frameworks") + @ExcludeMissing + fun _frameworks(): JsonField> = frameworks + + /** + * Returns the raw JSON value of [immutable]. + * + * Unlike [immutable], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("immutable") @ExcludeMissing fun _immutable(): JsonField = immutable + + /** + * Returns the raw JSON value of [renewalCadenceDays]. + * + * Unlike [renewalCadenceDays], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("renewalCadenceDays") + @ExcludeMissing + fun _renewalCadenceDays(): JsonField = renewalCadenceDays + + /** + * Returns the raw JSON value of [results]. + * + * Unlike [results], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("results") @ExcludeMissing fun _results(): JsonField> = results + + /** + * Returns the raw JSON value of [resultsSummary]. + * + * Unlike [resultsSummary], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("resultsSummary") + @ExcludeMissing + fun _resultsSummary(): JsonField = resultsSummary + + /** + * Returns the raw JSON value of [tagIds]. + * + * Unlike [tagIds], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("tagIds") @ExcludeMissing fun _tagIds(): JsonField> = tagIds + + /** + * Returns the raw JSON value of [tags]. + * + * Unlike [tags], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("tags") @ExcludeMissing fun _tags(): JsonField> = tags + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Item]. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateUpdated() + * .name() + * .scope() + * .type() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Item]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var name: JsonField? = null + private var scope: JsonField? = null + private var type: JsonField? = null + private var workspaceId: JsonField? = null + private var assigneeId: JsonField = JsonMissing.of() + private var automationParams: JsonField = JsonMissing.of() + private var automationType: JsonField = JsonMissing.of() + private var deactivated: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var evidenceType: JsonField = JsonMissing.of() + private var frameworks: JsonField>? = null + private var immutable: JsonField = JsonMissing.of() + private var renewalCadenceDays: JsonField = JsonMissing.of() + private var results: JsonField>? = null + private var resultsSummary: JsonField = JsonMissing.of() + private var tagIds: JsonField>? = null + private var tags: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(item: Item) = apply { + id = item.id + dateCreated = item.dateCreated + dateUpdated = item.dateUpdated + name = item.name + scope = item.scope + type = item.type + workspaceId = item.workspaceId + assigneeId = item.assigneeId + automationParams = item.automationParams + automationType = item.automationType + deactivated = item.deactivated + description = item.description + evidenceType = item.evidenceType + frameworks = item.frameworks.map { it.toMutableList() } + immutable = item.immutable + renewalCadenceDays = item.renewalCadenceDays + results = item.results.map { it.toMutableList() } + resultsSummary = item.resultsSummary + tagIds = item.tagIds.map { it.toMutableList() } + tags = item.tags.map { it.toMutableList() } + additionalProperties = item.additionalProperties.toMutableMap() + } + + /** The rule id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The last update date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** The rule name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun name(name: JsonField) = apply { this.name = name } + + /** + * Whether the rule is evaluated once for the whole workspace, or once per project the + * rule's frameworks apply to. + */ + fun scope(scope: Scope) = scope(JsonField.of(scope)) + + /** + * Sets [Builder.scope] to an arbitrary JSON value. + * + * You should usually call [Builder.scope] with a well-typed [Scope] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun scope(scope: JsonField) = apply { this.scope = scope } + + /** + * `platform` rules are evaluated automatically from the state of your Openlayer + * workspace. `evidence` rules are satisfied by attaching evidence. + */ + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun type(type: JsonField) = apply { this.type = type } + + /** The id of the workspace the rule belongs to. */ + fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) + + /** + * Sets [Builder.workspaceId] to an arbitrary JSON value. + * + * You should usually call [Builder.workspaceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun workspaceId(workspaceId: JsonField) = apply { + this.workspaceId = workspaceId + } + + /** The user responsible for satisfying the rule. */ + fun assigneeId(assigneeId: String?) = assigneeId(JsonField.ofNullable(assigneeId)) + + /** Alias for calling [Builder.assigneeId] with `assigneeId.orElse(null)`. */ + fun assigneeId(assigneeId: Optional) = assigneeId(assigneeId.getOrNull()) + + /** + * Sets [Builder.assigneeId] to an arbitrary JSON value. + * + * You should usually call [Builder.assigneeId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun assigneeId(assigneeId: JsonField) = apply { this.assigneeId = assigneeId } + + /** Configuration for the platform check, when the automation takes parameters. */ + fun automationParams(automationParams: AutomationParams?) = + automationParams(JsonField.ofNullable(automationParams)) + + /** + * Alias for calling [Builder.automationParams] with `automationParams.orElse(null)`. + */ + fun automationParams(automationParams: Optional) = + automationParams(automationParams.getOrNull()) + + /** + * Sets [Builder.automationParams] to an arbitrary JSON value. + * + * You should usually call [Builder.automationParams] with a well-typed + * [AutomationParams] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun automationParams(automationParams: JsonField) = apply { + this.automationParams = automationParams + } + + /** + * Which workspace signal a platform rule checks, for example `monitoring_mode_enabled`, + * `test_setup`, or `project_owner_set`. `null` for evidence rules. + */ + fun automationType(automationType: String?) = + automationType(JsonField.ofNullable(automationType)) + + /** Alias for calling [Builder.automationType] with `automationType.orElse(null)`. */ + fun automationType(automationType: Optional) = + automationType(automationType.getOrNull()) + + /** + * Sets [Builder.automationType] to an arbitrary JSON value. + * + * You should usually call [Builder.automationType] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun automationType(automationType: JsonField) = apply { + this.automationType = automationType + } + + /** Whether the rule is excluded from compliance calculations. */ + fun deactivated(deactivated: Boolean) = deactivated(JsonField.of(deactivated)) + + /** + * Sets [Builder.deactivated] to an arbitrary JSON value. + * + * You should usually call [Builder.deactivated] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun deactivated(deactivated: JsonField) = apply { + this.deactivated = deactivated + } + + /** What the rule requires. */ + fun description(description: String?) = description(JsonField.ofNullable(description)) + + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ + fun description(description: Optional) = description(description.getOrNull()) + + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun description(description: JsonField) = apply { + this.description = description + } + + /** The kind of evidence that satisfies the rule. `null` for platform rules. */ + fun evidenceType(evidenceType: EvidenceType?) = + evidenceType(JsonField.ofNullable(evidenceType)) + + /** Alias for calling [Builder.evidenceType] with `evidenceType.orElse(null)`. */ + fun evidenceType(evidenceType: Optional) = + evidenceType(evidenceType.getOrNull()) + + /** + * Sets [Builder.evidenceType] to an arbitrary JSON value. + * + * You should usually call [Builder.evidenceType] with a well-typed [EvidenceType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun evidenceType(evidenceType: JsonField) = apply { + this.evidenceType = evidenceType + } + + /** The frameworks that include this rule. */ + fun frameworks(frameworks: List) = frameworks(JsonField.of(frameworks)) + + /** + * Sets [Builder.frameworks] to an arbitrary JSON value. + * + * You should usually call [Builder.frameworks] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun frameworks(frameworks: JsonField>) = apply { + this.frameworks = frameworks.map { it.toMutableList() } + } + + /** + * Adds a single [Framework] to [frameworks]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addFramework(framework: Framework) = apply { + frameworks = + (frameworks ?: JsonField.of(mutableListOf())).also { + checkKnown("frameworks", it).add(framework) + } + } + + /** Whether the rule is managed by Openlayer and cannot be edited. */ + fun immutable(immutable: Boolean) = immutable(JsonField.of(immutable)) + + /** + * Sets [Builder.immutable] to an arbitrary JSON value. + * + * You should usually call [Builder.immutable] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun immutable(immutable: JsonField) = apply { this.immutable = immutable } + + /** + * How often evidence must be renewed, in days. Once evidence is older than this, the + * rule result becomes `due_soon` and then `failing`. + */ + fun renewalCadenceDays(renewalCadenceDays: Long?) = + renewalCadenceDays(JsonField.ofNullable(renewalCadenceDays)) + + /** + * Alias for [Builder.renewalCadenceDays]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun renewalCadenceDays(renewalCadenceDays: Long) = + renewalCadenceDays(renewalCadenceDays as Long?) + + /** + * Alias for calling [Builder.renewalCadenceDays] with + * `renewalCadenceDays.orElse(null)`. + */ + fun renewalCadenceDays(renewalCadenceDays: Optional) = + renewalCadenceDays(renewalCadenceDays.getOrNull()) + + /** + * Sets [Builder.renewalCadenceDays] to an arbitrary JSON value. + * + * You should usually call [Builder.renewalCadenceDays] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun renewalCadenceDays(renewalCadenceDays: JsonField) = apply { + this.renewalCadenceDays = renewalCadenceDays + } + + /** + * The rule's results, one per entity the rule is evaluated against. Only returned when + * `includeResults` is `true`. + */ + fun results(results: List) = results(JsonField.of(results)) + + /** + * Sets [Builder.results] to an arbitrary JSON value. + * + * You should usually call [Builder.results] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun results(results: JsonField>) = apply { + this.results = results.map { it.toMutableList() } + } + + /** + * Adds a single [Result] to [results]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addResult(result: Result) = apply { + results = + (results ?: JsonField.of(mutableListOf())).also { + checkKnown("results", it).add(result) + } + } + + /** + * Pass-rate counts across all of the rule's entities, independent of any status filter + * applied to the request. + */ + fun resultsSummary(resultsSummary: ResultsSummary?) = + resultsSummary(JsonField.ofNullable(resultsSummary)) + + /** Alias for calling [Builder.resultsSummary] with `resultsSummary.orElse(null)`. */ + fun resultsSummary(resultsSummary: Optional) = + resultsSummary(resultsSummary.getOrNull()) + + /** + * Sets [Builder.resultsSummary] to an arbitrary JSON value. + * + * You should usually call [Builder.resultsSummary] with a well-typed [ResultsSummary] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun resultsSummary(resultsSummary: JsonField) = apply { + this.resultsSummary = resultsSummary + } + + /** + * The ids of the rule tags to associate with the rule. Replaces the rule's tags. Read + * them back from `tags`, and list the tags available in the workspace with `GET + * /workspaces/{workspaceId}/rule-tags`. + */ + fun tagIds(tagIds: List?) = tagIds(JsonField.ofNullable(tagIds)) + + /** Alias for calling [Builder.tagIds] with `tagIds.orElse(null)`. */ + fun tagIds(tagIds: Optional>) = tagIds(tagIds.getOrNull()) + + /** + * Sets [Builder.tagIds] to an arbitrary JSON value. + * + * You should usually call [Builder.tagIds] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun tagIds(tagIds: JsonField>) = apply { + this.tagIds = tagIds.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [tagIds]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addTagId(tagId: String) = apply { + tagIds = + (tagIds ?: JsonField.of(mutableListOf())).also { + checkKnown("tagIds", it).add(tagId) + } + } + + /** The rule tags associated with the rule. */ + fun tags(tags: List?) = tags(JsonField.ofNullable(tags)) + + /** Alias for calling [Builder.tags] with `tags.orElse(null)`. */ + fun tags(tags: Optional>) = tags(tags.getOrNull()) + + /** + * Sets [Builder.tags] to an arbitrary JSON value. + * + * You should usually call [Builder.tags] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun tags(tags: JsonField>) = apply { + this.tags = tags.map { it.toMutableList() } + } + + /** + * Adds a single [Tag] to [tags]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addTag(tag: Tag) = apply { + tags = + (tags ?: JsonField.of(mutableListOf())).also { checkKnown("tags", it).add(tag) } + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Item]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateUpdated() + * .name() + * .scope() + * .type() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Item = + Item( + checkRequired("id", id), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("name", name), + checkRequired("scope", scope), + checkRequired("type", type), + checkRequired("workspaceId", workspaceId), + assigneeId, + automationParams, + automationType, + deactivated, + description, + evidenceType, + (frameworks ?: JsonMissing.of()).map { it.toImmutable() }, + immutable, + renewalCadenceDays, + (results ?: JsonMissing.of()).map { it.toImmutable() }, + resultsSummary, + (tagIds ?: JsonMissing.of()).map { it.toImmutable() }, + (tags ?: JsonMissing.of()).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Item = apply { + if (validated) { + return@apply + } + + id() + dateCreated() + dateUpdated() + name() + scope().validate() + type().validate() + workspaceId() + assigneeId() + automationParams().ifPresent { it.validate() } + automationType() + deactivated() + description() + evidenceType().ifPresent { it.validate() } + frameworks().ifPresent { it.forEach { it.validate() } } + immutable() + renewalCadenceDays() + results().ifPresent { it.forEach { it.validate() } } + resultsSummary().ifPresent { it.validate() } + tagIds() + tags().ifPresent { it.forEach { it.validate() } } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (scope.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + (if (assigneeId.asKnown().isPresent) 1 else 0) + + (automationParams.asKnown().getOrNull()?.validity() ?: 0) + + (if (automationType.asKnown().isPresent) 1 else 0) + + (if (deactivated.asKnown().isPresent) 1 else 0) + + (if (description.asKnown().isPresent) 1 else 0) + + (evidenceType.asKnown().getOrNull()?.validity() ?: 0) + + (frameworks.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (immutable.asKnown().isPresent) 1 else 0) + + (if (renewalCadenceDays.asKnown().isPresent) 1 else 0) + + (results.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (resultsSummary.asKnown().getOrNull()?.validity() ?: 0) + + (tagIds.asKnown().getOrNull()?.size ?: 0) + + (tags.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + /** + * Whether the rule is evaluated once for the whole workspace, or once per project the + * rule's frameworks apply to. + */ + class Scope @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val PROJECT = of("project") + + @JvmField val WORKSPACE = of("workspace") + + @JvmStatic fun of(value: String) = Scope(JsonField.of(value)) + } + + /** An enum containing [Scope]'s known values. */ + enum class Known { + PROJECT, + WORKSPACE, + } + + /** + * An enum containing [Scope]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Scope] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + PROJECT, + WORKSPACE, + /** + * An enum member indicating that [Scope] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + PROJECT -> Value.PROJECT + WORKSPACE -> Value.WORKSPACE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + PROJECT -> Known.PROJECT + WORKSPACE -> Known.WORKSPACE + else -> throw OpenlayerInvalidDataException("Unknown Scope: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Scope = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Scope && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** + * `platform` rules are evaluated automatically from the state of your Openlayer workspace. + * `evidence` rules are satisfied by attaching evidence. + */ + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val PLATFORM = of("platform") + + @JvmField val EVIDENCE = of("evidence") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + PLATFORM, + EVIDENCE, + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + PLATFORM, + EVIDENCE, + /** An enum member indicating that [Type] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + PLATFORM -> Value.PLATFORM + EVIDENCE -> Value.EVIDENCE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + PLATFORM -> Known.PLATFORM + EVIDENCE -> Known.EVIDENCE + else -> throw OpenlayerInvalidDataException("Unknown Type: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Configuration for the platform check, when the automation takes parameters. */ + class AutomationParams + @JsonCreator + private constructor( + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [AutomationParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [AutomationParams]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(automationParams: AutomationParams) = apply { + additionalProperties = automationParams.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [AutomationParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): AutomationParams = AutomationParams(additionalProperties.toImmutable()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): AutomationParams = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is AutomationParams && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = "AutomationParams{additionalProperties=$additionalProperties}" + } + + /** The kind of evidence that satisfies the rule. `null` for platform rules. */ + class EvidenceType @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val DOCUMENT = of("document") + + @JvmField val TEXT = of("text") + + @JvmField val URL = of("url") + + @JvmField val CATEGORY_VALUE = of("categoryValue") + + @JvmStatic fun of(value: String) = EvidenceType(JsonField.of(value)) + } + + /** An enum containing [EvidenceType]'s known values. */ + enum class Known { + DOCUMENT, + TEXT, + URL, + CATEGORY_VALUE, + } + + /** + * An enum containing [EvidenceType]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [EvidenceType] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DOCUMENT, + TEXT, + URL, + CATEGORY_VALUE, + /** + * An enum member indicating that [EvidenceType] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DOCUMENT -> Value.DOCUMENT + TEXT -> Value.TEXT + URL -> Value.URL + CATEGORY_VALUE -> Value.CATEGORY_VALUE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + DOCUMENT -> Known.DOCUMENT + TEXT -> Known.TEXT + URL -> Known.URL + CATEGORY_VALUE -> Known.CATEGORY_VALUE + else -> throw OpenlayerInvalidDataException("Unknown EvidenceType: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): EvidenceType = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is EvidenceType && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + class Framework + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val avatar: JsonField, + private val builtInSlug: JsonField, + private val enabled: JsonField, + private val name: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("avatar") + @ExcludeMissing + avatar: JsonField = JsonMissing.of(), + @JsonProperty("builtInSlug") + @ExcludeMissing + builtInSlug: JsonField = JsonMissing.of(), + @JsonProperty("enabled") + @ExcludeMissing + enabled: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + ) : this(id, avatar, builtInSlug, enabled, name, mutableMapOf()) + + /** + * The framework id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun id(): String = id.getRequired("id") + + /** + * The icon shown for the framework. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun avatar(): Optional = avatar.getOptional("avatar") + + /** + * Identifies a framework that ships with Openlayer, for example `eu_ai_act`, + * `iso_42001`, `nist_ai_rmf`, or `traiga`. `null` for frameworks you create yourself. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun builtInSlug(): Optional = builtInSlug.getOptional("builtInSlug") + + /** + * Whether the framework is active. Rules of a disabled framework are not evaluated and + * do not count towards compliance. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun enabled(): Boolean = enabled.getRequired("enabled") + + /** + * The framework name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun name(): String = name.getRequired("name") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [avatar]. + * + * Unlike [avatar], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("avatar") @ExcludeMissing fun _avatar(): JsonField = avatar + + /** + * Returns the raw JSON value of [builtInSlug]. + * + * Unlike [builtInSlug], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("builtInSlug") + @ExcludeMissing + fun _builtInSlug(): JsonField = builtInSlug + + /** + * Returns the raw JSON value of [enabled]. + * + * Unlike [enabled], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("enabled") @ExcludeMissing fun _enabled(): JsonField = enabled + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Framework]. + * + * The following fields are required: + * ```java + * .id() + * .avatar() + * .builtInSlug() + * .enabled() + * .name() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Framework]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var avatar: JsonField? = null + private var builtInSlug: JsonField? = null + private var enabled: JsonField? = null + private var name: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(framework: Framework) = apply { + id = framework.id + avatar = framework.avatar + builtInSlug = framework.builtInSlug + enabled = framework.enabled + name = framework.name + additionalProperties = framework.additionalProperties.toMutableMap() + } + + /** The framework id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The icon shown for the framework. */ + fun avatar(avatar: Avatar?) = avatar(JsonField.ofNullable(avatar)) + + /** Alias for calling [Builder.avatar] with `avatar.orElse(null)`. */ + fun avatar(avatar: Optional) = avatar(avatar.getOrNull()) + + /** + * Sets [Builder.avatar] to an arbitrary JSON value. + * + * You should usually call [Builder.avatar] with a well-typed [Avatar] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun avatar(avatar: JsonField) = apply { this.avatar = avatar } + + /** + * Identifies a framework that ships with Openlayer, for example `eu_ai_act`, + * `iso_42001`, `nist_ai_rmf`, or `traiga`. `null` for frameworks you create + * yourself. + */ + fun builtInSlug(builtInSlug: String?) = + builtInSlug(JsonField.ofNullable(builtInSlug)) + + /** Alias for calling [Builder.builtInSlug] with `builtInSlug.orElse(null)`. */ + fun builtInSlug(builtInSlug: Optional) = + builtInSlug(builtInSlug.getOrNull()) + + /** + * Sets [Builder.builtInSlug] to an arbitrary JSON value. + * + * You should usually call [Builder.builtInSlug] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun builtInSlug(builtInSlug: JsonField) = apply { + this.builtInSlug = builtInSlug + } + + /** + * Whether the framework is active. Rules of a disabled framework are not evaluated + * and do not count towards compliance. + */ + fun enabled(enabled: Boolean) = enabled(JsonField.of(enabled)) + + /** + * Sets [Builder.enabled] to an arbitrary JSON value. + * + * You should usually call [Builder.enabled] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun enabled(enabled: JsonField) = apply { this.enabled = enabled } + + /** The framework name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun name(name: JsonField) = apply { this.name = name } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Framework]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .avatar() + * .builtInSlug() + * .enabled() + * .name() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Framework = + Framework( + checkRequired("id", id), + checkRequired("avatar", avatar), + checkRequired("builtInSlug", builtInSlug), + checkRequired("enabled", enabled), + checkRequired("name", name), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Framework = apply { + if (validated) { + return@apply + } + + id() + avatar().ifPresent { it.validate() } + builtInSlug() + enabled() + name() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (avatar.asKnown().getOrNull()?.validity() ?: 0) + + (if (builtInSlug.asKnown().isPresent) 1 else 0) + + (if (enabled.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + /** The icon shown for the framework. */ + class Avatar + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val type: JsonField, + private val value: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("value") + @ExcludeMissing + value: JsonField = JsonMissing.of(), + ) : this(type, value, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun type(): Type = type.getRequired("type") + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun value(): String = value.getRequired("value") + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + /** + * Returns the raw JSON value of [value]. + * + * Unlike [value], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Avatar]. + * + * The following fields are required: + * ```java + * .type() + * .value() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Avatar]. */ + class Builder internal constructor() { + + private var type: JsonField? = null + private var value: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(avatar: Avatar) = apply { + type = avatar.type + value = avatar.value + additionalProperties = avatar.additionalProperties.toMutableMap() + } + + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun type(type: JsonField) = apply { this.type = type } + + fun value(value: String) = value(JsonField.of(value)) + + /** + * Sets [Builder.value] to an arbitrary JSON value. + * + * You should usually call [Builder.value] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun value(value: JsonField) = apply { this.value = value } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Avatar]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .type() + * .value() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Avatar = + Avatar( + checkRequired("type", type), + checkRequired("value", value), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): Avatar = apply { + if (validated) { + return@apply + } + + type().validate() + value() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (type.asKnown().getOrNull()?.validity() ?: 0) + + (if (value.asKnown().isPresent) 1 else 0) + + class Type @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val EMOJI = of("emoji") + + @JvmField val IMAGE_URL = of("imageUrl") + + @JvmField val BUILTIN_IMAGE = of("builtinImage") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + EMOJI, + IMAGE_URL, + BUILTIN_IMAGE, + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + EMOJI, + IMAGE_URL, + BUILTIN_IMAGE, + /** + * An enum member indicating that [Type] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + EMOJI -> Value.EMOJI + IMAGE_URL -> Value.IMAGE_URL + BUILTIN_IMAGE -> Value.BUILTIN_IMAGE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + EMOJI -> Known.EMOJI + IMAGE_URL -> Known.IMAGE_URL + BUILTIN_IMAGE -> Known.BUILTIN_IMAGE + else -> throw OpenlayerInvalidDataException("Unknown Type: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object + * doesn't match its expected type. + */ + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Avatar && + type == other.type && + value == other.value && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(type, value, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Avatar{type=$type, value=$value, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Framework && + id == other.id && + avatar == other.avatar && + builtInSlug == other.builtInSlug && + enabled == other.enabled && + name == other.name && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(id, avatar, builtInSlug, enabled, name, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Framework{id=$id, avatar=$avatar, builtInSlug=$builtInSlug, enabled=$enabled, name=$name, additionalProperties=$additionalProperties}" + } + + class Result + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val deactivated: JsonField, + private val ruleId: JsonField, + private val status: JsonField, + private val workspaceId: JsonField, + private val assigneeId: JsonField, + private val blockedBy: JsonField>, + private val blocking: JsonField>, + private val dateLastEvaluated: JsonField, + private val dateOfLatestEvidence: JsonField, + private val dateOfNextEvaluation: JsonField, + private val dateOfRenewal: JsonField, + private val deactivatedReason: JsonField, + private val projectId: JsonField, + private val statusMessage: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("deactivated") + @ExcludeMissing + deactivated: JsonField = JsonMissing.of(), + @JsonProperty("ruleId") + @ExcludeMissing + ruleId: JsonField = JsonMissing.of(), + @JsonProperty("status") + @ExcludeMissing + status: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + @JsonProperty("assigneeId") + @ExcludeMissing + assigneeId: JsonField = JsonMissing.of(), + @JsonProperty("blockedBy") + @ExcludeMissing + blockedBy: JsonField> = JsonMissing.of(), + @JsonProperty("blocking") + @ExcludeMissing + blocking: JsonField> = JsonMissing.of(), + @JsonProperty("dateLastEvaluated") + @ExcludeMissing + dateLastEvaluated: JsonField = JsonMissing.of(), + @JsonProperty("dateOfLatestEvidence") + @ExcludeMissing + dateOfLatestEvidence: JsonField = JsonMissing.of(), + @JsonProperty("dateOfNextEvaluation") + @ExcludeMissing + dateOfNextEvaluation: JsonField = JsonMissing.of(), + @JsonProperty("dateOfRenewal") + @ExcludeMissing + dateOfRenewal: JsonField = JsonMissing.of(), + @JsonProperty("deactivatedReason") + @ExcludeMissing + deactivatedReason: JsonField = JsonMissing.of(), + @JsonProperty("projectId") + @ExcludeMissing + projectId: JsonField = JsonMissing.of(), + @JsonProperty("statusMessage") + @ExcludeMissing + statusMessage: JsonField = JsonMissing.of(), + ) : this( + id, + dateCreated, + dateUpdated, + deactivated, + ruleId, + status, + workspaceId, + assigneeId, + blockedBy, + blocking, + dateLastEvaluated, + dateOfLatestEvidence, + dateOfNextEvaluation, + dateOfRenewal, + deactivatedReason, + projectId, + statusMessage, + mutableMapOf(), + ) + + /** + * The rule result id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun id(): String = id.getRequired("id") + + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** + * The last update date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** + * Whether this result is excluded from compliance calculations. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun deactivated(): Boolean = deactivated.getRequired("deactivated") + + /** + * The rule this result belongs to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun ruleId(): String = ruleId.getRequired("ruleId") + + /** + * The compliance status of the rule for this entity. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun status(): Status = status.getRequired("status") + + /** + * The id of the workspace the rule result belongs to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun workspaceId(): String = workspaceId.getRequired("workspaceId") + + /** + * The user responsible for this result. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun assigneeId(): Optional = assigneeId.getOptional("assigneeId") + + /** + * Rule results that must pass before this one can be satisfied. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun blockedBy(): Optional> = blockedBy.getOptional("blockedBy") + + /** + * Rule results that this one blocks. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun blocking(): Optional> = blocking.getOptional("blocking") + + /** + * When the rule was last evaluated. Platform rules only. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun dateLastEvaluated(): Optional = + dateLastEvaluated.getOptional("dateLastEvaluated") + + /** + * When the most recent piece of evidence was attached. Evidence rules only. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun dateOfLatestEvidence(): Optional = + dateOfLatestEvidence.getOptional("dateOfLatestEvidence") + + /** + * When the rule will next be evaluated. Platform rules only. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun dateOfNextEvaluation(): Optional = + dateOfNextEvaluation.getOptional("dateOfNextEvaluation") + + /** + * When the evidence must be renewed. Evidence rules with a renewal cadence only. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun dateOfRenewal(): Optional = + dateOfRenewal.getOptional("dateOfRenewal") + + /** + * Why the result was excluded. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun deactivatedReason(): Optional = + deactivatedReason.getOptional("deactivatedReason") + + /** + * The project this result was evaluated for. `null` for workspace-scoped rules. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun projectId(): Optional = projectId.getOptional("projectId") + + /** + * A human-readable explanation of the status. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun statusMessage(): Optional = statusMessage.getOptional("statusMessage") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** + * Returns the raw JSON value of [deactivated]. + * + * Unlike [deactivated], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("deactivated") + @ExcludeMissing + fun _deactivated(): JsonField = deactivated + + /** + * Returns the raw JSON value of [ruleId]. + * + * Unlike [ruleId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("ruleId") @ExcludeMissing fun _ruleId(): JsonField = ruleId + + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + + /** + * Returns the raw JSON value of [workspaceId]. + * + * Unlike [workspaceId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("workspaceId") + @ExcludeMissing + fun _workspaceId(): JsonField = workspaceId + + /** + * Returns the raw JSON value of [assigneeId]. + * + * Unlike [assigneeId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("assigneeId") + @ExcludeMissing + fun _assigneeId(): JsonField = assigneeId + + /** + * Returns the raw JSON value of [blockedBy]. + * + * Unlike [blockedBy], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("blockedBy") + @ExcludeMissing + fun _blockedBy(): JsonField> = blockedBy + + /** + * Returns the raw JSON value of [blocking]. + * + * Unlike [blocking], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("blocking") + @ExcludeMissing + fun _blocking(): JsonField> = blocking + + /** + * Returns the raw JSON value of [dateLastEvaluated]. + * + * Unlike [dateLastEvaluated], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("dateLastEvaluated") + @ExcludeMissing + fun _dateLastEvaluated(): JsonField = dateLastEvaluated + + /** + * Returns the raw JSON value of [dateOfLatestEvidence]. + * + * Unlike [dateOfLatestEvidence], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("dateOfLatestEvidence") + @ExcludeMissing + fun _dateOfLatestEvidence(): JsonField = dateOfLatestEvidence + + /** + * Returns the raw JSON value of [dateOfNextEvaluation]. + * + * Unlike [dateOfNextEvaluation], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("dateOfNextEvaluation") + @ExcludeMissing + fun _dateOfNextEvaluation(): JsonField = dateOfNextEvaluation + + /** + * Returns the raw JSON value of [dateOfRenewal]. + * + * Unlike [dateOfRenewal], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("dateOfRenewal") + @ExcludeMissing + fun _dateOfRenewal(): JsonField = dateOfRenewal + + /** + * Returns the raw JSON value of [deactivatedReason]. + * + * Unlike [deactivatedReason], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("deactivatedReason") + @ExcludeMissing + fun _deactivatedReason(): JsonField = deactivatedReason + + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("projectId") + @ExcludeMissing + fun _projectId(): JsonField = projectId + + /** + * Returns the raw JSON value of [statusMessage]. + * + * Unlike [statusMessage], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("statusMessage") + @ExcludeMissing + fun _statusMessage(): JsonField = statusMessage + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Result]. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateUpdated() + * .deactivated() + * .ruleId() + * .status() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Result]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var deactivated: JsonField? = null + private var ruleId: JsonField? = null + private var status: JsonField? = null + private var workspaceId: JsonField? = null + private var assigneeId: JsonField = JsonMissing.of() + private var blockedBy: JsonField>? = null + private var blocking: JsonField>? = null + private var dateLastEvaluated: JsonField = JsonMissing.of() + private var dateOfLatestEvidence: JsonField = JsonMissing.of() + private var dateOfNextEvaluation: JsonField = JsonMissing.of() + private var dateOfRenewal: JsonField = JsonMissing.of() + private var deactivatedReason: JsonField = JsonMissing.of() + private var projectId: JsonField = JsonMissing.of() + private var statusMessage: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(result: Result) = apply { + id = result.id + dateCreated = result.dateCreated + dateUpdated = result.dateUpdated + deactivated = result.deactivated + ruleId = result.ruleId + status = result.status + workspaceId = result.workspaceId + assigneeId = result.assigneeId + blockedBy = result.blockedBy.map { it.toMutableList() } + blocking = result.blocking.map { it.toMutableList() } + dateLastEvaluated = result.dateLastEvaluated + dateOfLatestEvidence = result.dateOfLatestEvidence + dateOfNextEvaluation = result.dateOfNextEvaluation + dateOfRenewal = result.dateOfRenewal + deactivatedReason = result.deactivatedReason + projectId = result.projectId + statusMessage = result.statusMessage + additionalProperties = result.additionalProperties.toMutableMap() + } + + /** The rule result id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = + dateCreated(JsonField.of(dateCreated)) + + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The last update date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = + dateUpdated(JsonField.of(dateUpdated)) + + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** Whether this result is excluded from compliance calculations. */ + fun deactivated(deactivated: Boolean) = deactivated(JsonField.of(deactivated)) + + /** + * Sets [Builder.deactivated] to an arbitrary JSON value. + * + * You should usually call [Builder.deactivated] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun deactivated(deactivated: JsonField) = apply { + this.deactivated = deactivated + } + + /** The rule this result belongs to. */ + fun ruleId(ruleId: String) = ruleId(JsonField.of(ruleId)) + + /** + * Sets [Builder.ruleId] to an arbitrary JSON value. + * + * You should usually call [Builder.ruleId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun ruleId(ruleId: JsonField) = apply { this.ruleId = ruleId } + + /** The compliance status of the rule for this entity. */ + fun status(status: Status) = status(JsonField.of(status)) + + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun status(status: JsonField) = apply { this.status = status } + + /** The id of the workspace the rule result belongs to. */ + fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) + + /** + * Sets [Builder.workspaceId] to an arbitrary JSON value. + * + * You should usually call [Builder.workspaceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun workspaceId(workspaceId: JsonField) = apply { + this.workspaceId = workspaceId + } + + /** The user responsible for this result. */ + fun assigneeId(assigneeId: String?) = assigneeId(JsonField.ofNullable(assigneeId)) + + /** Alias for calling [Builder.assigneeId] with `assigneeId.orElse(null)`. */ + fun assigneeId(assigneeId: Optional) = assigneeId(assigneeId.getOrNull()) + + /** + * Sets [Builder.assigneeId] to an arbitrary JSON value. + * + * You should usually call [Builder.assigneeId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun assigneeId(assigneeId: JsonField) = apply { + this.assigneeId = assigneeId + } + + /** Rule results that must pass before this one can be satisfied. */ + fun blockedBy(blockedBy: List) = blockedBy(JsonField.of(blockedBy)) + + /** + * Sets [Builder.blockedBy] to an arbitrary JSON value. + * + * You should usually call [Builder.blockedBy] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun blockedBy(blockedBy: JsonField>) = apply { + this.blockedBy = blockedBy.map { it.toMutableList() } + } + + /** + * Adds a single [BlockedBy] to [Builder.blockedBy]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addBlockedBy(blockedBy: BlockedBy) = apply { + this.blockedBy = + (this.blockedBy ?: JsonField.of(mutableListOf())).also { + checkKnown("blockedBy", it).add(blockedBy) + } + } + + /** Rule results that this one blocks. */ + fun blocking(blocking: List) = blocking(JsonField.of(blocking)) + + /** + * Sets [Builder.blocking] to an arbitrary JSON value. + * + * You should usually call [Builder.blocking] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun blocking(blocking: JsonField>) = apply { + this.blocking = blocking.map { it.toMutableList() } + } + + /** + * Adds a single [Blocking] to [Builder.blocking]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addBlocking(blocking: Blocking) = apply { + this.blocking = + (this.blocking ?: JsonField.of(mutableListOf())).also { + checkKnown("blocking", it).add(blocking) + } + } + + /** When the rule was last evaluated. Platform rules only. */ + fun dateLastEvaluated(dateLastEvaluated: OffsetDateTime?) = + dateLastEvaluated(JsonField.ofNullable(dateLastEvaluated)) + + /** + * Alias for calling [Builder.dateLastEvaluated] with + * `dateLastEvaluated.orElse(null)`. + */ + fun dateLastEvaluated(dateLastEvaluated: Optional) = + dateLastEvaluated(dateLastEvaluated.getOrNull()) + + /** + * Sets [Builder.dateLastEvaluated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateLastEvaluated] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun dateLastEvaluated(dateLastEvaluated: JsonField) = apply { + this.dateLastEvaluated = dateLastEvaluated + } + + /** When the most recent piece of evidence was attached. Evidence rules only. */ + fun dateOfLatestEvidence(dateOfLatestEvidence: OffsetDateTime?) = + dateOfLatestEvidence(JsonField.ofNullable(dateOfLatestEvidence)) + + /** + * Alias for calling [Builder.dateOfLatestEvidence] with + * `dateOfLatestEvidence.orElse(null)`. + */ + fun dateOfLatestEvidence(dateOfLatestEvidence: Optional) = + dateOfLatestEvidence(dateOfLatestEvidence.getOrNull()) + + /** + * Sets [Builder.dateOfLatestEvidence] to an arbitrary JSON value. + * + * You should usually call [Builder.dateOfLatestEvidence] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun dateOfLatestEvidence(dateOfLatestEvidence: JsonField) = apply { + this.dateOfLatestEvidence = dateOfLatestEvidence + } + + /** When the rule will next be evaluated. Platform rules only. */ + fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime?) = + dateOfNextEvaluation(JsonField.ofNullable(dateOfNextEvaluation)) + + /** + * Alias for calling [Builder.dateOfNextEvaluation] with + * `dateOfNextEvaluation.orElse(null)`. + */ + fun dateOfNextEvaluation(dateOfNextEvaluation: Optional) = + dateOfNextEvaluation(dateOfNextEvaluation.getOrNull()) + + /** + * Sets [Builder.dateOfNextEvaluation] to an arbitrary JSON value. + * + * You should usually call [Builder.dateOfNextEvaluation] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun dateOfNextEvaluation(dateOfNextEvaluation: JsonField) = apply { + this.dateOfNextEvaluation = dateOfNextEvaluation + } + + /** + * When the evidence must be renewed. Evidence rules with a renewal cadence only. + */ + fun dateOfRenewal(dateOfRenewal: OffsetDateTime?) = + dateOfRenewal(JsonField.ofNullable(dateOfRenewal)) + + /** Alias for calling [Builder.dateOfRenewal] with `dateOfRenewal.orElse(null)`. */ + fun dateOfRenewal(dateOfRenewal: Optional) = + dateOfRenewal(dateOfRenewal.getOrNull()) + + /** + * Sets [Builder.dateOfRenewal] to an arbitrary JSON value. + * + * You should usually call [Builder.dateOfRenewal] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun dateOfRenewal(dateOfRenewal: JsonField) = apply { + this.dateOfRenewal = dateOfRenewal + } + + /** Why the result was excluded. */ + fun deactivatedReason(deactivatedReason: String?) = + deactivatedReason(JsonField.ofNullable(deactivatedReason)) + + /** + * Alias for calling [Builder.deactivatedReason] with + * `deactivatedReason.orElse(null)`. + */ + fun deactivatedReason(deactivatedReason: Optional) = + deactivatedReason(deactivatedReason.getOrNull()) + + /** + * Sets [Builder.deactivatedReason] to an arbitrary JSON value. + * + * You should usually call [Builder.deactivatedReason] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun deactivatedReason(deactivatedReason: JsonField) = apply { + this.deactivatedReason = deactivatedReason + } + + /** The project this result was evaluated for. `null` for workspace-scoped rules. */ + fun projectId(projectId: String?) = projectId(JsonField.ofNullable(projectId)) + + /** Alias for calling [Builder.projectId] with `projectId.orElse(null)`. */ + fun projectId(projectId: Optional) = projectId(projectId.getOrNull()) + + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun projectId(projectId: JsonField) = apply { this.projectId = projectId } + + /** A human-readable explanation of the status. */ + fun statusMessage(statusMessage: String?) = + statusMessage(JsonField.ofNullable(statusMessage)) + + /** Alias for calling [Builder.statusMessage] with `statusMessage.orElse(null)`. */ + fun statusMessage(statusMessage: Optional) = + statusMessage(statusMessage.getOrNull()) + + /** + * Sets [Builder.statusMessage] to an arbitrary JSON value. + * + * You should usually call [Builder.statusMessage] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun statusMessage(statusMessage: JsonField) = apply { + this.statusMessage = statusMessage + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Result]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateUpdated() + * .deactivated() + * .ruleId() + * .status() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Result = + Result( + checkRequired("id", id), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("deactivated", deactivated), + checkRequired("ruleId", ruleId), + checkRequired("status", status), + checkRequired("workspaceId", workspaceId), + assigneeId, + (blockedBy ?: JsonMissing.of()).map { it.toImmutable() }, + (blocking ?: JsonMissing.of()).map { it.toImmutable() }, + dateLastEvaluated, + dateOfLatestEvidence, + dateOfNextEvaluation, + dateOfRenewal, + deactivatedReason, + projectId, + statusMessage, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Result = apply { + if (validated) { + return@apply + } + + id() + dateCreated() + dateUpdated() + deactivated() + ruleId() + status().validate() + workspaceId() + assigneeId() + blockedBy().ifPresent { it.forEach { it.validate() } } + blocking().ifPresent { it.forEach { it.validate() } } + dateLastEvaluated() + dateOfLatestEvidence() + dateOfNextEvaluation() + dateOfRenewal() + deactivatedReason() + projectId() + statusMessage() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (deactivated.asKnown().isPresent) 1 else 0) + + (if (ruleId.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + (if (assigneeId.asKnown().isPresent) 1 else 0) + + (blockedBy.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (blocking.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (dateLastEvaluated.asKnown().isPresent) 1 else 0) + + (if (dateOfLatestEvidence.asKnown().isPresent) 1 else 0) + + (if (dateOfNextEvaluation.asKnown().isPresent) 1 else 0) + + (if (dateOfRenewal.asKnown().isPresent) 1 else 0) + + (if (deactivatedReason.asKnown().isPresent) 1 else 0) + + (if (projectId.asKnown().isPresent) 1 else 0) + + (if (statusMessage.asKnown().isPresent) 1 else 0) + + /** The compliance status of the rule for this entity. */ + class Status @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val RUNNING = of("running") + + @JvmField val PASSING = of("passing") + + @JvmField val FAILING = of("failing") + + @JvmField val SKIPPED = of("skipped") + + @JvmField val ERROR = of("error") + + @JvmField val PENDING = of("pending") + + @JvmField val DUE_SOON = of("due_soon") + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + /** An enum containing [Status]'s known values. */ + enum class Known { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + } + + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + /** + * An enum member indicating that [Status] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + PENDING -> Value.PENDING + DUE_SOON -> Value.DUE_SOON + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + PENDING -> Known.PENDING + DUE_SOON -> Known.DUE_SOON + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + class BlockedBy + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val status: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("status") + @ExcludeMissing + status: JsonField = JsonMissing.of(), + ) : this(id, status, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun id(): Optional = id.getOptional("id") + + /** + * The compliance status of the rule for this entity. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun status(): Optional = status.getOptional("status") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [BlockedBy]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BlockedBy]. */ + class Builder internal constructor() { + + private var id: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(blockedBy: BlockedBy) = apply { + id = blockedBy.id + status = blockedBy.status + additionalProperties = blockedBy.additionalProperties.toMutableMap() + } + + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The compliance status of the rule for this entity. */ + fun status(status: Status) = status(JsonField.of(status)) + + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun status(status: JsonField) = apply { this.status = status } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [BlockedBy]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): BlockedBy = + BlockedBy(id, status, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): BlockedBy = apply { + if (validated) { + return@apply + } + + id() + status().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + /** The compliance status of the rule for this entity. */ + class Status + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val RUNNING = of("running") + + @JvmField val PASSING = of("passing") + + @JvmField val FAILING = of("failing") + + @JvmField val SKIPPED = of("skipped") + + @JvmField val ERROR = of("error") + + @JvmField val PENDING = of("pending") + + @JvmField val DUE_SOON = of("due_soon") + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + /** An enum containing [Status]'s known values. */ + enum class Known { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + } + + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + /** + * An enum member indicating that [Status] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + PENDING -> Value.PENDING + DUE_SOON -> Value.DUE_SOON + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + PENDING -> Known.PENDING + DUE_SOON -> Known.DUE_SOON + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object + * doesn't match its expected type. + */ + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is BlockedBy && + id == other.id && + status == other.status && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(id, status, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BlockedBy{id=$id, status=$status, additionalProperties=$additionalProperties}" + } + + class Blocking + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val status: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("status") + @ExcludeMissing + status: JsonField = JsonMissing.of(), + ) : this(id, status, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun id(): Optional = id.getOptional("id") + + /** + * The compliance status of the rule for this entity. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun status(): Optional = status.getOptional("status") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Blocking]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Blocking]. */ + class Builder internal constructor() { + + private var id: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(blocking: Blocking) = apply { + id = blocking.id + status = blocking.status + additionalProperties = blocking.additionalProperties.toMutableMap() + } + + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The compliance status of the rule for this entity. */ + fun status(status: Status) = status(JsonField.of(status)) + + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun status(status: JsonField) = apply { this.status = status } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Blocking]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Blocking = + Blocking(id, status, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): Blocking = apply { + if (validated) { + return@apply + } + + id() + status().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + /** The compliance status of the rule for this entity. */ + class Status + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val RUNNING = of("running") + + @JvmField val PASSING = of("passing") + + @JvmField val FAILING = of("failing") + + @JvmField val SKIPPED = of("skipped") + + @JvmField val ERROR = of("error") + + @JvmField val PENDING = of("pending") + + @JvmField val DUE_SOON = of("due_soon") + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + /** An enum containing [Status]'s known values. */ + enum class Known { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + } + + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + /** + * An enum member indicating that [Status] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + PENDING -> Value.PENDING + DUE_SOON -> Value.DUE_SOON + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known + * and don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not + * a known member. + */ + fun known(): Known = + when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + PENDING -> Known.PENDING + DUE_SOON -> Known.DUE_SOON + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object + * doesn't match its expected type. + */ + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Blocking && + id == other.id && + status == other.status && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(id, status, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Blocking{id=$id, status=$status, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Result && + id == other.id && + dateCreated == other.dateCreated && + dateUpdated == other.dateUpdated && + deactivated == other.deactivated && + ruleId == other.ruleId && + status == other.status && + workspaceId == other.workspaceId && + assigneeId == other.assigneeId && + blockedBy == other.blockedBy && + blocking == other.blocking && + dateLastEvaluated == other.dateLastEvaluated && + dateOfLatestEvidence == other.dateOfLatestEvidence && + dateOfNextEvaluation == other.dateOfNextEvaluation && + dateOfRenewal == other.dateOfRenewal && + deactivatedReason == other.deactivatedReason && + projectId == other.projectId && + statusMessage == other.statusMessage && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + dateCreated, + dateUpdated, + deactivated, + ruleId, + status, + workspaceId, + assigneeId, + blockedBy, + blocking, + dateLastEvaluated, + dateOfLatestEvidence, + dateOfNextEvaluation, + dateOfRenewal, + deactivatedReason, + projectId, + statusMessage, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Result{id=$id, dateCreated=$dateCreated, dateUpdated=$dateUpdated, deactivated=$deactivated, ruleId=$ruleId, status=$status, workspaceId=$workspaceId, assigneeId=$assigneeId, blockedBy=$blockedBy, blocking=$blocking, dateLastEvaluated=$dateLastEvaluated, dateOfLatestEvidence=$dateOfLatestEvidence, dateOfNextEvaluation=$dateOfNextEvaluation, dateOfRenewal=$dateOfRenewal, deactivatedReason=$deactivatedReason, projectId=$projectId, statusMessage=$statusMessage, additionalProperties=$additionalProperties}" + } + + /** + * Pass-rate counts across all of the rule's entities, independent of any status filter + * applied to the request. + */ + class ResultsSummary + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val passing: JsonField, + private val total: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("passing") + @ExcludeMissing + passing: JsonField = JsonMissing.of(), + @JsonProperty("total") @ExcludeMissing total: JsonField = JsonMissing.of(), + ) : this(passing, total, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun passing(): Optional = passing.getOptional("passing") + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun total(): Optional = total.getOptional("total") + + /** + * Returns the raw JSON value of [passing]. + * + * Unlike [passing], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("passing") @ExcludeMissing fun _passing(): JsonField = passing + + /** + * Returns the raw JSON value of [total]. + * + * Unlike [total], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("total") @ExcludeMissing fun _total(): JsonField = total + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [ResultsSummary]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ResultsSummary]. */ + class Builder internal constructor() { + + private var passing: JsonField = JsonMissing.of() + private var total: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(resultsSummary: ResultsSummary) = apply { + passing = resultsSummary.passing + total = resultsSummary.total + additionalProperties = resultsSummary.additionalProperties.toMutableMap() + } + + fun passing(passing: Long) = passing(JsonField.of(passing)) + + /** + * Sets [Builder.passing] to an arbitrary JSON value. + * + * You should usually call [Builder.passing] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun passing(passing: JsonField) = apply { this.passing = passing } + + fun total(total: Long) = total(JsonField.of(total)) + + /** + * Sets [Builder.total] to an arbitrary JSON value. + * + * You should usually call [Builder.total] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun total(total: JsonField) = apply { this.total = total } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ResultsSummary]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): ResultsSummary = + ResultsSummary(passing, total, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): ResultsSummary = apply { + if (validated) { + return@apply + } + + passing() + total() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (passing.asKnown().isPresent) 1 else 0) + + (if (total.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ResultsSummary && + passing == other.passing && + total == other.total && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(passing, total, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ResultsSummary{passing=$passing, total=$total, additionalProperties=$additionalProperties}" + } + + class Tag + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val creatorId: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val immutable: JsonField, + private val name: JsonField, + private val workspaceId: JsonField, + private val color: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("creatorId") + @ExcludeMissing + creatorId: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("immutable") + @ExcludeMissing + immutable: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + @JsonProperty("color") @ExcludeMissing color: JsonField = JsonMissing.of(), + ) : this( + id, + creatorId, + dateCreated, + dateUpdated, + immutable, + name, + workspaceId, + color, + mutableMapOf(), + ) + + /** + * The rule tag id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun id(): String = id.getRequired("id") + + /** + * The user who created the tag. `null` for tags that ship with Openlayer. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun creatorId(): Optional = creatorId.getOptional("creatorId") + + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** + * The last update date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** + * Whether the tag is managed by Openlayer and cannot be edited or deleted. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun immutable(): Boolean = immutable.getRequired("immutable") + + /** + * The tag name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun name(): String = name.getRequired("name") + + /** + * The id of the workspace the tag belongs to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun workspaceId(): String = workspaceId.getRequired("workspaceId") + + /** + * The color the tag is displayed with. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun color(): Optional = color.getOptional("color") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [creatorId]. + * + * Unlike [creatorId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("creatorId") + @ExcludeMissing + fun _creatorId(): JsonField = creatorId + + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** + * Returns the raw JSON value of [immutable]. + * + * Unlike [immutable], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("immutable") + @ExcludeMissing + fun _immutable(): JsonField = immutable + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [workspaceId]. + * + * Unlike [workspaceId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("workspaceId") + @ExcludeMissing + fun _workspaceId(): JsonField = workspaceId + + /** + * Returns the raw JSON value of [color]. + * + * Unlike [color], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("color") @ExcludeMissing fun _color(): JsonField = color + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Tag]. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .immutable() + * .name() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Tag]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var creatorId: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var immutable: JsonField? = null + private var name: JsonField? = null + private var workspaceId: JsonField? = null + private var color: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(tag: Tag) = apply { + id = tag.id + creatorId = tag.creatorId + dateCreated = tag.dateCreated + dateUpdated = tag.dateUpdated + immutable = tag.immutable + name = tag.name + workspaceId = tag.workspaceId + color = tag.color + additionalProperties = tag.additionalProperties.toMutableMap() + } + + /** The rule tag id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The user who created the tag. `null` for tags that ship with Openlayer. */ + fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) + + /** Alias for calling [Builder.creatorId] with `creatorId.orElse(null)`. */ + fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) + + /** + * Sets [Builder.creatorId] to an arbitrary JSON value. + * + * You should usually call [Builder.creatorId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = + dateCreated(JsonField.of(dateCreated)) + + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The last update date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = + dateUpdated(JsonField.of(dateUpdated)) + + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** Whether the tag is managed by Openlayer and cannot be edited or deleted. */ + fun immutable(immutable: Boolean) = immutable(JsonField.of(immutable)) + + /** + * Sets [Builder.immutable] to an arbitrary JSON value. + * + * You should usually call [Builder.immutable] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun immutable(immutable: JsonField) = apply { this.immutable = immutable } + + /** The tag name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun name(name: JsonField) = apply { this.name = name } + + /** The id of the workspace the tag belongs to. */ + fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) + + /** + * Sets [Builder.workspaceId] to an arbitrary JSON value. + * + * You should usually call [Builder.workspaceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun workspaceId(workspaceId: JsonField) = apply { + this.workspaceId = workspaceId + } + + /** The color the tag is displayed with. */ + fun color(color: String?) = color(JsonField.ofNullable(color)) + + /** Alias for calling [Builder.color] with `color.orElse(null)`. */ + fun color(color: Optional) = color(color.getOrNull()) + + /** + * Sets [Builder.color] to an arbitrary JSON value. + * + * You should usually call [Builder.color] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun color(color: JsonField) = apply { this.color = color } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Tag]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .immutable() + * .name() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Tag = + Tag( + checkRequired("id", id), + checkRequired("creatorId", creatorId), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("immutable", immutable), + checkRequired("name", name), + checkRequired("workspaceId", workspaceId), + color, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Tag = apply { + if (validated) { + return@apply + } + + id() + creatorId() + dateCreated() + dateUpdated() + immutable() + name() + workspaceId() + color() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (creatorId.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (immutable.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + (if (color.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Tag && + id == other.id && + creatorId == other.creatorId && + dateCreated == other.dateCreated && + dateUpdated == other.dateUpdated && + immutable == other.immutable && + name == other.name && + workspaceId == other.workspaceId && + color == other.color && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + creatorId, + dateCreated, + dateUpdated, + immutable, + name, + workspaceId, + color, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Tag{id=$id, creatorId=$creatorId, dateCreated=$dateCreated, dateUpdated=$dateUpdated, immutable=$immutable, name=$name, workspaceId=$workspaceId, color=$color, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Item && + id == other.id && + dateCreated == other.dateCreated && + dateUpdated == other.dateUpdated && + name == other.name && + scope == other.scope && + type == other.type && + workspaceId == other.workspaceId && + assigneeId == other.assigneeId && + automationParams == other.automationParams && + automationType == other.automationType && + deactivated == other.deactivated && + description == other.description && + evidenceType == other.evidenceType && + frameworks == other.frameworks && + immutable == other.immutable && + renewalCadenceDays == other.renewalCadenceDays && + results == other.results && + resultsSummary == other.resultsSummary && + tagIds == other.tagIds && + tags == other.tags && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + dateCreated, + dateUpdated, + name, + scope, + type, + workspaceId, + assigneeId, + automationParams, + automationType, + deactivated, + description, + evidenceType, + frameworks, + immutable, + renewalCadenceDays, + results, + resultsSummary, + tagIds, + tags, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Item{id=$id, dateCreated=$dateCreated, dateUpdated=$dateUpdated, name=$name, scope=$scope, type=$type, workspaceId=$workspaceId, assigneeId=$assigneeId, automationParams=$automationParams, automationType=$automationType, deactivated=$deactivated, description=$description, evidenceType=$evidenceType, frameworks=$frameworks, immutable=$immutable, renewalCadenceDays=$renewalCadenceDays, results=$results, resultsSummary=$resultsSummary, tagIds=$tagIds, tags=$tags, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is RuleListResponse && + items == other.items && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(items, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "RuleListResponse{items=$items, additionalProperties=$additionalProperties}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/rules/RuleRetrieveParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/rules/RuleRetrieveParams.kt new file mode 100644 index 00000000..64932fbd --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/rules/RuleRetrieveParams.kt @@ -0,0 +1,189 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.rules + +import com.openlayer.api.core.Params +import com.openlayer.api.core.http.Headers +import com.openlayer.api.core.http.QueryParams +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** Retrieve a governance rule by its id, including the frameworks it belongs to and its tags. */ +class RuleRetrieveParams +private constructor( + private val ruleId: String?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun ruleId(): Optional = Optional.ofNullable(ruleId) + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): RuleRetrieveParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [RuleRetrieveParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [RuleRetrieveParams]. */ + class Builder internal constructor() { + + private var ruleId: String? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(ruleRetrieveParams: RuleRetrieveParams) = apply { + ruleId = ruleRetrieveParams.ruleId + additionalHeaders = ruleRetrieveParams.additionalHeaders.toBuilder() + additionalQueryParams = ruleRetrieveParams.additionalQueryParams.toBuilder() + } + + fun ruleId(ruleId: String?) = apply { this.ruleId = ruleId } + + /** Alias for calling [Builder.ruleId] with `ruleId.orElse(null)`. */ + fun ruleId(ruleId: Optional) = ruleId(ruleId.getOrNull()) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [RuleRetrieveParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): RuleRetrieveParams = + RuleRetrieveParams(ruleId, additionalHeaders.build(), additionalQueryParams.build()) + } + + fun _pathParam(index: Int): String = + when (index) { + 0 -> ruleId ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is RuleRetrieveParams && + ruleId == other.ruleId && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = Objects.hash(ruleId, additionalHeaders, additionalQueryParams) + + override fun toString() = + "RuleRetrieveParams{ruleId=$ruleId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/rules/RuleRetrieveResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/rules/RuleRetrieveResponse.kt new file mode 100644 index 00000000..30dfc4b1 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/rules/RuleRetrieveResponse.kt @@ -0,0 +1,4821 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.rules + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.openlayer.api.core.Enum +import com.openlayer.api.core.ExcludeMissing +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonMissing +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.checkKnown +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.toImmutable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.time.OffsetDateTime +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class RuleRetrieveResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val id: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val name: JsonField, + private val scope: JsonField, + private val type: JsonField, + private val workspaceId: JsonField, + private val assigneeId: JsonField, + private val automationParams: JsonField, + private val automationType: JsonField, + private val deactivated: JsonField, + private val description: JsonField, + private val evidenceType: JsonField, + private val frameworks: JsonField>, + private val immutable: JsonField, + private val renewalCadenceDays: JsonField, + private val results: JsonField>, + private val resultsSummary: JsonField, + private val tagIds: JsonField>, + private val tags: JsonField>, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("scope") @ExcludeMissing scope: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + @JsonProperty("assigneeId") + @ExcludeMissing + assigneeId: JsonField = JsonMissing.of(), + @JsonProperty("automationParams") + @ExcludeMissing + automationParams: JsonField = JsonMissing.of(), + @JsonProperty("automationType") + @ExcludeMissing + automationType: JsonField = JsonMissing.of(), + @JsonProperty("deactivated") + @ExcludeMissing + deactivated: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + description: JsonField = JsonMissing.of(), + @JsonProperty("evidenceType") + @ExcludeMissing + evidenceType: JsonField = JsonMissing.of(), + @JsonProperty("frameworks") + @ExcludeMissing + frameworks: JsonField> = JsonMissing.of(), + @JsonProperty("immutable") @ExcludeMissing immutable: JsonField = JsonMissing.of(), + @JsonProperty("renewalCadenceDays") + @ExcludeMissing + renewalCadenceDays: JsonField = JsonMissing.of(), + @JsonProperty("results") + @ExcludeMissing + results: JsonField> = JsonMissing.of(), + @JsonProperty("resultsSummary") + @ExcludeMissing + resultsSummary: JsonField = JsonMissing.of(), + @JsonProperty("tagIds") @ExcludeMissing tagIds: JsonField> = JsonMissing.of(), + @JsonProperty("tags") @ExcludeMissing tags: JsonField> = JsonMissing.of(), + ) : this( + id, + dateCreated, + dateUpdated, + name, + scope, + type, + workspaceId, + assigneeId, + automationParams, + automationType, + deactivated, + description, + evidenceType, + frameworks, + immutable, + renewalCadenceDays, + results, + resultsSummary, + tagIds, + tags, + mutableMapOf(), + ) + + /** + * The rule id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun id(): String = id.getRequired("id") + + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** + * The last update date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** + * The rule name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun name(): String = name.getRequired("name") + + /** + * Whether the rule is evaluated once for the whole workspace, or once per project the rule's + * frameworks apply to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun scope(): Scope = scope.getRequired("scope") + + /** + * `platform` rules are evaluated automatically from the state of your Openlayer workspace. + * `evidence` rules are satisfied by attaching evidence. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun type(): Type = type.getRequired("type") + + /** + * The id of the workspace the rule belongs to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun workspaceId(): String = workspaceId.getRequired("workspaceId") + + /** + * The user responsible for satisfying the rule. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun assigneeId(): Optional = assigneeId.getOptional("assigneeId") + + /** + * Configuration for the platform check, when the automation takes parameters. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun automationParams(): Optional = + automationParams.getOptional("automationParams") + + /** + * Which workspace signal a platform rule checks, for example `monitoring_mode_enabled`, + * `test_setup`, or `project_owner_set`. `null` for evidence rules. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun automationType(): Optional = automationType.getOptional("automationType") + + /** + * Whether the rule is excluded from compliance calculations. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun deactivated(): Optional = deactivated.getOptional("deactivated") + + /** + * What the rule requires. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun description(): Optional = description.getOptional("description") + + /** + * The kind of evidence that satisfies the rule. `null` for platform rules. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun evidenceType(): Optional = evidenceType.getOptional("evidenceType") + + /** + * The frameworks that include this rule. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun frameworks(): Optional> = frameworks.getOptional("frameworks") + + /** + * Whether the rule is managed by Openlayer and cannot be edited. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun immutable(): Optional = immutable.getOptional("immutable") + + /** + * How often evidence must be renewed, in days. Once evidence is older than this, the rule + * result becomes `due_soon` and then `failing`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun renewalCadenceDays(): Optional = renewalCadenceDays.getOptional("renewalCadenceDays") + + /** + * The rule's results, one per entity the rule is evaluated against. Only returned when + * `includeResults` is `true`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun results(): Optional> = results.getOptional("results") + + /** + * Pass-rate counts across all of the rule's entities, independent of any status filter applied + * to the request. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun resultsSummary(): Optional = resultsSummary.getOptional("resultsSummary") + + /** + * The ids of the rule tags to associate with the rule. Replaces the rule's tags. Read them back + * from `tags`, and list the tags available in the workspace with `GET + * /workspaces/{workspaceId}/rule-tags`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun tagIds(): Optional> = tagIds.getOptional("tagIds") + + /** + * The rule tags associated with the rule. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun tags(): Optional> = tags.getOptional("tags") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [scope]. + * + * Unlike [scope], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("scope") @ExcludeMissing fun _scope(): JsonField = scope + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + /** + * Returns the raw JSON value of [workspaceId]. + * + * Unlike [workspaceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("workspaceId") @ExcludeMissing fun _workspaceId(): JsonField = workspaceId + + /** + * Returns the raw JSON value of [assigneeId]. + * + * Unlike [assigneeId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("assigneeId") @ExcludeMissing fun _assigneeId(): JsonField = assigneeId + + /** + * Returns the raw JSON value of [automationParams]. + * + * Unlike [automationParams], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("automationParams") + @ExcludeMissing + fun _automationParams(): JsonField = automationParams + + /** + * Returns the raw JSON value of [automationType]. + * + * Unlike [automationType], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("automationType") + @ExcludeMissing + fun _automationType(): JsonField = automationType + + /** + * Returns the raw JSON value of [deactivated]. + * + * Unlike [deactivated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("deactivated") + @ExcludeMissing + fun _deactivated(): JsonField = deactivated + + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description + + /** + * Returns the raw JSON value of [evidenceType]. + * + * Unlike [evidenceType], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("evidenceType") + @ExcludeMissing + fun _evidenceType(): JsonField = evidenceType + + /** + * Returns the raw JSON value of [frameworks]. + * + * Unlike [frameworks], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("frameworks") + @ExcludeMissing + fun _frameworks(): JsonField> = frameworks + + /** + * Returns the raw JSON value of [immutable]. + * + * Unlike [immutable], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("immutable") @ExcludeMissing fun _immutable(): JsonField = immutable + + /** + * Returns the raw JSON value of [renewalCadenceDays]. + * + * Unlike [renewalCadenceDays], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("renewalCadenceDays") + @ExcludeMissing + fun _renewalCadenceDays(): JsonField = renewalCadenceDays + + /** + * Returns the raw JSON value of [results]. + * + * Unlike [results], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("results") @ExcludeMissing fun _results(): JsonField> = results + + /** + * Returns the raw JSON value of [resultsSummary]. + * + * Unlike [resultsSummary], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("resultsSummary") + @ExcludeMissing + fun _resultsSummary(): JsonField = resultsSummary + + /** + * Returns the raw JSON value of [tagIds]. + * + * Unlike [tagIds], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("tagIds") @ExcludeMissing fun _tagIds(): JsonField> = tagIds + + /** + * Returns the raw JSON value of [tags]. + * + * Unlike [tags], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("tags") @ExcludeMissing fun _tags(): JsonField> = tags + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [RuleRetrieveResponse]. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateUpdated() + * .name() + * .scope() + * .type() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [RuleRetrieveResponse]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var name: JsonField? = null + private var scope: JsonField? = null + private var type: JsonField? = null + private var workspaceId: JsonField? = null + private var assigneeId: JsonField = JsonMissing.of() + private var automationParams: JsonField = JsonMissing.of() + private var automationType: JsonField = JsonMissing.of() + private var deactivated: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var evidenceType: JsonField = JsonMissing.of() + private var frameworks: JsonField>? = null + private var immutable: JsonField = JsonMissing.of() + private var renewalCadenceDays: JsonField = JsonMissing.of() + private var results: JsonField>? = null + private var resultsSummary: JsonField = JsonMissing.of() + private var tagIds: JsonField>? = null + private var tags: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(ruleRetrieveResponse: RuleRetrieveResponse) = apply { + id = ruleRetrieveResponse.id + dateCreated = ruleRetrieveResponse.dateCreated + dateUpdated = ruleRetrieveResponse.dateUpdated + name = ruleRetrieveResponse.name + scope = ruleRetrieveResponse.scope + type = ruleRetrieveResponse.type + workspaceId = ruleRetrieveResponse.workspaceId + assigneeId = ruleRetrieveResponse.assigneeId + automationParams = ruleRetrieveResponse.automationParams + automationType = ruleRetrieveResponse.automationType + deactivated = ruleRetrieveResponse.deactivated + description = ruleRetrieveResponse.description + evidenceType = ruleRetrieveResponse.evidenceType + frameworks = ruleRetrieveResponse.frameworks.map { it.toMutableList() } + immutable = ruleRetrieveResponse.immutable + renewalCadenceDays = ruleRetrieveResponse.renewalCadenceDays + results = ruleRetrieveResponse.results.map { it.toMutableList() } + resultsSummary = ruleRetrieveResponse.resultsSummary + tagIds = ruleRetrieveResponse.tagIds.map { it.toMutableList() } + tags = ruleRetrieveResponse.tags.map { it.toMutableList() } + additionalProperties = ruleRetrieveResponse.additionalProperties.toMutableMap() + } + + /** The rule id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The last update date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** The rule name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun name(name: JsonField) = apply { this.name = name } + + /** + * Whether the rule is evaluated once for the whole workspace, or once per project the + * rule's frameworks apply to. + */ + fun scope(scope: Scope) = scope(JsonField.of(scope)) + + /** + * Sets [Builder.scope] to an arbitrary JSON value. + * + * You should usually call [Builder.scope] with a well-typed [Scope] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun scope(scope: JsonField) = apply { this.scope = scope } + + /** + * `platform` rules are evaluated automatically from the state of your Openlayer workspace. + * `evidence` rules are satisfied by attaching evidence. + */ + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun type(type: JsonField) = apply { this.type = type } + + /** The id of the workspace the rule belongs to. */ + fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) + + /** + * Sets [Builder.workspaceId] to an arbitrary JSON value. + * + * You should usually call [Builder.workspaceId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun workspaceId(workspaceId: JsonField) = apply { this.workspaceId = workspaceId } + + /** The user responsible for satisfying the rule. */ + fun assigneeId(assigneeId: String?) = assigneeId(JsonField.ofNullable(assigneeId)) + + /** Alias for calling [Builder.assigneeId] with `assigneeId.orElse(null)`. */ + fun assigneeId(assigneeId: Optional) = assigneeId(assigneeId.getOrNull()) + + /** + * Sets [Builder.assigneeId] to an arbitrary JSON value. + * + * You should usually call [Builder.assigneeId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun assigneeId(assigneeId: JsonField) = apply { this.assigneeId = assigneeId } + + /** Configuration for the platform check, when the automation takes parameters. */ + fun automationParams(automationParams: AutomationParams?) = + automationParams(JsonField.ofNullable(automationParams)) + + /** Alias for calling [Builder.automationParams] with `automationParams.orElse(null)`. */ + fun automationParams(automationParams: Optional) = + automationParams(automationParams.getOrNull()) + + /** + * Sets [Builder.automationParams] to an arbitrary JSON value. + * + * You should usually call [Builder.automationParams] with a well-typed [AutomationParams] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun automationParams(automationParams: JsonField) = apply { + this.automationParams = automationParams + } + + /** + * Which workspace signal a platform rule checks, for example `monitoring_mode_enabled`, + * `test_setup`, or `project_owner_set`. `null` for evidence rules. + */ + fun automationType(automationType: String?) = + automationType(JsonField.ofNullable(automationType)) + + /** Alias for calling [Builder.automationType] with `automationType.orElse(null)`. */ + fun automationType(automationType: Optional) = + automationType(automationType.getOrNull()) + + /** + * Sets [Builder.automationType] to an arbitrary JSON value. + * + * You should usually call [Builder.automationType] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun automationType(automationType: JsonField) = apply { + this.automationType = automationType + } + + /** Whether the rule is excluded from compliance calculations. */ + fun deactivated(deactivated: Boolean) = deactivated(JsonField.of(deactivated)) + + /** + * Sets [Builder.deactivated] to an arbitrary JSON value. + * + * You should usually call [Builder.deactivated] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun deactivated(deactivated: JsonField) = apply { this.deactivated = deactivated } + + /** What the rule requires. */ + fun description(description: String?) = description(JsonField.ofNullable(description)) + + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ + fun description(description: Optional) = description(description.getOrNull()) + + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun description(description: JsonField) = apply { this.description = description } + + /** The kind of evidence that satisfies the rule. `null` for platform rules. */ + fun evidenceType(evidenceType: EvidenceType?) = + evidenceType(JsonField.ofNullable(evidenceType)) + + /** Alias for calling [Builder.evidenceType] with `evidenceType.orElse(null)`. */ + fun evidenceType(evidenceType: Optional) = + evidenceType(evidenceType.getOrNull()) + + /** + * Sets [Builder.evidenceType] to an arbitrary JSON value. + * + * You should usually call [Builder.evidenceType] with a well-typed [EvidenceType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun evidenceType(evidenceType: JsonField) = apply { + this.evidenceType = evidenceType + } + + /** The frameworks that include this rule. */ + fun frameworks(frameworks: List) = frameworks(JsonField.of(frameworks)) + + /** + * Sets [Builder.frameworks] to an arbitrary JSON value. + * + * You should usually call [Builder.frameworks] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun frameworks(frameworks: JsonField>) = apply { + this.frameworks = frameworks.map { it.toMutableList() } + } + + /** + * Adds a single [Framework] to [frameworks]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addFramework(framework: Framework) = apply { + frameworks = + (frameworks ?: JsonField.of(mutableListOf())).also { + checkKnown("frameworks", it).add(framework) + } + } + + /** Whether the rule is managed by Openlayer and cannot be edited. */ + fun immutable(immutable: Boolean) = immutable(JsonField.of(immutable)) + + /** + * Sets [Builder.immutable] to an arbitrary JSON value. + * + * You should usually call [Builder.immutable] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun immutable(immutable: JsonField) = apply { this.immutable = immutable } + + /** + * How often evidence must be renewed, in days. Once evidence is older than this, the rule + * result becomes `due_soon` and then `failing`. + */ + fun renewalCadenceDays(renewalCadenceDays: Long?) = + renewalCadenceDays(JsonField.ofNullable(renewalCadenceDays)) + + /** + * Alias for [Builder.renewalCadenceDays]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun renewalCadenceDays(renewalCadenceDays: Long) = + renewalCadenceDays(renewalCadenceDays as Long?) + + /** + * Alias for calling [Builder.renewalCadenceDays] with `renewalCadenceDays.orElse(null)`. + */ + fun renewalCadenceDays(renewalCadenceDays: Optional) = + renewalCadenceDays(renewalCadenceDays.getOrNull()) + + /** + * Sets [Builder.renewalCadenceDays] to an arbitrary JSON value. + * + * You should usually call [Builder.renewalCadenceDays] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun renewalCadenceDays(renewalCadenceDays: JsonField) = apply { + this.renewalCadenceDays = renewalCadenceDays + } + + /** + * The rule's results, one per entity the rule is evaluated against. Only returned when + * `includeResults` is `true`. + */ + fun results(results: List) = results(JsonField.of(results)) + + /** + * Sets [Builder.results] to an arbitrary JSON value. + * + * You should usually call [Builder.results] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun results(results: JsonField>) = apply { + this.results = results.map { it.toMutableList() } + } + + /** + * Adds a single [Result] to [results]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addResult(result: Result) = apply { + results = + (results ?: JsonField.of(mutableListOf())).also { + checkKnown("results", it).add(result) + } + } + + /** + * Pass-rate counts across all of the rule's entities, independent of any status filter + * applied to the request. + */ + fun resultsSummary(resultsSummary: ResultsSummary?) = + resultsSummary(JsonField.ofNullable(resultsSummary)) + + /** Alias for calling [Builder.resultsSummary] with `resultsSummary.orElse(null)`. */ + fun resultsSummary(resultsSummary: Optional) = + resultsSummary(resultsSummary.getOrNull()) + + /** + * Sets [Builder.resultsSummary] to an arbitrary JSON value. + * + * You should usually call [Builder.resultsSummary] with a well-typed [ResultsSummary] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun resultsSummary(resultsSummary: JsonField) = apply { + this.resultsSummary = resultsSummary + } + + /** + * The ids of the rule tags to associate with the rule. Replaces the rule's tags. Read them + * back from `tags`, and list the tags available in the workspace with `GET + * /workspaces/{workspaceId}/rule-tags`. + */ + fun tagIds(tagIds: List?) = tagIds(JsonField.ofNullable(tagIds)) + + /** Alias for calling [Builder.tagIds] with `tagIds.orElse(null)`. */ + fun tagIds(tagIds: Optional>) = tagIds(tagIds.getOrNull()) + + /** + * Sets [Builder.tagIds] to an arbitrary JSON value. + * + * You should usually call [Builder.tagIds] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun tagIds(tagIds: JsonField>) = apply { + this.tagIds = tagIds.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [tagIds]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addTagId(tagId: String) = apply { + tagIds = + (tagIds ?: JsonField.of(mutableListOf())).also { + checkKnown("tagIds", it).add(tagId) + } + } + + /** The rule tags associated with the rule. */ + fun tags(tags: List?) = tags(JsonField.ofNullable(tags)) + + /** Alias for calling [Builder.tags] with `tags.orElse(null)`. */ + fun tags(tags: Optional>) = tags(tags.getOrNull()) + + /** + * Sets [Builder.tags] to an arbitrary JSON value. + * + * You should usually call [Builder.tags] with a well-typed `List` value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun tags(tags: JsonField>) = apply { this.tags = tags.map { it.toMutableList() } } + + /** + * Adds a single [Tag] to [tags]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addTag(tag: Tag) = apply { + tags = (tags ?: JsonField.of(mutableListOf())).also { checkKnown("tags", it).add(tag) } + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [RuleRetrieveResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateUpdated() + * .name() + * .scope() + * .type() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): RuleRetrieveResponse = + RuleRetrieveResponse( + checkRequired("id", id), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("name", name), + checkRequired("scope", scope), + checkRequired("type", type), + checkRequired("workspaceId", workspaceId), + assigneeId, + automationParams, + automationType, + deactivated, + description, + evidenceType, + (frameworks ?: JsonMissing.of()).map { it.toImmutable() }, + immutable, + renewalCadenceDays, + (results ?: JsonMissing.of()).map { it.toImmutable() }, + resultsSummary, + (tagIds ?: JsonMissing.of()).map { it.toImmutable() }, + (tags ?: JsonMissing.of()).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): RuleRetrieveResponse = apply { + if (validated) { + return@apply + } + + id() + dateCreated() + dateUpdated() + name() + scope().validate() + type().validate() + workspaceId() + assigneeId() + automationParams().ifPresent { it.validate() } + automationType() + deactivated() + description() + evidenceType().ifPresent { it.validate() } + frameworks().ifPresent { it.forEach { it.validate() } } + immutable() + renewalCadenceDays() + results().ifPresent { it.forEach { it.validate() } } + resultsSummary().ifPresent { it.validate() } + tagIds() + tags().ifPresent { it.forEach { it.validate() } } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (scope.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + (if (assigneeId.asKnown().isPresent) 1 else 0) + + (automationParams.asKnown().getOrNull()?.validity() ?: 0) + + (if (automationType.asKnown().isPresent) 1 else 0) + + (if (deactivated.asKnown().isPresent) 1 else 0) + + (if (description.asKnown().isPresent) 1 else 0) + + (evidenceType.asKnown().getOrNull()?.validity() ?: 0) + + (frameworks.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (immutable.asKnown().isPresent) 1 else 0) + + (if (renewalCadenceDays.asKnown().isPresent) 1 else 0) + + (results.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (resultsSummary.asKnown().getOrNull()?.validity() ?: 0) + + (tagIds.asKnown().getOrNull()?.size ?: 0) + + (tags.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + /** + * Whether the rule is evaluated once for the whole workspace, or once per project the rule's + * frameworks apply to. + */ + class Scope @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val PROJECT = of("project") + + @JvmField val WORKSPACE = of("workspace") + + @JvmStatic fun of(value: String) = Scope(JsonField.of(value)) + } + + /** An enum containing [Scope]'s known values. */ + enum class Known { + PROJECT, + WORKSPACE, + } + + /** + * An enum containing [Scope]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Scope] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + PROJECT, + WORKSPACE, + /** An enum member indicating that [Scope] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + PROJECT -> Value.PROJECT + WORKSPACE -> Value.WORKSPACE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + PROJECT -> Known.PROJECT + WORKSPACE -> Known.WORKSPACE + else -> throw OpenlayerInvalidDataException("Unknown Scope: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Scope = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Scope && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** + * `platform` rules are evaluated automatically from the state of your Openlayer workspace. + * `evidence` rules are satisfied by attaching evidence. + */ + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val PLATFORM = of("platform") + + @JvmField val EVIDENCE = of("evidence") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + PLATFORM, + EVIDENCE, + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + PLATFORM, + EVIDENCE, + /** An enum member indicating that [Type] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + PLATFORM -> Value.PLATFORM + EVIDENCE -> Value.EVIDENCE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + PLATFORM -> Known.PLATFORM + EVIDENCE -> Known.EVIDENCE + else -> throw OpenlayerInvalidDataException("Unknown Type: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Configuration for the platform check, when the automation takes parameters. */ + class AutomationParams + @JsonCreator + private constructor( + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [AutomationParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [AutomationParams]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(automationParams: AutomationParams) = apply { + additionalProperties = automationParams.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [AutomationParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): AutomationParams = AutomationParams(additionalProperties.toImmutable()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): AutomationParams = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is AutomationParams && additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = "AutomationParams{additionalProperties=$additionalProperties}" + } + + /** The kind of evidence that satisfies the rule. `null` for platform rules. */ + class EvidenceType @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val DOCUMENT = of("document") + + @JvmField val TEXT = of("text") + + @JvmField val URL = of("url") + + @JvmField val CATEGORY_VALUE = of("categoryValue") + + @JvmStatic fun of(value: String) = EvidenceType(JsonField.of(value)) + } + + /** An enum containing [EvidenceType]'s known values. */ + enum class Known { + DOCUMENT, + TEXT, + URL, + CATEGORY_VALUE, + } + + /** + * An enum containing [EvidenceType]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [EvidenceType] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DOCUMENT, + TEXT, + URL, + CATEGORY_VALUE, + /** + * An enum member indicating that [EvidenceType] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DOCUMENT -> Value.DOCUMENT + TEXT -> Value.TEXT + URL -> Value.URL + CATEGORY_VALUE -> Value.CATEGORY_VALUE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + DOCUMENT -> Known.DOCUMENT + TEXT -> Known.TEXT + URL -> Known.URL + CATEGORY_VALUE -> Known.CATEGORY_VALUE + else -> throw OpenlayerInvalidDataException("Unknown EvidenceType: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): EvidenceType = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is EvidenceType && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + class Framework + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val avatar: JsonField, + private val builtInSlug: JsonField, + private val enabled: JsonField, + private val name: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("avatar") @ExcludeMissing avatar: JsonField = JsonMissing.of(), + @JsonProperty("builtInSlug") + @ExcludeMissing + builtInSlug: JsonField = JsonMissing.of(), + @JsonProperty("enabled") @ExcludeMissing enabled: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + ) : this(id, avatar, builtInSlug, enabled, name, mutableMapOf()) + + /** + * The framework id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun id(): String = id.getRequired("id") + + /** + * The icon shown for the framework. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun avatar(): Optional = avatar.getOptional("avatar") + + /** + * Identifies a framework that ships with Openlayer, for example `eu_ai_act`, `iso_42001`, + * `nist_ai_rmf`, or `traiga`. `null` for frameworks you create yourself. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun builtInSlug(): Optional = builtInSlug.getOptional("builtInSlug") + + /** + * Whether the framework is active. Rules of a disabled framework are not evaluated and do + * not count towards compliance. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun enabled(): Boolean = enabled.getRequired("enabled") + + /** + * The framework name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun name(): String = name.getRequired("name") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [avatar]. + * + * Unlike [avatar], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("avatar") @ExcludeMissing fun _avatar(): JsonField = avatar + + /** + * Returns the raw JSON value of [builtInSlug]. + * + * Unlike [builtInSlug], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("builtInSlug") + @ExcludeMissing + fun _builtInSlug(): JsonField = builtInSlug + + /** + * Returns the raw JSON value of [enabled]. + * + * Unlike [enabled], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("enabled") @ExcludeMissing fun _enabled(): JsonField = enabled + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Framework]. + * + * The following fields are required: + * ```java + * .id() + * .avatar() + * .builtInSlug() + * .enabled() + * .name() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Framework]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var avatar: JsonField? = null + private var builtInSlug: JsonField? = null + private var enabled: JsonField? = null + private var name: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(framework: Framework) = apply { + id = framework.id + avatar = framework.avatar + builtInSlug = framework.builtInSlug + enabled = framework.enabled + name = framework.name + additionalProperties = framework.additionalProperties.toMutableMap() + } + + /** The framework id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The icon shown for the framework. */ + fun avatar(avatar: Avatar?) = avatar(JsonField.ofNullable(avatar)) + + /** Alias for calling [Builder.avatar] with `avatar.orElse(null)`. */ + fun avatar(avatar: Optional) = avatar(avatar.getOrNull()) + + /** + * Sets [Builder.avatar] to an arbitrary JSON value. + * + * You should usually call [Builder.avatar] with a well-typed [Avatar] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun avatar(avatar: JsonField) = apply { this.avatar = avatar } + + /** + * Identifies a framework that ships with Openlayer, for example `eu_ai_act`, + * `iso_42001`, `nist_ai_rmf`, or `traiga`. `null` for frameworks you create yourself. + */ + fun builtInSlug(builtInSlug: String?) = builtInSlug(JsonField.ofNullable(builtInSlug)) + + /** Alias for calling [Builder.builtInSlug] with `builtInSlug.orElse(null)`. */ + fun builtInSlug(builtInSlug: Optional) = builtInSlug(builtInSlug.getOrNull()) + + /** + * Sets [Builder.builtInSlug] to an arbitrary JSON value. + * + * You should usually call [Builder.builtInSlug] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun builtInSlug(builtInSlug: JsonField) = apply { + this.builtInSlug = builtInSlug + } + + /** + * Whether the framework is active. Rules of a disabled framework are not evaluated and + * do not count towards compliance. + */ + fun enabled(enabled: Boolean) = enabled(JsonField.of(enabled)) + + /** + * Sets [Builder.enabled] to an arbitrary JSON value. + * + * You should usually call [Builder.enabled] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun enabled(enabled: JsonField) = apply { this.enabled = enabled } + + /** The framework name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun name(name: JsonField) = apply { this.name = name } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Framework]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .avatar() + * .builtInSlug() + * .enabled() + * .name() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Framework = + Framework( + checkRequired("id", id), + checkRequired("avatar", avatar), + checkRequired("builtInSlug", builtInSlug), + checkRequired("enabled", enabled), + checkRequired("name", name), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Framework = apply { + if (validated) { + return@apply + } + + id() + avatar().ifPresent { it.validate() } + builtInSlug() + enabled() + name() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (avatar.asKnown().getOrNull()?.validity() ?: 0) + + (if (builtInSlug.asKnown().isPresent) 1 else 0) + + (if (enabled.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + /** The icon shown for the framework. */ + class Avatar + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val type: JsonField, + private val value: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("value") @ExcludeMissing value: JsonField = JsonMissing.of(), + ) : this(type, value, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun type(): Type = type.getRequired("type") + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun value(): String = value.getRequired("value") + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + /** + * Returns the raw JSON value of [value]. + * + * Unlike [value], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Avatar]. + * + * The following fields are required: + * ```java + * .type() + * .value() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Avatar]. */ + class Builder internal constructor() { + + private var type: JsonField? = null + private var value: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(avatar: Avatar) = apply { + type = avatar.type + value = avatar.value + additionalProperties = avatar.additionalProperties.toMutableMap() + } + + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun type(type: JsonField) = apply { this.type = type } + + fun value(value: String) = value(JsonField.of(value)) + + /** + * Sets [Builder.value] to an arbitrary JSON value. + * + * You should usually call [Builder.value] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun value(value: JsonField) = apply { this.value = value } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Avatar]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .type() + * .value() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Avatar = + Avatar( + checkRequired("type", type), + checkRequired("value", value), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Avatar = apply { + if (validated) { + return@apply + } + + type().validate() + value() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (type.asKnown().getOrNull()?.validity() ?: 0) + + (if (value.asKnown().isPresent) 1 else 0) + + class Type @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val EMOJI = of("emoji") + + @JvmField val IMAGE_URL = of("imageUrl") + + @JvmField val BUILTIN_IMAGE = of("builtinImage") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + EMOJI, + IMAGE_URL, + BUILTIN_IMAGE, + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + EMOJI, + IMAGE_URL, + BUILTIN_IMAGE, + /** + * An enum member indicating that [Type] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + EMOJI -> Value.EMOJI + IMAGE_URL -> Value.IMAGE_URL + BUILTIN_IMAGE -> Value.BUILTIN_IMAGE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + EMOJI -> Known.EMOJI + IMAGE_URL -> Known.IMAGE_URL + BUILTIN_IMAGE -> Known.BUILTIN_IMAGE + else -> throw OpenlayerInvalidDataException("Unknown Type: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Avatar && + type == other.type && + value == other.value && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(type, value, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Avatar{type=$type, value=$value, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Framework && + id == other.id && + avatar == other.avatar && + builtInSlug == other.builtInSlug && + enabled == other.enabled && + name == other.name && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(id, avatar, builtInSlug, enabled, name, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Framework{id=$id, avatar=$avatar, builtInSlug=$builtInSlug, enabled=$enabled, name=$name, additionalProperties=$additionalProperties}" + } + + class Result + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val deactivated: JsonField, + private val ruleId: JsonField, + private val status: JsonField, + private val workspaceId: JsonField, + private val assigneeId: JsonField, + private val blockedBy: JsonField>, + private val blocking: JsonField>, + private val dateLastEvaluated: JsonField, + private val dateOfLatestEvidence: JsonField, + private val dateOfNextEvaluation: JsonField, + private val dateOfRenewal: JsonField, + private val deactivatedReason: JsonField, + private val projectId: JsonField, + private val statusMessage: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("deactivated") + @ExcludeMissing + deactivated: JsonField = JsonMissing.of(), + @JsonProperty("ruleId") @ExcludeMissing ruleId: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + @JsonProperty("assigneeId") + @ExcludeMissing + assigneeId: JsonField = JsonMissing.of(), + @JsonProperty("blockedBy") + @ExcludeMissing + blockedBy: JsonField> = JsonMissing.of(), + @JsonProperty("blocking") + @ExcludeMissing + blocking: JsonField> = JsonMissing.of(), + @JsonProperty("dateLastEvaluated") + @ExcludeMissing + dateLastEvaluated: JsonField = JsonMissing.of(), + @JsonProperty("dateOfLatestEvidence") + @ExcludeMissing + dateOfLatestEvidence: JsonField = JsonMissing.of(), + @JsonProperty("dateOfNextEvaluation") + @ExcludeMissing + dateOfNextEvaluation: JsonField = JsonMissing.of(), + @JsonProperty("dateOfRenewal") + @ExcludeMissing + dateOfRenewal: JsonField = JsonMissing.of(), + @JsonProperty("deactivatedReason") + @ExcludeMissing + deactivatedReason: JsonField = JsonMissing.of(), + @JsonProperty("projectId") + @ExcludeMissing + projectId: JsonField = JsonMissing.of(), + @JsonProperty("statusMessage") + @ExcludeMissing + statusMessage: JsonField = JsonMissing.of(), + ) : this( + id, + dateCreated, + dateUpdated, + deactivated, + ruleId, + status, + workspaceId, + assigneeId, + blockedBy, + blocking, + dateLastEvaluated, + dateOfLatestEvidence, + dateOfNextEvaluation, + dateOfRenewal, + deactivatedReason, + projectId, + statusMessage, + mutableMapOf(), + ) + + /** + * The rule result id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun id(): String = id.getRequired("id") + + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** + * The last update date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** + * Whether this result is excluded from compliance calculations. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun deactivated(): Boolean = deactivated.getRequired("deactivated") + + /** + * The rule this result belongs to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun ruleId(): String = ruleId.getRequired("ruleId") + + /** + * The compliance status of the rule for this entity. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun status(): Status = status.getRequired("status") + + /** + * The id of the workspace the rule result belongs to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun workspaceId(): String = workspaceId.getRequired("workspaceId") + + /** + * The user responsible for this result. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun assigneeId(): Optional = assigneeId.getOptional("assigneeId") + + /** + * Rule results that must pass before this one can be satisfied. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun blockedBy(): Optional> = blockedBy.getOptional("blockedBy") + + /** + * Rule results that this one blocks. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun blocking(): Optional> = blocking.getOptional("blocking") + + /** + * When the rule was last evaluated. Platform rules only. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun dateLastEvaluated(): Optional = + dateLastEvaluated.getOptional("dateLastEvaluated") + + /** + * When the most recent piece of evidence was attached. Evidence rules only. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun dateOfLatestEvidence(): Optional = + dateOfLatestEvidence.getOptional("dateOfLatestEvidence") + + /** + * When the rule will next be evaluated. Platform rules only. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun dateOfNextEvaluation(): Optional = + dateOfNextEvaluation.getOptional("dateOfNextEvaluation") + + /** + * When the evidence must be renewed. Evidence rules with a renewal cadence only. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun dateOfRenewal(): Optional = dateOfRenewal.getOptional("dateOfRenewal") + + /** + * Why the result was excluded. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun deactivatedReason(): Optional = + deactivatedReason.getOptional("deactivatedReason") + + /** + * The project this result was evaluated for. `null` for workspace-scoped rules. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun projectId(): Optional = projectId.getOptional("projectId") + + /** + * A human-readable explanation of the status. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun statusMessage(): Optional = statusMessage.getOptional("statusMessage") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** + * Returns the raw JSON value of [deactivated]. + * + * Unlike [deactivated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("deactivated") + @ExcludeMissing + fun _deactivated(): JsonField = deactivated + + /** + * Returns the raw JSON value of [ruleId]. + * + * Unlike [ruleId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("ruleId") @ExcludeMissing fun _ruleId(): JsonField = ruleId + + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + + /** + * Returns the raw JSON value of [workspaceId]. + * + * Unlike [workspaceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("workspaceId") + @ExcludeMissing + fun _workspaceId(): JsonField = workspaceId + + /** + * Returns the raw JSON value of [assigneeId]. + * + * Unlike [assigneeId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("assigneeId") + @ExcludeMissing + fun _assigneeId(): JsonField = assigneeId + + /** + * Returns the raw JSON value of [blockedBy]. + * + * Unlike [blockedBy], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("blockedBy") + @ExcludeMissing + fun _blockedBy(): JsonField> = blockedBy + + /** + * Returns the raw JSON value of [blocking]. + * + * Unlike [blocking], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("blocking") + @ExcludeMissing + fun _blocking(): JsonField> = blocking + + /** + * Returns the raw JSON value of [dateLastEvaluated]. + * + * Unlike [dateLastEvaluated], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("dateLastEvaluated") + @ExcludeMissing + fun _dateLastEvaluated(): JsonField = dateLastEvaluated + + /** + * Returns the raw JSON value of [dateOfLatestEvidence]. + * + * Unlike [dateOfLatestEvidence], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("dateOfLatestEvidence") + @ExcludeMissing + fun _dateOfLatestEvidence(): JsonField = dateOfLatestEvidence + + /** + * Returns the raw JSON value of [dateOfNextEvaluation]. + * + * Unlike [dateOfNextEvaluation], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("dateOfNextEvaluation") + @ExcludeMissing + fun _dateOfNextEvaluation(): JsonField = dateOfNextEvaluation + + /** + * Returns the raw JSON value of [dateOfRenewal]. + * + * Unlike [dateOfRenewal], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("dateOfRenewal") + @ExcludeMissing + fun _dateOfRenewal(): JsonField = dateOfRenewal + + /** + * Returns the raw JSON value of [deactivatedReason]. + * + * Unlike [deactivatedReason], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("deactivatedReason") + @ExcludeMissing + fun _deactivatedReason(): JsonField = deactivatedReason + + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("projectId") @ExcludeMissing fun _projectId(): JsonField = projectId + + /** + * Returns the raw JSON value of [statusMessage]. + * + * Unlike [statusMessage], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("statusMessage") + @ExcludeMissing + fun _statusMessage(): JsonField = statusMessage + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Result]. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateUpdated() + * .deactivated() + * .ruleId() + * .status() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Result]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var deactivated: JsonField? = null + private var ruleId: JsonField? = null + private var status: JsonField? = null + private var workspaceId: JsonField? = null + private var assigneeId: JsonField = JsonMissing.of() + private var blockedBy: JsonField>? = null + private var blocking: JsonField>? = null + private var dateLastEvaluated: JsonField = JsonMissing.of() + private var dateOfLatestEvidence: JsonField = JsonMissing.of() + private var dateOfNextEvaluation: JsonField = JsonMissing.of() + private var dateOfRenewal: JsonField = JsonMissing.of() + private var deactivatedReason: JsonField = JsonMissing.of() + private var projectId: JsonField = JsonMissing.of() + private var statusMessage: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(result: Result) = apply { + id = result.id + dateCreated = result.dateCreated + dateUpdated = result.dateUpdated + deactivated = result.deactivated + ruleId = result.ruleId + status = result.status + workspaceId = result.workspaceId + assigneeId = result.assigneeId + blockedBy = result.blockedBy.map { it.toMutableList() } + blocking = result.blocking.map { it.toMutableList() } + dateLastEvaluated = result.dateLastEvaluated + dateOfLatestEvidence = result.dateOfLatestEvidence + dateOfNextEvaluation = result.dateOfNextEvaluation + dateOfRenewal = result.dateOfRenewal + deactivatedReason = result.deactivatedReason + projectId = result.projectId + statusMessage = result.statusMessage + additionalProperties = result.additionalProperties.toMutableMap() + } + + /** The rule result id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The last update date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** Whether this result is excluded from compliance calculations. */ + fun deactivated(deactivated: Boolean) = deactivated(JsonField.of(deactivated)) + + /** + * Sets [Builder.deactivated] to an arbitrary JSON value. + * + * You should usually call [Builder.deactivated] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun deactivated(deactivated: JsonField) = apply { + this.deactivated = deactivated + } + + /** The rule this result belongs to. */ + fun ruleId(ruleId: String) = ruleId(JsonField.of(ruleId)) + + /** + * Sets [Builder.ruleId] to an arbitrary JSON value. + * + * You should usually call [Builder.ruleId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun ruleId(ruleId: JsonField) = apply { this.ruleId = ruleId } + + /** The compliance status of the rule for this entity. */ + fun status(status: Status) = status(JsonField.of(status)) + + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun status(status: JsonField) = apply { this.status = status } + + /** The id of the workspace the rule result belongs to. */ + fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) + + /** + * Sets [Builder.workspaceId] to an arbitrary JSON value. + * + * You should usually call [Builder.workspaceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun workspaceId(workspaceId: JsonField) = apply { + this.workspaceId = workspaceId + } + + /** The user responsible for this result. */ + fun assigneeId(assigneeId: String?) = assigneeId(JsonField.ofNullable(assigneeId)) + + /** Alias for calling [Builder.assigneeId] with `assigneeId.orElse(null)`. */ + fun assigneeId(assigneeId: Optional) = assigneeId(assigneeId.getOrNull()) + + /** + * Sets [Builder.assigneeId] to an arbitrary JSON value. + * + * You should usually call [Builder.assigneeId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun assigneeId(assigneeId: JsonField) = apply { this.assigneeId = assigneeId } + + /** Rule results that must pass before this one can be satisfied. */ + fun blockedBy(blockedBy: List) = blockedBy(JsonField.of(blockedBy)) + + /** + * Sets [Builder.blockedBy] to an arbitrary JSON value. + * + * You should usually call [Builder.blockedBy] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun blockedBy(blockedBy: JsonField>) = apply { + this.blockedBy = blockedBy.map { it.toMutableList() } + } + + /** + * Adds a single [BlockedBy] to [Builder.blockedBy]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addBlockedBy(blockedBy: BlockedBy) = apply { + this.blockedBy = + (this.blockedBy ?: JsonField.of(mutableListOf())).also { + checkKnown("blockedBy", it).add(blockedBy) + } + } + + /** Rule results that this one blocks. */ + fun blocking(blocking: List) = blocking(JsonField.of(blocking)) + + /** + * Sets [Builder.blocking] to an arbitrary JSON value. + * + * You should usually call [Builder.blocking] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun blocking(blocking: JsonField>) = apply { + this.blocking = blocking.map { it.toMutableList() } + } + + /** + * Adds a single [Blocking] to [Builder.blocking]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addBlocking(blocking: Blocking) = apply { + this.blocking = + (this.blocking ?: JsonField.of(mutableListOf())).also { + checkKnown("blocking", it).add(blocking) + } + } + + /** When the rule was last evaluated. Platform rules only. */ + fun dateLastEvaluated(dateLastEvaluated: OffsetDateTime?) = + dateLastEvaluated(JsonField.ofNullable(dateLastEvaluated)) + + /** + * Alias for calling [Builder.dateLastEvaluated] with `dateLastEvaluated.orElse(null)`. + */ + fun dateLastEvaluated(dateLastEvaluated: Optional) = + dateLastEvaluated(dateLastEvaluated.getOrNull()) + + /** + * Sets [Builder.dateLastEvaluated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateLastEvaluated] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun dateLastEvaluated(dateLastEvaluated: JsonField) = apply { + this.dateLastEvaluated = dateLastEvaluated + } + + /** When the most recent piece of evidence was attached. Evidence rules only. */ + fun dateOfLatestEvidence(dateOfLatestEvidence: OffsetDateTime?) = + dateOfLatestEvidence(JsonField.ofNullable(dateOfLatestEvidence)) + + /** + * Alias for calling [Builder.dateOfLatestEvidence] with + * `dateOfLatestEvidence.orElse(null)`. + */ + fun dateOfLatestEvidence(dateOfLatestEvidence: Optional) = + dateOfLatestEvidence(dateOfLatestEvidence.getOrNull()) + + /** + * Sets [Builder.dateOfLatestEvidence] to an arbitrary JSON value. + * + * You should usually call [Builder.dateOfLatestEvidence] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun dateOfLatestEvidence(dateOfLatestEvidence: JsonField) = apply { + this.dateOfLatestEvidence = dateOfLatestEvidence + } + + /** When the rule will next be evaluated. Platform rules only. */ + fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime?) = + dateOfNextEvaluation(JsonField.ofNullable(dateOfNextEvaluation)) + + /** + * Alias for calling [Builder.dateOfNextEvaluation] with + * `dateOfNextEvaluation.orElse(null)`. + */ + fun dateOfNextEvaluation(dateOfNextEvaluation: Optional) = + dateOfNextEvaluation(dateOfNextEvaluation.getOrNull()) + + /** + * Sets [Builder.dateOfNextEvaluation] to an arbitrary JSON value. + * + * You should usually call [Builder.dateOfNextEvaluation] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun dateOfNextEvaluation(dateOfNextEvaluation: JsonField) = apply { + this.dateOfNextEvaluation = dateOfNextEvaluation + } + + /** When the evidence must be renewed. Evidence rules with a renewal cadence only. */ + fun dateOfRenewal(dateOfRenewal: OffsetDateTime?) = + dateOfRenewal(JsonField.ofNullable(dateOfRenewal)) + + /** Alias for calling [Builder.dateOfRenewal] with `dateOfRenewal.orElse(null)`. */ + fun dateOfRenewal(dateOfRenewal: Optional) = + dateOfRenewal(dateOfRenewal.getOrNull()) + + /** + * Sets [Builder.dateOfRenewal] to an arbitrary JSON value. + * + * You should usually call [Builder.dateOfRenewal] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun dateOfRenewal(dateOfRenewal: JsonField) = apply { + this.dateOfRenewal = dateOfRenewal + } + + /** Why the result was excluded. */ + fun deactivatedReason(deactivatedReason: String?) = + deactivatedReason(JsonField.ofNullable(deactivatedReason)) + + /** + * Alias for calling [Builder.deactivatedReason] with `deactivatedReason.orElse(null)`. + */ + fun deactivatedReason(deactivatedReason: Optional) = + deactivatedReason(deactivatedReason.getOrNull()) + + /** + * Sets [Builder.deactivatedReason] to an arbitrary JSON value. + * + * You should usually call [Builder.deactivatedReason] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun deactivatedReason(deactivatedReason: JsonField) = apply { + this.deactivatedReason = deactivatedReason + } + + /** The project this result was evaluated for. `null` for workspace-scoped rules. */ + fun projectId(projectId: String?) = projectId(JsonField.ofNullable(projectId)) + + /** Alias for calling [Builder.projectId] with `projectId.orElse(null)`. */ + fun projectId(projectId: Optional) = projectId(projectId.getOrNull()) + + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun projectId(projectId: JsonField) = apply { this.projectId = projectId } + + /** A human-readable explanation of the status. */ + fun statusMessage(statusMessage: String?) = + statusMessage(JsonField.ofNullable(statusMessage)) + + /** Alias for calling [Builder.statusMessage] with `statusMessage.orElse(null)`. */ + fun statusMessage(statusMessage: Optional) = + statusMessage(statusMessage.getOrNull()) + + /** + * Sets [Builder.statusMessage] to an arbitrary JSON value. + * + * You should usually call [Builder.statusMessage] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun statusMessage(statusMessage: JsonField) = apply { + this.statusMessage = statusMessage + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Result]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateUpdated() + * .deactivated() + * .ruleId() + * .status() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Result = + Result( + checkRequired("id", id), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("deactivated", deactivated), + checkRequired("ruleId", ruleId), + checkRequired("status", status), + checkRequired("workspaceId", workspaceId), + assigneeId, + (blockedBy ?: JsonMissing.of()).map { it.toImmutable() }, + (blocking ?: JsonMissing.of()).map { it.toImmutable() }, + dateLastEvaluated, + dateOfLatestEvidence, + dateOfNextEvaluation, + dateOfRenewal, + deactivatedReason, + projectId, + statusMessage, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Result = apply { + if (validated) { + return@apply + } + + id() + dateCreated() + dateUpdated() + deactivated() + ruleId() + status().validate() + workspaceId() + assigneeId() + blockedBy().ifPresent { it.forEach { it.validate() } } + blocking().ifPresent { it.forEach { it.validate() } } + dateLastEvaluated() + dateOfLatestEvidence() + dateOfNextEvaluation() + dateOfRenewal() + deactivatedReason() + projectId() + statusMessage() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (deactivated.asKnown().isPresent) 1 else 0) + + (if (ruleId.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + (if (assigneeId.asKnown().isPresent) 1 else 0) + + (blockedBy.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (blocking.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (dateLastEvaluated.asKnown().isPresent) 1 else 0) + + (if (dateOfLatestEvidence.asKnown().isPresent) 1 else 0) + + (if (dateOfNextEvaluation.asKnown().isPresent) 1 else 0) + + (if (dateOfRenewal.asKnown().isPresent) 1 else 0) + + (if (deactivatedReason.asKnown().isPresent) 1 else 0) + + (if (projectId.asKnown().isPresent) 1 else 0) + + (if (statusMessage.asKnown().isPresent) 1 else 0) + + /** The compliance status of the rule for this entity. */ + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val RUNNING = of("running") + + @JvmField val PASSING = of("passing") + + @JvmField val FAILING = of("failing") + + @JvmField val SKIPPED = of("skipped") + + @JvmField val ERROR = of("error") + + @JvmField val PENDING = of("pending") + + @JvmField val DUE_SOON = of("due_soon") + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + /** An enum containing [Status]'s known values. */ + enum class Known { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + } + + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + /** + * An enum member indicating that [Status] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + PENDING -> Value.PENDING + DUE_SOON -> Value.DUE_SOON + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + PENDING -> Known.PENDING + DUE_SOON -> Known.DUE_SOON + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + class BlockedBy + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val status: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + ) : this(id, status, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun id(): Optional = id.getOptional("id") + + /** + * The compliance status of the rule for this entity. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun status(): Optional = status.getOptional("status") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [BlockedBy]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BlockedBy]. */ + class Builder internal constructor() { + + private var id: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(blockedBy: BlockedBy) = apply { + id = blockedBy.id + status = blockedBy.status + additionalProperties = blockedBy.additionalProperties.toMutableMap() + } + + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The compliance status of the rule for this entity. */ + fun status(status: Status) = status(JsonField.of(status)) + + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun status(status: JsonField) = apply { this.status = status } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [BlockedBy]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): BlockedBy = BlockedBy(id, status, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): BlockedBy = apply { + if (validated) { + return@apply + } + + id() + status().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + /** The compliance status of the rule for this entity. */ + class Status @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val RUNNING = of("running") + + @JvmField val PASSING = of("passing") + + @JvmField val FAILING = of("failing") + + @JvmField val SKIPPED = of("skipped") + + @JvmField val ERROR = of("error") + + @JvmField val PENDING = of("pending") + + @JvmField val DUE_SOON = of("due_soon") + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + /** An enum containing [Status]'s known values. */ + enum class Known { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + } + + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + /** + * An enum member indicating that [Status] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + PENDING -> Value.PENDING + DUE_SOON -> Value.DUE_SOON + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + PENDING -> Known.PENDING + DUE_SOON -> Known.DUE_SOON + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is BlockedBy && + id == other.id && + status == other.status && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(id, status, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BlockedBy{id=$id, status=$status, additionalProperties=$additionalProperties}" + } + + class Blocking + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val status: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + ) : this(id, status, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun id(): Optional = id.getOptional("id") + + /** + * The compliance status of the rule for this entity. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun status(): Optional = status.getOptional("status") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Blocking]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Blocking]. */ + class Builder internal constructor() { + + private var id: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(blocking: Blocking) = apply { + id = blocking.id + status = blocking.status + additionalProperties = blocking.additionalProperties.toMutableMap() + } + + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The compliance status of the rule for this entity. */ + fun status(status: Status) = status(JsonField.of(status)) + + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun status(status: JsonField) = apply { this.status = status } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Blocking]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Blocking = Blocking(id, status, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Blocking = apply { + if (validated) { + return@apply + } + + id() + status().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + /** The compliance status of the rule for this entity. */ + class Status @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val RUNNING = of("running") + + @JvmField val PASSING = of("passing") + + @JvmField val FAILING = of("failing") + + @JvmField val SKIPPED = of("skipped") + + @JvmField val ERROR = of("error") + + @JvmField val PENDING = of("pending") + + @JvmField val DUE_SOON = of("due_soon") + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + /** An enum containing [Status]'s known values. */ + enum class Known { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + } + + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + /** + * An enum member indicating that [Status] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + PENDING -> Value.PENDING + DUE_SOON -> Value.DUE_SOON + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + PENDING -> Known.PENDING + DUE_SOON -> Known.DUE_SOON + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Blocking && + id == other.id && + status == other.status && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(id, status, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Blocking{id=$id, status=$status, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Result && + id == other.id && + dateCreated == other.dateCreated && + dateUpdated == other.dateUpdated && + deactivated == other.deactivated && + ruleId == other.ruleId && + status == other.status && + workspaceId == other.workspaceId && + assigneeId == other.assigneeId && + blockedBy == other.blockedBy && + blocking == other.blocking && + dateLastEvaluated == other.dateLastEvaluated && + dateOfLatestEvidence == other.dateOfLatestEvidence && + dateOfNextEvaluation == other.dateOfNextEvaluation && + dateOfRenewal == other.dateOfRenewal && + deactivatedReason == other.deactivatedReason && + projectId == other.projectId && + statusMessage == other.statusMessage && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + dateCreated, + dateUpdated, + deactivated, + ruleId, + status, + workspaceId, + assigneeId, + blockedBy, + blocking, + dateLastEvaluated, + dateOfLatestEvidence, + dateOfNextEvaluation, + dateOfRenewal, + deactivatedReason, + projectId, + statusMessage, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Result{id=$id, dateCreated=$dateCreated, dateUpdated=$dateUpdated, deactivated=$deactivated, ruleId=$ruleId, status=$status, workspaceId=$workspaceId, assigneeId=$assigneeId, blockedBy=$blockedBy, blocking=$blocking, dateLastEvaluated=$dateLastEvaluated, dateOfLatestEvidence=$dateOfLatestEvidence, dateOfNextEvaluation=$dateOfNextEvaluation, dateOfRenewal=$dateOfRenewal, deactivatedReason=$deactivatedReason, projectId=$projectId, statusMessage=$statusMessage, additionalProperties=$additionalProperties}" + } + + /** + * Pass-rate counts across all of the rule's entities, independent of any status filter applied + * to the request. + */ + class ResultsSummary + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val passing: JsonField, + private val total: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("passing") @ExcludeMissing passing: JsonField = JsonMissing.of(), + @JsonProperty("total") @ExcludeMissing total: JsonField = JsonMissing.of(), + ) : this(passing, total, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun passing(): Optional = passing.getOptional("passing") + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun total(): Optional = total.getOptional("total") + + /** + * Returns the raw JSON value of [passing]. + * + * Unlike [passing], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("passing") @ExcludeMissing fun _passing(): JsonField = passing + + /** + * Returns the raw JSON value of [total]. + * + * Unlike [total], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("total") @ExcludeMissing fun _total(): JsonField = total + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [ResultsSummary]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ResultsSummary]. */ + class Builder internal constructor() { + + private var passing: JsonField = JsonMissing.of() + private var total: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(resultsSummary: ResultsSummary) = apply { + passing = resultsSummary.passing + total = resultsSummary.total + additionalProperties = resultsSummary.additionalProperties.toMutableMap() + } + + fun passing(passing: Long) = passing(JsonField.of(passing)) + + /** + * Sets [Builder.passing] to an arbitrary JSON value. + * + * You should usually call [Builder.passing] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun passing(passing: JsonField) = apply { this.passing = passing } + + fun total(total: Long) = total(JsonField.of(total)) + + /** + * Sets [Builder.total] to an arbitrary JSON value. + * + * You should usually call [Builder.total] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun total(total: JsonField) = apply { this.total = total } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ResultsSummary]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): ResultsSummary = + ResultsSummary(passing, total, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): ResultsSummary = apply { + if (validated) { + return@apply + } + + passing() + total() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (passing.asKnown().isPresent) 1 else 0) + (if (total.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ResultsSummary && + passing == other.passing && + total == other.total && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(passing, total, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ResultsSummary{passing=$passing, total=$total, additionalProperties=$additionalProperties}" + } + + class Tag + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val creatorId: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val immutable: JsonField, + private val name: JsonField, + private val workspaceId: JsonField, + private val color: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("creatorId") + @ExcludeMissing + creatorId: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("immutable") + @ExcludeMissing + immutable: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + @JsonProperty("color") @ExcludeMissing color: JsonField = JsonMissing.of(), + ) : this( + id, + creatorId, + dateCreated, + dateUpdated, + immutable, + name, + workspaceId, + color, + mutableMapOf(), + ) + + /** + * The rule tag id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun id(): String = id.getRequired("id") + + /** + * The user who created the tag. `null` for tags that ship with Openlayer. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun creatorId(): Optional = creatorId.getOptional("creatorId") + + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** + * The last update date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** + * Whether the tag is managed by Openlayer and cannot be edited or deleted. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun immutable(): Boolean = immutable.getRequired("immutable") + + /** + * The tag name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun name(): String = name.getRequired("name") + + /** + * The id of the workspace the tag belongs to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun workspaceId(): String = workspaceId.getRequired("workspaceId") + + /** + * The color the tag is displayed with. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun color(): Optional = color.getOptional("color") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [creatorId]. + * + * Unlike [creatorId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("creatorId") @ExcludeMissing fun _creatorId(): JsonField = creatorId + + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** + * Returns the raw JSON value of [immutable]. + * + * Unlike [immutable], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("immutable") @ExcludeMissing fun _immutable(): JsonField = immutable + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [workspaceId]. + * + * Unlike [workspaceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("workspaceId") + @ExcludeMissing + fun _workspaceId(): JsonField = workspaceId + + /** + * Returns the raw JSON value of [color]. + * + * Unlike [color], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("color") @ExcludeMissing fun _color(): JsonField = color + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Tag]. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .immutable() + * .name() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Tag]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var creatorId: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var immutable: JsonField? = null + private var name: JsonField? = null + private var workspaceId: JsonField? = null + private var color: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(tag: Tag) = apply { + id = tag.id + creatorId = tag.creatorId + dateCreated = tag.dateCreated + dateUpdated = tag.dateUpdated + immutable = tag.immutable + name = tag.name + workspaceId = tag.workspaceId + color = tag.color + additionalProperties = tag.additionalProperties.toMutableMap() + } + + /** The rule tag id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The user who created the tag. `null` for tags that ship with Openlayer. */ + fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) + + /** Alias for calling [Builder.creatorId] with `creatorId.orElse(null)`. */ + fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) + + /** + * Sets [Builder.creatorId] to an arbitrary JSON value. + * + * You should usually call [Builder.creatorId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The last update date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** Whether the tag is managed by Openlayer and cannot be edited or deleted. */ + fun immutable(immutable: Boolean) = immutable(JsonField.of(immutable)) + + /** + * Sets [Builder.immutable] to an arbitrary JSON value. + * + * You should usually call [Builder.immutable] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun immutable(immutable: JsonField) = apply { this.immutable = immutable } + + /** The tag name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun name(name: JsonField) = apply { this.name = name } + + /** The id of the workspace the tag belongs to. */ + fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) + + /** + * Sets [Builder.workspaceId] to an arbitrary JSON value. + * + * You should usually call [Builder.workspaceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun workspaceId(workspaceId: JsonField) = apply { + this.workspaceId = workspaceId + } + + /** The color the tag is displayed with. */ + fun color(color: String?) = color(JsonField.ofNullable(color)) + + /** Alias for calling [Builder.color] with `color.orElse(null)`. */ + fun color(color: Optional) = color(color.getOrNull()) + + /** + * Sets [Builder.color] to an arbitrary JSON value. + * + * You should usually call [Builder.color] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun color(color: JsonField) = apply { this.color = color } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Tag]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .immutable() + * .name() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Tag = + Tag( + checkRequired("id", id), + checkRequired("creatorId", creatorId), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("immutable", immutable), + checkRequired("name", name), + checkRequired("workspaceId", workspaceId), + color, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Tag = apply { + if (validated) { + return@apply + } + + id() + creatorId() + dateCreated() + dateUpdated() + immutable() + name() + workspaceId() + color() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (creatorId.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (immutable.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + (if (color.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Tag && + id == other.id && + creatorId == other.creatorId && + dateCreated == other.dateCreated && + dateUpdated == other.dateUpdated && + immutable == other.immutable && + name == other.name && + workspaceId == other.workspaceId && + color == other.color && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + creatorId, + dateCreated, + dateUpdated, + immutable, + name, + workspaceId, + color, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Tag{id=$id, creatorId=$creatorId, dateCreated=$dateCreated, dateUpdated=$dateUpdated, immutable=$immutable, name=$name, workspaceId=$workspaceId, color=$color, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is RuleRetrieveResponse && + id == other.id && + dateCreated == other.dateCreated && + dateUpdated == other.dateUpdated && + name == other.name && + scope == other.scope && + type == other.type && + workspaceId == other.workspaceId && + assigneeId == other.assigneeId && + automationParams == other.automationParams && + automationType == other.automationType && + deactivated == other.deactivated && + description == other.description && + evidenceType == other.evidenceType && + frameworks == other.frameworks && + immutable == other.immutable && + renewalCadenceDays == other.renewalCadenceDays && + results == other.results && + resultsSummary == other.resultsSummary && + tagIds == other.tagIds && + tags == other.tags && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + dateCreated, + dateUpdated, + name, + scope, + type, + workspaceId, + assigneeId, + automationParams, + automationType, + deactivated, + description, + evidenceType, + frameworks, + immutable, + renewalCadenceDays, + results, + resultsSummary, + tagIds, + tags, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "RuleRetrieveResponse{id=$id, dateCreated=$dateCreated, dateUpdated=$dateUpdated, name=$name, scope=$scope, type=$type, workspaceId=$workspaceId, assigneeId=$assigneeId, automationParams=$automationParams, automationType=$automationType, deactivated=$deactivated, description=$description, evidenceType=$evidenceType, frameworks=$frameworks, immutable=$immutable, renewalCadenceDays=$renewalCadenceDays, results=$results, resultsSummary=$resultsSummary, tagIds=$tagIds, tags=$tags, additionalProperties=$additionalProperties}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/rules/RuleUpdateParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/rules/RuleUpdateParams.kt new file mode 100644 index 00000000..5d50162c --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/rules/RuleUpdateParams.kt @@ -0,0 +1,885 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.rules + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.openlayer.api.core.ExcludeMissing +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonMissing +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.Params +import com.openlayer.api.core.checkKnown +import com.openlayer.api.core.http.Headers +import com.openlayer.api.core.http.QueryParams +import com.openlayer.api.core.toImmutable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * Update a governance rule. Only the fields you send are changed. + * + * Rules that ship with Openlayer report `immutable: true` and cannot be edited. + * + * A rule's `scope`, `type`, `evidenceType`, and automation are fixed once it exists -- create a new + * rule instead of converting one. + */ +class RuleUpdateParams +private constructor( + private val ruleId: String?, + private val body: Body, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun ruleId(): Optional = Optional.ofNullable(ruleId) + + /** + * The user responsible for satisfying the rule. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun assigneeId(): Optional = body.assigneeId() + + /** + * Whether the rule is excluded from compliance calculations. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun deactivated(): Optional = body.deactivated() + + /** + * What the rule requires. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun description(): Optional = body.description() + + /** + * The rule name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun name(): Optional = body.name() + + /** + * How often evidence must be renewed, in days. Once evidence is older than this, the rule + * result becomes `due_soon` and then `failing`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun renewalCadenceDays(): Optional = body.renewalCadenceDays() + + /** + * The ids of the rule tags to associate with the rule. Replaces the rule's tags. Read them back + * from `tags`, and list the tags available in the workspace with `GET + * /workspaces/{workspaceId}/rule-tags`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun tagIds(): Optional> = body.tagIds() + + /** + * Returns the raw JSON value of [assigneeId]. + * + * Unlike [assigneeId], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _assigneeId(): JsonField = body._assigneeId() + + /** + * Returns the raw JSON value of [deactivated]. + * + * Unlike [deactivated], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _deactivated(): JsonField = body._deactivated() + + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _description(): JsonField = body._description() + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _name(): JsonField = body._name() + + /** + * Returns the raw JSON value of [renewalCadenceDays]. + * + * Unlike [renewalCadenceDays], this method doesn't throw if the JSON field has an unexpected + * type. + */ + fun _renewalCadenceDays(): JsonField = body._renewalCadenceDays() + + /** + * Returns the raw JSON value of [tagIds]. + * + * Unlike [tagIds], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _tagIds(): JsonField> = body._tagIds() + + fun _additionalBodyProperties(): Map = body._additionalProperties() + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): RuleUpdateParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [RuleUpdateParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [RuleUpdateParams]. */ + class Builder internal constructor() { + + private var ruleId: String? = null + private var body: Body.Builder = Body.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(ruleUpdateParams: RuleUpdateParams) = apply { + ruleId = ruleUpdateParams.ruleId + body = ruleUpdateParams.body.toBuilder() + additionalHeaders = ruleUpdateParams.additionalHeaders.toBuilder() + additionalQueryParams = ruleUpdateParams.additionalQueryParams.toBuilder() + } + + fun ruleId(ruleId: String?) = apply { this.ruleId = ruleId } + + /** Alias for calling [Builder.ruleId] with `ruleId.orElse(null)`. */ + fun ruleId(ruleId: Optional) = ruleId(ruleId.getOrNull()) + + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [assigneeId] + * - [deactivated] + * - [description] + * - [name] + * - [renewalCadenceDays] + * - etc. + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + + /** The user responsible for satisfying the rule. */ + fun assigneeId(assigneeId: String?) = apply { body.assigneeId(assigneeId) } + + /** Alias for calling [Builder.assigneeId] with `assigneeId.orElse(null)`. */ + fun assigneeId(assigneeId: Optional) = assigneeId(assigneeId.getOrNull()) + + /** + * Sets [Builder.assigneeId] to an arbitrary JSON value. + * + * You should usually call [Builder.assigneeId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun assigneeId(assigneeId: JsonField) = apply { body.assigneeId(assigneeId) } + + /** Whether the rule is excluded from compliance calculations. */ + fun deactivated(deactivated: Boolean) = apply { body.deactivated(deactivated) } + + /** + * Sets [Builder.deactivated] to an arbitrary JSON value. + * + * You should usually call [Builder.deactivated] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun deactivated(deactivated: JsonField) = apply { body.deactivated(deactivated) } + + /** What the rule requires. */ + fun description(description: String?) = apply { body.description(description) } + + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ + fun description(description: Optional) = description(description.getOrNull()) + + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun description(description: JsonField) = apply { body.description(description) } + + /** The rule name. */ + fun name(name: String) = apply { body.name(name) } + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun name(name: JsonField) = apply { body.name(name) } + + /** + * How often evidence must be renewed, in days. Once evidence is older than this, the rule + * result becomes `due_soon` and then `failing`. + */ + fun renewalCadenceDays(renewalCadenceDays: Long?) = apply { + body.renewalCadenceDays(renewalCadenceDays) + } + + /** + * Alias for [Builder.renewalCadenceDays]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun renewalCadenceDays(renewalCadenceDays: Long) = + renewalCadenceDays(renewalCadenceDays as Long?) + + /** + * Alias for calling [Builder.renewalCadenceDays] with `renewalCadenceDays.orElse(null)`. + */ + fun renewalCadenceDays(renewalCadenceDays: Optional) = + renewalCadenceDays(renewalCadenceDays.getOrNull()) + + /** + * Sets [Builder.renewalCadenceDays] to an arbitrary JSON value. + * + * You should usually call [Builder.renewalCadenceDays] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun renewalCadenceDays(renewalCadenceDays: JsonField) = apply { + body.renewalCadenceDays(renewalCadenceDays) + } + + /** + * The ids of the rule tags to associate with the rule. Replaces the rule's tags. Read them + * back from `tags`, and list the tags available in the workspace with `GET + * /workspaces/{workspaceId}/rule-tags`. + */ + fun tagIds(tagIds: List?) = apply { body.tagIds(tagIds) } + + /** Alias for calling [Builder.tagIds] with `tagIds.orElse(null)`. */ + fun tagIds(tagIds: Optional>) = tagIds(tagIds.getOrNull()) + + /** + * Sets [Builder.tagIds] to an arbitrary JSON value. + * + * You should usually call [Builder.tagIds] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun tagIds(tagIds: JsonField>) = apply { body.tagIds(tagIds) } + + /** + * Adds a single [String] to [tagIds]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addTagId(tagId: String) = apply { body.addTagId(tagId) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [RuleUpdateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): RuleUpdateParams = + RuleUpdateParams( + ruleId, + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _body(): Body = body + + fun _pathParam(index: Int): String = + when (index) { + 0 -> ruleId ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val assigneeId: JsonField, + private val deactivated: JsonField, + private val description: JsonField, + private val name: JsonField, + private val renewalCadenceDays: JsonField, + private val tagIds: JsonField>, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("assigneeId") + @ExcludeMissing + assigneeId: JsonField = JsonMissing.of(), + @JsonProperty("deactivated") + @ExcludeMissing + deactivated: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + description: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("renewalCadenceDays") + @ExcludeMissing + renewalCadenceDays: JsonField = JsonMissing.of(), + @JsonProperty("tagIds") + @ExcludeMissing + tagIds: JsonField> = JsonMissing.of(), + ) : this( + assigneeId, + deactivated, + description, + name, + renewalCadenceDays, + tagIds, + mutableMapOf(), + ) + + /** + * The user responsible for satisfying the rule. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun assigneeId(): Optional = assigneeId.getOptional("assigneeId") + + /** + * Whether the rule is excluded from compliance calculations. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun deactivated(): Optional = deactivated.getOptional("deactivated") + + /** + * What the rule requires. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun description(): Optional = description.getOptional("description") + + /** + * The rule name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun name(): Optional = name.getOptional("name") + + /** + * How often evidence must be renewed, in days. Once evidence is older than this, the rule + * result becomes `due_soon` and then `failing`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun renewalCadenceDays(): Optional = + renewalCadenceDays.getOptional("renewalCadenceDays") + + /** + * The ids of the rule tags to associate with the rule. Replaces the rule's tags. Read them + * back from `tags`, and list the tags available in the workspace with `GET + * /workspaces/{workspaceId}/rule-tags`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun tagIds(): Optional> = tagIds.getOptional("tagIds") + + /** + * Returns the raw JSON value of [assigneeId]. + * + * Unlike [assigneeId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("assigneeId") + @ExcludeMissing + fun _assigneeId(): JsonField = assigneeId + + /** + * Returns the raw JSON value of [deactivated]. + * + * Unlike [deactivated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("deactivated") + @ExcludeMissing + fun _deactivated(): JsonField = deactivated + + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("description") + @ExcludeMissing + fun _description(): JsonField = description + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [renewalCadenceDays]. + * + * Unlike [renewalCadenceDays], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("renewalCadenceDays") + @ExcludeMissing + fun _renewalCadenceDays(): JsonField = renewalCadenceDays + + /** + * Returns the raw JSON value of [tagIds]. + * + * Unlike [tagIds], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("tagIds") @ExcludeMissing fun _tagIds(): JsonField> = tagIds + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Body]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var assigneeId: JsonField = JsonMissing.of() + private var deactivated: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var renewalCadenceDays: JsonField = JsonMissing.of() + private var tagIds: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + assigneeId = body.assigneeId + deactivated = body.deactivated + description = body.description + name = body.name + renewalCadenceDays = body.renewalCadenceDays + tagIds = body.tagIds.map { it.toMutableList() } + additionalProperties = body.additionalProperties.toMutableMap() + } + + /** The user responsible for satisfying the rule. */ + fun assigneeId(assigneeId: String?) = assigneeId(JsonField.ofNullable(assigneeId)) + + /** Alias for calling [Builder.assigneeId] with `assigneeId.orElse(null)`. */ + fun assigneeId(assigneeId: Optional) = assigneeId(assigneeId.getOrNull()) + + /** + * Sets [Builder.assigneeId] to an arbitrary JSON value. + * + * You should usually call [Builder.assigneeId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun assigneeId(assigneeId: JsonField) = apply { this.assigneeId = assigneeId } + + /** Whether the rule is excluded from compliance calculations. */ + fun deactivated(deactivated: Boolean) = deactivated(JsonField.of(deactivated)) + + /** + * Sets [Builder.deactivated] to an arbitrary JSON value. + * + * You should usually call [Builder.deactivated] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun deactivated(deactivated: JsonField) = apply { + this.deactivated = deactivated + } + + /** What the rule requires. */ + fun description(description: String?) = description(JsonField.ofNullable(description)) + + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ + fun description(description: Optional) = description(description.getOrNull()) + + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun description(description: JsonField) = apply { + this.description = description + } + + /** The rule name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun name(name: JsonField) = apply { this.name = name } + + /** + * How often evidence must be renewed, in days. Once evidence is older than this, the + * rule result becomes `due_soon` and then `failing`. + */ + fun renewalCadenceDays(renewalCadenceDays: Long?) = + renewalCadenceDays(JsonField.ofNullable(renewalCadenceDays)) + + /** + * Alias for [Builder.renewalCadenceDays]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun renewalCadenceDays(renewalCadenceDays: Long) = + renewalCadenceDays(renewalCadenceDays as Long?) + + /** + * Alias for calling [Builder.renewalCadenceDays] with + * `renewalCadenceDays.orElse(null)`. + */ + fun renewalCadenceDays(renewalCadenceDays: Optional) = + renewalCadenceDays(renewalCadenceDays.getOrNull()) + + /** + * Sets [Builder.renewalCadenceDays] to an arbitrary JSON value. + * + * You should usually call [Builder.renewalCadenceDays] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun renewalCadenceDays(renewalCadenceDays: JsonField) = apply { + this.renewalCadenceDays = renewalCadenceDays + } + + /** + * The ids of the rule tags to associate with the rule. Replaces the rule's tags. Read + * them back from `tags`, and list the tags available in the workspace with `GET + * /workspaces/{workspaceId}/rule-tags`. + */ + fun tagIds(tagIds: List?) = tagIds(JsonField.ofNullable(tagIds)) + + /** Alias for calling [Builder.tagIds] with `tagIds.orElse(null)`. */ + fun tagIds(tagIds: Optional>) = tagIds(tagIds.getOrNull()) + + /** + * Sets [Builder.tagIds] to an arbitrary JSON value. + * + * You should usually call [Builder.tagIds] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun tagIds(tagIds: JsonField>) = apply { + this.tagIds = tagIds.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [tagIds]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addTagId(tagId: String) = apply { + tagIds = + (tagIds ?: JsonField.of(mutableListOf())).also { + checkKnown("tagIds", it).add(tagId) + } + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Body = + Body( + assigneeId, + deactivated, + description, + name, + renewalCadenceDays, + (tagIds ?: JsonMissing.of()).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Body = apply { + if (validated) { + return@apply + } + + assigneeId() + deactivated() + description() + name() + renewalCadenceDays() + tagIds() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (assigneeId.asKnown().isPresent) 1 else 0) + + (if (deactivated.asKnown().isPresent) 1 else 0) + + (if (description.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (renewalCadenceDays.asKnown().isPresent) 1 else 0) + + (tagIds.asKnown().getOrNull()?.size ?: 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Body && + assigneeId == other.assigneeId && + deactivated == other.deactivated && + description == other.description && + name == other.name && + renewalCadenceDays == other.renewalCadenceDays && + tagIds == other.tagIds && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + assigneeId, + deactivated, + description, + name, + renewalCadenceDays, + tagIds, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Body{assigneeId=$assigneeId, deactivated=$deactivated, description=$description, name=$name, renewalCadenceDays=$renewalCadenceDays, tagIds=$tagIds, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is RuleUpdateParams && + ruleId == other.ruleId && + body == other.body && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = + Objects.hash(ruleId, body, additionalHeaders, additionalQueryParams) + + override fun toString() = + "RuleUpdateParams{ruleId=$ruleId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/rules/RuleUpdateResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/rules/RuleUpdateResponse.kt new file mode 100644 index 00000000..7f207688 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/rules/RuleUpdateResponse.kt @@ -0,0 +1,4821 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.rules + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.openlayer.api.core.Enum +import com.openlayer.api.core.ExcludeMissing +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonMissing +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.checkKnown +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.toImmutable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.time.OffsetDateTime +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class RuleUpdateResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val id: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val name: JsonField, + private val scope: JsonField, + private val type: JsonField, + private val workspaceId: JsonField, + private val assigneeId: JsonField, + private val automationParams: JsonField, + private val automationType: JsonField, + private val deactivated: JsonField, + private val description: JsonField, + private val evidenceType: JsonField, + private val frameworks: JsonField>, + private val immutable: JsonField, + private val renewalCadenceDays: JsonField, + private val results: JsonField>, + private val resultsSummary: JsonField, + private val tagIds: JsonField>, + private val tags: JsonField>, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("scope") @ExcludeMissing scope: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + @JsonProperty("assigneeId") + @ExcludeMissing + assigneeId: JsonField = JsonMissing.of(), + @JsonProperty("automationParams") + @ExcludeMissing + automationParams: JsonField = JsonMissing.of(), + @JsonProperty("automationType") + @ExcludeMissing + automationType: JsonField = JsonMissing.of(), + @JsonProperty("deactivated") + @ExcludeMissing + deactivated: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + description: JsonField = JsonMissing.of(), + @JsonProperty("evidenceType") + @ExcludeMissing + evidenceType: JsonField = JsonMissing.of(), + @JsonProperty("frameworks") + @ExcludeMissing + frameworks: JsonField> = JsonMissing.of(), + @JsonProperty("immutable") @ExcludeMissing immutable: JsonField = JsonMissing.of(), + @JsonProperty("renewalCadenceDays") + @ExcludeMissing + renewalCadenceDays: JsonField = JsonMissing.of(), + @JsonProperty("results") + @ExcludeMissing + results: JsonField> = JsonMissing.of(), + @JsonProperty("resultsSummary") + @ExcludeMissing + resultsSummary: JsonField = JsonMissing.of(), + @JsonProperty("tagIds") @ExcludeMissing tagIds: JsonField> = JsonMissing.of(), + @JsonProperty("tags") @ExcludeMissing tags: JsonField> = JsonMissing.of(), + ) : this( + id, + dateCreated, + dateUpdated, + name, + scope, + type, + workspaceId, + assigneeId, + automationParams, + automationType, + deactivated, + description, + evidenceType, + frameworks, + immutable, + renewalCadenceDays, + results, + resultsSummary, + tagIds, + tags, + mutableMapOf(), + ) + + /** + * The rule id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun id(): String = id.getRequired("id") + + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** + * The last update date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** + * The rule name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun name(): String = name.getRequired("name") + + /** + * Whether the rule is evaluated once for the whole workspace, or once per project the rule's + * frameworks apply to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun scope(): Scope = scope.getRequired("scope") + + /** + * `platform` rules are evaluated automatically from the state of your Openlayer workspace. + * `evidence` rules are satisfied by attaching evidence. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun type(): Type = type.getRequired("type") + + /** + * The id of the workspace the rule belongs to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun workspaceId(): String = workspaceId.getRequired("workspaceId") + + /** + * The user responsible for satisfying the rule. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun assigneeId(): Optional = assigneeId.getOptional("assigneeId") + + /** + * Configuration for the platform check, when the automation takes parameters. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun automationParams(): Optional = + automationParams.getOptional("automationParams") + + /** + * Which workspace signal a platform rule checks, for example `monitoring_mode_enabled`, + * `test_setup`, or `project_owner_set`. `null` for evidence rules. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun automationType(): Optional = automationType.getOptional("automationType") + + /** + * Whether the rule is excluded from compliance calculations. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun deactivated(): Optional = deactivated.getOptional("deactivated") + + /** + * What the rule requires. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun description(): Optional = description.getOptional("description") + + /** + * The kind of evidence that satisfies the rule. `null` for platform rules. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun evidenceType(): Optional = evidenceType.getOptional("evidenceType") + + /** + * The frameworks that include this rule. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun frameworks(): Optional> = frameworks.getOptional("frameworks") + + /** + * Whether the rule is managed by Openlayer and cannot be edited. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun immutable(): Optional = immutable.getOptional("immutable") + + /** + * How often evidence must be renewed, in days. Once evidence is older than this, the rule + * result becomes `due_soon` and then `failing`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun renewalCadenceDays(): Optional = renewalCadenceDays.getOptional("renewalCadenceDays") + + /** + * The rule's results, one per entity the rule is evaluated against. Only returned when + * `includeResults` is `true`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun results(): Optional> = results.getOptional("results") + + /** + * Pass-rate counts across all of the rule's entities, independent of any status filter applied + * to the request. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun resultsSummary(): Optional = resultsSummary.getOptional("resultsSummary") + + /** + * The ids of the rule tags to associate with the rule. Replaces the rule's tags. Read them back + * from `tags`, and list the tags available in the workspace with `GET + * /workspaces/{workspaceId}/rule-tags`. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun tagIds(): Optional> = tagIds.getOptional("tagIds") + + /** + * The rule tags associated with the rule. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun tags(): Optional> = tags.getOptional("tags") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [scope]. + * + * Unlike [scope], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("scope") @ExcludeMissing fun _scope(): JsonField = scope + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + /** + * Returns the raw JSON value of [workspaceId]. + * + * Unlike [workspaceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("workspaceId") @ExcludeMissing fun _workspaceId(): JsonField = workspaceId + + /** + * Returns the raw JSON value of [assigneeId]. + * + * Unlike [assigneeId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("assigneeId") @ExcludeMissing fun _assigneeId(): JsonField = assigneeId + + /** + * Returns the raw JSON value of [automationParams]. + * + * Unlike [automationParams], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("automationParams") + @ExcludeMissing + fun _automationParams(): JsonField = automationParams + + /** + * Returns the raw JSON value of [automationType]. + * + * Unlike [automationType], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("automationType") + @ExcludeMissing + fun _automationType(): JsonField = automationType + + /** + * Returns the raw JSON value of [deactivated]. + * + * Unlike [deactivated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("deactivated") + @ExcludeMissing + fun _deactivated(): JsonField = deactivated + + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description + + /** + * Returns the raw JSON value of [evidenceType]. + * + * Unlike [evidenceType], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("evidenceType") + @ExcludeMissing + fun _evidenceType(): JsonField = evidenceType + + /** + * Returns the raw JSON value of [frameworks]. + * + * Unlike [frameworks], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("frameworks") + @ExcludeMissing + fun _frameworks(): JsonField> = frameworks + + /** + * Returns the raw JSON value of [immutable]. + * + * Unlike [immutable], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("immutable") @ExcludeMissing fun _immutable(): JsonField = immutable + + /** + * Returns the raw JSON value of [renewalCadenceDays]. + * + * Unlike [renewalCadenceDays], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("renewalCadenceDays") + @ExcludeMissing + fun _renewalCadenceDays(): JsonField = renewalCadenceDays + + /** + * Returns the raw JSON value of [results]. + * + * Unlike [results], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("results") @ExcludeMissing fun _results(): JsonField> = results + + /** + * Returns the raw JSON value of [resultsSummary]. + * + * Unlike [resultsSummary], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("resultsSummary") + @ExcludeMissing + fun _resultsSummary(): JsonField = resultsSummary + + /** + * Returns the raw JSON value of [tagIds]. + * + * Unlike [tagIds], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("tagIds") @ExcludeMissing fun _tagIds(): JsonField> = tagIds + + /** + * Returns the raw JSON value of [tags]. + * + * Unlike [tags], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("tags") @ExcludeMissing fun _tags(): JsonField> = tags + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [RuleUpdateResponse]. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateUpdated() + * .name() + * .scope() + * .type() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [RuleUpdateResponse]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var name: JsonField? = null + private var scope: JsonField? = null + private var type: JsonField? = null + private var workspaceId: JsonField? = null + private var assigneeId: JsonField = JsonMissing.of() + private var automationParams: JsonField = JsonMissing.of() + private var automationType: JsonField = JsonMissing.of() + private var deactivated: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var evidenceType: JsonField = JsonMissing.of() + private var frameworks: JsonField>? = null + private var immutable: JsonField = JsonMissing.of() + private var renewalCadenceDays: JsonField = JsonMissing.of() + private var results: JsonField>? = null + private var resultsSummary: JsonField = JsonMissing.of() + private var tagIds: JsonField>? = null + private var tags: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(ruleUpdateResponse: RuleUpdateResponse) = apply { + id = ruleUpdateResponse.id + dateCreated = ruleUpdateResponse.dateCreated + dateUpdated = ruleUpdateResponse.dateUpdated + name = ruleUpdateResponse.name + scope = ruleUpdateResponse.scope + type = ruleUpdateResponse.type + workspaceId = ruleUpdateResponse.workspaceId + assigneeId = ruleUpdateResponse.assigneeId + automationParams = ruleUpdateResponse.automationParams + automationType = ruleUpdateResponse.automationType + deactivated = ruleUpdateResponse.deactivated + description = ruleUpdateResponse.description + evidenceType = ruleUpdateResponse.evidenceType + frameworks = ruleUpdateResponse.frameworks.map { it.toMutableList() } + immutable = ruleUpdateResponse.immutable + renewalCadenceDays = ruleUpdateResponse.renewalCadenceDays + results = ruleUpdateResponse.results.map { it.toMutableList() } + resultsSummary = ruleUpdateResponse.resultsSummary + tagIds = ruleUpdateResponse.tagIds.map { it.toMutableList() } + tags = ruleUpdateResponse.tags.map { it.toMutableList() } + additionalProperties = ruleUpdateResponse.additionalProperties.toMutableMap() + } + + /** The rule id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The last update date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** The rule name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun name(name: JsonField) = apply { this.name = name } + + /** + * Whether the rule is evaluated once for the whole workspace, or once per project the + * rule's frameworks apply to. + */ + fun scope(scope: Scope) = scope(JsonField.of(scope)) + + /** + * Sets [Builder.scope] to an arbitrary JSON value. + * + * You should usually call [Builder.scope] with a well-typed [Scope] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun scope(scope: JsonField) = apply { this.scope = scope } + + /** + * `platform` rules are evaluated automatically from the state of your Openlayer workspace. + * `evidence` rules are satisfied by attaching evidence. + */ + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun type(type: JsonField) = apply { this.type = type } + + /** The id of the workspace the rule belongs to. */ + fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) + + /** + * Sets [Builder.workspaceId] to an arbitrary JSON value. + * + * You should usually call [Builder.workspaceId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun workspaceId(workspaceId: JsonField) = apply { this.workspaceId = workspaceId } + + /** The user responsible for satisfying the rule. */ + fun assigneeId(assigneeId: String?) = assigneeId(JsonField.ofNullable(assigneeId)) + + /** Alias for calling [Builder.assigneeId] with `assigneeId.orElse(null)`. */ + fun assigneeId(assigneeId: Optional) = assigneeId(assigneeId.getOrNull()) + + /** + * Sets [Builder.assigneeId] to an arbitrary JSON value. + * + * You should usually call [Builder.assigneeId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun assigneeId(assigneeId: JsonField) = apply { this.assigneeId = assigneeId } + + /** Configuration for the platform check, when the automation takes parameters. */ + fun automationParams(automationParams: AutomationParams?) = + automationParams(JsonField.ofNullable(automationParams)) + + /** Alias for calling [Builder.automationParams] with `automationParams.orElse(null)`. */ + fun automationParams(automationParams: Optional) = + automationParams(automationParams.getOrNull()) + + /** + * Sets [Builder.automationParams] to an arbitrary JSON value. + * + * You should usually call [Builder.automationParams] with a well-typed [AutomationParams] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun automationParams(automationParams: JsonField) = apply { + this.automationParams = automationParams + } + + /** + * Which workspace signal a platform rule checks, for example `monitoring_mode_enabled`, + * `test_setup`, or `project_owner_set`. `null` for evidence rules. + */ + fun automationType(automationType: String?) = + automationType(JsonField.ofNullable(automationType)) + + /** Alias for calling [Builder.automationType] with `automationType.orElse(null)`. */ + fun automationType(automationType: Optional) = + automationType(automationType.getOrNull()) + + /** + * Sets [Builder.automationType] to an arbitrary JSON value. + * + * You should usually call [Builder.automationType] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun automationType(automationType: JsonField) = apply { + this.automationType = automationType + } + + /** Whether the rule is excluded from compliance calculations. */ + fun deactivated(deactivated: Boolean) = deactivated(JsonField.of(deactivated)) + + /** + * Sets [Builder.deactivated] to an arbitrary JSON value. + * + * You should usually call [Builder.deactivated] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun deactivated(deactivated: JsonField) = apply { this.deactivated = deactivated } + + /** What the rule requires. */ + fun description(description: String?) = description(JsonField.ofNullable(description)) + + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ + fun description(description: Optional) = description(description.getOrNull()) + + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun description(description: JsonField) = apply { this.description = description } + + /** The kind of evidence that satisfies the rule. `null` for platform rules. */ + fun evidenceType(evidenceType: EvidenceType?) = + evidenceType(JsonField.ofNullable(evidenceType)) + + /** Alias for calling [Builder.evidenceType] with `evidenceType.orElse(null)`. */ + fun evidenceType(evidenceType: Optional) = + evidenceType(evidenceType.getOrNull()) + + /** + * Sets [Builder.evidenceType] to an arbitrary JSON value. + * + * You should usually call [Builder.evidenceType] with a well-typed [EvidenceType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun evidenceType(evidenceType: JsonField) = apply { + this.evidenceType = evidenceType + } + + /** The frameworks that include this rule. */ + fun frameworks(frameworks: List) = frameworks(JsonField.of(frameworks)) + + /** + * Sets [Builder.frameworks] to an arbitrary JSON value. + * + * You should usually call [Builder.frameworks] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun frameworks(frameworks: JsonField>) = apply { + this.frameworks = frameworks.map { it.toMutableList() } + } + + /** + * Adds a single [Framework] to [frameworks]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addFramework(framework: Framework) = apply { + frameworks = + (frameworks ?: JsonField.of(mutableListOf())).also { + checkKnown("frameworks", it).add(framework) + } + } + + /** Whether the rule is managed by Openlayer and cannot be edited. */ + fun immutable(immutable: Boolean) = immutable(JsonField.of(immutable)) + + /** + * Sets [Builder.immutable] to an arbitrary JSON value. + * + * You should usually call [Builder.immutable] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun immutable(immutable: JsonField) = apply { this.immutable = immutable } + + /** + * How often evidence must be renewed, in days. Once evidence is older than this, the rule + * result becomes `due_soon` and then `failing`. + */ + fun renewalCadenceDays(renewalCadenceDays: Long?) = + renewalCadenceDays(JsonField.ofNullable(renewalCadenceDays)) + + /** + * Alias for [Builder.renewalCadenceDays]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun renewalCadenceDays(renewalCadenceDays: Long) = + renewalCadenceDays(renewalCadenceDays as Long?) + + /** + * Alias for calling [Builder.renewalCadenceDays] with `renewalCadenceDays.orElse(null)`. + */ + fun renewalCadenceDays(renewalCadenceDays: Optional) = + renewalCadenceDays(renewalCadenceDays.getOrNull()) + + /** + * Sets [Builder.renewalCadenceDays] to an arbitrary JSON value. + * + * You should usually call [Builder.renewalCadenceDays] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun renewalCadenceDays(renewalCadenceDays: JsonField) = apply { + this.renewalCadenceDays = renewalCadenceDays + } + + /** + * The rule's results, one per entity the rule is evaluated against. Only returned when + * `includeResults` is `true`. + */ + fun results(results: List) = results(JsonField.of(results)) + + /** + * Sets [Builder.results] to an arbitrary JSON value. + * + * You should usually call [Builder.results] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun results(results: JsonField>) = apply { + this.results = results.map { it.toMutableList() } + } + + /** + * Adds a single [Result] to [results]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addResult(result: Result) = apply { + results = + (results ?: JsonField.of(mutableListOf())).also { + checkKnown("results", it).add(result) + } + } + + /** + * Pass-rate counts across all of the rule's entities, independent of any status filter + * applied to the request. + */ + fun resultsSummary(resultsSummary: ResultsSummary?) = + resultsSummary(JsonField.ofNullable(resultsSummary)) + + /** Alias for calling [Builder.resultsSummary] with `resultsSummary.orElse(null)`. */ + fun resultsSummary(resultsSummary: Optional) = + resultsSummary(resultsSummary.getOrNull()) + + /** + * Sets [Builder.resultsSummary] to an arbitrary JSON value. + * + * You should usually call [Builder.resultsSummary] with a well-typed [ResultsSummary] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun resultsSummary(resultsSummary: JsonField) = apply { + this.resultsSummary = resultsSummary + } + + /** + * The ids of the rule tags to associate with the rule. Replaces the rule's tags. Read them + * back from `tags`, and list the tags available in the workspace with `GET + * /workspaces/{workspaceId}/rule-tags`. + */ + fun tagIds(tagIds: List?) = tagIds(JsonField.ofNullable(tagIds)) + + /** Alias for calling [Builder.tagIds] with `tagIds.orElse(null)`. */ + fun tagIds(tagIds: Optional>) = tagIds(tagIds.getOrNull()) + + /** + * Sets [Builder.tagIds] to an arbitrary JSON value. + * + * You should usually call [Builder.tagIds] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun tagIds(tagIds: JsonField>) = apply { + this.tagIds = tagIds.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [tagIds]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addTagId(tagId: String) = apply { + tagIds = + (tagIds ?: JsonField.of(mutableListOf())).also { + checkKnown("tagIds", it).add(tagId) + } + } + + /** The rule tags associated with the rule. */ + fun tags(tags: List?) = tags(JsonField.ofNullable(tags)) + + /** Alias for calling [Builder.tags] with `tags.orElse(null)`. */ + fun tags(tags: Optional>) = tags(tags.getOrNull()) + + /** + * Sets [Builder.tags] to an arbitrary JSON value. + * + * You should usually call [Builder.tags] with a well-typed `List` value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun tags(tags: JsonField>) = apply { this.tags = tags.map { it.toMutableList() } } + + /** + * Adds a single [Tag] to [tags]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addTag(tag: Tag) = apply { + tags = (tags ?: JsonField.of(mutableListOf())).also { checkKnown("tags", it).add(tag) } + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [RuleUpdateResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateUpdated() + * .name() + * .scope() + * .type() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): RuleUpdateResponse = + RuleUpdateResponse( + checkRequired("id", id), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("name", name), + checkRequired("scope", scope), + checkRequired("type", type), + checkRequired("workspaceId", workspaceId), + assigneeId, + automationParams, + automationType, + deactivated, + description, + evidenceType, + (frameworks ?: JsonMissing.of()).map { it.toImmutable() }, + immutable, + renewalCadenceDays, + (results ?: JsonMissing.of()).map { it.toImmutable() }, + resultsSummary, + (tagIds ?: JsonMissing.of()).map { it.toImmutable() }, + (tags ?: JsonMissing.of()).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): RuleUpdateResponse = apply { + if (validated) { + return@apply + } + + id() + dateCreated() + dateUpdated() + name() + scope().validate() + type().validate() + workspaceId() + assigneeId() + automationParams().ifPresent { it.validate() } + automationType() + deactivated() + description() + evidenceType().ifPresent { it.validate() } + frameworks().ifPresent { it.forEach { it.validate() } } + immutable() + renewalCadenceDays() + results().ifPresent { it.forEach { it.validate() } } + resultsSummary().ifPresent { it.validate() } + tagIds() + tags().ifPresent { it.forEach { it.validate() } } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (scope.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + (if (assigneeId.asKnown().isPresent) 1 else 0) + + (automationParams.asKnown().getOrNull()?.validity() ?: 0) + + (if (automationType.asKnown().isPresent) 1 else 0) + + (if (deactivated.asKnown().isPresent) 1 else 0) + + (if (description.asKnown().isPresent) 1 else 0) + + (evidenceType.asKnown().getOrNull()?.validity() ?: 0) + + (frameworks.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (immutable.asKnown().isPresent) 1 else 0) + + (if (renewalCadenceDays.asKnown().isPresent) 1 else 0) + + (results.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (resultsSummary.asKnown().getOrNull()?.validity() ?: 0) + + (tagIds.asKnown().getOrNull()?.size ?: 0) + + (tags.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + /** + * Whether the rule is evaluated once for the whole workspace, or once per project the rule's + * frameworks apply to. + */ + class Scope @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val PROJECT = of("project") + + @JvmField val WORKSPACE = of("workspace") + + @JvmStatic fun of(value: String) = Scope(JsonField.of(value)) + } + + /** An enum containing [Scope]'s known values. */ + enum class Known { + PROJECT, + WORKSPACE, + } + + /** + * An enum containing [Scope]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Scope] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + PROJECT, + WORKSPACE, + /** An enum member indicating that [Scope] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + PROJECT -> Value.PROJECT + WORKSPACE -> Value.WORKSPACE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + PROJECT -> Known.PROJECT + WORKSPACE -> Known.WORKSPACE + else -> throw OpenlayerInvalidDataException("Unknown Scope: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Scope = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Scope && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** + * `platform` rules are evaluated automatically from the state of your Openlayer workspace. + * `evidence` rules are satisfied by attaching evidence. + */ + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val PLATFORM = of("platform") + + @JvmField val EVIDENCE = of("evidence") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + PLATFORM, + EVIDENCE, + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + PLATFORM, + EVIDENCE, + /** An enum member indicating that [Type] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + PLATFORM -> Value.PLATFORM + EVIDENCE -> Value.EVIDENCE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + PLATFORM -> Known.PLATFORM + EVIDENCE -> Known.EVIDENCE + else -> throw OpenlayerInvalidDataException("Unknown Type: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Configuration for the platform check, when the automation takes parameters. */ + class AutomationParams + @JsonCreator + private constructor( + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [AutomationParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [AutomationParams]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(automationParams: AutomationParams) = apply { + additionalProperties = automationParams.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [AutomationParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): AutomationParams = AutomationParams(additionalProperties.toImmutable()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): AutomationParams = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is AutomationParams && additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = "AutomationParams{additionalProperties=$additionalProperties}" + } + + /** The kind of evidence that satisfies the rule. `null` for platform rules. */ + class EvidenceType @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val DOCUMENT = of("document") + + @JvmField val TEXT = of("text") + + @JvmField val URL = of("url") + + @JvmField val CATEGORY_VALUE = of("categoryValue") + + @JvmStatic fun of(value: String) = EvidenceType(JsonField.of(value)) + } + + /** An enum containing [EvidenceType]'s known values. */ + enum class Known { + DOCUMENT, + TEXT, + URL, + CATEGORY_VALUE, + } + + /** + * An enum containing [EvidenceType]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [EvidenceType] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DOCUMENT, + TEXT, + URL, + CATEGORY_VALUE, + /** + * An enum member indicating that [EvidenceType] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DOCUMENT -> Value.DOCUMENT + TEXT -> Value.TEXT + URL -> Value.URL + CATEGORY_VALUE -> Value.CATEGORY_VALUE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + DOCUMENT -> Known.DOCUMENT + TEXT -> Known.TEXT + URL -> Known.URL + CATEGORY_VALUE -> Known.CATEGORY_VALUE + else -> throw OpenlayerInvalidDataException("Unknown EvidenceType: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): EvidenceType = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is EvidenceType && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + class Framework + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val avatar: JsonField, + private val builtInSlug: JsonField, + private val enabled: JsonField, + private val name: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("avatar") @ExcludeMissing avatar: JsonField = JsonMissing.of(), + @JsonProperty("builtInSlug") + @ExcludeMissing + builtInSlug: JsonField = JsonMissing.of(), + @JsonProperty("enabled") @ExcludeMissing enabled: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + ) : this(id, avatar, builtInSlug, enabled, name, mutableMapOf()) + + /** + * The framework id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun id(): String = id.getRequired("id") + + /** + * The icon shown for the framework. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun avatar(): Optional = avatar.getOptional("avatar") + + /** + * Identifies a framework that ships with Openlayer, for example `eu_ai_act`, `iso_42001`, + * `nist_ai_rmf`, or `traiga`. `null` for frameworks you create yourself. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun builtInSlug(): Optional = builtInSlug.getOptional("builtInSlug") + + /** + * Whether the framework is active. Rules of a disabled framework are not evaluated and do + * not count towards compliance. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun enabled(): Boolean = enabled.getRequired("enabled") + + /** + * The framework name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun name(): String = name.getRequired("name") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [avatar]. + * + * Unlike [avatar], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("avatar") @ExcludeMissing fun _avatar(): JsonField = avatar + + /** + * Returns the raw JSON value of [builtInSlug]. + * + * Unlike [builtInSlug], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("builtInSlug") + @ExcludeMissing + fun _builtInSlug(): JsonField = builtInSlug + + /** + * Returns the raw JSON value of [enabled]. + * + * Unlike [enabled], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("enabled") @ExcludeMissing fun _enabled(): JsonField = enabled + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Framework]. + * + * The following fields are required: + * ```java + * .id() + * .avatar() + * .builtInSlug() + * .enabled() + * .name() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Framework]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var avatar: JsonField? = null + private var builtInSlug: JsonField? = null + private var enabled: JsonField? = null + private var name: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(framework: Framework) = apply { + id = framework.id + avatar = framework.avatar + builtInSlug = framework.builtInSlug + enabled = framework.enabled + name = framework.name + additionalProperties = framework.additionalProperties.toMutableMap() + } + + /** The framework id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The icon shown for the framework. */ + fun avatar(avatar: Avatar?) = avatar(JsonField.ofNullable(avatar)) + + /** Alias for calling [Builder.avatar] with `avatar.orElse(null)`. */ + fun avatar(avatar: Optional) = avatar(avatar.getOrNull()) + + /** + * Sets [Builder.avatar] to an arbitrary JSON value. + * + * You should usually call [Builder.avatar] with a well-typed [Avatar] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun avatar(avatar: JsonField) = apply { this.avatar = avatar } + + /** + * Identifies a framework that ships with Openlayer, for example `eu_ai_act`, + * `iso_42001`, `nist_ai_rmf`, or `traiga`. `null` for frameworks you create yourself. + */ + fun builtInSlug(builtInSlug: String?) = builtInSlug(JsonField.ofNullable(builtInSlug)) + + /** Alias for calling [Builder.builtInSlug] with `builtInSlug.orElse(null)`. */ + fun builtInSlug(builtInSlug: Optional) = builtInSlug(builtInSlug.getOrNull()) + + /** + * Sets [Builder.builtInSlug] to an arbitrary JSON value. + * + * You should usually call [Builder.builtInSlug] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun builtInSlug(builtInSlug: JsonField) = apply { + this.builtInSlug = builtInSlug + } + + /** + * Whether the framework is active. Rules of a disabled framework are not evaluated and + * do not count towards compliance. + */ + fun enabled(enabled: Boolean) = enabled(JsonField.of(enabled)) + + /** + * Sets [Builder.enabled] to an arbitrary JSON value. + * + * You should usually call [Builder.enabled] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun enabled(enabled: JsonField) = apply { this.enabled = enabled } + + /** The framework name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun name(name: JsonField) = apply { this.name = name } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Framework]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .avatar() + * .builtInSlug() + * .enabled() + * .name() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Framework = + Framework( + checkRequired("id", id), + checkRequired("avatar", avatar), + checkRequired("builtInSlug", builtInSlug), + checkRequired("enabled", enabled), + checkRequired("name", name), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Framework = apply { + if (validated) { + return@apply + } + + id() + avatar().ifPresent { it.validate() } + builtInSlug() + enabled() + name() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (avatar.asKnown().getOrNull()?.validity() ?: 0) + + (if (builtInSlug.asKnown().isPresent) 1 else 0) + + (if (enabled.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + /** The icon shown for the framework. */ + class Avatar + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val type: JsonField, + private val value: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("value") @ExcludeMissing value: JsonField = JsonMissing.of(), + ) : this(type, value, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun type(): Type = type.getRequired("type") + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun value(): String = value.getRequired("value") + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + /** + * Returns the raw JSON value of [value]. + * + * Unlike [value], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Avatar]. + * + * The following fields are required: + * ```java + * .type() + * .value() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Avatar]. */ + class Builder internal constructor() { + + private var type: JsonField? = null + private var value: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(avatar: Avatar) = apply { + type = avatar.type + value = avatar.value + additionalProperties = avatar.additionalProperties.toMutableMap() + } + + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun type(type: JsonField) = apply { this.type = type } + + fun value(value: String) = value(JsonField.of(value)) + + /** + * Sets [Builder.value] to an arbitrary JSON value. + * + * You should usually call [Builder.value] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun value(value: JsonField) = apply { this.value = value } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Avatar]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .type() + * .value() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Avatar = + Avatar( + checkRequired("type", type), + checkRequired("value", value), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Avatar = apply { + if (validated) { + return@apply + } + + type().validate() + value() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (type.asKnown().getOrNull()?.validity() ?: 0) + + (if (value.asKnown().isPresent) 1 else 0) + + class Type @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val EMOJI = of("emoji") + + @JvmField val IMAGE_URL = of("imageUrl") + + @JvmField val BUILTIN_IMAGE = of("builtinImage") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + EMOJI, + IMAGE_URL, + BUILTIN_IMAGE, + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + EMOJI, + IMAGE_URL, + BUILTIN_IMAGE, + /** + * An enum member indicating that [Type] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + EMOJI -> Value.EMOJI + IMAGE_URL -> Value.IMAGE_URL + BUILTIN_IMAGE -> Value.BUILTIN_IMAGE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + EMOJI -> Known.EMOJI + IMAGE_URL -> Known.IMAGE_URL + BUILTIN_IMAGE -> Known.BUILTIN_IMAGE + else -> throw OpenlayerInvalidDataException("Unknown Type: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Avatar && + type == other.type && + value == other.value && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(type, value, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Avatar{type=$type, value=$value, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Framework && + id == other.id && + avatar == other.avatar && + builtInSlug == other.builtInSlug && + enabled == other.enabled && + name == other.name && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(id, avatar, builtInSlug, enabled, name, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Framework{id=$id, avatar=$avatar, builtInSlug=$builtInSlug, enabled=$enabled, name=$name, additionalProperties=$additionalProperties}" + } + + class Result + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val deactivated: JsonField, + private val ruleId: JsonField, + private val status: JsonField, + private val workspaceId: JsonField, + private val assigneeId: JsonField, + private val blockedBy: JsonField>, + private val blocking: JsonField>, + private val dateLastEvaluated: JsonField, + private val dateOfLatestEvidence: JsonField, + private val dateOfNextEvaluation: JsonField, + private val dateOfRenewal: JsonField, + private val deactivatedReason: JsonField, + private val projectId: JsonField, + private val statusMessage: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("deactivated") + @ExcludeMissing + deactivated: JsonField = JsonMissing.of(), + @JsonProperty("ruleId") @ExcludeMissing ruleId: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + @JsonProperty("assigneeId") + @ExcludeMissing + assigneeId: JsonField = JsonMissing.of(), + @JsonProperty("blockedBy") + @ExcludeMissing + blockedBy: JsonField> = JsonMissing.of(), + @JsonProperty("blocking") + @ExcludeMissing + blocking: JsonField> = JsonMissing.of(), + @JsonProperty("dateLastEvaluated") + @ExcludeMissing + dateLastEvaluated: JsonField = JsonMissing.of(), + @JsonProperty("dateOfLatestEvidence") + @ExcludeMissing + dateOfLatestEvidence: JsonField = JsonMissing.of(), + @JsonProperty("dateOfNextEvaluation") + @ExcludeMissing + dateOfNextEvaluation: JsonField = JsonMissing.of(), + @JsonProperty("dateOfRenewal") + @ExcludeMissing + dateOfRenewal: JsonField = JsonMissing.of(), + @JsonProperty("deactivatedReason") + @ExcludeMissing + deactivatedReason: JsonField = JsonMissing.of(), + @JsonProperty("projectId") + @ExcludeMissing + projectId: JsonField = JsonMissing.of(), + @JsonProperty("statusMessage") + @ExcludeMissing + statusMessage: JsonField = JsonMissing.of(), + ) : this( + id, + dateCreated, + dateUpdated, + deactivated, + ruleId, + status, + workspaceId, + assigneeId, + blockedBy, + blocking, + dateLastEvaluated, + dateOfLatestEvidence, + dateOfNextEvaluation, + dateOfRenewal, + deactivatedReason, + projectId, + statusMessage, + mutableMapOf(), + ) + + /** + * The rule result id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun id(): String = id.getRequired("id") + + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** + * The last update date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** + * Whether this result is excluded from compliance calculations. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun deactivated(): Boolean = deactivated.getRequired("deactivated") + + /** + * The rule this result belongs to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun ruleId(): String = ruleId.getRequired("ruleId") + + /** + * The compliance status of the rule for this entity. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun status(): Status = status.getRequired("status") + + /** + * The id of the workspace the rule result belongs to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun workspaceId(): String = workspaceId.getRequired("workspaceId") + + /** + * The user responsible for this result. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun assigneeId(): Optional = assigneeId.getOptional("assigneeId") + + /** + * Rule results that must pass before this one can be satisfied. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun blockedBy(): Optional> = blockedBy.getOptional("blockedBy") + + /** + * Rule results that this one blocks. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun blocking(): Optional> = blocking.getOptional("blocking") + + /** + * When the rule was last evaluated. Platform rules only. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun dateLastEvaluated(): Optional = + dateLastEvaluated.getOptional("dateLastEvaluated") + + /** + * When the most recent piece of evidence was attached. Evidence rules only. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun dateOfLatestEvidence(): Optional = + dateOfLatestEvidence.getOptional("dateOfLatestEvidence") + + /** + * When the rule will next be evaluated. Platform rules only. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun dateOfNextEvaluation(): Optional = + dateOfNextEvaluation.getOptional("dateOfNextEvaluation") + + /** + * When the evidence must be renewed. Evidence rules with a renewal cadence only. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun dateOfRenewal(): Optional = dateOfRenewal.getOptional("dateOfRenewal") + + /** + * Why the result was excluded. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun deactivatedReason(): Optional = + deactivatedReason.getOptional("deactivatedReason") + + /** + * The project this result was evaluated for. `null` for workspace-scoped rules. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun projectId(): Optional = projectId.getOptional("projectId") + + /** + * A human-readable explanation of the status. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun statusMessage(): Optional = statusMessage.getOptional("statusMessage") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** + * Returns the raw JSON value of [deactivated]. + * + * Unlike [deactivated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("deactivated") + @ExcludeMissing + fun _deactivated(): JsonField = deactivated + + /** + * Returns the raw JSON value of [ruleId]. + * + * Unlike [ruleId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("ruleId") @ExcludeMissing fun _ruleId(): JsonField = ruleId + + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + + /** + * Returns the raw JSON value of [workspaceId]. + * + * Unlike [workspaceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("workspaceId") + @ExcludeMissing + fun _workspaceId(): JsonField = workspaceId + + /** + * Returns the raw JSON value of [assigneeId]. + * + * Unlike [assigneeId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("assigneeId") + @ExcludeMissing + fun _assigneeId(): JsonField = assigneeId + + /** + * Returns the raw JSON value of [blockedBy]. + * + * Unlike [blockedBy], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("blockedBy") + @ExcludeMissing + fun _blockedBy(): JsonField> = blockedBy + + /** + * Returns the raw JSON value of [blocking]. + * + * Unlike [blocking], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("blocking") + @ExcludeMissing + fun _blocking(): JsonField> = blocking + + /** + * Returns the raw JSON value of [dateLastEvaluated]. + * + * Unlike [dateLastEvaluated], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("dateLastEvaluated") + @ExcludeMissing + fun _dateLastEvaluated(): JsonField = dateLastEvaluated + + /** + * Returns the raw JSON value of [dateOfLatestEvidence]. + * + * Unlike [dateOfLatestEvidence], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("dateOfLatestEvidence") + @ExcludeMissing + fun _dateOfLatestEvidence(): JsonField = dateOfLatestEvidence + + /** + * Returns the raw JSON value of [dateOfNextEvaluation]. + * + * Unlike [dateOfNextEvaluation], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("dateOfNextEvaluation") + @ExcludeMissing + fun _dateOfNextEvaluation(): JsonField = dateOfNextEvaluation + + /** + * Returns the raw JSON value of [dateOfRenewal]. + * + * Unlike [dateOfRenewal], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("dateOfRenewal") + @ExcludeMissing + fun _dateOfRenewal(): JsonField = dateOfRenewal + + /** + * Returns the raw JSON value of [deactivatedReason]. + * + * Unlike [deactivatedReason], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("deactivatedReason") + @ExcludeMissing + fun _deactivatedReason(): JsonField = deactivatedReason + + /** + * Returns the raw JSON value of [projectId]. + * + * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("projectId") @ExcludeMissing fun _projectId(): JsonField = projectId + + /** + * Returns the raw JSON value of [statusMessage]. + * + * Unlike [statusMessage], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("statusMessage") + @ExcludeMissing + fun _statusMessage(): JsonField = statusMessage + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Result]. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateUpdated() + * .deactivated() + * .ruleId() + * .status() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Result]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var deactivated: JsonField? = null + private var ruleId: JsonField? = null + private var status: JsonField? = null + private var workspaceId: JsonField? = null + private var assigneeId: JsonField = JsonMissing.of() + private var blockedBy: JsonField>? = null + private var blocking: JsonField>? = null + private var dateLastEvaluated: JsonField = JsonMissing.of() + private var dateOfLatestEvidence: JsonField = JsonMissing.of() + private var dateOfNextEvaluation: JsonField = JsonMissing.of() + private var dateOfRenewal: JsonField = JsonMissing.of() + private var deactivatedReason: JsonField = JsonMissing.of() + private var projectId: JsonField = JsonMissing.of() + private var statusMessage: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(result: Result) = apply { + id = result.id + dateCreated = result.dateCreated + dateUpdated = result.dateUpdated + deactivated = result.deactivated + ruleId = result.ruleId + status = result.status + workspaceId = result.workspaceId + assigneeId = result.assigneeId + blockedBy = result.blockedBy.map { it.toMutableList() } + blocking = result.blocking.map { it.toMutableList() } + dateLastEvaluated = result.dateLastEvaluated + dateOfLatestEvidence = result.dateOfLatestEvidence + dateOfNextEvaluation = result.dateOfNextEvaluation + dateOfRenewal = result.dateOfRenewal + deactivatedReason = result.deactivatedReason + projectId = result.projectId + statusMessage = result.statusMessage + additionalProperties = result.additionalProperties.toMutableMap() + } + + /** The rule result id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The last update date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** Whether this result is excluded from compliance calculations. */ + fun deactivated(deactivated: Boolean) = deactivated(JsonField.of(deactivated)) + + /** + * Sets [Builder.deactivated] to an arbitrary JSON value. + * + * You should usually call [Builder.deactivated] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun deactivated(deactivated: JsonField) = apply { + this.deactivated = deactivated + } + + /** The rule this result belongs to. */ + fun ruleId(ruleId: String) = ruleId(JsonField.of(ruleId)) + + /** + * Sets [Builder.ruleId] to an arbitrary JSON value. + * + * You should usually call [Builder.ruleId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun ruleId(ruleId: JsonField) = apply { this.ruleId = ruleId } + + /** The compliance status of the rule for this entity. */ + fun status(status: Status) = status(JsonField.of(status)) + + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun status(status: JsonField) = apply { this.status = status } + + /** The id of the workspace the rule result belongs to. */ + fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) + + /** + * Sets [Builder.workspaceId] to an arbitrary JSON value. + * + * You should usually call [Builder.workspaceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun workspaceId(workspaceId: JsonField) = apply { + this.workspaceId = workspaceId + } + + /** The user responsible for this result. */ + fun assigneeId(assigneeId: String?) = assigneeId(JsonField.ofNullable(assigneeId)) + + /** Alias for calling [Builder.assigneeId] with `assigneeId.orElse(null)`. */ + fun assigneeId(assigneeId: Optional) = assigneeId(assigneeId.getOrNull()) + + /** + * Sets [Builder.assigneeId] to an arbitrary JSON value. + * + * You should usually call [Builder.assigneeId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun assigneeId(assigneeId: JsonField) = apply { this.assigneeId = assigneeId } + + /** Rule results that must pass before this one can be satisfied. */ + fun blockedBy(blockedBy: List) = blockedBy(JsonField.of(blockedBy)) + + /** + * Sets [Builder.blockedBy] to an arbitrary JSON value. + * + * You should usually call [Builder.blockedBy] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun blockedBy(blockedBy: JsonField>) = apply { + this.blockedBy = blockedBy.map { it.toMutableList() } + } + + /** + * Adds a single [BlockedBy] to [Builder.blockedBy]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addBlockedBy(blockedBy: BlockedBy) = apply { + this.blockedBy = + (this.blockedBy ?: JsonField.of(mutableListOf())).also { + checkKnown("blockedBy", it).add(blockedBy) + } + } + + /** Rule results that this one blocks. */ + fun blocking(blocking: List) = blocking(JsonField.of(blocking)) + + /** + * Sets [Builder.blocking] to an arbitrary JSON value. + * + * You should usually call [Builder.blocking] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun blocking(blocking: JsonField>) = apply { + this.blocking = blocking.map { it.toMutableList() } + } + + /** + * Adds a single [Blocking] to [Builder.blocking]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addBlocking(blocking: Blocking) = apply { + this.blocking = + (this.blocking ?: JsonField.of(mutableListOf())).also { + checkKnown("blocking", it).add(blocking) + } + } + + /** When the rule was last evaluated. Platform rules only. */ + fun dateLastEvaluated(dateLastEvaluated: OffsetDateTime?) = + dateLastEvaluated(JsonField.ofNullable(dateLastEvaluated)) + + /** + * Alias for calling [Builder.dateLastEvaluated] with `dateLastEvaluated.orElse(null)`. + */ + fun dateLastEvaluated(dateLastEvaluated: Optional) = + dateLastEvaluated(dateLastEvaluated.getOrNull()) + + /** + * Sets [Builder.dateLastEvaluated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateLastEvaluated] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun dateLastEvaluated(dateLastEvaluated: JsonField) = apply { + this.dateLastEvaluated = dateLastEvaluated + } + + /** When the most recent piece of evidence was attached. Evidence rules only. */ + fun dateOfLatestEvidence(dateOfLatestEvidence: OffsetDateTime?) = + dateOfLatestEvidence(JsonField.ofNullable(dateOfLatestEvidence)) + + /** + * Alias for calling [Builder.dateOfLatestEvidence] with + * `dateOfLatestEvidence.orElse(null)`. + */ + fun dateOfLatestEvidence(dateOfLatestEvidence: Optional) = + dateOfLatestEvidence(dateOfLatestEvidence.getOrNull()) + + /** + * Sets [Builder.dateOfLatestEvidence] to an arbitrary JSON value. + * + * You should usually call [Builder.dateOfLatestEvidence] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun dateOfLatestEvidence(dateOfLatestEvidence: JsonField) = apply { + this.dateOfLatestEvidence = dateOfLatestEvidence + } + + /** When the rule will next be evaluated. Platform rules only. */ + fun dateOfNextEvaluation(dateOfNextEvaluation: OffsetDateTime?) = + dateOfNextEvaluation(JsonField.ofNullable(dateOfNextEvaluation)) + + /** + * Alias for calling [Builder.dateOfNextEvaluation] with + * `dateOfNextEvaluation.orElse(null)`. + */ + fun dateOfNextEvaluation(dateOfNextEvaluation: Optional) = + dateOfNextEvaluation(dateOfNextEvaluation.getOrNull()) + + /** + * Sets [Builder.dateOfNextEvaluation] to an arbitrary JSON value. + * + * You should usually call [Builder.dateOfNextEvaluation] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun dateOfNextEvaluation(dateOfNextEvaluation: JsonField) = apply { + this.dateOfNextEvaluation = dateOfNextEvaluation + } + + /** When the evidence must be renewed. Evidence rules with a renewal cadence only. */ + fun dateOfRenewal(dateOfRenewal: OffsetDateTime?) = + dateOfRenewal(JsonField.ofNullable(dateOfRenewal)) + + /** Alias for calling [Builder.dateOfRenewal] with `dateOfRenewal.orElse(null)`. */ + fun dateOfRenewal(dateOfRenewal: Optional) = + dateOfRenewal(dateOfRenewal.getOrNull()) + + /** + * Sets [Builder.dateOfRenewal] to an arbitrary JSON value. + * + * You should usually call [Builder.dateOfRenewal] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun dateOfRenewal(dateOfRenewal: JsonField) = apply { + this.dateOfRenewal = dateOfRenewal + } + + /** Why the result was excluded. */ + fun deactivatedReason(deactivatedReason: String?) = + deactivatedReason(JsonField.ofNullable(deactivatedReason)) + + /** + * Alias for calling [Builder.deactivatedReason] with `deactivatedReason.orElse(null)`. + */ + fun deactivatedReason(deactivatedReason: Optional) = + deactivatedReason(deactivatedReason.getOrNull()) + + /** + * Sets [Builder.deactivatedReason] to an arbitrary JSON value. + * + * You should usually call [Builder.deactivatedReason] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun deactivatedReason(deactivatedReason: JsonField) = apply { + this.deactivatedReason = deactivatedReason + } + + /** The project this result was evaluated for. `null` for workspace-scoped rules. */ + fun projectId(projectId: String?) = projectId(JsonField.ofNullable(projectId)) + + /** Alias for calling [Builder.projectId] with `projectId.orElse(null)`. */ + fun projectId(projectId: Optional) = projectId(projectId.getOrNull()) + + /** + * Sets [Builder.projectId] to an arbitrary JSON value. + * + * You should usually call [Builder.projectId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun projectId(projectId: JsonField) = apply { this.projectId = projectId } + + /** A human-readable explanation of the status. */ + fun statusMessage(statusMessage: String?) = + statusMessage(JsonField.ofNullable(statusMessage)) + + /** Alias for calling [Builder.statusMessage] with `statusMessage.orElse(null)`. */ + fun statusMessage(statusMessage: Optional) = + statusMessage(statusMessage.getOrNull()) + + /** + * Sets [Builder.statusMessage] to an arbitrary JSON value. + * + * You should usually call [Builder.statusMessage] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun statusMessage(statusMessage: JsonField) = apply { + this.statusMessage = statusMessage + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Result]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .dateCreated() + * .dateUpdated() + * .deactivated() + * .ruleId() + * .status() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Result = + Result( + checkRequired("id", id), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("deactivated", deactivated), + checkRequired("ruleId", ruleId), + checkRequired("status", status), + checkRequired("workspaceId", workspaceId), + assigneeId, + (blockedBy ?: JsonMissing.of()).map { it.toImmutable() }, + (blocking ?: JsonMissing.of()).map { it.toImmutable() }, + dateLastEvaluated, + dateOfLatestEvidence, + dateOfNextEvaluation, + dateOfRenewal, + deactivatedReason, + projectId, + statusMessage, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Result = apply { + if (validated) { + return@apply + } + + id() + dateCreated() + dateUpdated() + deactivated() + ruleId() + status().validate() + workspaceId() + assigneeId() + blockedBy().ifPresent { it.forEach { it.validate() } } + blocking().ifPresent { it.forEach { it.validate() } } + dateLastEvaluated() + dateOfLatestEvidence() + dateOfNextEvaluation() + dateOfRenewal() + deactivatedReason() + projectId() + statusMessage() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (deactivated.asKnown().isPresent) 1 else 0) + + (if (ruleId.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + (if (assigneeId.asKnown().isPresent) 1 else 0) + + (blockedBy.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (blocking.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (dateLastEvaluated.asKnown().isPresent) 1 else 0) + + (if (dateOfLatestEvidence.asKnown().isPresent) 1 else 0) + + (if (dateOfNextEvaluation.asKnown().isPresent) 1 else 0) + + (if (dateOfRenewal.asKnown().isPresent) 1 else 0) + + (if (deactivatedReason.asKnown().isPresent) 1 else 0) + + (if (projectId.asKnown().isPresent) 1 else 0) + + (if (statusMessage.asKnown().isPresent) 1 else 0) + + /** The compliance status of the rule for this entity. */ + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val RUNNING = of("running") + + @JvmField val PASSING = of("passing") + + @JvmField val FAILING = of("failing") + + @JvmField val SKIPPED = of("skipped") + + @JvmField val ERROR = of("error") + + @JvmField val PENDING = of("pending") + + @JvmField val DUE_SOON = of("due_soon") + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + /** An enum containing [Status]'s known values. */ + enum class Known { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + } + + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + /** + * An enum member indicating that [Status] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + PENDING -> Value.PENDING + DUE_SOON -> Value.DUE_SOON + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + PENDING -> Known.PENDING + DUE_SOON -> Known.DUE_SOON + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + class BlockedBy + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val status: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + ) : this(id, status, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun id(): Optional = id.getOptional("id") + + /** + * The compliance status of the rule for this entity. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun status(): Optional = status.getOptional("status") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [BlockedBy]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BlockedBy]. */ + class Builder internal constructor() { + + private var id: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(blockedBy: BlockedBy) = apply { + id = blockedBy.id + status = blockedBy.status + additionalProperties = blockedBy.additionalProperties.toMutableMap() + } + + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The compliance status of the rule for this entity. */ + fun status(status: Status) = status(JsonField.of(status)) + + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun status(status: JsonField) = apply { this.status = status } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [BlockedBy]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): BlockedBy = BlockedBy(id, status, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): BlockedBy = apply { + if (validated) { + return@apply + } + + id() + status().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + /** The compliance status of the rule for this entity. */ + class Status @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val RUNNING = of("running") + + @JvmField val PASSING = of("passing") + + @JvmField val FAILING = of("failing") + + @JvmField val SKIPPED = of("skipped") + + @JvmField val ERROR = of("error") + + @JvmField val PENDING = of("pending") + + @JvmField val DUE_SOON = of("due_soon") + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + /** An enum containing [Status]'s known values. */ + enum class Known { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + } + + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + /** + * An enum member indicating that [Status] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + PENDING -> Value.PENDING + DUE_SOON -> Value.DUE_SOON + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + PENDING -> Known.PENDING + DUE_SOON -> Known.DUE_SOON + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is BlockedBy && + id == other.id && + status == other.status && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(id, status, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BlockedBy{id=$id, status=$status, additionalProperties=$additionalProperties}" + } + + class Blocking + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val status: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + ) : this(id, status, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun id(): Optional = id.getOptional("id") + + /** + * The compliance status of the rule for this entity. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun status(): Optional = status.getOptional("status") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Blocking]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Blocking]. */ + class Builder internal constructor() { + + private var id: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(blocking: Blocking) = apply { + id = blocking.id + status = blocking.status + additionalProperties = blocking.additionalProperties.toMutableMap() + } + + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The compliance status of the rule for this entity. */ + fun status(status: Status) = status(JsonField.of(status)) + + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun status(status: JsonField) = apply { this.status = status } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Blocking]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Blocking = Blocking(id, status, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Blocking = apply { + if (validated) { + return@apply + } + + id() + status().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + /** The compliance status of the rule for this entity. */ + class Status @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val RUNNING = of("running") + + @JvmField val PASSING = of("passing") + + @JvmField val FAILING = of("failing") + + @JvmField val SKIPPED = of("skipped") + + @JvmField val ERROR = of("error") + + @JvmField val PENDING = of("pending") + + @JvmField val DUE_SOON = of("due_soon") + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + /** An enum containing [Status]'s known values. */ + enum class Known { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + } + + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + RUNNING, + PASSING, + FAILING, + SKIPPED, + ERROR, + PENDING, + DUE_SOON, + /** + * An enum member indicating that [Status] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + RUNNING -> Value.RUNNING + PASSING -> Value.PASSING + FAILING -> Value.FAILING + SKIPPED -> Value.SKIPPED + ERROR -> Value.ERROR + PENDING -> Value.PENDING + DUE_SOON -> Value.DUE_SOON + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws OpenlayerInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + RUNNING -> Known.RUNNING + PASSING -> Known.PASSING + FAILING -> Known.FAILING + SKIPPED -> Known.SKIPPED + ERROR -> Known.ERROR + PENDING -> Known.PENDING + DUE_SOON -> Known.DUE_SOON + else -> throw OpenlayerInvalidDataException("Unknown Status: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws OpenlayerInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + OpenlayerInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Blocking && + id == other.id && + status == other.status && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(id, status, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Blocking{id=$id, status=$status, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Result && + id == other.id && + dateCreated == other.dateCreated && + dateUpdated == other.dateUpdated && + deactivated == other.deactivated && + ruleId == other.ruleId && + status == other.status && + workspaceId == other.workspaceId && + assigneeId == other.assigneeId && + blockedBy == other.blockedBy && + blocking == other.blocking && + dateLastEvaluated == other.dateLastEvaluated && + dateOfLatestEvidence == other.dateOfLatestEvidence && + dateOfNextEvaluation == other.dateOfNextEvaluation && + dateOfRenewal == other.dateOfRenewal && + deactivatedReason == other.deactivatedReason && + projectId == other.projectId && + statusMessage == other.statusMessage && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + dateCreated, + dateUpdated, + deactivated, + ruleId, + status, + workspaceId, + assigneeId, + blockedBy, + blocking, + dateLastEvaluated, + dateOfLatestEvidence, + dateOfNextEvaluation, + dateOfRenewal, + deactivatedReason, + projectId, + statusMessage, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Result{id=$id, dateCreated=$dateCreated, dateUpdated=$dateUpdated, deactivated=$deactivated, ruleId=$ruleId, status=$status, workspaceId=$workspaceId, assigneeId=$assigneeId, blockedBy=$blockedBy, blocking=$blocking, dateLastEvaluated=$dateLastEvaluated, dateOfLatestEvidence=$dateOfLatestEvidence, dateOfNextEvaluation=$dateOfNextEvaluation, dateOfRenewal=$dateOfRenewal, deactivatedReason=$deactivatedReason, projectId=$projectId, statusMessage=$statusMessage, additionalProperties=$additionalProperties}" + } + + /** + * Pass-rate counts across all of the rule's entities, independent of any status filter applied + * to the request. + */ + class ResultsSummary + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val passing: JsonField, + private val total: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("passing") @ExcludeMissing passing: JsonField = JsonMissing.of(), + @JsonProperty("total") @ExcludeMissing total: JsonField = JsonMissing.of(), + ) : this(passing, total, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun passing(): Optional = passing.getOptional("passing") + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun total(): Optional = total.getOptional("total") + + /** + * Returns the raw JSON value of [passing]. + * + * Unlike [passing], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("passing") @ExcludeMissing fun _passing(): JsonField = passing + + /** + * Returns the raw JSON value of [total]. + * + * Unlike [total], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("total") @ExcludeMissing fun _total(): JsonField = total + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [ResultsSummary]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ResultsSummary]. */ + class Builder internal constructor() { + + private var passing: JsonField = JsonMissing.of() + private var total: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(resultsSummary: ResultsSummary) = apply { + passing = resultsSummary.passing + total = resultsSummary.total + additionalProperties = resultsSummary.additionalProperties.toMutableMap() + } + + fun passing(passing: Long) = passing(JsonField.of(passing)) + + /** + * Sets [Builder.passing] to an arbitrary JSON value. + * + * You should usually call [Builder.passing] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun passing(passing: JsonField) = apply { this.passing = passing } + + fun total(total: Long) = total(JsonField.of(total)) + + /** + * Sets [Builder.total] to an arbitrary JSON value. + * + * You should usually call [Builder.total] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun total(total: JsonField) = apply { this.total = total } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ResultsSummary]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): ResultsSummary = + ResultsSummary(passing, total, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): ResultsSummary = apply { + if (validated) { + return@apply + } + + passing() + total() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (passing.asKnown().isPresent) 1 else 0) + (if (total.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ResultsSummary && + passing == other.passing && + total == other.total && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(passing, total, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ResultsSummary{passing=$passing, total=$total, additionalProperties=$additionalProperties}" + } + + class Tag + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val creatorId: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val immutable: JsonField, + private val name: JsonField, + private val workspaceId: JsonField, + private val color: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("creatorId") + @ExcludeMissing + creatorId: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("immutable") + @ExcludeMissing + immutable: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + @JsonProperty("color") @ExcludeMissing color: JsonField = JsonMissing.of(), + ) : this( + id, + creatorId, + dateCreated, + dateUpdated, + immutable, + name, + workspaceId, + color, + mutableMapOf(), + ) + + /** + * The rule tag id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun id(): String = id.getRequired("id") + + /** + * The user who created the tag. `null` for tags that ship with Openlayer. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun creatorId(): Optional = creatorId.getOptional("creatorId") + + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** + * The last update date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** + * Whether the tag is managed by Openlayer and cannot be edited or deleted. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun immutable(): Boolean = immutable.getRequired("immutable") + + /** + * The tag name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun name(): String = name.getRequired("name") + + /** + * The id of the workspace the tag belongs to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun workspaceId(): String = workspaceId.getRequired("workspaceId") + + /** + * The color the tag is displayed with. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun color(): Optional = color.getOptional("color") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [creatorId]. + * + * Unlike [creatorId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("creatorId") @ExcludeMissing fun _creatorId(): JsonField = creatorId + + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** + * Returns the raw JSON value of [immutable]. + * + * Unlike [immutable], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("immutable") @ExcludeMissing fun _immutable(): JsonField = immutable + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [workspaceId]. + * + * Unlike [workspaceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("workspaceId") + @ExcludeMissing + fun _workspaceId(): JsonField = workspaceId + + /** + * Returns the raw JSON value of [color]. + * + * Unlike [color], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("color") @ExcludeMissing fun _color(): JsonField = color + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Tag]. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .immutable() + * .name() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Tag]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var creatorId: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var immutable: JsonField? = null + private var name: JsonField? = null + private var workspaceId: JsonField? = null + private var color: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(tag: Tag) = apply { + id = tag.id + creatorId = tag.creatorId + dateCreated = tag.dateCreated + dateUpdated = tag.dateUpdated + immutable = tag.immutable + name = tag.name + workspaceId = tag.workspaceId + color = tag.color + additionalProperties = tag.additionalProperties.toMutableMap() + } + + /** The rule tag id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The user who created the tag. `null` for tags that ship with Openlayer. */ + fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) + + /** Alias for calling [Builder.creatorId] with `creatorId.orElse(null)`. */ + fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) + + /** + * Sets [Builder.creatorId] to an arbitrary JSON value. + * + * You should usually call [Builder.creatorId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The last update date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** Whether the tag is managed by Openlayer and cannot be edited or deleted. */ + fun immutable(immutable: Boolean) = immutable(JsonField.of(immutable)) + + /** + * Sets [Builder.immutable] to an arbitrary JSON value. + * + * You should usually call [Builder.immutable] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun immutable(immutable: JsonField) = apply { this.immutable = immutable } + + /** The tag name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun name(name: JsonField) = apply { this.name = name } + + /** The id of the workspace the tag belongs to. */ + fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) + + /** + * Sets [Builder.workspaceId] to an arbitrary JSON value. + * + * You should usually call [Builder.workspaceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun workspaceId(workspaceId: JsonField) = apply { + this.workspaceId = workspaceId + } + + /** The color the tag is displayed with. */ + fun color(color: String?) = color(JsonField.ofNullable(color)) + + /** Alias for calling [Builder.color] with `color.orElse(null)`. */ + fun color(color: Optional) = color(color.getOrNull()) + + /** + * Sets [Builder.color] to an arbitrary JSON value. + * + * You should usually call [Builder.color] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun color(color: JsonField) = apply { this.color = color } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Tag]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .immutable() + * .name() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Tag = + Tag( + checkRequired("id", id), + checkRequired("creatorId", creatorId), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("immutable", immutable), + checkRequired("name", name), + checkRequired("workspaceId", workspaceId), + color, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Tag = apply { + if (validated) { + return@apply + } + + id() + creatorId() + dateCreated() + dateUpdated() + immutable() + name() + workspaceId() + color() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (creatorId.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (immutable.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + (if (color.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Tag && + id == other.id && + creatorId == other.creatorId && + dateCreated == other.dateCreated && + dateUpdated == other.dateUpdated && + immutable == other.immutable && + name == other.name && + workspaceId == other.workspaceId && + color == other.color && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + creatorId, + dateCreated, + dateUpdated, + immutable, + name, + workspaceId, + color, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Tag{id=$id, creatorId=$creatorId, dateCreated=$dateCreated, dateUpdated=$dateUpdated, immutable=$immutable, name=$name, workspaceId=$workspaceId, color=$color, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is RuleUpdateResponse && + id == other.id && + dateCreated == other.dateCreated && + dateUpdated == other.dateUpdated && + name == other.name && + scope == other.scope && + type == other.type && + workspaceId == other.workspaceId && + assigneeId == other.assigneeId && + automationParams == other.automationParams && + automationType == other.automationType && + deactivated == other.deactivated && + description == other.description && + evidenceType == other.evidenceType && + frameworks == other.frameworks && + immutable == other.immutable && + renewalCadenceDays == other.renewalCadenceDays && + results == other.results && + resultsSummary == other.resultsSummary && + tagIds == other.tagIds && + tags == other.tags && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + dateCreated, + dateUpdated, + name, + scope, + type, + workspaceId, + assigneeId, + automationParams, + automationType, + deactivated, + description, + evidenceType, + frameworks, + immutable, + renewalCadenceDays, + results, + resultsSummary, + tagIds, + tags, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "RuleUpdateResponse{id=$id, dateCreated=$dateCreated, dateUpdated=$dateUpdated, name=$name, scope=$scope, type=$type, workspaceId=$workspaceId, assigneeId=$assigneeId, automationParams=$automationParams, automationType=$automationType, deactivated=$deactivated, description=$description, evidenceType=$evidenceType, frameworks=$frameworks, immutable=$immutable, renewalCadenceDays=$renewalCadenceDays, results=$results, resultsSummary=$resultsSummary, tagIds=$tagIds, tags=$tags, additionalProperties=$additionalProperties}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/rulestats/RuleStatRetrieveParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/rulestats/RuleStatRetrieveParams.kt new file mode 100644 index 00000000..d12efb21 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/rulestats/RuleStatRetrieveParams.kt @@ -0,0 +1,235 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.rulestats + +import com.openlayer.api.core.Params +import com.openlayer.api.core.http.Headers +import com.openlayer.api.core.http.QueryParams +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * Get a compliance roll-up for a workspace: how many rules exist, and how many of their results are + * passing, failing, pending, or due for renewal. + * + * Counts respect the filters you pass, so `frameworkId` gives you a single framework's overall + * compliance and `projectId` gives you a single project's. + */ +class RuleStatRetrieveParams +private constructor( + private val workspaceId: String?, + private val frameworkId: String?, + private val projectId: String?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun workspaceId(): Optional = Optional.ofNullable(workspaceId) + + /** Only include items belonging to this framework. */ + fun frameworkId(): Optional = Optional.ofNullable(frameworkId) + + /** Only include items that apply to this project. */ + fun projectId(): Optional = Optional.ofNullable(projectId) + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): RuleStatRetrieveParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [RuleStatRetrieveParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [RuleStatRetrieveParams]. */ + class Builder internal constructor() { + + private var workspaceId: String? = null + private var frameworkId: String? = null + private var projectId: String? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(ruleStatRetrieveParams: RuleStatRetrieveParams) = apply { + workspaceId = ruleStatRetrieveParams.workspaceId + frameworkId = ruleStatRetrieveParams.frameworkId + projectId = ruleStatRetrieveParams.projectId + additionalHeaders = ruleStatRetrieveParams.additionalHeaders.toBuilder() + additionalQueryParams = ruleStatRetrieveParams.additionalQueryParams.toBuilder() + } + + fun workspaceId(workspaceId: String?) = apply { this.workspaceId = workspaceId } + + /** Alias for calling [Builder.workspaceId] with `workspaceId.orElse(null)`. */ + fun workspaceId(workspaceId: Optional) = workspaceId(workspaceId.getOrNull()) + + /** Only include items belonging to this framework. */ + fun frameworkId(frameworkId: String?) = apply { this.frameworkId = frameworkId } + + /** Alias for calling [Builder.frameworkId] with `frameworkId.orElse(null)`. */ + fun frameworkId(frameworkId: Optional) = frameworkId(frameworkId.getOrNull()) + + /** Only include items that apply to this project. */ + fun projectId(projectId: String?) = apply { this.projectId = projectId } + + /** Alias for calling [Builder.projectId] with `projectId.orElse(null)`. */ + fun projectId(projectId: Optional) = projectId(projectId.getOrNull()) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [RuleStatRetrieveParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): RuleStatRetrieveParams = + RuleStatRetrieveParams( + workspaceId, + frameworkId, + projectId, + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _pathParam(index: Int): String = + when (index) { + 0 -> workspaceId ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + frameworkId?.let { put("frameworkId", it) } + projectId?.let { put("projectId", it) } + putAll(additionalQueryParams) + } + .build() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is RuleStatRetrieveParams && + workspaceId == other.workspaceId && + frameworkId == other.frameworkId && + projectId == other.projectId && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = + Objects.hash(workspaceId, frameworkId, projectId, additionalHeaders, additionalQueryParams) + + override fun toString() = + "RuleStatRetrieveParams{workspaceId=$workspaceId, frameworkId=$frameworkId, projectId=$projectId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/rulestats/RuleStatRetrieveResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/rulestats/RuleStatRetrieveResponse.kt new file mode 100644 index 00000000..ba2ed9bc --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/rulestats/RuleStatRetrieveResponse.kt @@ -0,0 +1,3874 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.rulestats + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.openlayer.api.core.ExcludeMissing +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonMissing +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.checkRequired +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class RuleStatRetrieveResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val ruleResults: JsonField, + private val rules: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("ruleResults") + @ExcludeMissing + ruleResults: JsonField = JsonMissing.of(), + @JsonProperty("rules") @ExcludeMissing rules: JsonField = JsonMissing.of(), + ) : this(ruleResults, rules, mutableMapOf()) + + /** + * Counts of rule results, after any filters in the request, with breakdowns by the type and + * scope of the rule each result belongs to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun ruleResults(): RuleResults = ruleResults.getRequired("ruleResults") + + /** + * Counts of the rules themselves, after any filters in the request. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun rules(): Rules = rules.getRequired("rules") + + /** + * Returns the raw JSON value of [ruleResults]. + * + * Unlike [ruleResults], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("ruleResults") + @ExcludeMissing + fun _ruleResults(): JsonField = ruleResults + + /** + * Returns the raw JSON value of [rules]. + * + * Unlike [rules], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("rules") @ExcludeMissing fun _rules(): JsonField = rules + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [RuleStatRetrieveResponse]. + * + * The following fields are required: + * ```java + * .ruleResults() + * .rules() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [RuleStatRetrieveResponse]. */ + class Builder internal constructor() { + + private var ruleResults: JsonField? = null + private var rules: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(ruleStatRetrieveResponse: RuleStatRetrieveResponse) = apply { + ruleResults = ruleStatRetrieveResponse.ruleResults + rules = ruleStatRetrieveResponse.rules + additionalProperties = ruleStatRetrieveResponse.additionalProperties.toMutableMap() + } + + /** + * Counts of rule results, after any filters in the request, with breakdowns by the type and + * scope of the rule each result belongs to. + */ + fun ruleResults(ruleResults: RuleResults) = ruleResults(JsonField.of(ruleResults)) + + /** + * Sets [Builder.ruleResults] to an arbitrary JSON value. + * + * You should usually call [Builder.ruleResults] with a well-typed [RuleResults] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun ruleResults(ruleResults: JsonField) = apply { + this.ruleResults = ruleResults + } + + /** Counts of the rules themselves, after any filters in the request. */ + fun rules(rules: Rules) = rules(JsonField.of(rules)) + + /** + * Sets [Builder.rules] to an arbitrary JSON value. + * + * You should usually call [Builder.rules] with a well-typed [Rules] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun rules(rules: JsonField) = apply { this.rules = rules } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [RuleStatRetrieveResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .ruleResults() + * .rules() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): RuleStatRetrieveResponse = + RuleStatRetrieveResponse( + checkRequired("ruleResults", ruleResults), + checkRequired("rules", rules), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): RuleStatRetrieveResponse = apply { + if (validated) { + return@apply + } + + ruleResults().validate() + rules().validate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (ruleResults.asKnown().getOrNull()?.validity() ?: 0) + + (rules.asKnown().getOrNull()?.validity() ?: 0) + + /** + * Counts of rule results, after any filters in the request, with breakdowns by the type and + * scope of the rule each result belongs to. + */ + class RuleResults + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val total: JsonField, + private val totalDueSoon: JsonField, + private val totalError: JsonField, + private val totalFailing: JsonField, + private val totalPassing: JsonField, + private val totalPending: JsonField, + private val totalRunning: JsonField, + private val totalSkipped: JsonField, + private val byRuleScope: JsonField, + private val byRuleType: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("total") @ExcludeMissing total: JsonField = JsonMissing.of(), + @JsonProperty("totalDueSoon") + @ExcludeMissing + totalDueSoon: JsonField = JsonMissing.of(), + @JsonProperty("totalError") + @ExcludeMissing + totalError: JsonField = JsonMissing.of(), + @JsonProperty("totalFailing") + @ExcludeMissing + totalFailing: JsonField = JsonMissing.of(), + @JsonProperty("totalPassing") + @ExcludeMissing + totalPassing: JsonField = JsonMissing.of(), + @JsonProperty("totalPending") + @ExcludeMissing + totalPending: JsonField = JsonMissing.of(), + @JsonProperty("totalRunning") + @ExcludeMissing + totalRunning: JsonField = JsonMissing.of(), + @JsonProperty("totalSkipped") + @ExcludeMissing + totalSkipped: JsonField = JsonMissing.of(), + @JsonProperty("byRuleScope") + @ExcludeMissing + byRuleScope: JsonField = JsonMissing.of(), + @JsonProperty("byRuleType") + @ExcludeMissing + byRuleType: JsonField = JsonMissing.of(), + ) : this( + total, + totalDueSoon, + totalError, + totalFailing, + totalPassing, + totalPending, + totalRunning, + totalSkipped, + byRuleScope, + byRuleType, + mutableMapOf(), + ) + + /** + * The total number of rule results. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun total(): Long = total.getRequired("total") + + /** + * The number of rule results whose evidence is about to expire. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun totalDueSoon(): Long = totalDueSoon.getRequired("totalDueSoon") + + /** + * The number of rule results that errored during evaluation. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun totalError(): Long = totalError.getRequired("totalError") + + /** + * The number of failing rule results. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun totalFailing(): Long = totalFailing.getRequired("totalFailing") + + /** + * The number of passing rule results. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun totalPassing(): Long = totalPassing.getRequired("totalPassing") + + /** + * The number of rule results that have not been satisfied yet. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun totalPending(): Long = totalPending.getRequired("totalPending") + + /** + * The number of rule results currently being evaluated. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun totalRunning(): Long = totalRunning.getRequired("totalRunning") + + /** + * The number of skipped rule results. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun totalSkipped(): Long = totalSkipped.getRequired("totalSkipped") + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun byRuleScope(): Optional = byRuleScope.getOptional("byRuleScope") + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun byRuleType(): Optional = byRuleType.getOptional("byRuleType") + + /** + * Returns the raw JSON value of [total]. + * + * Unlike [total], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("total") @ExcludeMissing fun _total(): JsonField = total + + /** + * Returns the raw JSON value of [totalDueSoon]. + * + * Unlike [totalDueSoon], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("totalDueSoon") + @ExcludeMissing + fun _totalDueSoon(): JsonField = totalDueSoon + + /** + * Returns the raw JSON value of [totalError]. + * + * Unlike [totalError], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("totalError") @ExcludeMissing fun _totalError(): JsonField = totalError + + /** + * Returns the raw JSON value of [totalFailing]. + * + * Unlike [totalFailing], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("totalFailing") + @ExcludeMissing + fun _totalFailing(): JsonField = totalFailing + + /** + * Returns the raw JSON value of [totalPassing]. + * + * Unlike [totalPassing], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("totalPassing") + @ExcludeMissing + fun _totalPassing(): JsonField = totalPassing + + /** + * Returns the raw JSON value of [totalPending]. + * + * Unlike [totalPending], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("totalPending") + @ExcludeMissing + fun _totalPending(): JsonField = totalPending + + /** + * Returns the raw JSON value of [totalRunning]. + * + * Unlike [totalRunning], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("totalRunning") + @ExcludeMissing + fun _totalRunning(): JsonField = totalRunning + + /** + * Returns the raw JSON value of [totalSkipped]. + * + * Unlike [totalSkipped], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("totalSkipped") + @ExcludeMissing + fun _totalSkipped(): JsonField = totalSkipped + + /** + * Returns the raw JSON value of [byRuleScope]. + * + * Unlike [byRuleScope], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("byRuleScope") + @ExcludeMissing + fun _byRuleScope(): JsonField = byRuleScope + + /** + * Returns the raw JSON value of [byRuleType]. + * + * Unlike [byRuleType], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("byRuleType") + @ExcludeMissing + fun _byRuleType(): JsonField = byRuleType + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [RuleResults]. + * + * The following fields are required: + * ```java + * .total() + * .totalDueSoon() + * .totalError() + * .totalFailing() + * .totalPassing() + * .totalPending() + * .totalRunning() + * .totalSkipped() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [RuleResults]. */ + class Builder internal constructor() { + + private var total: JsonField? = null + private var totalDueSoon: JsonField? = null + private var totalError: JsonField? = null + private var totalFailing: JsonField? = null + private var totalPassing: JsonField? = null + private var totalPending: JsonField? = null + private var totalRunning: JsonField? = null + private var totalSkipped: JsonField? = null + private var byRuleScope: JsonField = JsonMissing.of() + private var byRuleType: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(ruleResults: RuleResults) = apply { + total = ruleResults.total + totalDueSoon = ruleResults.totalDueSoon + totalError = ruleResults.totalError + totalFailing = ruleResults.totalFailing + totalPassing = ruleResults.totalPassing + totalPending = ruleResults.totalPending + totalRunning = ruleResults.totalRunning + totalSkipped = ruleResults.totalSkipped + byRuleScope = ruleResults.byRuleScope + byRuleType = ruleResults.byRuleType + additionalProperties = ruleResults.additionalProperties.toMutableMap() + } + + /** The total number of rule results. */ + fun total(total: Long) = total(JsonField.of(total)) + + /** + * Sets [Builder.total] to an arbitrary JSON value. + * + * You should usually call [Builder.total] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun total(total: JsonField) = apply { this.total = total } + + /** The number of rule results whose evidence is about to expire. */ + fun totalDueSoon(totalDueSoon: Long) = totalDueSoon(JsonField.of(totalDueSoon)) + + /** + * Sets [Builder.totalDueSoon] to an arbitrary JSON value. + * + * You should usually call [Builder.totalDueSoon] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun totalDueSoon(totalDueSoon: JsonField) = apply { + this.totalDueSoon = totalDueSoon + } + + /** The number of rule results that errored during evaluation. */ + fun totalError(totalError: Long) = totalError(JsonField.of(totalError)) + + /** + * Sets [Builder.totalError] to an arbitrary JSON value. + * + * You should usually call [Builder.totalError] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun totalError(totalError: JsonField) = apply { this.totalError = totalError } + + /** The number of failing rule results. */ + fun totalFailing(totalFailing: Long) = totalFailing(JsonField.of(totalFailing)) + + /** + * Sets [Builder.totalFailing] to an arbitrary JSON value. + * + * You should usually call [Builder.totalFailing] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun totalFailing(totalFailing: JsonField) = apply { + this.totalFailing = totalFailing + } + + /** The number of passing rule results. */ + fun totalPassing(totalPassing: Long) = totalPassing(JsonField.of(totalPassing)) + + /** + * Sets [Builder.totalPassing] to an arbitrary JSON value. + * + * You should usually call [Builder.totalPassing] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun totalPassing(totalPassing: JsonField) = apply { + this.totalPassing = totalPassing + } + + /** The number of rule results that have not been satisfied yet. */ + fun totalPending(totalPending: Long) = totalPending(JsonField.of(totalPending)) + + /** + * Sets [Builder.totalPending] to an arbitrary JSON value. + * + * You should usually call [Builder.totalPending] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun totalPending(totalPending: JsonField) = apply { + this.totalPending = totalPending + } + + /** The number of rule results currently being evaluated. */ + fun totalRunning(totalRunning: Long) = totalRunning(JsonField.of(totalRunning)) + + /** + * Sets [Builder.totalRunning] to an arbitrary JSON value. + * + * You should usually call [Builder.totalRunning] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun totalRunning(totalRunning: JsonField) = apply { + this.totalRunning = totalRunning + } + + /** The number of skipped rule results. */ + fun totalSkipped(totalSkipped: Long) = totalSkipped(JsonField.of(totalSkipped)) + + /** + * Sets [Builder.totalSkipped] to an arbitrary JSON value. + * + * You should usually call [Builder.totalSkipped] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun totalSkipped(totalSkipped: JsonField) = apply { + this.totalSkipped = totalSkipped + } + + fun byRuleScope(byRuleScope: ByRuleScope) = byRuleScope(JsonField.of(byRuleScope)) + + /** + * Sets [Builder.byRuleScope] to an arbitrary JSON value. + * + * You should usually call [Builder.byRuleScope] with a well-typed [ByRuleScope] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun byRuleScope(byRuleScope: JsonField) = apply { + this.byRuleScope = byRuleScope + } + + fun byRuleType(byRuleType: ByRuleType) = byRuleType(JsonField.of(byRuleType)) + + /** + * Sets [Builder.byRuleType] to an arbitrary JSON value. + * + * You should usually call [Builder.byRuleType] with a well-typed [ByRuleType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun byRuleType(byRuleType: JsonField) = apply { + this.byRuleType = byRuleType + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [RuleResults]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .total() + * .totalDueSoon() + * .totalError() + * .totalFailing() + * .totalPassing() + * .totalPending() + * .totalRunning() + * .totalSkipped() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): RuleResults = + RuleResults( + checkRequired("total", total), + checkRequired("totalDueSoon", totalDueSoon), + checkRequired("totalError", totalError), + checkRequired("totalFailing", totalFailing), + checkRequired("totalPassing", totalPassing), + checkRequired("totalPending", totalPending), + checkRequired("totalRunning", totalRunning), + checkRequired("totalSkipped", totalSkipped), + byRuleScope, + byRuleType, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): RuleResults = apply { + if (validated) { + return@apply + } + + total() + totalDueSoon() + totalError() + totalFailing() + totalPassing() + totalPending() + totalRunning() + totalSkipped() + byRuleScope().ifPresent { it.validate() } + byRuleType().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (total.asKnown().isPresent) 1 else 0) + + (if (totalDueSoon.asKnown().isPresent) 1 else 0) + + (if (totalError.asKnown().isPresent) 1 else 0) + + (if (totalFailing.asKnown().isPresent) 1 else 0) + + (if (totalPassing.asKnown().isPresent) 1 else 0) + + (if (totalPending.asKnown().isPresent) 1 else 0) + + (if (totalRunning.asKnown().isPresent) 1 else 0) + + (if (totalSkipped.asKnown().isPresent) 1 else 0) + + (byRuleScope.asKnown().getOrNull()?.validity() ?: 0) + + (byRuleType.asKnown().getOrNull()?.validity() ?: 0) + + class ByRuleScope + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val project: JsonField, + private val workspace: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("project") + @ExcludeMissing + project: JsonField = JsonMissing.of(), + @JsonProperty("workspace") + @ExcludeMissing + workspace: JsonField = JsonMissing.of(), + ) : this(project, workspace, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun project(): Optional = project.getOptional("project") + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun workspace(): Optional = workspace.getOptional("workspace") + + /** + * Returns the raw JSON value of [project]. + * + * Unlike [project], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("project") @ExcludeMissing fun _project(): JsonField = project + + /** + * Returns the raw JSON value of [workspace]. + * + * Unlike [workspace], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("workspace") + @ExcludeMissing + fun _workspace(): JsonField = workspace + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [ByRuleScope]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ByRuleScope]. */ + class Builder internal constructor() { + + private var project: JsonField = JsonMissing.of() + private var workspace: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(byRuleScope: ByRuleScope) = apply { + project = byRuleScope.project + workspace = byRuleScope.workspace + additionalProperties = byRuleScope.additionalProperties.toMutableMap() + } + + fun project(project: Project) = project(JsonField.of(project)) + + /** + * Sets [Builder.project] to an arbitrary JSON value. + * + * You should usually call [Builder.project] with a well-typed [Project] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun project(project: JsonField) = apply { this.project = project } + + fun workspace(workspace: Workspace) = workspace(JsonField.of(workspace)) + + /** + * Sets [Builder.workspace] to an arbitrary JSON value. + * + * You should usually call [Builder.workspace] with a well-typed [Workspace] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun workspace(workspace: JsonField) = apply { + this.workspace = workspace + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ByRuleScope]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): ByRuleScope = + ByRuleScope(project, workspace, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): ByRuleScope = apply { + if (validated) { + return@apply + } + + project().ifPresent { it.validate() } + workspace().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (project.asKnown().getOrNull()?.validity() ?: 0) + + (workspace.asKnown().getOrNull()?.validity() ?: 0) + + class Project + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val total: JsonField, + private val totalDueSoon: JsonField, + private val totalError: JsonField, + private val totalFailing: JsonField, + private val totalPassing: JsonField, + private val totalPending: JsonField, + private val totalRunning: JsonField, + private val totalSkipped: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("total") + @ExcludeMissing + total: JsonField = JsonMissing.of(), + @JsonProperty("totalDueSoon") + @ExcludeMissing + totalDueSoon: JsonField = JsonMissing.of(), + @JsonProperty("totalError") + @ExcludeMissing + totalError: JsonField = JsonMissing.of(), + @JsonProperty("totalFailing") + @ExcludeMissing + totalFailing: JsonField = JsonMissing.of(), + @JsonProperty("totalPassing") + @ExcludeMissing + totalPassing: JsonField = JsonMissing.of(), + @JsonProperty("totalPending") + @ExcludeMissing + totalPending: JsonField = JsonMissing.of(), + @JsonProperty("totalRunning") + @ExcludeMissing + totalRunning: JsonField = JsonMissing.of(), + @JsonProperty("totalSkipped") + @ExcludeMissing + totalSkipped: JsonField = JsonMissing.of(), + ) : this( + total, + totalDueSoon, + totalError, + totalFailing, + totalPassing, + totalPending, + totalRunning, + totalSkipped, + mutableMapOf(), + ) + + /** + * The total number of rule results. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun total(): Long = total.getRequired("total") + + /** + * The number of rule results whose evidence is about to expire. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalDueSoon(): Long = totalDueSoon.getRequired("totalDueSoon") + + /** + * The number of rule results that errored during evaluation. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalError(): Long = totalError.getRequired("totalError") + + /** + * The number of failing rule results. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalFailing(): Long = totalFailing.getRequired("totalFailing") + + /** + * The number of passing rule results. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalPassing(): Long = totalPassing.getRequired("totalPassing") + + /** + * The number of rule results that have not been satisfied yet. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalPending(): Long = totalPending.getRequired("totalPending") + + /** + * The number of rule results currently being evaluated. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalRunning(): Long = totalRunning.getRequired("totalRunning") + + /** + * The number of skipped rule results. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalSkipped(): Long = totalSkipped.getRequired("totalSkipped") + + /** + * Returns the raw JSON value of [total]. + * + * Unlike [total], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("total") @ExcludeMissing fun _total(): JsonField = total + + /** + * Returns the raw JSON value of [totalDueSoon]. + * + * Unlike [totalDueSoon], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalDueSoon") + @ExcludeMissing + fun _totalDueSoon(): JsonField = totalDueSoon + + /** + * Returns the raw JSON value of [totalError]. + * + * Unlike [totalError], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalError") + @ExcludeMissing + fun _totalError(): JsonField = totalError + + /** + * Returns the raw JSON value of [totalFailing]. + * + * Unlike [totalFailing], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalFailing") + @ExcludeMissing + fun _totalFailing(): JsonField = totalFailing + + /** + * Returns the raw JSON value of [totalPassing]. + * + * Unlike [totalPassing], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalPassing") + @ExcludeMissing + fun _totalPassing(): JsonField = totalPassing + + /** + * Returns the raw JSON value of [totalPending]. + * + * Unlike [totalPending], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalPending") + @ExcludeMissing + fun _totalPending(): JsonField = totalPending + + /** + * Returns the raw JSON value of [totalRunning]. + * + * Unlike [totalRunning], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalRunning") + @ExcludeMissing + fun _totalRunning(): JsonField = totalRunning + + /** + * Returns the raw JSON value of [totalSkipped]. + * + * Unlike [totalSkipped], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalSkipped") + @ExcludeMissing + fun _totalSkipped(): JsonField = totalSkipped + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Project]. + * + * The following fields are required: + * ```java + * .total() + * .totalDueSoon() + * .totalError() + * .totalFailing() + * .totalPassing() + * .totalPending() + * .totalRunning() + * .totalSkipped() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Project]. */ + class Builder internal constructor() { + + private var total: JsonField? = null + private var totalDueSoon: JsonField? = null + private var totalError: JsonField? = null + private var totalFailing: JsonField? = null + private var totalPassing: JsonField? = null + private var totalPending: JsonField? = null + private var totalRunning: JsonField? = null + private var totalSkipped: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(project: Project) = apply { + total = project.total + totalDueSoon = project.totalDueSoon + totalError = project.totalError + totalFailing = project.totalFailing + totalPassing = project.totalPassing + totalPending = project.totalPending + totalRunning = project.totalRunning + totalSkipped = project.totalSkipped + additionalProperties = project.additionalProperties.toMutableMap() + } + + /** The total number of rule results. */ + fun total(total: Long) = total(JsonField.of(total)) + + /** + * Sets [Builder.total] to an arbitrary JSON value. + * + * You should usually call [Builder.total] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun total(total: JsonField) = apply { this.total = total } + + /** The number of rule results whose evidence is about to expire. */ + fun totalDueSoon(totalDueSoon: Long) = totalDueSoon(JsonField.of(totalDueSoon)) + + /** + * Sets [Builder.totalDueSoon] to an arbitrary JSON value. + * + * You should usually call [Builder.totalDueSoon] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalDueSoon(totalDueSoon: JsonField) = apply { + this.totalDueSoon = totalDueSoon + } + + /** The number of rule results that errored during evaluation. */ + fun totalError(totalError: Long) = totalError(JsonField.of(totalError)) + + /** + * Sets [Builder.totalError] to an arbitrary JSON value. + * + * You should usually call [Builder.totalError] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalError(totalError: JsonField) = apply { + this.totalError = totalError + } + + /** The number of failing rule results. */ + fun totalFailing(totalFailing: Long) = totalFailing(JsonField.of(totalFailing)) + + /** + * Sets [Builder.totalFailing] to an arbitrary JSON value. + * + * You should usually call [Builder.totalFailing] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalFailing(totalFailing: JsonField) = apply { + this.totalFailing = totalFailing + } + + /** The number of passing rule results. */ + fun totalPassing(totalPassing: Long) = totalPassing(JsonField.of(totalPassing)) + + /** + * Sets [Builder.totalPassing] to an arbitrary JSON value. + * + * You should usually call [Builder.totalPassing] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalPassing(totalPassing: JsonField) = apply { + this.totalPassing = totalPassing + } + + /** The number of rule results that have not been satisfied yet. */ + fun totalPending(totalPending: Long) = totalPending(JsonField.of(totalPending)) + + /** + * Sets [Builder.totalPending] to an arbitrary JSON value. + * + * You should usually call [Builder.totalPending] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalPending(totalPending: JsonField) = apply { + this.totalPending = totalPending + } + + /** The number of rule results currently being evaluated. */ + fun totalRunning(totalRunning: Long) = totalRunning(JsonField.of(totalRunning)) + + /** + * Sets [Builder.totalRunning] to an arbitrary JSON value. + * + * You should usually call [Builder.totalRunning] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalRunning(totalRunning: JsonField) = apply { + this.totalRunning = totalRunning + } + + /** The number of skipped rule results. */ + fun totalSkipped(totalSkipped: Long) = totalSkipped(JsonField.of(totalSkipped)) + + /** + * Sets [Builder.totalSkipped] to an arbitrary JSON value. + * + * You should usually call [Builder.totalSkipped] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalSkipped(totalSkipped: JsonField) = apply { + this.totalSkipped = totalSkipped + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Project]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .total() + * .totalDueSoon() + * .totalError() + * .totalFailing() + * .totalPassing() + * .totalPending() + * .totalRunning() + * .totalSkipped() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Project = + Project( + checkRequired("total", total), + checkRequired("totalDueSoon", totalDueSoon), + checkRequired("totalError", totalError), + checkRequired("totalFailing", totalFailing), + checkRequired("totalPassing", totalPassing), + checkRequired("totalPending", totalPending), + checkRequired("totalRunning", totalRunning), + checkRequired("totalSkipped", totalSkipped), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): Project = apply { + if (validated) { + return@apply + } + + total() + totalDueSoon() + totalError() + totalFailing() + totalPassing() + totalPending() + totalRunning() + totalSkipped() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (total.asKnown().isPresent) 1 else 0) + + (if (totalDueSoon.asKnown().isPresent) 1 else 0) + + (if (totalError.asKnown().isPresent) 1 else 0) + + (if (totalFailing.asKnown().isPresent) 1 else 0) + + (if (totalPassing.asKnown().isPresent) 1 else 0) + + (if (totalPending.asKnown().isPresent) 1 else 0) + + (if (totalRunning.asKnown().isPresent) 1 else 0) + + (if (totalSkipped.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Project && + total == other.total && + totalDueSoon == other.totalDueSoon && + totalError == other.totalError && + totalFailing == other.totalFailing && + totalPassing == other.totalPassing && + totalPending == other.totalPending && + totalRunning == other.totalRunning && + totalSkipped == other.totalSkipped && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + total, + totalDueSoon, + totalError, + totalFailing, + totalPassing, + totalPending, + totalRunning, + totalSkipped, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Project{total=$total, totalDueSoon=$totalDueSoon, totalError=$totalError, totalFailing=$totalFailing, totalPassing=$totalPassing, totalPending=$totalPending, totalRunning=$totalRunning, totalSkipped=$totalSkipped, additionalProperties=$additionalProperties}" + } + + class Workspace + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val total: JsonField, + private val totalDueSoon: JsonField, + private val totalError: JsonField, + private val totalFailing: JsonField, + private val totalPassing: JsonField, + private val totalPending: JsonField, + private val totalRunning: JsonField, + private val totalSkipped: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("total") + @ExcludeMissing + total: JsonField = JsonMissing.of(), + @JsonProperty("totalDueSoon") + @ExcludeMissing + totalDueSoon: JsonField = JsonMissing.of(), + @JsonProperty("totalError") + @ExcludeMissing + totalError: JsonField = JsonMissing.of(), + @JsonProperty("totalFailing") + @ExcludeMissing + totalFailing: JsonField = JsonMissing.of(), + @JsonProperty("totalPassing") + @ExcludeMissing + totalPassing: JsonField = JsonMissing.of(), + @JsonProperty("totalPending") + @ExcludeMissing + totalPending: JsonField = JsonMissing.of(), + @JsonProperty("totalRunning") + @ExcludeMissing + totalRunning: JsonField = JsonMissing.of(), + @JsonProperty("totalSkipped") + @ExcludeMissing + totalSkipped: JsonField = JsonMissing.of(), + ) : this( + total, + totalDueSoon, + totalError, + totalFailing, + totalPassing, + totalPending, + totalRunning, + totalSkipped, + mutableMapOf(), + ) + + /** + * The total number of rule results. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun total(): Long = total.getRequired("total") + + /** + * The number of rule results whose evidence is about to expire. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalDueSoon(): Long = totalDueSoon.getRequired("totalDueSoon") + + /** + * The number of rule results that errored during evaluation. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalError(): Long = totalError.getRequired("totalError") + + /** + * The number of failing rule results. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalFailing(): Long = totalFailing.getRequired("totalFailing") + + /** + * The number of passing rule results. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalPassing(): Long = totalPassing.getRequired("totalPassing") + + /** + * The number of rule results that have not been satisfied yet. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalPending(): Long = totalPending.getRequired("totalPending") + + /** + * The number of rule results currently being evaluated. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalRunning(): Long = totalRunning.getRequired("totalRunning") + + /** + * The number of skipped rule results. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalSkipped(): Long = totalSkipped.getRequired("totalSkipped") + + /** + * Returns the raw JSON value of [total]. + * + * Unlike [total], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("total") @ExcludeMissing fun _total(): JsonField = total + + /** + * Returns the raw JSON value of [totalDueSoon]. + * + * Unlike [totalDueSoon], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalDueSoon") + @ExcludeMissing + fun _totalDueSoon(): JsonField = totalDueSoon + + /** + * Returns the raw JSON value of [totalError]. + * + * Unlike [totalError], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalError") + @ExcludeMissing + fun _totalError(): JsonField = totalError + + /** + * Returns the raw JSON value of [totalFailing]. + * + * Unlike [totalFailing], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalFailing") + @ExcludeMissing + fun _totalFailing(): JsonField = totalFailing + + /** + * Returns the raw JSON value of [totalPassing]. + * + * Unlike [totalPassing], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalPassing") + @ExcludeMissing + fun _totalPassing(): JsonField = totalPassing + + /** + * Returns the raw JSON value of [totalPending]. + * + * Unlike [totalPending], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalPending") + @ExcludeMissing + fun _totalPending(): JsonField = totalPending + + /** + * Returns the raw JSON value of [totalRunning]. + * + * Unlike [totalRunning], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalRunning") + @ExcludeMissing + fun _totalRunning(): JsonField = totalRunning + + /** + * Returns the raw JSON value of [totalSkipped]. + * + * Unlike [totalSkipped], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalSkipped") + @ExcludeMissing + fun _totalSkipped(): JsonField = totalSkipped + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Workspace]. + * + * The following fields are required: + * ```java + * .total() + * .totalDueSoon() + * .totalError() + * .totalFailing() + * .totalPassing() + * .totalPending() + * .totalRunning() + * .totalSkipped() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Workspace]. */ + class Builder internal constructor() { + + private var total: JsonField? = null + private var totalDueSoon: JsonField? = null + private var totalError: JsonField? = null + private var totalFailing: JsonField? = null + private var totalPassing: JsonField? = null + private var totalPending: JsonField? = null + private var totalRunning: JsonField? = null + private var totalSkipped: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(workspace: Workspace) = apply { + total = workspace.total + totalDueSoon = workspace.totalDueSoon + totalError = workspace.totalError + totalFailing = workspace.totalFailing + totalPassing = workspace.totalPassing + totalPending = workspace.totalPending + totalRunning = workspace.totalRunning + totalSkipped = workspace.totalSkipped + additionalProperties = workspace.additionalProperties.toMutableMap() + } + + /** The total number of rule results. */ + fun total(total: Long) = total(JsonField.of(total)) + + /** + * Sets [Builder.total] to an arbitrary JSON value. + * + * You should usually call [Builder.total] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun total(total: JsonField) = apply { this.total = total } + + /** The number of rule results whose evidence is about to expire. */ + fun totalDueSoon(totalDueSoon: Long) = totalDueSoon(JsonField.of(totalDueSoon)) + + /** + * Sets [Builder.totalDueSoon] to an arbitrary JSON value. + * + * You should usually call [Builder.totalDueSoon] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalDueSoon(totalDueSoon: JsonField) = apply { + this.totalDueSoon = totalDueSoon + } + + /** The number of rule results that errored during evaluation. */ + fun totalError(totalError: Long) = totalError(JsonField.of(totalError)) + + /** + * Sets [Builder.totalError] to an arbitrary JSON value. + * + * You should usually call [Builder.totalError] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalError(totalError: JsonField) = apply { + this.totalError = totalError + } + + /** The number of failing rule results. */ + fun totalFailing(totalFailing: Long) = totalFailing(JsonField.of(totalFailing)) + + /** + * Sets [Builder.totalFailing] to an arbitrary JSON value. + * + * You should usually call [Builder.totalFailing] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalFailing(totalFailing: JsonField) = apply { + this.totalFailing = totalFailing + } + + /** The number of passing rule results. */ + fun totalPassing(totalPassing: Long) = totalPassing(JsonField.of(totalPassing)) + + /** + * Sets [Builder.totalPassing] to an arbitrary JSON value. + * + * You should usually call [Builder.totalPassing] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalPassing(totalPassing: JsonField) = apply { + this.totalPassing = totalPassing + } + + /** The number of rule results that have not been satisfied yet. */ + fun totalPending(totalPending: Long) = totalPending(JsonField.of(totalPending)) + + /** + * Sets [Builder.totalPending] to an arbitrary JSON value. + * + * You should usually call [Builder.totalPending] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalPending(totalPending: JsonField) = apply { + this.totalPending = totalPending + } + + /** The number of rule results currently being evaluated. */ + fun totalRunning(totalRunning: Long) = totalRunning(JsonField.of(totalRunning)) + + /** + * Sets [Builder.totalRunning] to an arbitrary JSON value. + * + * You should usually call [Builder.totalRunning] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalRunning(totalRunning: JsonField) = apply { + this.totalRunning = totalRunning + } + + /** The number of skipped rule results. */ + fun totalSkipped(totalSkipped: Long) = totalSkipped(JsonField.of(totalSkipped)) + + /** + * Sets [Builder.totalSkipped] to an arbitrary JSON value. + * + * You should usually call [Builder.totalSkipped] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalSkipped(totalSkipped: JsonField) = apply { + this.totalSkipped = totalSkipped + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Workspace]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .total() + * .totalDueSoon() + * .totalError() + * .totalFailing() + * .totalPassing() + * .totalPending() + * .totalRunning() + * .totalSkipped() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Workspace = + Workspace( + checkRequired("total", total), + checkRequired("totalDueSoon", totalDueSoon), + checkRequired("totalError", totalError), + checkRequired("totalFailing", totalFailing), + checkRequired("totalPassing", totalPassing), + checkRequired("totalPending", totalPending), + checkRequired("totalRunning", totalRunning), + checkRequired("totalSkipped", totalSkipped), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): Workspace = apply { + if (validated) { + return@apply + } + + total() + totalDueSoon() + totalError() + totalFailing() + totalPassing() + totalPending() + totalRunning() + totalSkipped() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (total.asKnown().isPresent) 1 else 0) + + (if (totalDueSoon.asKnown().isPresent) 1 else 0) + + (if (totalError.asKnown().isPresent) 1 else 0) + + (if (totalFailing.asKnown().isPresent) 1 else 0) + + (if (totalPassing.asKnown().isPresent) 1 else 0) + + (if (totalPending.asKnown().isPresent) 1 else 0) + + (if (totalRunning.asKnown().isPresent) 1 else 0) + + (if (totalSkipped.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Workspace && + total == other.total && + totalDueSoon == other.totalDueSoon && + totalError == other.totalError && + totalFailing == other.totalFailing && + totalPassing == other.totalPassing && + totalPending == other.totalPending && + totalRunning == other.totalRunning && + totalSkipped == other.totalSkipped && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + total, + totalDueSoon, + totalError, + totalFailing, + totalPassing, + totalPending, + totalRunning, + totalSkipped, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Workspace{total=$total, totalDueSoon=$totalDueSoon, totalError=$totalError, totalFailing=$totalFailing, totalPassing=$totalPassing, totalPending=$totalPending, totalRunning=$totalRunning, totalSkipped=$totalSkipped, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ByRuleScope && + project == other.project && + workspace == other.workspace && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(project, workspace, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ByRuleScope{project=$project, workspace=$workspace, additionalProperties=$additionalProperties}" + } + + class ByRuleType + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val evidence: JsonField, + private val platform: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("evidence") + @ExcludeMissing + evidence: JsonField = JsonMissing.of(), + @JsonProperty("platform") + @ExcludeMissing + platform: JsonField = JsonMissing.of(), + ) : this(evidence, platform, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun evidence(): Optional = evidence.getOptional("evidence") + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun platform(): Optional = platform.getOptional("platform") + + /** + * Returns the raw JSON value of [evidence]. + * + * Unlike [evidence], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("evidence") + @ExcludeMissing + fun _evidence(): JsonField = evidence + + /** + * Returns the raw JSON value of [platform]. + * + * Unlike [platform], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("platform") + @ExcludeMissing + fun _platform(): JsonField = platform + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [ByRuleType]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ByRuleType]. */ + class Builder internal constructor() { + + private var evidence: JsonField = JsonMissing.of() + private var platform: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(byRuleType: ByRuleType) = apply { + evidence = byRuleType.evidence + platform = byRuleType.platform + additionalProperties = byRuleType.additionalProperties.toMutableMap() + } + + fun evidence(evidence: Evidence) = evidence(JsonField.of(evidence)) + + /** + * Sets [Builder.evidence] to an arbitrary JSON value. + * + * You should usually call [Builder.evidence] with a well-typed [Evidence] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun evidence(evidence: JsonField) = apply { this.evidence = evidence } + + fun platform(platform: Platform) = platform(JsonField.of(platform)) + + /** + * Sets [Builder.platform] to an arbitrary JSON value. + * + * You should usually call [Builder.platform] with a well-typed [Platform] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun platform(platform: JsonField) = apply { this.platform = platform } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ByRuleType]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): ByRuleType = + ByRuleType(evidence, platform, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): ByRuleType = apply { + if (validated) { + return@apply + } + + evidence().ifPresent { it.validate() } + platform().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (evidence.asKnown().getOrNull()?.validity() ?: 0) + + (platform.asKnown().getOrNull()?.validity() ?: 0) + + class Evidence + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val total: JsonField, + private val totalDueSoon: JsonField, + private val totalError: JsonField, + private val totalFailing: JsonField, + private val totalPassing: JsonField, + private val totalPending: JsonField, + private val totalRunning: JsonField, + private val totalSkipped: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("total") + @ExcludeMissing + total: JsonField = JsonMissing.of(), + @JsonProperty("totalDueSoon") + @ExcludeMissing + totalDueSoon: JsonField = JsonMissing.of(), + @JsonProperty("totalError") + @ExcludeMissing + totalError: JsonField = JsonMissing.of(), + @JsonProperty("totalFailing") + @ExcludeMissing + totalFailing: JsonField = JsonMissing.of(), + @JsonProperty("totalPassing") + @ExcludeMissing + totalPassing: JsonField = JsonMissing.of(), + @JsonProperty("totalPending") + @ExcludeMissing + totalPending: JsonField = JsonMissing.of(), + @JsonProperty("totalRunning") + @ExcludeMissing + totalRunning: JsonField = JsonMissing.of(), + @JsonProperty("totalSkipped") + @ExcludeMissing + totalSkipped: JsonField = JsonMissing.of(), + ) : this( + total, + totalDueSoon, + totalError, + totalFailing, + totalPassing, + totalPending, + totalRunning, + totalSkipped, + mutableMapOf(), + ) + + /** + * The total number of rule results. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun total(): Long = total.getRequired("total") + + /** + * The number of rule results whose evidence is about to expire. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalDueSoon(): Long = totalDueSoon.getRequired("totalDueSoon") + + /** + * The number of rule results that errored during evaluation. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalError(): Long = totalError.getRequired("totalError") + + /** + * The number of failing rule results. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalFailing(): Long = totalFailing.getRequired("totalFailing") + + /** + * The number of passing rule results. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalPassing(): Long = totalPassing.getRequired("totalPassing") + + /** + * The number of rule results that have not been satisfied yet. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalPending(): Long = totalPending.getRequired("totalPending") + + /** + * The number of rule results currently being evaluated. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalRunning(): Long = totalRunning.getRequired("totalRunning") + + /** + * The number of skipped rule results. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalSkipped(): Long = totalSkipped.getRequired("totalSkipped") + + /** + * Returns the raw JSON value of [total]. + * + * Unlike [total], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("total") @ExcludeMissing fun _total(): JsonField = total + + /** + * Returns the raw JSON value of [totalDueSoon]. + * + * Unlike [totalDueSoon], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalDueSoon") + @ExcludeMissing + fun _totalDueSoon(): JsonField = totalDueSoon + + /** + * Returns the raw JSON value of [totalError]. + * + * Unlike [totalError], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalError") + @ExcludeMissing + fun _totalError(): JsonField = totalError + + /** + * Returns the raw JSON value of [totalFailing]. + * + * Unlike [totalFailing], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalFailing") + @ExcludeMissing + fun _totalFailing(): JsonField = totalFailing + + /** + * Returns the raw JSON value of [totalPassing]. + * + * Unlike [totalPassing], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalPassing") + @ExcludeMissing + fun _totalPassing(): JsonField = totalPassing + + /** + * Returns the raw JSON value of [totalPending]. + * + * Unlike [totalPending], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalPending") + @ExcludeMissing + fun _totalPending(): JsonField = totalPending + + /** + * Returns the raw JSON value of [totalRunning]. + * + * Unlike [totalRunning], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalRunning") + @ExcludeMissing + fun _totalRunning(): JsonField = totalRunning + + /** + * Returns the raw JSON value of [totalSkipped]. + * + * Unlike [totalSkipped], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalSkipped") + @ExcludeMissing + fun _totalSkipped(): JsonField = totalSkipped + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Evidence]. + * + * The following fields are required: + * ```java + * .total() + * .totalDueSoon() + * .totalError() + * .totalFailing() + * .totalPassing() + * .totalPending() + * .totalRunning() + * .totalSkipped() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Evidence]. */ + class Builder internal constructor() { + + private var total: JsonField? = null + private var totalDueSoon: JsonField? = null + private var totalError: JsonField? = null + private var totalFailing: JsonField? = null + private var totalPassing: JsonField? = null + private var totalPending: JsonField? = null + private var totalRunning: JsonField? = null + private var totalSkipped: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(evidence: Evidence) = apply { + total = evidence.total + totalDueSoon = evidence.totalDueSoon + totalError = evidence.totalError + totalFailing = evidence.totalFailing + totalPassing = evidence.totalPassing + totalPending = evidence.totalPending + totalRunning = evidence.totalRunning + totalSkipped = evidence.totalSkipped + additionalProperties = evidence.additionalProperties.toMutableMap() + } + + /** The total number of rule results. */ + fun total(total: Long) = total(JsonField.of(total)) + + /** + * Sets [Builder.total] to an arbitrary JSON value. + * + * You should usually call [Builder.total] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun total(total: JsonField) = apply { this.total = total } + + /** The number of rule results whose evidence is about to expire. */ + fun totalDueSoon(totalDueSoon: Long) = totalDueSoon(JsonField.of(totalDueSoon)) + + /** + * Sets [Builder.totalDueSoon] to an arbitrary JSON value. + * + * You should usually call [Builder.totalDueSoon] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalDueSoon(totalDueSoon: JsonField) = apply { + this.totalDueSoon = totalDueSoon + } + + /** The number of rule results that errored during evaluation. */ + fun totalError(totalError: Long) = totalError(JsonField.of(totalError)) + + /** + * Sets [Builder.totalError] to an arbitrary JSON value. + * + * You should usually call [Builder.totalError] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalError(totalError: JsonField) = apply { + this.totalError = totalError + } + + /** The number of failing rule results. */ + fun totalFailing(totalFailing: Long) = totalFailing(JsonField.of(totalFailing)) + + /** + * Sets [Builder.totalFailing] to an arbitrary JSON value. + * + * You should usually call [Builder.totalFailing] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalFailing(totalFailing: JsonField) = apply { + this.totalFailing = totalFailing + } + + /** The number of passing rule results. */ + fun totalPassing(totalPassing: Long) = totalPassing(JsonField.of(totalPassing)) + + /** + * Sets [Builder.totalPassing] to an arbitrary JSON value. + * + * You should usually call [Builder.totalPassing] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalPassing(totalPassing: JsonField) = apply { + this.totalPassing = totalPassing + } + + /** The number of rule results that have not been satisfied yet. */ + fun totalPending(totalPending: Long) = totalPending(JsonField.of(totalPending)) + + /** + * Sets [Builder.totalPending] to an arbitrary JSON value. + * + * You should usually call [Builder.totalPending] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalPending(totalPending: JsonField) = apply { + this.totalPending = totalPending + } + + /** The number of rule results currently being evaluated. */ + fun totalRunning(totalRunning: Long) = totalRunning(JsonField.of(totalRunning)) + + /** + * Sets [Builder.totalRunning] to an arbitrary JSON value. + * + * You should usually call [Builder.totalRunning] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalRunning(totalRunning: JsonField) = apply { + this.totalRunning = totalRunning + } + + /** The number of skipped rule results. */ + fun totalSkipped(totalSkipped: Long) = totalSkipped(JsonField.of(totalSkipped)) + + /** + * Sets [Builder.totalSkipped] to an arbitrary JSON value. + * + * You should usually call [Builder.totalSkipped] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalSkipped(totalSkipped: JsonField) = apply { + this.totalSkipped = totalSkipped + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Evidence]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .total() + * .totalDueSoon() + * .totalError() + * .totalFailing() + * .totalPassing() + * .totalPending() + * .totalRunning() + * .totalSkipped() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Evidence = + Evidence( + checkRequired("total", total), + checkRequired("totalDueSoon", totalDueSoon), + checkRequired("totalError", totalError), + checkRequired("totalFailing", totalFailing), + checkRequired("totalPassing", totalPassing), + checkRequired("totalPending", totalPending), + checkRequired("totalRunning", totalRunning), + checkRequired("totalSkipped", totalSkipped), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): Evidence = apply { + if (validated) { + return@apply + } + + total() + totalDueSoon() + totalError() + totalFailing() + totalPassing() + totalPending() + totalRunning() + totalSkipped() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (total.asKnown().isPresent) 1 else 0) + + (if (totalDueSoon.asKnown().isPresent) 1 else 0) + + (if (totalError.asKnown().isPresent) 1 else 0) + + (if (totalFailing.asKnown().isPresent) 1 else 0) + + (if (totalPassing.asKnown().isPresent) 1 else 0) + + (if (totalPending.asKnown().isPresent) 1 else 0) + + (if (totalRunning.asKnown().isPresent) 1 else 0) + + (if (totalSkipped.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Evidence && + total == other.total && + totalDueSoon == other.totalDueSoon && + totalError == other.totalError && + totalFailing == other.totalFailing && + totalPassing == other.totalPassing && + totalPending == other.totalPending && + totalRunning == other.totalRunning && + totalSkipped == other.totalSkipped && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + total, + totalDueSoon, + totalError, + totalFailing, + totalPassing, + totalPending, + totalRunning, + totalSkipped, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Evidence{total=$total, totalDueSoon=$totalDueSoon, totalError=$totalError, totalFailing=$totalFailing, totalPassing=$totalPassing, totalPending=$totalPending, totalRunning=$totalRunning, totalSkipped=$totalSkipped, additionalProperties=$additionalProperties}" + } + + class Platform + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val total: JsonField, + private val totalDueSoon: JsonField, + private val totalError: JsonField, + private val totalFailing: JsonField, + private val totalPassing: JsonField, + private val totalPending: JsonField, + private val totalRunning: JsonField, + private val totalSkipped: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("total") + @ExcludeMissing + total: JsonField = JsonMissing.of(), + @JsonProperty("totalDueSoon") + @ExcludeMissing + totalDueSoon: JsonField = JsonMissing.of(), + @JsonProperty("totalError") + @ExcludeMissing + totalError: JsonField = JsonMissing.of(), + @JsonProperty("totalFailing") + @ExcludeMissing + totalFailing: JsonField = JsonMissing.of(), + @JsonProperty("totalPassing") + @ExcludeMissing + totalPassing: JsonField = JsonMissing.of(), + @JsonProperty("totalPending") + @ExcludeMissing + totalPending: JsonField = JsonMissing.of(), + @JsonProperty("totalRunning") + @ExcludeMissing + totalRunning: JsonField = JsonMissing.of(), + @JsonProperty("totalSkipped") + @ExcludeMissing + totalSkipped: JsonField = JsonMissing.of(), + ) : this( + total, + totalDueSoon, + totalError, + totalFailing, + totalPassing, + totalPending, + totalRunning, + totalSkipped, + mutableMapOf(), + ) + + /** + * The total number of rule results. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun total(): Long = total.getRequired("total") + + /** + * The number of rule results whose evidence is about to expire. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalDueSoon(): Long = totalDueSoon.getRequired("totalDueSoon") + + /** + * The number of rule results that errored during evaluation. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalError(): Long = totalError.getRequired("totalError") + + /** + * The number of failing rule results. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalFailing(): Long = totalFailing.getRequired("totalFailing") + + /** + * The number of passing rule results. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalPassing(): Long = totalPassing.getRequired("totalPassing") + + /** + * The number of rule results that have not been satisfied yet. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalPending(): Long = totalPending.getRequired("totalPending") + + /** + * The number of rule results currently being evaluated. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalRunning(): Long = totalRunning.getRequired("totalRunning") + + /** + * The number of skipped rule results. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalSkipped(): Long = totalSkipped.getRequired("totalSkipped") + + /** + * Returns the raw JSON value of [total]. + * + * Unlike [total], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("total") @ExcludeMissing fun _total(): JsonField = total + + /** + * Returns the raw JSON value of [totalDueSoon]. + * + * Unlike [totalDueSoon], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalDueSoon") + @ExcludeMissing + fun _totalDueSoon(): JsonField = totalDueSoon + + /** + * Returns the raw JSON value of [totalError]. + * + * Unlike [totalError], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalError") + @ExcludeMissing + fun _totalError(): JsonField = totalError + + /** + * Returns the raw JSON value of [totalFailing]. + * + * Unlike [totalFailing], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalFailing") + @ExcludeMissing + fun _totalFailing(): JsonField = totalFailing + + /** + * Returns the raw JSON value of [totalPassing]. + * + * Unlike [totalPassing], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalPassing") + @ExcludeMissing + fun _totalPassing(): JsonField = totalPassing + + /** + * Returns the raw JSON value of [totalPending]. + * + * Unlike [totalPending], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalPending") + @ExcludeMissing + fun _totalPending(): JsonField = totalPending + + /** + * Returns the raw JSON value of [totalRunning]. + * + * Unlike [totalRunning], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalRunning") + @ExcludeMissing + fun _totalRunning(): JsonField = totalRunning + + /** + * Returns the raw JSON value of [totalSkipped]. + * + * Unlike [totalSkipped], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("totalSkipped") + @ExcludeMissing + fun _totalSkipped(): JsonField = totalSkipped + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Platform]. + * + * The following fields are required: + * ```java + * .total() + * .totalDueSoon() + * .totalError() + * .totalFailing() + * .totalPassing() + * .totalPending() + * .totalRunning() + * .totalSkipped() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Platform]. */ + class Builder internal constructor() { + + private var total: JsonField? = null + private var totalDueSoon: JsonField? = null + private var totalError: JsonField? = null + private var totalFailing: JsonField? = null + private var totalPassing: JsonField? = null + private var totalPending: JsonField? = null + private var totalRunning: JsonField? = null + private var totalSkipped: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(platform: Platform) = apply { + total = platform.total + totalDueSoon = platform.totalDueSoon + totalError = platform.totalError + totalFailing = platform.totalFailing + totalPassing = platform.totalPassing + totalPending = platform.totalPending + totalRunning = platform.totalRunning + totalSkipped = platform.totalSkipped + additionalProperties = platform.additionalProperties.toMutableMap() + } + + /** The total number of rule results. */ + fun total(total: Long) = total(JsonField.of(total)) + + /** + * Sets [Builder.total] to an arbitrary JSON value. + * + * You should usually call [Builder.total] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun total(total: JsonField) = apply { this.total = total } + + /** The number of rule results whose evidence is about to expire. */ + fun totalDueSoon(totalDueSoon: Long) = totalDueSoon(JsonField.of(totalDueSoon)) + + /** + * Sets [Builder.totalDueSoon] to an arbitrary JSON value. + * + * You should usually call [Builder.totalDueSoon] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalDueSoon(totalDueSoon: JsonField) = apply { + this.totalDueSoon = totalDueSoon + } + + /** The number of rule results that errored during evaluation. */ + fun totalError(totalError: Long) = totalError(JsonField.of(totalError)) + + /** + * Sets [Builder.totalError] to an arbitrary JSON value. + * + * You should usually call [Builder.totalError] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalError(totalError: JsonField) = apply { + this.totalError = totalError + } + + /** The number of failing rule results. */ + fun totalFailing(totalFailing: Long) = totalFailing(JsonField.of(totalFailing)) + + /** + * Sets [Builder.totalFailing] to an arbitrary JSON value. + * + * You should usually call [Builder.totalFailing] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalFailing(totalFailing: JsonField) = apply { + this.totalFailing = totalFailing + } + + /** The number of passing rule results. */ + fun totalPassing(totalPassing: Long) = totalPassing(JsonField.of(totalPassing)) + + /** + * Sets [Builder.totalPassing] to an arbitrary JSON value. + * + * You should usually call [Builder.totalPassing] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalPassing(totalPassing: JsonField) = apply { + this.totalPassing = totalPassing + } + + /** The number of rule results that have not been satisfied yet. */ + fun totalPending(totalPending: Long) = totalPending(JsonField.of(totalPending)) + + /** + * Sets [Builder.totalPending] to an arbitrary JSON value. + * + * You should usually call [Builder.totalPending] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalPending(totalPending: JsonField) = apply { + this.totalPending = totalPending + } + + /** The number of rule results currently being evaluated. */ + fun totalRunning(totalRunning: Long) = totalRunning(JsonField.of(totalRunning)) + + /** + * Sets [Builder.totalRunning] to an arbitrary JSON value. + * + * You should usually call [Builder.totalRunning] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalRunning(totalRunning: JsonField) = apply { + this.totalRunning = totalRunning + } + + /** The number of skipped rule results. */ + fun totalSkipped(totalSkipped: Long) = totalSkipped(JsonField.of(totalSkipped)) + + /** + * Sets [Builder.totalSkipped] to an arbitrary JSON value. + * + * You should usually call [Builder.totalSkipped] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalSkipped(totalSkipped: JsonField) = apply { + this.totalSkipped = totalSkipped + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Platform]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .total() + * .totalDueSoon() + * .totalError() + * .totalFailing() + * .totalPassing() + * .totalPending() + * .totalRunning() + * .totalSkipped() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Platform = + Platform( + checkRequired("total", total), + checkRequired("totalDueSoon", totalDueSoon), + checkRequired("totalError", totalError), + checkRequired("totalFailing", totalFailing), + checkRequired("totalPassing", totalPassing), + checkRequired("totalPending", totalPending), + checkRequired("totalRunning", totalRunning), + checkRequired("totalSkipped", totalSkipped), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): Platform = apply { + if (validated) { + return@apply + } + + total() + totalDueSoon() + totalError() + totalFailing() + totalPassing() + totalPending() + totalRunning() + totalSkipped() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (total.asKnown().isPresent) 1 else 0) + + (if (totalDueSoon.asKnown().isPresent) 1 else 0) + + (if (totalError.asKnown().isPresent) 1 else 0) + + (if (totalFailing.asKnown().isPresent) 1 else 0) + + (if (totalPassing.asKnown().isPresent) 1 else 0) + + (if (totalPending.asKnown().isPresent) 1 else 0) + + (if (totalRunning.asKnown().isPresent) 1 else 0) + + (if (totalSkipped.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Platform && + total == other.total && + totalDueSoon == other.totalDueSoon && + totalError == other.totalError && + totalFailing == other.totalFailing && + totalPassing == other.totalPassing && + totalPending == other.totalPending && + totalRunning == other.totalRunning && + totalSkipped == other.totalSkipped && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + total, + totalDueSoon, + totalError, + totalFailing, + totalPassing, + totalPending, + totalRunning, + totalSkipped, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Platform{total=$total, totalDueSoon=$totalDueSoon, totalError=$totalError, totalFailing=$totalFailing, totalPassing=$totalPassing, totalPending=$totalPending, totalRunning=$totalRunning, totalSkipped=$totalSkipped, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ByRuleType && + evidence == other.evidence && + platform == other.platform && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(evidence, platform, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ByRuleType{evidence=$evidence, platform=$platform, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is RuleResults && + total == other.total && + totalDueSoon == other.totalDueSoon && + totalError == other.totalError && + totalFailing == other.totalFailing && + totalPassing == other.totalPassing && + totalPending == other.totalPending && + totalRunning == other.totalRunning && + totalSkipped == other.totalSkipped && + byRuleScope == other.byRuleScope && + byRuleType == other.byRuleType && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + total, + totalDueSoon, + totalError, + totalFailing, + totalPassing, + totalPending, + totalRunning, + totalSkipped, + byRuleScope, + byRuleType, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "RuleResults{total=$total, totalDueSoon=$totalDueSoon, totalError=$totalError, totalFailing=$totalFailing, totalPassing=$totalPassing, totalPending=$totalPending, totalRunning=$totalRunning, totalSkipped=$totalSkipped, byRuleScope=$byRuleScope, byRuleType=$byRuleType, additionalProperties=$additionalProperties}" + } + + /** Counts of the rules themselves, after any filters in the request. */ + class Rules + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val byScope: JsonField, + private val byType: JsonField, + private val total: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("byScope") @ExcludeMissing byScope: JsonField = JsonMissing.of(), + @JsonProperty("byType") @ExcludeMissing byType: JsonField = JsonMissing.of(), + @JsonProperty("total") @ExcludeMissing total: JsonField = JsonMissing.of(), + ) : this(byScope, byType, total, mutableMapOf()) + + /** + * Rule counts by scope. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun byScope(): Optional = byScope.getOptional("byScope") + + /** + * Rule counts by type. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun byType(): Optional = byType.getOptional("byType") + + /** + * The total number of rules. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun total(): Optional = total.getOptional("total") + + /** + * Returns the raw JSON value of [byScope]. + * + * Unlike [byScope], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("byScope") @ExcludeMissing fun _byScope(): JsonField = byScope + + /** + * Returns the raw JSON value of [byType]. + * + * Unlike [byType], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("byType") @ExcludeMissing fun _byType(): JsonField = byType + + /** + * Returns the raw JSON value of [total]. + * + * Unlike [total], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("total") @ExcludeMissing fun _total(): JsonField = total + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Rules]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Rules]. */ + class Builder internal constructor() { + + private var byScope: JsonField = JsonMissing.of() + private var byType: JsonField = JsonMissing.of() + private var total: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(rules: Rules) = apply { + byScope = rules.byScope + byType = rules.byType + total = rules.total + additionalProperties = rules.additionalProperties.toMutableMap() + } + + /** Rule counts by scope. */ + fun byScope(byScope: ByScope) = byScope(JsonField.of(byScope)) + + /** + * Sets [Builder.byScope] to an arbitrary JSON value. + * + * You should usually call [Builder.byScope] with a well-typed [ByScope] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun byScope(byScope: JsonField) = apply { this.byScope = byScope } + + /** Rule counts by type. */ + fun byType(byType: ByType) = byType(JsonField.of(byType)) + + /** + * Sets [Builder.byType] to an arbitrary JSON value. + * + * You should usually call [Builder.byType] with a well-typed [ByType] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun byType(byType: JsonField) = apply { this.byType = byType } + + /** The total number of rules. */ + fun total(total: Long) = total(JsonField.of(total)) + + /** + * Sets [Builder.total] to an arbitrary JSON value. + * + * You should usually call [Builder.total] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun total(total: JsonField) = apply { this.total = total } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Rules]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Rules = Rules(byScope, byType, total, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Rules = apply { + if (validated) { + return@apply + } + + byScope().ifPresent { it.validate() } + byType().ifPresent { it.validate() } + total() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (byScope.asKnown().getOrNull()?.validity() ?: 0) + + (byType.asKnown().getOrNull()?.validity() ?: 0) + + (if (total.asKnown().isPresent) 1 else 0) + + /** Rule counts by scope. */ + class ByScope + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val project: JsonField, + private val workspace: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("project") + @ExcludeMissing + project: JsonField = JsonMissing.of(), + @JsonProperty("workspace") + @ExcludeMissing + workspace: JsonField = JsonMissing.of(), + ) : this(project, workspace, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun project(): Optional = project.getOptional("project") + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun workspace(): Optional = workspace.getOptional("workspace") + + /** + * Returns the raw JSON value of [project]. + * + * Unlike [project], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("project") @ExcludeMissing fun _project(): JsonField = project + + /** + * Returns the raw JSON value of [workspace]. + * + * Unlike [workspace], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("workspace") @ExcludeMissing fun _workspace(): JsonField = workspace + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [ByScope]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ByScope]. */ + class Builder internal constructor() { + + private var project: JsonField = JsonMissing.of() + private var workspace: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(byScope: ByScope) = apply { + project = byScope.project + workspace = byScope.workspace + additionalProperties = byScope.additionalProperties.toMutableMap() + } + + fun project(project: Long) = project(JsonField.of(project)) + + /** + * Sets [Builder.project] to an arbitrary JSON value. + * + * You should usually call [Builder.project] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun project(project: JsonField) = apply { this.project = project } + + fun workspace(workspace: Long) = workspace(JsonField.of(workspace)) + + /** + * Sets [Builder.workspace] to an arbitrary JSON value. + * + * You should usually call [Builder.workspace] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun workspace(workspace: JsonField) = apply { this.workspace = workspace } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ByScope]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): ByScope = + ByScope(project, workspace, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): ByScope = apply { + if (validated) { + return@apply + } + + project() + workspace() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (project.asKnown().isPresent) 1 else 0) + + (if (workspace.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ByScope && + project == other.project && + workspace == other.workspace && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(project, workspace, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ByScope{project=$project, workspace=$workspace, additionalProperties=$additionalProperties}" + } + + /** Rule counts by type. */ + class ByType + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val evidence: JsonField, + private val platform: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("evidence") + @ExcludeMissing + evidence: JsonField = JsonMissing.of(), + @JsonProperty("platform") + @ExcludeMissing + platform: JsonField = JsonMissing.of(), + ) : this(evidence, platform, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun evidence(): Optional = evidence.getOptional("evidence") + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun platform(): Optional = platform.getOptional("platform") + + /** + * Returns the raw JSON value of [evidence]. + * + * Unlike [evidence], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("evidence") @ExcludeMissing fun _evidence(): JsonField = evidence + + /** + * Returns the raw JSON value of [platform]. + * + * Unlike [platform], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("platform") @ExcludeMissing fun _platform(): JsonField = platform + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [ByType]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ByType]. */ + class Builder internal constructor() { + + private var evidence: JsonField = JsonMissing.of() + private var platform: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(byType: ByType) = apply { + evidence = byType.evidence + platform = byType.platform + additionalProperties = byType.additionalProperties.toMutableMap() + } + + fun evidence(evidence: Long) = evidence(JsonField.of(evidence)) + + /** + * Sets [Builder.evidence] to an arbitrary JSON value. + * + * You should usually call [Builder.evidence] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun evidence(evidence: JsonField) = apply { this.evidence = evidence } + + fun platform(platform: Long) = platform(JsonField.of(platform)) + + /** + * Sets [Builder.platform] to an arbitrary JSON value. + * + * You should usually call [Builder.platform] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun platform(platform: JsonField) = apply { this.platform = platform } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ByType]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): ByType = + ByType(evidence, platform, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): ByType = apply { + if (validated) { + return@apply + } + + evidence() + platform() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (evidence.asKnown().isPresent) 1 else 0) + + (if (platform.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ByType && + evidence == other.evidence && + platform == other.platform && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(evidence, platform, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ByType{evidence=$evidence, platform=$platform, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Rules && + byScope == other.byScope && + byType == other.byType && + total == other.total && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(byScope, byType, total, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Rules{byScope=$byScope, byType=$byType, total=$total, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is RuleStatRetrieveResponse && + ruleResults == other.ruleResults && + rules == other.rules && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(ruleResults, rules, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "RuleStatRetrieveResponse{ruleResults=$ruleResults, rules=$rules, additionalProperties=$additionalProperties}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/ruletags/RuleTagListParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/ruletags/RuleTagListParams.kt new file mode 100644 index 00000000..a0824b19 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/ruletags/RuleTagListParams.kt @@ -0,0 +1,248 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.ruletags + +import com.openlayer.api.core.Params +import com.openlayer.api.core.http.Headers +import com.openlayer.api.core.http.QueryParams +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * List the rule tags in a workspace. + * + * Tags group rules across frameworks, for example by team or by control family. Use the ids + * returned here with the `tags` filter on [List rules](/api-reference/rest/governance/list-rules). + */ +class RuleTagListParams +private constructor( + private val workspaceId: String?, + private val page: Long?, + private val perPage: Long?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun workspaceId(): Optional = Optional.ofNullable(workspaceId) + + /** The page to return in a paginated query. */ + fun page(): Optional = Optional.ofNullable(page) + + /** Maximum number of items to return per page. */ + fun perPage(): Optional = Optional.ofNullable(perPage) + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): RuleTagListParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [RuleTagListParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [RuleTagListParams]. */ + class Builder internal constructor() { + + private var workspaceId: String? = null + private var page: Long? = null + private var perPage: Long? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(ruleTagListParams: RuleTagListParams) = apply { + workspaceId = ruleTagListParams.workspaceId + page = ruleTagListParams.page + perPage = ruleTagListParams.perPage + additionalHeaders = ruleTagListParams.additionalHeaders.toBuilder() + additionalQueryParams = ruleTagListParams.additionalQueryParams.toBuilder() + } + + fun workspaceId(workspaceId: String?) = apply { this.workspaceId = workspaceId } + + /** Alias for calling [Builder.workspaceId] with `workspaceId.orElse(null)`. */ + fun workspaceId(workspaceId: Optional) = workspaceId(workspaceId.getOrNull()) + + /** The page to return in a paginated query. */ + fun page(page: Long?) = apply { this.page = page } + + /** + * Alias for [Builder.page]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun page(page: Long) = page(page as Long?) + + /** Alias for calling [Builder.page] with `page.orElse(null)`. */ + fun page(page: Optional) = page(page.getOrNull()) + + /** Maximum number of items to return per page. */ + fun perPage(perPage: Long?) = apply { this.perPage = perPage } + + /** + * Alias for [Builder.perPage]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun perPage(perPage: Long) = perPage(perPage as Long?) + + /** Alias for calling [Builder.perPage] with `perPage.orElse(null)`. */ + fun perPage(perPage: Optional) = perPage(perPage.getOrNull()) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [RuleTagListParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): RuleTagListParams = + RuleTagListParams( + workspaceId, + page, + perPage, + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _pathParam(index: Int): String = + when (index) { + 0 -> workspaceId ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + page?.let { put("page", it.toString()) } + perPage?.let { put("perPage", it.toString()) } + putAll(additionalQueryParams) + } + .build() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is RuleTagListParams && + workspaceId == other.workspaceId && + page == other.page && + perPage == other.perPage && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = + Objects.hash(workspaceId, page, perPage, additionalHeaders, additionalQueryParams) + + override fun toString() = + "RuleTagListParams{workspaceId=$workspaceId, page=$page, perPage=$perPage, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/ruletags/RuleTagListResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/ruletags/RuleTagListResponse.kt new file mode 100644 index 00000000..54a2814a --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/governance/ruletags/RuleTagListResponse.kt @@ -0,0 +1,675 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.ruletags + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.openlayer.api.core.ExcludeMissing +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonMissing +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.checkKnown +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.toImmutable +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.time.OffsetDateTime +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class RuleTagListResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val items: JsonField>, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("items") @ExcludeMissing items: JsonField> = JsonMissing.of() + ) : this(items, mutableMapOf()) + + /** + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun items(): List = items.getRequired("items") + + /** + * Returns the raw JSON value of [items]. + * + * Unlike [items], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("items") @ExcludeMissing fun _items(): JsonField> = items + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [RuleTagListResponse]. + * + * The following fields are required: + * ```java + * .items() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [RuleTagListResponse]. */ + class Builder internal constructor() { + + private var items: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(ruleTagListResponse: RuleTagListResponse) = apply { + items = ruleTagListResponse.items.map { it.toMutableList() } + additionalProperties = ruleTagListResponse.additionalProperties.toMutableMap() + } + + fun items(items: List) = items(JsonField.of(items)) + + /** + * Sets [Builder.items] to an arbitrary JSON value. + * + * You should usually call [Builder.items] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun items(items: JsonField>) = apply { + this.items = items.map { it.toMutableList() } + } + + /** + * Adds a single [Item] to [items]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addItem(item: Item) = apply { + items = + (items ?: JsonField.of(mutableListOf())).also { checkKnown("items", it).add(item) } + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [RuleTagListResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .items() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): RuleTagListResponse = + RuleTagListResponse( + checkRequired("items", items).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): RuleTagListResponse = apply { + if (validated) { + return@apply + } + + items().forEach { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (items.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + class Item + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val creatorId: JsonField, + private val dateCreated: JsonField, + private val dateUpdated: JsonField, + private val immutable: JsonField, + private val name: JsonField, + private val workspaceId: JsonField, + private val color: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("creatorId") + @ExcludeMissing + creatorId: JsonField = JsonMissing.of(), + @JsonProperty("dateCreated") + @ExcludeMissing + dateCreated: JsonField = JsonMissing.of(), + @JsonProperty("dateUpdated") + @ExcludeMissing + dateUpdated: JsonField = JsonMissing.of(), + @JsonProperty("immutable") + @ExcludeMissing + immutable: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("workspaceId") + @ExcludeMissing + workspaceId: JsonField = JsonMissing.of(), + @JsonProperty("color") @ExcludeMissing color: JsonField = JsonMissing.of(), + ) : this( + id, + creatorId, + dateCreated, + dateUpdated, + immutable, + name, + workspaceId, + color, + mutableMapOf(), + ) + + /** + * The rule tag id. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun id(): String = id.getRequired("id") + + /** + * The user who created the tag. `null` for tags that ship with Openlayer. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun creatorId(): Optional = creatorId.getOptional("creatorId") + + /** + * The creation date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateCreated(): OffsetDateTime = dateCreated.getRequired("dateCreated") + + /** + * The last update date. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun dateUpdated(): OffsetDateTime = dateUpdated.getRequired("dateUpdated") + + /** + * Whether the tag is managed by Openlayer and cannot be edited or deleted. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun immutable(): Boolean = immutable.getRequired("immutable") + + /** + * The tag name. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun name(): String = name.getRequired("name") + + /** + * The id of the workspace the tag belongs to. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun workspaceId(): String = workspaceId.getRequired("workspaceId") + + /** + * The color the tag is displayed with. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun color(): Optional = color.getOptional("color") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [creatorId]. + * + * Unlike [creatorId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("creatorId") @ExcludeMissing fun _creatorId(): JsonField = creatorId + + /** + * Returns the raw JSON value of [dateCreated]. + * + * Unlike [dateCreated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateCreated") + @ExcludeMissing + fun _dateCreated(): JsonField = dateCreated + + /** + * Returns the raw JSON value of [dateUpdated]. + * + * Unlike [dateUpdated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dateUpdated") + @ExcludeMissing + fun _dateUpdated(): JsonField = dateUpdated + + /** + * Returns the raw JSON value of [immutable]. + * + * Unlike [immutable], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("immutable") @ExcludeMissing fun _immutable(): JsonField = immutable + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [workspaceId]. + * + * Unlike [workspaceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("workspaceId") + @ExcludeMissing + fun _workspaceId(): JsonField = workspaceId + + /** + * Returns the raw JSON value of [color]. + * + * Unlike [color], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("color") @ExcludeMissing fun _color(): JsonField = color + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Item]. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .immutable() + * .name() + * .workspaceId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Item]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var creatorId: JsonField? = null + private var dateCreated: JsonField? = null + private var dateUpdated: JsonField? = null + private var immutable: JsonField? = null + private var name: JsonField? = null + private var workspaceId: JsonField? = null + private var color: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(item: Item) = apply { + id = item.id + creatorId = item.creatorId + dateCreated = item.dateCreated + dateUpdated = item.dateUpdated + immutable = item.immutable + name = item.name + workspaceId = item.workspaceId + color = item.color + additionalProperties = item.additionalProperties.toMutableMap() + } + + /** The rule tag id. */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The user who created the tag. `null` for tags that ship with Openlayer. */ + fun creatorId(creatorId: String?) = creatorId(JsonField.ofNullable(creatorId)) + + /** Alias for calling [Builder.creatorId] with `creatorId.orElse(null)`. */ + fun creatorId(creatorId: Optional) = creatorId(creatorId.getOrNull()) + + /** + * Sets [Builder.creatorId] to an arbitrary JSON value. + * + * You should usually call [Builder.creatorId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun creatorId(creatorId: JsonField) = apply { this.creatorId = creatorId } + + /** The creation date. */ + fun dateCreated(dateCreated: OffsetDateTime) = dateCreated(JsonField.of(dateCreated)) + + /** + * Sets [Builder.dateCreated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateCreated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun dateCreated(dateCreated: JsonField) = apply { + this.dateCreated = dateCreated + } + + /** The last update date. */ + fun dateUpdated(dateUpdated: OffsetDateTime) = dateUpdated(JsonField.of(dateUpdated)) + + /** + * Sets [Builder.dateUpdated] to an arbitrary JSON value. + * + * You should usually call [Builder.dateUpdated] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun dateUpdated(dateUpdated: JsonField) = apply { + this.dateUpdated = dateUpdated + } + + /** Whether the tag is managed by Openlayer and cannot be edited or deleted. */ + fun immutable(immutable: Boolean) = immutable(JsonField.of(immutable)) + + /** + * Sets [Builder.immutable] to an arbitrary JSON value. + * + * You should usually call [Builder.immutable] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun immutable(immutable: JsonField) = apply { this.immutable = immutable } + + /** The tag name. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun name(name: JsonField) = apply { this.name = name } + + /** The id of the workspace the tag belongs to. */ + fun workspaceId(workspaceId: String) = workspaceId(JsonField.of(workspaceId)) + + /** + * Sets [Builder.workspaceId] to an arbitrary JSON value. + * + * You should usually call [Builder.workspaceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun workspaceId(workspaceId: JsonField) = apply { + this.workspaceId = workspaceId + } + + /** The color the tag is displayed with. */ + fun color(color: String?) = color(JsonField.ofNullable(color)) + + /** Alias for calling [Builder.color] with `color.orElse(null)`. */ + fun color(color: Optional) = color(color.getOrNull()) + + /** + * Sets [Builder.color] to an arbitrary JSON value. + * + * You should usually call [Builder.color] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun color(color: JsonField) = apply { this.color = color } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Item]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .creatorId() + * .dateCreated() + * .dateUpdated() + * .immutable() + * .name() + * .workspaceId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Item = + Item( + checkRequired("id", id), + checkRequired("creatorId", creatorId), + checkRequired("dateCreated", dateCreated), + checkRequired("dateUpdated", dateUpdated), + checkRequired("immutable", immutable), + checkRequired("name", name), + checkRequired("workspaceId", workspaceId), + color, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Item = apply { + if (validated) { + return@apply + } + + id() + creatorId() + dateCreated() + dateUpdated() + immutable() + name() + workspaceId() + color() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (creatorId.asKnown().isPresent) 1 else 0) + + (if (dateCreated.asKnown().isPresent) 1 else 0) + + (if (dateUpdated.asKnown().isPresent) 1 else 0) + + (if (immutable.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (workspaceId.asKnown().isPresent) 1 else 0) + + (if (color.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Item && + id == other.id && + creatorId == other.creatorId && + dateCreated == other.dateCreated && + dateUpdated == other.dateUpdated && + immutable == other.immutable && + name == other.name && + workspaceId == other.workspaceId && + color == other.color && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + creatorId, + dateCreated, + dateUpdated, + immutable, + name, + workspaceId, + color, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Item{id=$id, creatorId=$creatorId, dateCreated=$dateCreated, dateUpdated=$dateUpdated, immutable=$immutable, name=$name, workspaceId=$workspaceId, color=$color, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is RuleTagListResponse && + items == other.items && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(items, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "RuleTagListResponse{items=$items, additionalProperties=$additionalProperties}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlRetrieveParams.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlRetrieveParams.kt new file mode 100644 index 00000000..0ae8e692 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlRetrieveParams.kt @@ -0,0 +1,212 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.storage.presignedurl + +import com.openlayer.api.core.Params +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.http.Headers +import com.openlayer.api.core.http.QueryParams +import java.util.Objects + +/** + * Exchange a `storageUri` for a short-lived presigned url you can download the object from. + * + * Use it to collect anything the platform stored on your behalf -- for example the archive a + * framework export leaves behind, whose `storageUri` comes back in the background task's `outputs`. + * + * The workspace is taken from the API key, so there is nothing else to send. The url is only issued + * for objects your workspace owns, and `404` covers both "no such object" and "not yours". + */ +class PresignedUrlRetrieveParams +private constructor( + private val storageUri: String, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + /** The object's storage uri. */ + fun storageUri(): String = storageUri + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [PresignedUrlRetrieveParams]. + * + * The following fields are required: + * ```java + * .storageUri() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [PresignedUrlRetrieveParams]. */ + class Builder internal constructor() { + + private var storageUri: String? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(presignedUrlRetrieveParams: PresignedUrlRetrieveParams) = apply { + storageUri = presignedUrlRetrieveParams.storageUri + additionalHeaders = presignedUrlRetrieveParams.additionalHeaders.toBuilder() + additionalQueryParams = presignedUrlRetrieveParams.additionalQueryParams.toBuilder() + } + + /** The object's storage uri. */ + fun storageUri(storageUri: String) = apply { this.storageUri = storageUri } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [PresignedUrlRetrieveParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .storageUri() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): PresignedUrlRetrieveParams = + PresignedUrlRetrieveParams( + checkRequired("storageUri", storageUri), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + put("storageUri", storageUri) + putAll(additionalQueryParams) + } + .build() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is PresignedUrlRetrieveParams && + storageUri == other.storageUri && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = + Objects.hash(storageUri, additionalHeaders, additionalQueryParams) + + override fun toString() = + "PresignedUrlRetrieveParams{storageUri=$storageUri, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlRetrieveResponse.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlRetrieveResponse.kt new file mode 100644 index 00000000..6f819e34 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlRetrieveResponse.kt @@ -0,0 +1,181 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.storage.presignedurl + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.openlayer.api.core.ExcludeMissing +import com.openlayer.api.core.JsonField +import com.openlayer.api.core.JsonMissing +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.checkRequired +import com.openlayer.api.errors.OpenlayerInvalidDataException +import java.util.Collections +import java.util.Objects + +class PresignedUrlRetrieveResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val url: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("url") @ExcludeMissing url: JsonField = JsonMissing.of() + ) : this(url, mutableMapOf()) + + /** + * The presigned url. Short-lived -- download promptly. + * + * @throws OpenlayerInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun url(): String = url.getRequired("url") + + /** + * Returns the raw JSON value of [url]. + * + * Unlike [url], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("url") @ExcludeMissing fun _url(): JsonField = url + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [PresignedUrlRetrieveResponse]. + * + * The following fields are required: + * ```java + * .url() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [PresignedUrlRetrieveResponse]. */ + class Builder internal constructor() { + + private var url: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(presignedUrlRetrieveResponse: PresignedUrlRetrieveResponse) = apply { + url = presignedUrlRetrieveResponse.url + additionalProperties = presignedUrlRetrieveResponse.additionalProperties.toMutableMap() + } + + /** The presigned url. Short-lived -- download promptly. */ + fun url(url: String) = url(JsonField.of(url)) + + /** + * Sets [Builder.url] to an arbitrary JSON value. + * + * You should usually call [Builder.url] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun url(url: JsonField) = apply { this.url = url } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [PresignedUrlRetrieveResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .url() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): PresignedUrlRetrieveResponse = + PresignedUrlRetrieveResponse( + checkRequired("url", url), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws OpenlayerInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): PresignedUrlRetrieveResponse = apply { + if (validated) { + return@apply + } + + url() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenlayerInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = (if (url.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is PresignedUrlRetrieveResponse && + url == other.url && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(url, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "PresignedUrlRetrieveResponse{url=$url, additionalProperties=$additionalProperties}" +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/BackgroundTaskServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/BackgroundTaskServiceAsync.kt new file mode 100644 index 00000000..883a329b --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/BackgroundTaskServiceAsync.kt @@ -0,0 +1,128 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.async + +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.models.backgroundtasks.BackgroundTaskRetrieveParams +import com.openlayer.api.models.backgroundtasks.BackgroundTaskRetrieveResponse +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer + +interface BackgroundTaskServiceAsync { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): BackgroundTaskServiceAsync + + /** + * Retrieve a background task's status, progress and results. + * + * Endpoints that cannot answer within one request queue a task and hand back its id -- for + * example `POST /frameworks/{frameworkId}/export`. Poll this endpoint until `complete` is + * `true`, then read what the task produced from `outputs`. + */ + fun retrieve(taskId: String): CompletableFuture = + retrieve(taskId, BackgroundTaskRetrieveParams.none()) + + /** @see retrieve */ + fun retrieve( + taskId: String, + params: BackgroundTaskRetrieveParams = BackgroundTaskRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + retrieve(params.toBuilder().taskId(taskId).build(), requestOptions) + + /** @see retrieve */ + fun retrieve( + taskId: String, + params: BackgroundTaskRetrieveParams = BackgroundTaskRetrieveParams.none(), + ): CompletableFuture = + retrieve(taskId, params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + params: BackgroundTaskRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see retrieve */ + fun retrieve( + params: BackgroundTaskRetrieveParams + ): CompletableFuture = retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + taskId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + retrieve(taskId, BackgroundTaskRetrieveParams.none(), requestOptions) + + /** + * A view of [BackgroundTaskServiceAsync] that provides access to raw HTTP responses for each + * method. + */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): BackgroundTaskServiceAsync.WithRawResponse + + /** + * Returns a raw HTTP response for `get /background-tasks/{taskId}`, but is otherwise the + * same as [BackgroundTaskServiceAsync.retrieve]. + */ + fun retrieve( + taskId: String + ): CompletableFuture> = + retrieve(taskId, BackgroundTaskRetrieveParams.none()) + + /** @see retrieve */ + fun retrieve( + taskId: String, + params: BackgroundTaskRetrieveParams = BackgroundTaskRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + retrieve(params.toBuilder().taskId(taskId).build(), requestOptions) + + /** @see retrieve */ + fun retrieve( + taskId: String, + params: BackgroundTaskRetrieveParams = BackgroundTaskRetrieveParams.none(), + ): CompletableFuture> = + retrieve(taskId, params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + params: BackgroundTaskRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see retrieve */ + fun retrieve( + params: BackgroundTaskRetrieveParams + ): CompletableFuture> = + retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + taskId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + retrieve(taskId, BackgroundTaskRetrieveParams.none(), requestOptions) + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/BackgroundTaskServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/BackgroundTaskServiceAsyncImpl.kt new file mode 100644 index 00000000..d382ca6c --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/BackgroundTaskServiceAsyncImpl.kt @@ -0,0 +1,91 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.async + +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.handlers.errorBodyHandler +import com.openlayer.api.core.handlers.errorHandler +import com.openlayer.api.core.handlers.jsonHandler +import com.openlayer.api.core.http.HttpMethod +import com.openlayer.api.core.http.HttpRequest +import com.openlayer.api.core.http.HttpResponse +import com.openlayer.api.core.http.HttpResponse.Handler +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.core.http.parseable +import com.openlayer.api.core.prepareAsync +import com.openlayer.api.models.backgroundtasks.BackgroundTaskRetrieveParams +import com.openlayer.api.models.backgroundtasks.BackgroundTaskRetrieveResponse +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer +import kotlin.jvm.optionals.getOrNull + +class BackgroundTaskServiceAsyncImpl +internal constructor(private val clientOptions: ClientOptions) : BackgroundTaskServiceAsync { + + private val withRawResponse: BackgroundTaskServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): BackgroundTaskServiceAsync.WithRawResponse = withRawResponse + + override fun withOptions( + modifier: Consumer + ): BackgroundTaskServiceAsync = + BackgroundTaskServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun retrieve( + params: BackgroundTaskRetrieveParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // get /background-tasks/{taskId} + withRawResponse().retrieve(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + BackgroundTaskServiceAsync.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + override fun withOptions( + modifier: Consumer + ): BackgroundTaskServiceAsync.WithRawResponse = + BackgroundTaskServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun retrieve( + params: BackgroundTaskRetrieveParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("taskId", params.taskId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("background-tasks", params._pathParam(0)) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { retrieveHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/GovernanceServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/GovernanceServiceAsync.kt new file mode 100644 index 00000000..709baeda --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/GovernanceServiceAsync.kt @@ -0,0 +1,62 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.async + +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.services.async.governance.FrameworkServiceAsync +import com.openlayer.api.services.async.governance.RuleResultServiceAsync +import com.openlayer.api.services.async.governance.RuleServiceAsync +import com.openlayer.api.services.async.governance.RuleStatServiceAsync +import com.openlayer.api.services.async.governance.RuleTagServiceAsync +import java.util.function.Consumer + +interface GovernanceServiceAsync { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): GovernanceServiceAsync + + fun frameworks(): FrameworkServiceAsync + + fun rules(): RuleServiceAsync + + fun ruleResults(): RuleResultServiceAsync + + fun ruleStats(): RuleStatServiceAsync + + fun ruleTags(): RuleTagServiceAsync + + /** + * A view of [GovernanceServiceAsync] that provides access to raw HTTP responses for each + * method. + */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): GovernanceServiceAsync.WithRawResponse + + fun frameworks(): FrameworkServiceAsync.WithRawResponse + + fun rules(): RuleServiceAsync.WithRawResponse + + fun ruleResults(): RuleResultServiceAsync.WithRawResponse + + fun ruleStats(): RuleStatServiceAsync.WithRawResponse + + fun ruleTags(): RuleTagServiceAsync.WithRawResponse + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/GovernanceServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/GovernanceServiceAsyncImpl.kt new file mode 100644 index 00000000..ae1f57ad --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/GovernanceServiceAsyncImpl.kt @@ -0,0 +1,94 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.async + +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.services.async.governance.FrameworkServiceAsync +import com.openlayer.api.services.async.governance.FrameworkServiceAsyncImpl +import com.openlayer.api.services.async.governance.RuleResultServiceAsync +import com.openlayer.api.services.async.governance.RuleResultServiceAsyncImpl +import com.openlayer.api.services.async.governance.RuleServiceAsync +import com.openlayer.api.services.async.governance.RuleServiceAsyncImpl +import com.openlayer.api.services.async.governance.RuleStatServiceAsync +import com.openlayer.api.services.async.governance.RuleStatServiceAsyncImpl +import com.openlayer.api.services.async.governance.RuleTagServiceAsync +import com.openlayer.api.services.async.governance.RuleTagServiceAsyncImpl +import java.util.function.Consumer + +class GovernanceServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + GovernanceServiceAsync { + + private val withRawResponse: GovernanceServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + private val frameworks: FrameworkServiceAsync by lazy { + FrameworkServiceAsyncImpl(clientOptions) + } + + private val rules: RuleServiceAsync by lazy { RuleServiceAsyncImpl(clientOptions) } + + private val ruleResults: RuleResultServiceAsync by lazy { + RuleResultServiceAsyncImpl(clientOptions) + } + + private val ruleStats: RuleStatServiceAsync by lazy { RuleStatServiceAsyncImpl(clientOptions) } + + private val ruleTags: RuleTagServiceAsync by lazy { RuleTagServiceAsyncImpl(clientOptions) } + + override fun withRawResponse(): GovernanceServiceAsync.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): GovernanceServiceAsync = + GovernanceServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun frameworks(): FrameworkServiceAsync = frameworks + + override fun rules(): RuleServiceAsync = rules + + override fun ruleResults(): RuleResultServiceAsync = ruleResults + + override fun ruleStats(): RuleStatServiceAsync = ruleStats + + override fun ruleTags(): RuleTagServiceAsync = ruleTags + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + GovernanceServiceAsync.WithRawResponse { + + private val frameworks: FrameworkServiceAsync.WithRawResponse by lazy { + FrameworkServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + private val rules: RuleServiceAsync.WithRawResponse by lazy { + RuleServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + private val ruleResults: RuleResultServiceAsync.WithRawResponse by lazy { + RuleResultServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + private val ruleStats: RuleStatServiceAsync.WithRawResponse by lazy { + RuleStatServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + private val ruleTags: RuleTagServiceAsync.WithRawResponse by lazy { + RuleTagServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + override fun withOptions( + modifier: Consumer + ): GovernanceServiceAsync.WithRawResponse = + GovernanceServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + override fun frameworks(): FrameworkServiceAsync.WithRawResponse = frameworks + + override fun rules(): RuleServiceAsync.WithRawResponse = rules + + override fun ruleResults(): RuleResultServiceAsync.WithRawResponse = ruleResults + + override fun ruleStats(): RuleStatServiceAsync.WithRawResponse = ruleStats + + override fun ruleTags(): RuleTagServiceAsync.WithRawResponse = ruleTags + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/FrameworkServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/FrameworkServiceAsync.kt new file mode 100644 index 00000000..1b98cdf5 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/FrameworkServiceAsync.kt @@ -0,0 +1,756 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.async.governance + +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.models.governance.frameworks.FrameworkCreateParams +import com.openlayer.api.models.governance.frameworks.FrameworkCreateResponse +import com.openlayer.api.models.governance.frameworks.FrameworkExportParams +import com.openlayer.api.models.governance.frameworks.FrameworkExportResponse +import com.openlayer.api.models.governance.frameworks.FrameworkListParams +import com.openlayer.api.models.governance.frameworks.FrameworkListProjectRuleStatsParams +import com.openlayer.api.models.governance.frameworks.FrameworkListProjectRuleStatsResponse +import com.openlayer.api.models.governance.frameworks.FrameworkListProjectsParams +import com.openlayer.api.models.governance.frameworks.FrameworkListProjectsResponse +import com.openlayer.api.models.governance.frameworks.FrameworkListResponse +import com.openlayer.api.models.governance.frameworks.FrameworkListRulesParams +import com.openlayer.api.models.governance.frameworks.FrameworkListRulesResponse +import com.openlayer.api.models.governance.frameworks.FrameworkRetrieveParams +import com.openlayer.api.models.governance.frameworks.FrameworkRetrieveResponse +import com.openlayer.api.models.governance.frameworks.FrameworkUpdateParams +import com.openlayer.api.models.governance.frameworks.FrameworkUpdateResponse +import com.openlayer.api.services.async.governance.frameworks.DocumentServiceAsync +import com.openlayer.api.services.async.governance.frameworks.SectionServiceAsync +import com.openlayer.api.services.async.governance.frameworks.SubsectionServiceAsync +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer + +interface FrameworkServiceAsync { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): FrameworkServiceAsync + + fun documents(): DocumentServiceAsync + + fun sections(): SectionServiceAsync + + fun subsections(): SubsectionServiceAsync + + /** + * Create a custom governance framework in a workspace. + * + * Use this to track compliance against an internal policy, or against a standard Openlayer does + * not ship as a built-in framework. A new framework starts with no rules -- add them from the + * Openlayer app, or map an existing rule to it. + * + * A framework is created disabled unless you pass `enabled: true`. While it is disabled its + * rules are not evaluated and do not count towards compliance. + */ + fun create( + workspaceId: String, + params: FrameworkCreateParams, + ): CompletableFuture = + create(workspaceId, params, RequestOptions.none()) + + /** @see create */ + fun create( + workspaceId: String, + params: FrameworkCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + create(params.toBuilder().workspaceId(workspaceId).build(), requestOptions) + + /** @see create */ + fun create(params: FrameworkCreateParams): CompletableFuture = + create(params, RequestOptions.none()) + + /** @see create */ + fun create( + params: FrameworkCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** Retrieve a governance framework by its id. */ + fun retrieve(frameworkId: String): CompletableFuture = + retrieve(frameworkId, FrameworkRetrieveParams.none()) + + /** @see retrieve */ + fun retrieve( + frameworkId: String, + params: FrameworkRetrieveParams = FrameworkRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + retrieve(params.toBuilder().frameworkId(frameworkId).build(), requestOptions) + + /** @see retrieve */ + fun retrieve( + frameworkId: String, + params: FrameworkRetrieveParams = FrameworkRetrieveParams.none(), + ): CompletableFuture = + retrieve(frameworkId, params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + params: FrameworkRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see retrieve */ + fun retrieve(params: FrameworkRetrieveParams): CompletableFuture = + retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + frameworkId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + retrieve(frameworkId, FrameworkRetrieveParams.none(), requestOptions) + + /** + * Update a governance framework. + * + * The most common use is activating or deactivating a framework for the workspace by setting + * `enabled`. Rules of a disabled framework are not evaluated and do not count towards + * compliance. + * + * Frameworks that ship with Openlayer report `immutable: true`. For those, only `enabled`, + * `tags`, and `projectSelector` can be changed -- their name and definition are managed by + * Openlayer. + * + * Only the fields you send are changed. + */ + fun update(frameworkId: String): CompletableFuture = + update(frameworkId, FrameworkUpdateParams.none()) + + /** @see update */ + fun update( + frameworkId: String, + params: FrameworkUpdateParams = FrameworkUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + update(params.toBuilder().frameworkId(frameworkId).build(), requestOptions) + + /** @see update */ + fun update( + frameworkId: String, + params: FrameworkUpdateParams = FrameworkUpdateParams.none(), + ): CompletableFuture = + update(frameworkId, params, RequestOptions.none()) + + /** @see update */ + fun update( + params: FrameworkUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see update */ + fun update(params: FrameworkUpdateParams): CompletableFuture = + update(params, RequestOptions.none()) + + /** @see update */ + fun update( + frameworkId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + update(frameworkId, FrameworkUpdateParams.none(), requestOptions) + + /** + * List the governance frameworks in a workspace. + * + * A framework is a set of rules -- drawn from a regulation, a standard, or your own internal + * policy -- that Openlayer tracks compliance against. Use this endpoint to find the framework + * you want to report on, then read its rules and rule results. + */ + fun list(workspaceId: String): CompletableFuture = + list(workspaceId, FrameworkListParams.none()) + + /** @see list */ + fun list( + workspaceId: String, + params: FrameworkListParams = FrameworkListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + list(params.toBuilder().workspaceId(workspaceId).build(), requestOptions) + + /** @see list */ + fun list( + workspaceId: String, + params: FrameworkListParams = FrameworkListParams.none(), + ): CompletableFuture = list(workspaceId, params, RequestOptions.none()) + + /** @see list */ + fun list( + params: FrameworkListParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see list */ + fun list(params: FrameworkListParams): CompletableFuture = + list(params, RequestOptions.none()) + + /** @see list */ + fun list( + workspaceId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + list(workspaceId, FrameworkListParams.none(), requestOptions) + + /** + * Export a framework's evidence and progress as an audit-ready zip archive. + * + * The archive holds every evidence file uploaded against the framework's evidence-based rules, + * a markdown report of the framework's progress and the status of all its rules (broken down by + * documentation section when the framework has documents), and CSV manifests of rules and + * evidence with SHA-256 checksums. + * + * Send `projectId` to export one project's compliance with the framework. Omit it for the + * workspace-wide view across every project in the framework, including workspace-scoped rules. + * + * The export runs as a background task, so this returns `202` immediately. To collect the + * archive: + * 1. Poll `GET /background-tasks/{taskId}` with the returned `taskResultId` until `complete` is + * `true`. + * 2. Read `outputs.storageUri` off that task. + * 3. Exchange it for a download link at `GET /storage/presigned-url?storageUri=`. + * + * Rate limited to 2 requests per minute per framework. Asking for an export while an identical + * one is still queued returns that task rather than starting a second one. + */ + fun export(frameworkId: String): CompletableFuture = + export(frameworkId, FrameworkExportParams.none()) + + /** @see export */ + fun export( + frameworkId: String, + params: FrameworkExportParams = FrameworkExportParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + export(params.toBuilder().frameworkId(frameworkId).build(), requestOptions) + + /** @see export */ + fun export( + frameworkId: String, + params: FrameworkExportParams = FrameworkExportParams.none(), + ): CompletableFuture = + export(frameworkId, params, RequestOptions.none()) + + /** @see export */ + fun export( + params: FrameworkExportParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see export */ + fun export(params: FrameworkExportParams): CompletableFuture = + export(params, RequestOptions.none()) + + /** @see export */ + fun export( + frameworkId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + export(frameworkId, FrameworkExportParams.none(), requestOptions) + + /** + * Get a compliance roll-up for a framework, one row per project it applies to. + * + * Each row counts the project's rule results by status, so you can report on where a framework + * is complete and where it is not without fetching every individual rule result. + */ + fun listProjectRuleStats( + frameworkId: String + ): CompletableFuture = + listProjectRuleStats(frameworkId, FrameworkListProjectRuleStatsParams.none()) + + /** @see listProjectRuleStats */ + fun listProjectRuleStats( + frameworkId: String, + params: FrameworkListProjectRuleStatsParams = FrameworkListProjectRuleStatsParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + listProjectRuleStats(params.toBuilder().frameworkId(frameworkId).build(), requestOptions) + + /** @see listProjectRuleStats */ + fun listProjectRuleStats( + frameworkId: String, + params: FrameworkListProjectRuleStatsParams = FrameworkListProjectRuleStatsParams.none(), + ): CompletableFuture = + listProjectRuleStats(frameworkId, params, RequestOptions.none()) + + /** @see listProjectRuleStats */ + fun listProjectRuleStats( + params: FrameworkListProjectRuleStatsParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see listProjectRuleStats */ + fun listProjectRuleStats( + params: FrameworkListProjectRuleStatsParams + ): CompletableFuture = + listProjectRuleStats(params, RequestOptions.none()) + + /** @see listProjectRuleStats */ + fun listProjectRuleStats( + frameworkId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + listProjectRuleStats( + frameworkId, + FrameworkListProjectRuleStatsParams.none(), + requestOptions, + ) + + /** + * List the projects a framework applies to. + * + * Which projects a framework covers is determined by its `projectSelector`. A framework with an + * empty selector applies to every project in the workspace. + */ + fun listProjects(frameworkId: String): CompletableFuture = + listProjects(frameworkId, FrameworkListProjectsParams.none()) + + /** @see listProjects */ + fun listProjects( + frameworkId: String, + params: FrameworkListProjectsParams = FrameworkListProjectsParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + listProjects(params.toBuilder().frameworkId(frameworkId).build(), requestOptions) + + /** @see listProjects */ + fun listProjects( + frameworkId: String, + params: FrameworkListProjectsParams = FrameworkListProjectsParams.none(), + ): CompletableFuture = + listProjects(frameworkId, params, RequestOptions.none()) + + /** @see listProjects */ + fun listProjects( + params: FrameworkListProjectsParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see listProjects */ + fun listProjects( + params: FrameworkListProjectsParams + ): CompletableFuture = + listProjects(params, RequestOptions.none()) + + /** @see listProjects */ + fun listProjects( + frameworkId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + listProjects(frameworkId, FrameworkListProjectsParams.none(), requestOptions) + + /** + * List the rules that belong to a framework. + * + * To read the compliance status of these rules, use + * [List rule results](/api-reference/rest/governance/list-rule-results) with the `frameworkId` + * filter, or fetch the results of an individual rule. + */ + fun listRules(frameworkId: String): CompletableFuture = + listRules(frameworkId, FrameworkListRulesParams.none()) + + /** @see listRules */ + fun listRules( + frameworkId: String, + params: FrameworkListRulesParams = FrameworkListRulesParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + listRules(params.toBuilder().frameworkId(frameworkId).build(), requestOptions) + + /** @see listRules */ + fun listRules( + frameworkId: String, + params: FrameworkListRulesParams = FrameworkListRulesParams.none(), + ): CompletableFuture = + listRules(frameworkId, params, RequestOptions.none()) + + /** @see listRules */ + fun listRules( + params: FrameworkListRulesParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see listRules */ + fun listRules(params: FrameworkListRulesParams): CompletableFuture = + listRules(params, RequestOptions.none()) + + /** @see listRules */ + fun listRules( + frameworkId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + listRules(frameworkId, FrameworkListRulesParams.none(), requestOptions) + + /** + * A view of [FrameworkServiceAsync] that provides access to raw HTTP responses for each method. + */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): FrameworkServiceAsync.WithRawResponse + + fun documents(): DocumentServiceAsync.WithRawResponse + + fun sections(): SectionServiceAsync.WithRawResponse + + fun subsections(): SubsectionServiceAsync.WithRawResponse + + /** + * Returns a raw HTTP response for `post /workspaces/{workspaceId}/frameworks`, but is + * otherwise the same as [FrameworkServiceAsync.create]. + */ + fun create( + workspaceId: String, + params: FrameworkCreateParams, + ): CompletableFuture> = + create(workspaceId, params, RequestOptions.none()) + + /** @see create */ + fun create( + workspaceId: String, + params: FrameworkCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + create(params.toBuilder().workspaceId(workspaceId).build(), requestOptions) + + /** @see create */ + fun create( + params: FrameworkCreateParams + ): CompletableFuture> = + create(params, RequestOptions.none()) + + /** @see create */ + fun create( + params: FrameworkCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** + * Returns a raw HTTP response for `get /frameworks/{frameworkId}`, but is otherwise the + * same as [FrameworkServiceAsync.retrieve]. + */ + fun retrieve( + frameworkId: String + ): CompletableFuture> = + retrieve(frameworkId, FrameworkRetrieveParams.none()) + + /** @see retrieve */ + fun retrieve( + frameworkId: String, + params: FrameworkRetrieveParams = FrameworkRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + retrieve(params.toBuilder().frameworkId(frameworkId).build(), requestOptions) + + /** @see retrieve */ + fun retrieve( + frameworkId: String, + params: FrameworkRetrieveParams = FrameworkRetrieveParams.none(), + ): CompletableFuture> = + retrieve(frameworkId, params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + params: FrameworkRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see retrieve */ + fun retrieve( + params: FrameworkRetrieveParams + ): CompletableFuture> = + retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + frameworkId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + retrieve(frameworkId, FrameworkRetrieveParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `put /frameworks/{frameworkId}`, but is otherwise the + * same as [FrameworkServiceAsync.update]. + */ + fun update( + frameworkId: String + ): CompletableFuture> = + update(frameworkId, FrameworkUpdateParams.none()) + + /** @see update */ + fun update( + frameworkId: String, + params: FrameworkUpdateParams = FrameworkUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + update(params.toBuilder().frameworkId(frameworkId).build(), requestOptions) + + /** @see update */ + fun update( + frameworkId: String, + params: FrameworkUpdateParams = FrameworkUpdateParams.none(), + ): CompletableFuture> = + update(frameworkId, params, RequestOptions.none()) + + /** @see update */ + fun update( + params: FrameworkUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see update */ + fun update( + params: FrameworkUpdateParams + ): CompletableFuture> = + update(params, RequestOptions.none()) + + /** @see update */ + fun update( + frameworkId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + update(frameworkId, FrameworkUpdateParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `get /workspaces/{workspaceId}/frameworks`, but is + * otherwise the same as [FrameworkServiceAsync.list]. + */ + fun list(workspaceId: String): CompletableFuture> = + list(workspaceId, FrameworkListParams.none()) + + /** @see list */ + fun list( + workspaceId: String, + params: FrameworkListParams = FrameworkListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + list(params.toBuilder().workspaceId(workspaceId).build(), requestOptions) + + /** @see list */ + fun list( + workspaceId: String, + params: FrameworkListParams = FrameworkListParams.none(), + ): CompletableFuture> = + list(workspaceId, params, RequestOptions.none()) + + /** @see list */ + fun list( + params: FrameworkListParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see list */ + fun list( + params: FrameworkListParams + ): CompletableFuture> = + list(params, RequestOptions.none()) + + /** @see list */ + fun list( + workspaceId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + list(workspaceId, FrameworkListParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `post /frameworks/{frameworkId}/export`, but is otherwise + * the same as [FrameworkServiceAsync.export]. + */ + fun export( + frameworkId: String + ): CompletableFuture> = + export(frameworkId, FrameworkExportParams.none()) + + /** @see export */ + fun export( + frameworkId: String, + params: FrameworkExportParams = FrameworkExportParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + export(params.toBuilder().frameworkId(frameworkId).build(), requestOptions) + + /** @see export */ + fun export( + frameworkId: String, + params: FrameworkExportParams = FrameworkExportParams.none(), + ): CompletableFuture> = + export(frameworkId, params, RequestOptions.none()) + + /** @see export */ + fun export( + params: FrameworkExportParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see export */ + fun export( + params: FrameworkExportParams + ): CompletableFuture> = + export(params, RequestOptions.none()) + + /** @see export */ + fun export( + frameworkId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + export(frameworkId, FrameworkExportParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `get /frameworks/{frameworkId}/project-rule-stats`, but + * is otherwise the same as [FrameworkServiceAsync.listProjectRuleStats]. + */ + fun listProjectRuleStats( + frameworkId: String + ): CompletableFuture> = + listProjectRuleStats(frameworkId, FrameworkListProjectRuleStatsParams.none()) + + /** @see listProjectRuleStats */ + fun listProjectRuleStats( + frameworkId: String, + params: FrameworkListProjectRuleStatsParams = + FrameworkListProjectRuleStatsParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + listProjectRuleStats( + params.toBuilder().frameworkId(frameworkId).build(), + requestOptions, + ) + + /** @see listProjectRuleStats */ + fun listProjectRuleStats( + frameworkId: String, + params: FrameworkListProjectRuleStatsParams = FrameworkListProjectRuleStatsParams.none(), + ): CompletableFuture> = + listProjectRuleStats(frameworkId, params, RequestOptions.none()) + + /** @see listProjectRuleStats */ + fun listProjectRuleStats( + params: FrameworkListProjectRuleStatsParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see listProjectRuleStats */ + fun listProjectRuleStats( + params: FrameworkListProjectRuleStatsParams + ): CompletableFuture> = + listProjectRuleStats(params, RequestOptions.none()) + + /** @see listProjectRuleStats */ + fun listProjectRuleStats( + frameworkId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + listProjectRuleStats( + frameworkId, + FrameworkListProjectRuleStatsParams.none(), + requestOptions, + ) + + /** + * Returns a raw HTTP response for `get /frameworks/{frameworkId}/projects`, but is + * otherwise the same as [FrameworkServiceAsync.listProjects]. + */ + fun listProjects( + frameworkId: String + ): CompletableFuture> = + listProjects(frameworkId, FrameworkListProjectsParams.none()) + + /** @see listProjects */ + fun listProjects( + frameworkId: String, + params: FrameworkListProjectsParams = FrameworkListProjectsParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + listProjects(params.toBuilder().frameworkId(frameworkId).build(), requestOptions) + + /** @see listProjects */ + fun listProjects( + frameworkId: String, + params: FrameworkListProjectsParams = FrameworkListProjectsParams.none(), + ): CompletableFuture> = + listProjects(frameworkId, params, RequestOptions.none()) + + /** @see listProjects */ + fun listProjects( + params: FrameworkListProjectsParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see listProjects */ + fun listProjects( + params: FrameworkListProjectsParams + ): CompletableFuture> = + listProjects(params, RequestOptions.none()) + + /** @see listProjects */ + fun listProjects( + frameworkId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + listProjects(frameworkId, FrameworkListProjectsParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `get /frameworks/{frameworkId}/rules`, but is otherwise + * the same as [FrameworkServiceAsync.listRules]. + */ + fun listRules( + frameworkId: String + ): CompletableFuture> = + listRules(frameworkId, FrameworkListRulesParams.none()) + + /** @see listRules */ + fun listRules( + frameworkId: String, + params: FrameworkListRulesParams = FrameworkListRulesParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + listRules(params.toBuilder().frameworkId(frameworkId).build(), requestOptions) + + /** @see listRules */ + fun listRules( + frameworkId: String, + params: FrameworkListRulesParams = FrameworkListRulesParams.none(), + ): CompletableFuture> = + listRules(frameworkId, params, RequestOptions.none()) + + /** @see listRules */ + fun listRules( + params: FrameworkListRulesParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see listRules */ + fun listRules( + params: FrameworkListRulesParams + ): CompletableFuture> = + listRules(params, RequestOptions.none()) + + /** @see listRules */ + fun listRules( + frameworkId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + listRules(frameworkId, FrameworkListRulesParams.none(), requestOptions) + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/FrameworkServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/FrameworkServiceAsyncImpl.kt new file mode 100644 index 00000000..e0a91181 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/FrameworkServiceAsyncImpl.kt @@ -0,0 +1,425 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.async.governance + +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.handlers.errorBodyHandler +import com.openlayer.api.core.handlers.errorHandler +import com.openlayer.api.core.handlers.jsonHandler +import com.openlayer.api.core.http.HttpMethod +import com.openlayer.api.core.http.HttpRequest +import com.openlayer.api.core.http.HttpResponse +import com.openlayer.api.core.http.HttpResponse.Handler +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.core.http.json +import com.openlayer.api.core.http.parseable +import com.openlayer.api.core.prepareAsync +import com.openlayer.api.models.governance.frameworks.FrameworkCreateParams +import com.openlayer.api.models.governance.frameworks.FrameworkCreateResponse +import com.openlayer.api.models.governance.frameworks.FrameworkExportParams +import com.openlayer.api.models.governance.frameworks.FrameworkExportResponse +import com.openlayer.api.models.governance.frameworks.FrameworkListParams +import com.openlayer.api.models.governance.frameworks.FrameworkListProjectRuleStatsParams +import com.openlayer.api.models.governance.frameworks.FrameworkListProjectRuleStatsResponse +import com.openlayer.api.models.governance.frameworks.FrameworkListProjectsParams +import com.openlayer.api.models.governance.frameworks.FrameworkListProjectsResponse +import com.openlayer.api.models.governance.frameworks.FrameworkListResponse +import com.openlayer.api.models.governance.frameworks.FrameworkListRulesParams +import com.openlayer.api.models.governance.frameworks.FrameworkListRulesResponse +import com.openlayer.api.models.governance.frameworks.FrameworkRetrieveParams +import com.openlayer.api.models.governance.frameworks.FrameworkRetrieveResponse +import com.openlayer.api.models.governance.frameworks.FrameworkUpdateParams +import com.openlayer.api.models.governance.frameworks.FrameworkUpdateResponse +import com.openlayer.api.services.async.governance.frameworks.DocumentServiceAsync +import com.openlayer.api.services.async.governance.frameworks.DocumentServiceAsyncImpl +import com.openlayer.api.services.async.governance.frameworks.SectionServiceAsync +import com.openlayer.api.services.async.governance.frameworks.SectionServiceAsyncImpl +import com.openlayer.api.services.async.governance.frameworks.SubsectionServiceAsync +import com.openlayer.api.services.async.governance.frameworks.SubsectionServiceAsyncImpl +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer +import kotlin.jvm.optionals.getOrNull + +class FrameworkServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + FrameworkServiceAsync { + + private val withRawResponse: FrameworkServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + private val documents: DocumentServiceAsync by lazy { DocumentServiceAsyncImpl(clientOptions) } + + private val sections: SectionServiceAsync by lazy { SectionServiceAsyncImpl(clientOptions) } + + private val subsections: SubsectionServiceAsync by lazy { + SubsectionServiceAsyncImpl(clientOptions) + } + + override fun withRawResponse(): FrameworkServiceAsync.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): FrameworkServiceAsync = + FrameworkServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun documents(): DocumentServiceAsync = documents + + override fun sections(): SectionServiceAsync = sections + + override fun subsections(): SubsectionServiceAsync = subsections + + override fun create( + params: FrameworkCreateParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // post /workspaces/{workspaceId}/frameworks + withRawResponse().create(params, requestOptions).thenApply { it.parse() } + + override fun retrieve( + params: FrameworkRetrieveParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // get /frameworks/{frameworkId} + withRawResponse().retrieve(params, requestOptions).thenApply { it.parse() } + + override fun update( + params: FrameworkUpdateParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // put /frameworks/{frameworkId} + withRawResponse().update(params, requestOptions).thenApply { it.parse() } + + override fun list( + params: FrameworkListParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // get /workspaces/{workspaceId}/frameworks + withRawResponse().list(params, requestOptions).thenApply { it.parse() } + + override fun export( + params: FrameworkExportParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // post /frameworks/{frameworkId}/export + withRawResponse().export(params, requestOptions).thenApply { it.parse() } + + override fun listProjectRuleStats( + params: FrameworkListProjectRuleStatsParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // get /frameworks/{frameworkId}/project-rule-stats + withRawResponse().listProjectRuleStats(params, requestOptions).thenApply { it.parse() } + + override fun listProjects( + params: FrameworkListProjectsParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // get /frameworks/{frameworkId}/projects + withRawResponse().listProjects(params, requestOptions).thenApply { it.parse() } + + override fun listRules( + params: FrameworkListRulesParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // get /frameworks/{frameworkId}/rules + withRawResponse().listRules(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + FrameworkServiceAsync.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + private val documents: DocumentServiceAsync.WithRawResponse by lazy { + DocumentServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + private val sections: SectionServiceAsync.WithRawResponse by lazy { + SectionServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + private val subsections: SubsectionServiceAsync.WithRawResponse by lazy { + SubsectionServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + + override fun withOptions( + modifier: Consumer + ): FrameworkServiceAsync.WithRawResponse = + FrameworkServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + override fun documents(): DocumentServiceAsync.WithRawResponse = documents + + override fun sections(): SectionServiceAsync.WithRawResponse = sections + + override fun subsections(): SubsectionServiceAsync.WithRawResponse = subsections + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun create( + params: FrameworkCreateParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("workspaceId", params.workspaceId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("workspaces", params._pathParam(0), "frameworks") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun retrieve( + params: FrameworkRetrieveParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("frameworkId", params.frameworkId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("frameworks", params._pathParam(0)) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { retrieveHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val updateHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun update( + params: FrameworkUpdateParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("frameworkId", params.frameworkId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.PUT) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("frameworks", params._pathParam(0)) + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { updateHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun list( + params: FrameworkListParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("workspaceId", params.workspaceId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("workspaces", params._pathParam(0), "frameworks") + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val exportHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun export( + params: FrameworkExportParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("frameworkId", params.frameworkId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("frameworks", params._pathParam(0), "export") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { exportHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val listProjectRuleStatsHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun listProjectRuleStats( + params: FrameworkListProjectRuleStatsParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("frameworkId", params.frameworkId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("frameworks", params._pathParam(0), "project-rule-stats") + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { listProjectRuleStatsHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val listProjectsHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun listProjects( + params: FrameworkListProjectsParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("frameworkId", params.frameworkId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("frameworks", params._pathParam(0), "projects") + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { listProjectsHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val listRulesHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun listRules( + params: FrameworkListRulesParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("frameworkId", params.frameworkId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("frameworks", params._pathParam(0), "rules") + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { listRulesHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/RuleResultServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/RuleResultServiceAsync.kt new file mode 100644 index 00000000..25b327d0 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/RuleResultServiceAsync.kt @@ -0,0 +1,483 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.async.governance + +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.models.governance.ruleresults.RuleResultCreateEvidenceParams +import com.openlayer.api.models.governance.ruleresults.RuleResultCreateEvidenceResponse +import com.openlayer.api.models.governance.ruleresults.RuleResultListEvidenceParams +import com.openlayer.api.models.governance.ruleresults.RuleResultListEvidenceResponse +import com.openlayer.api.models.governance.ruleresults.RuleResultListParams +import com.openlayer.api.models.governance.ruleresults.RuleResultListResponse +import com.openlayer.api.models.governance.ruleresults.RuleResultRetrieveParams +import com.openlayer.api.models.governance.ruleresults.RuleResultRetrieveResponse +import com.openlayer.api.models.governance.ruleresults.RuleResultUpdateParams +import com.openlayer.api.models.governance.ruleresults.RuleResultUpdateResponse +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer + +interface RuleResultServiceAsync { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): RuleResultServiceAsync + + /** + * Retrieve a rule result by its id. + * + * Alongside the status, the response carries the evaluation and renewal dates that explain it: + * `dateLastEvaluated` and `dateOfNextEvaluation` for platform rules, `dateOfLatestEvidence` and + * `dateOfRenewal` for evidence rules. + */ + fun retrieve(ruleResultId: String): CompletableFuture = + retrieve(ruleResultId, RuleResultRetrieveParams.none()) + + /** @see retrieve */ + fun retrieve( + ruleResultId: String, + params: RuleResultRetrieveParams = RuleResultRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + retrieve(params.toBuilder().ruleResultId(ruleResultId).build(), requestOptions) + + /** @see retrieve */ + fun retrieve( + ruleResultId: String, + params: RuleResultRetrieveParams = RuleResultRetrieveParams.none(), + ): CompletableFuture = + retrieve(ruleResultId, params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + params: RuleResultRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see retrieve */ + fun retrieve(params: RuleResultRetrieveParams): CompletableFuture = + retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + ruleResultId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + retrieve(ruleResultId, RuleResultRetrieveParams.none(), requestOptions) + + /** + * Update a rule result. Only the fields you send are changed. + * + * Use this to assign an owner, or to exclude a single result from compliance without + * deactivating the rule everywhere. `deactivatedReason` is required when setting `deactivated` + * to `true`. + * + * A result's `status` is computed by Openlayer and cannot be set directly. + */ + fun update(ruleResultId: String): CompletableFuture = + update(ruleResultId, RuleResultUpdateParams.none()) + + /** @see update */ + fun update( + ruleResultId: String, + params: RuleResultUpdateParams = RuleResultUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + update(params.toBuilder().ruleResultId(ruleResultId).build(), requestOptions) + + /** @see update */ + fun update( + ruleResultId: String, + params: RuleResultUpdateParams = RuleResultUpdateParams.none(), + ): CompletableFuture = + update(ruleResultId, params, RequestOptions.none()) + + /** @see update */ + fun update( + params: RuleResultUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see update */ + fun update(params: RuleResultUpdateParams): CompletableFuture = + update(params, RequestOptions.none()) + + /** @see update */ + fun update( + ruleResultId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + update(ruleResultId, RuleResultUpdateParams.none(), requestOptions) + + /** + * List rule results across a workspace. + * + * A rule result is the compliance status of one rule for one entity: a project for + * project-scoped rules, or the workspace itself for workspace-scoped rules. This is the + * endpoint to poll or export when you want your current compliance state, filtered to a + * framework, a project, or a status. + */ + fun list(workspaceId: String): CompletableFuture = + list(workspaceId, RuleResultListParams.none()) + + /** @see list */ + fun list( + workspaceId: String, + params: RuleResultListParams = RuleResultListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + list(params.toBuilder().workspaceId(workspaceId).build(), requestOptions) + + /** @see list */ + fun list( + workspaceId: String, + params: RuleResultListParams = RuleResultListParams.none(), + ): CompletableFuture = list(workspaceId, params, RequestOptions.none()) + + /** @see list */ + fun list( + params: RuleResultListParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see list */ + fun list(params: RuleResultListParams): CompletableFuture = + list(params, RequestOptions.none()) + + /** @see list */ + fun list( + workspaceId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + list(workspaceId, RuleResultListParams.none(), requestOptions) + + /** + * Attach evidence to a rule result, satisfying an evidence rule. + * + * Send the field that matches the rule's `evidenceType`: `storageUri` for an uploaded document, + * `text` for a written statement, or `url` for a link. + * + * For a document, upload the file first with `POST /storage/presigned-url` and send the + * resulting storage URI as `storageUri`. + * + * Attaching evidence re-evaluates the rule result. If the rule sets `renewalCadenceDays`, the + * renewal window restarts from this evidence. + */ + fun createEvidence(ruleResultId: String): CompletableFuture = + createEvidence(ruleResultId, RuleResultCreateEvidenceParams.none()) + + /** @see createEvidence */ + fun createEvidence( + ruleResultId: String, + params: RuleResultCreateEvidenceParams = RuleResultCreateEvidenceParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + createEvidence(params.toBuilder().ruleResultId(ruleResultId).build(), requestOptions) + + /** @see createEvidence */ + fun createEvidence( + ruleResultId: String, + params: RuleResultCreateEvidenceParams = RuleResultCreateEvidenceParams.none(), + ): CompletableFuture = + createEvidence(ruleResultId, params, RequestOptions.none()) + + /** @see createEvidence */ + fun createEvidence( + params: RuleResultCreateEvidenceParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see createEvidence */ + fun createEvidence( + params: RuleResultCreateEvidenceParams + ): CompletableFuture = + createEvidence(params, RequestOptions.none()) + + /** @see createEvidence */ + fun createEvidence( + ruleResultId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + createEvidence(ruleResultId, RuleResultCreateEvidenceParams.none(), requestOptions) + + /** + * List the evidence attached to a rule result. + * + * Which field carries the evidence depends on the rule's `evidenceType`: `storageUri` for + * uploaded documents, `text` for written statements, and `url` for links. + */ + fun listEvidence(ruleResultId: String): CompletableFuture = + listEvidence(ruleResultId, RuleResultListEvidenceParams.none()) + + /** @see listEvidence */ + fun listEvidence( + ruleResultId: String, + params: RuleResultListEvidenceParams = RuleResultListEvidenceParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + listEvidence(params.toBuilder().ruleResultId(ruleResultId).build(), requestOptions) + + /** @see listEvidence */ + fun listEvidence( + ruleResultId: String, + params: RuleResultListEvidenceParams = RuleResultListEvidenceParams.none(), + ): CompletableFuture = + listEvidence(ruleResultId, params, RequestOptions.none()) + + /** @see listEvidence */ + fun listEvidence( + params: RuleResultListEvidenceParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see listEvidence */ + fun listEvidence( + params: RuleResultListEvidenceParams + ): CompletableFuture = + listEvidence(params, RequestOptions.none()) + + /** @see listEvidence */ + fun listEvidence( + ruleResultId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + listEvidence(ruleResultId, RuleResultListEvidenceParams.none(), requestOptions) + + /** + * A view of [RuleResultServiceAsync] that provides access to raw HTTP responses for each + * method. + */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): RuleResultServiceAsync.WithRawResponse + + /** + * Returns a raw HTTP response for `get /rule-results/{ruleResultId}`, but is otherwise the + * same as [RuleResultServiceAsync.retrieve]. + */ + fun retrieve( + ruleResultId: String + ): CompletableFuture> = + retrieve(ruleResultId, RuleResultRetrieveParams.none()) + + /** @see retrieve */ + fun retrieve( + ruleResultId: String, + params: RuleResultRetrieveParams = RuleResultRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + retrieve(params.toBuilder().ruleResultId(ruleResultId).build(), requestOptions) + + /** @see retrieve */ + fun retrieve( + ruleResultId: String, + params: RuleResultRetrieveParams = RuleResultRetrieveParams.none(), + ): CompletableFuture> = + retrieve(ruleResultId, params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + params: RuleResultRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see retrieve */ + fun retrieve( + params: RuleResultRetrieveParams + ): CompletableFuture> = + retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + ruleResultId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + retrieve(ruleResultId, RuleResultRetrieveParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `patch /rule-results/{ruleResultId}`, but is otherwise + * the same as [RuleResultServiceAsync.update]. + */ + fun update( + ruleResultId: String + ): CompletableFuture> = + update(ruleResultId, RuleResultUpdateParams.none()) + + /** @see update */ + fun update( + ruleResultId: String, + params: RuleResultUpdateParams = RuleResultUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + update(params.toBuilder().ruleResultId(ruleResultId).build(), requestOptions) + + /** @see update */ + fun update( + ruleResultId: String, + params: RuleResultUpdateParams = RuleResultUpdateParams.none(), + ): CompletableFuture> = + update(ruleResultId, params, RequestOptions.none()) + + /** @see update */ + fun update( + params: RuleResultUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see update */ + fun update( + params: RuleResultUpdateParams + ): CompletableFuture> = + update(params, RequestOptions.none()) + + /** @see update */ + fun update( + ruleResultId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + update(ruleResultId, RuleResultUpdateParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `get /workspaces/{workspaceId}/rule-results`, but is + * otherwise the same as [RuleResultServiceAsync.list]. + */ + fun list(workspaceId: String): CompletableFuture> = + list(workspaceId, RuleResultListParams.none()) + + /** @see list */ + fun list( + workspaceId: String, + params: RuleResultListParams = RuleResultListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + list(params.toBuilder().workspaceId(workspaceId).build(), requestOptions) + + /** @see list */ + fun list( + workspaceId: String, + params: RuleResultListParams = RuleResultListParams.none(), + ): CompletableFuture> = + list(workspaceId, params, RequestOptions.none()) + + /** @see list */ + fun list( + params: RuleResultListParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see list */ + fun list( + params: RuleResultListParams + ): CompletableFuture> = + list(params, RequestOptions.none()) + + /** @see list */ + fun list( + workspaceId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + list(workspaceId, RuleResultListParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `post /rule-results/{ruleResultId}/evidence`, but is + * otherwise the same as [RuleResultServiceAsync.createEvidence]. + */ + fun createEvidence( + ruleResultId: String + ): CompletableFuture> = + createEvidence(ruleResultId, RuleResultCreateEvidenceParams.none()) + + /** @see createEvidence */ + fun createEvidence( + ruleResultId: String, + params: RuleResultCreateEvidenceParams = RuleResultCreateEvidenceParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + createEvidence(params.toBuilder().ruleResultId(ruleResultId).build(), requestOptions) + + /** @see createEvidence */ + fun createEvidence( + ruleResultId: String, + params: RuleResultCreateEvidenceParams = RuleResultCreateEvidenceParams.none(), + ): CompletableFuture> = + createEvidence(ruleResultId, params, RequestOptions.none()) + + /** @see createEvidence */ + fun createEvidence( + params: RuleResultCreateEvidenceParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see createEvidence */ + fun createEvidence( + params: RuleResultCreateEvidenceParams + ): CompletableFuture> = + createEvidence(params, RequestOptions.none()) + + /** @see createEvidence */ + fun createEvidence( + ruleResultId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + createEvidence(ruleResultId, RuleResultCreateEvidenceParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `get /rule-results/{ruleResultId}/evidence`, but is + * otherwise the same as [RuleResultServiceAsync.listEvidence]. + */ + fun listEvidence( + ruleResultId: String + ): CompletableFuture> = + listEvidence(ruleResultId, RuleResultListEvidenceParams.none()) + + /** @see listEvidence */ + fun listEvidence( + ruleResultId: String, + params: RuleResultListEvidenceParams = RuleResultListEvidenceParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + listEvidence(params.toBuilder().ruleResultId(ruleResultId).build(), requestOptions) + + /** @see listEvidence */ + fun listEvidence( + ruleResultId: String, + params: RuleResultListEvidenceParams = RuleResultListEvidenceParams.none(), + ): CompletableFuture> = + listEvidence(ruleResultId, params, RequestOptions.none()) + + /** @see listEvidence */ + fun listEvidence( + params: RuleResultListEvidenceParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see listEvidence */ + fun listEvidence( + params: RuleResultListEvidenceParams + ): CompletableFuture> = + listEvidence(params, RequestOptions.none()) + + /** @see listEvidence */ + fun listEvidence( + ruleResultId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + listEvidence(ruleResultId, RuleResultListEvidenceParams.none(), requestOptions) + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/RuleResultServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/RuleResultServiceAsyncImpl.kt new file mode 100644 index 00000000..7ee46101 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/RuleResultServiceAsyncImpl.kt @@ -0,0 +1,260 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.async.governance + +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.handlers.errorBodyHandler +import com.openlayer.api.core.handlers.errorHandler +import com.openlayer.api.core.handlers.jsonHandler +import com.openlayer.api.core.http.HttpMethod +import com.openlayer.api.core.http.HttpRequest +import com.openlayer.api.core.http.HttpResponse +import com.openlayer.api.core.http.HttpResponse.Handler +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.core.http.json +import com.openlayer.api.core.http.parseable +import com.openlayer.api.core.prepareAsync +import com.openlayer.api.models.governance.ruleresults.RuleResultCreateEvidenceParams +import com.openlayer.api.models.governance.ruleresults.RuleResultCreateEvidenceResponse +import com.openlayer.api.models.governance.ruleresults.RuleResultListEvidenceParams +import com.openlayer.api.models.governance.ruleresults.RuleResultListEvidenceResponse +import com.openlayer.api.models.governance.ruleresults.RuleResultListParams +import com.openlayer.api.models.governance.ruleresults.RuleResultListResponse +import com.openlayer.api.models.governance.ruleresults.RuleResultRetrieveParams +import com.openlayer.api.models.governance.ruleresults.RuleResultRetrieveResponse +import com.openlayer.api.models.governance.ruleresults.RuleResultUpdateParams +import com.openlayer.api.models.governance.ruleresults.RuleResultUpdateResponse +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer +import kotlin.jvm.optionals.getOrNull + +class RuleResultServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + RuleResultServiceAsync { + + private val withRawResponse: RuleResultServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): RuleResultServiceAsync.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): RuleResultServiceAsync = + RuleResultServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun retrieve( + params: RuleResultRetrieveParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // get /rule-results/{ruleResultId} + withRawResponse().retrieve(params, requestOptions).thenApply { it.parse() } + + override fun update( + params: RuleResultUpdateParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // patch /rule-results/{ruleResultId} + withRawResponse().update(params, requestOptions).thenApply { it.parse() } + + override fun list( + params: RuleResultListParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // get /workspaces/{workspaceId}/rule-results + withRawResponse().list(params, requestOptions).thenApply { it.parse() } + + override fun createEvidence( + params: RuleResultCreateEvidenceParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // post /rule-results/{ruleResultId}/evidence + withRawResponse().createEvidence(params, requestOptions).thenApply { it.parse() } + + override fun listEvidence( + params: RuleResultListEvidenceParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // get /rule-results/{ruleResultId}/evidence + withRawResponse().listEvidence(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + RuleResultServiceAsync.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + override fun withOptions( + modifier: Consumer + ): RuleResultServiceAsync.WithRawResponse = + RuleResultServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun retrieve( + params: RuleResultRetrieveParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("ruleResultId", params.ruleResultId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("rule-results", params._pathParam(0)) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { retrieveHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val updateHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun update( + params: RuleResultUpdateParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("ruleResultId", params.ruleResultId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.PATCH) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("rule-results", params._pathParam(0)) + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { updateHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun list( + params: RuleResultListParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("workspaceId", params.workspaceId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("workspaces", params._pathParam(0), "rule-results") + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val createEvidenceHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun createEvidence( + params: RuleResultCreateEvidenceParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("ruleResultId", params.ruleResultId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("rule-results", params._pathParam(0), "evidence") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { createEvidenceHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val listEvidenceHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun listEvidence( + params: RuleResultListEvidenceParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("ruleResultId", params.ruleResultId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("rule-results", params._pathParam(0), "evidence") + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { listEvidenceHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/RuleServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/RuleServiceAsync.kt new file mode 100644 index 00000000..cde6dfa8 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/RuleServiceAsync.kt @@ -0,0 +1,430 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.async.governance + +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpResponse +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.models.governance.rules.RuleCreateParams +import com.openlayer.api.models.governance.rules.RuleCreateResponse +import com.openlayer.api.models.governance.rules.RuleDeleteParams +import com.openlayer.api.models.governance.rules.RuleListParams +import com.openlayer.api.models.governance.rules.RuleListResponse +import com.openlayer.api.models.governance.rules.RuleRetrieveParams +import com.openlayer.api.models.governance.rules.RuleRetrieveResponse +import com.openlayer.api.models.governance.rules.RuleUpdateParams +import com.openlayer.api.models.governance.rules.RuleUpdateResponse +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer + +interface RuleServiceAsync { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): RuleServiceAsync + + /** + * Create a governance rule in a workspace. + * + * A rule is one requirement. Its `type` decides how it is satisfied, and the two types accept + * different fields: + * - `platform` rules are evaluated automatically from the state of your workspace. Set + * `automationType` to the signal to check. Their `scope` must be `project`, and + * `evidenceType` and `renewalCadenceDays` must be omitted or `null`. + * - `evidence` rules are satisfied by attaching evidence. Set `evidenceType` to the kind of + * evidence that satisfies them. `automationType` and `automationParams` must be omitted or + * `null`. + * + * A new rule belongs to no framework. Map it to one from the Openlayer app. + */ + fun create( + workspaceId: String, + params: RuleCreateParams, + ): CompletableFuture = create(workspaceId, params, RequestOptions.none()) + + /** @see create */ + fun create( + workspaceId: String, + params: RuleCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + create(params.toBuilder().workspaceId(workspaceId).build(), requestOptions) + + /** @see create */ + fun create(params: RuleCreateParams): CompletableFuture = + create(params, RequestOptions.none()) + + /** @see create */ + fun create( + params: RuleCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** + * Retrieve a governance rule by its id, including the frameworks it belongs to and its tags. + */ + fun retrieve(ruleId: String): CompletableFuture = + retrieve(ruleId, RuleRetrieveParams.none()) + + /** @see retrieve */ + fun retrieve( + ruleId: String, + params: RuleRetrieveParams = RuleRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + retrieve(params.toBuilder().ruleId(ruleId).build(), requestOptions) + + /** @see retrieve */ + fun retrieve( + ruleId: String, + params: RuleRetrieveParams = RuleRetrieveParams.none(), + ): CompletableFuture = retrieve(ruleId, params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + params: RuleRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see retrieve */ + fun retrieve(params: RuleRetrieveParams): CompletableFuture = + retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + ruleId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + retrieve(ruleId, RuleRetrieveParams.none(), requestOptions) + + /** + * Update a governance rule. Only the fields you send are changed. + * + * Rules that ship with Openlayer report `immutable: true` and cannot be edited. + * + * A rule's `scope`, `type`, `evidenceType`, and automation are fixed once it exists -- create a + * new rule instead of converting one. + */ + fun update(ruleId: String): CompletableFuture = + update(ruleId, RuleUpdateParams.none()) + + /** @see update */ + fun update( + ruleId: String, + params: RuleUpdateParams = RuleUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + update(params.toBuilder().ruleId(ruleId).build(), requestOptions) + + /** @see update */ + fun update( + ruleId: String, + params: RuleUpdateParams = RuleUpdateParams.none(), + ): CompletableFuture = update(ruleId, params, RequestOptions.none()) + + /** @see update */ + fun update( + params: RuleUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see update */ + fun update(params: RuleUpdateParams): CompletableFuture = + update(params, RequestOptions.none()) + + /** @see update */ + fun update( + ruleId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + update(ruleId, RuleUpdateParams.none(), requestOptions) + + /** + * List the governance rules in a workspace. + * + * A rule is a single requirement Openlayer tracks. `platform` rules are evaluated automatically + * from the state of your workspace; `evidence` rules are satisfied by attaching evidence. A + * rule can belong to several frameworks at once, and rules that belong to none are returned too + * unless you pass `includeUnframed=false`. + * + * Pass `includeResults=true` to get each rule's compliance results inline instead of fetching + * them separately. + */ + fun list(workspaceId: String): CompletableFuture = + list(workspaceId, RuleListParams.none()) + + /** @see list */ + fun list( + workspaceId: String, + params: RuleListParams = RuleListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + list(params.toBuilder().workspaceId(workspaceId).build(), requestOptions) + + /** @see list */ + fun list( + workspaceId: String, + params: RuleListParams = RuleListParams.none(), + ): CompletableFuture = list(workspaceId, params, RequestOptions.none()) + + /** @see list */ + fun list( + params: RuleListParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see list */ + fun list(params: RuleListParams): CompletableFuture = + list(params, RequestOptions.none()) + + /** @see list */ + fun list( + workspaceId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + list(workspaceId, RuleListParams.none(), requestOptions) + + /** + * Delete a governance rule and its rule results. + * + * Only rules you created can be deleted. Rules that ship with Openlayer report `immutable: + * true` and cannot be deleted -- exclude one from compliance by setting `deactivated` with `PUT + * /rules/{ruleId}` instead. + */ + fun delete(ruleId: String): CompletableFuture = delete(ruleId, RuleDeleteParams.none()) + + /** @see delete */ + fun delete( + ruleId: String, + params: RuleDeleteParams = RuleDeleteParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = delete(params.toBuilder().ruleId(ruleId).build(), requestOptions) + + /** @see delete */ + fun delete( + ruleId: String, + params: RuleDeleteParams = RuleDeleteParams.none(), + ): CompletableFuture = delete(ruleId, params, RequestOptions.none()) + + /** @see delete */ + fun delete( + params: RuleDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see delete */ + fun delete(params: RuleDeleteParams): CompletableFuture = + delete(params, RequestOptions.none()) + + /** @see delete */ + fun delete(ruleId: String, requestOptions: RequestOptions): CompletableFuture = + delete(ruleId, RuleDeleteParams.none(), requestOptions) + + /** A view of [RuleServiceAsync] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): RuleServiceAsync.WithRawResponse + + /** + * Returns a raw HTTP response for `post /workspaces/{workspaceId}/rules`, but is otherwise + * the same as [RuleServiceAsync.create]. + */ + fun create( + workspaceId: String, + params: RuleCreateParams, + ): CompletableFuture> = + create(workspaceId, params, RequestOptions.none()) + + /** @see create */ + fun create( + workspaceId: String, + params: RuleCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + create(params.toBuilder().workspaceId(workspaceId).build(), requestOptions) + + /** @see create */ + fun create( + params: RuleCreateParams + ): CompletableFuture> = + create(params, RequestOptions.none()) + + /** @see create */ + fun create( + params: RuleCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** + * Returns a raw HTTP response for `get /rules/{ruleId}`, but is otherwise the same as + * [RuleServiceAsync.retrieve]. + */ + fun retrieve(ruleId: String): CompletableFuture> = + retrieve(ruleId, RuleRetrieveParams.none()) + + /** @see retrieve */ + fun retrieve( + ruleId: String, + params: RuleRetrieveParams = RuleRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + retrieve(params.toBuilder().ruleId(ruleId).build(), requestOptions) + + /** @see retrieve */ + fun retrieve( + ruleId: String, + params: RuleRetrieveParams = RuleRetrieveParams.none(), + ): CompletableFuture> = + retrieve(ruleId, params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + params: RuleRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see retrieve */ + fun retrieve( + params: RuleRetrieveParams + ): CompletableFuture> = + retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + ruleId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + retrieve(ruleId, RuleRetrieveParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `put /rules/{ruleId}`, but is otherwise the same as + * [RuleServiceAsync.update]. + */ + fun update(ruleId: String): CompletableFuture> = + update(ruleId, RuleUpdateParams.none()) + + /** @see update */ + fun update( + ruleId: String, + params: RuleUpdateParams = RuleUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + update(params.toBuilder().ruleId(ruleId).build(), requestOptions) + + /** @see update */ + fun update( + ruleId: String, + params: RuleUpdateParams = RuleUpdateParams.none(), + ): CompletableFuture> = + update(ruleId, params, RequestOptions.none()) + + /** @see update */ + fun update( + params: RuleUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see update */ + fun update( + params: RuleUpdateParams + ): CompletableFuture> = + update(params, RequestOptions.none()) + + /** @see update */ + fun update( + ruleId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + update(ruleId, RuleUpdateParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `get /workspaces/{workspaceId}/rules`, but is otherwise + * the same as [RuleServiceAsync.list]. + */ + fun list(workspaceId: String): CompletableFuture> = + list(workspaceId, RuleListParams.none()) + + /** @see list */ + fun list( + workspaceId: String, + params: RuleListParams = RuleListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + list(params.toBuilder().workspaceId(workspaceId).build(), requestOptions) + + /** @see list */ + fun list( + workspaceId: String, + params: RuleListParams = RuleListParams.none(), + ): CompletableFuture> = + list(workspaceId, params, RequestOptions.none()) + + /** @see list */ + fun list( + params: RuleListParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see list */ + fun list(params: RuleListParams): CompletableFuture> = + list(params, RequestOptions.none()) + + /** @see list */ + fun list( + workspaceId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + list(workspaceId, RuleListParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `delete /rules/{ruleId}`, but is otherwise the same as + * [RuleServiceAsync.delete]. + */ + fun delete(ruleId: String): CompletableFuture = + delete(ruleId, RuleDeleteParams.none()) + + /** @see delete */ + fun delete( + ruleId: String, + params: RuleDeleteParams = RuleDeleteParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + delete(params.toBuilder().ruleId(ruleId).build(), requestOptions) + + /** @see delete */ + fun delete( + ruleId: String, + params: RuleDeleteParams = RuleDeleteParams.none(), + ): CompletableFuture = delete(ruleId, params, RequestOptions.none()) + + /** @see delete */ + fun delete( + params: RuleDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see delete */ + fun delete(params: RuleDeleteParams): CompletableFuture = + delete(params, RequestOptions.none()) + + /** @see delete */ + fun delete( + ruleId: String, + requestOptions: RequestOptions, + ): CompletableFuture = delete(ruleId, RuleDeleteParams.none(), requestOptions) + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/RuleServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/RuleServiceAsyncImpl.kt new file mode 100644 index 00000000..86b7a3d8 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/RuleServiceAsyncImpl.kt @@ -0,0 +1,254 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.async.governance + +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.handlers.emptyHandler +import com.openlayer.api.core.handlers.errorBodyHandler +import com.openlayer.api.core.handlers.errorHandler +import com.openlayer.api.core.handlers.jsonHandler +import com.openlayer.api.core.http.HttpMethod +import com.openlayer.api.core.http.HttpRequest +import com.openlayer.api.core.http.HttpResponse +import com.openlayer.api.core.http.HttpResponse.Handler +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.core.http.json +import com.openlayer.api.core.http.parseable +import com.openlayer.api.core.prepareAsync +import com.openlayer.api.models.governance.rules.RuleCreateParams +import com.openlayer.api.models.governance.rules.RuleCreateResponse +import com.openlayer.api.models.governance.rules.RuleDeleteParams +import com.openlayer.api.models.governance.rules.RuleListParams +import com.openlayer.api.models.governance.rules.RuleListResponse +import com.openlayer.api.models.governance.rules.RuleRetrieveParams +import com.openlayer.api.models.governance.rules.RuleRetrieveResponse +import com.openlayer.api.models.governance.rules.RuleUpdateParams +import com.openlayer.api.models.governance.rules.RuleUpdateResponse +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer +import kotlin.jvm.optionals.getOrNull + +class RuleServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + RuleServiceAsync { + + private val withRawResponse: RuleServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): RuleServiceAsync.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): RuleServiceAsync = + RuleServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun create( + params: RuleCreateParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // post /workspaces/{workspaceId}/rules + withRawResponse().create(params, requestOptions).thenApply { it.parse() } + + override fun retrieve( + params: RuleRetrieveParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // get /rules/{ruleId} + withRawResponse().retrieve(params, requestOptions).thenApply { it.parse() } + + override fun update( + params: RuleUpdateParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // put /rules/{ruleId} + withRawResponse().update(params, requestOptions).thenApply { it.parse() } + + override fun list( + params: RuleListParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // get /workspaces/{workspaceId}/rules + withRawResponse().list(params, requestOptions).thenApply { it.parse() } + + override fun delete( + params: RuleDeleteParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // delete /rules/{ruleId} + withRawResponse().delete(params, requestOptions).thenAccept {} + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + RuleServiceAsync.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + override fun withOptions( + modifier: Consumer + ): RuleServiceAsync.WithRawResponse = + RuleServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun create( + params: RuleCreateParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("workspaceId", params.workspaceId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("workspaces", params._pathParam(0), "rules") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun retrieve( + params: RuleRetrieveParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("ruleId", params.ruleId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("rules", params._pathParam(0)) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { retrieveHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val updateHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun update( + params: RuleUpdateParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("ruleId", params.ruleId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.PUT) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("rules", params._pathParam(0)) + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { updateHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun list( + params: RuleListParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("workspaceId", params.workspaceId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("workspaces", params._pathParam(0), "rules") + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val deleteHandler: Handler = emptyHandler() + + override fun delete( + params: RuleDeleteParams, + requestOptions: RequestOptions, + ): CompletableFuture { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("ruleId", params.ruleId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.DELETE) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("rules", params._pathParam(0)) + .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response.use { deleteHandler.handle(it) } + } + } + } + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/RuleStatServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/RuleStatServiceAsync.kt new file mode 100644 index 00000000..0921a521 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/RuleStatServiceAsync.kt @@ -0,0 +1,126 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.async.governance + +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.models.governance.rulestats.RuleStatRetrieveParams +import com.openlayer.api.models.governance.rulestats.RuleStatRetrieveResponse +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer + +interface RuleStatServiceAsync { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): RuleStatServiceAsync + + /** + * Get a compliance roll-up for a workspace: how many rules exist, and how many of their results + * are passing, failing, pending, or due for renewal. + * + * Counts respect the filters you pass, so `frameworkId` gives you a single framework's overall + * compliance and `projectId` gives you a single project's. + */ + fun retrieve(workspaceId: String): CompletableFuture = + retrieve(workspaceId, RuleStatRetrieveParams.none()) + + /** @see retrieve */ + fun retrieve( + workspaceId: String, + params: RuleStatRetrieveParams = RuleStatRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + retrieve(params.toBuilder().workspaceId(workspaceId).build(), requestOptions) + + /** @see retrieve */ + fun retrieve( + workspaceId: String, + params: RuleStatRetrieveParams = RuleStatRetrieveParams.none(), + ): CompletableFuture = + retrieve(workspaceId, params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + params: RuleStatRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see retrieve */ + fun retrieve(params: RuleStatRetrieveParams): CompletableFuture = + retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + workspaceId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + retrieve(workspaceId, RuleStatRetrieveParams.none(), requestOptions) + + /** + * A view of [RuleStatServiceAsync] that provides access to raw HTTP responses for each method. + */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): RuleStatServiceAsync.WithRawResponse + + /** + * Returns a raw HTTP response for `get /workspaces/{workspaceId}/rule-stats`, but is + * otherwise the same as [RuleStatServiceAsync.retrieve]. + */ + fun retrieve( + workspaceId: String + ): CompletableFuture> = + retrieve(workspaceId, RuleStatRetrieveParams.none()) + + /** @see retrieve */ + fun retrieve( + workspaceId: String, + params: RuleStatRetrieveParams = RuleStatRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + retrieve(params.toBuilder().workspaceId(workspaceId).build(), requestOptions) + + /** @see retrieve */ + fun retrieve( + workspaceId: String, + params: RuleStatRetrieveParams = RuleStatRetrieveParams.none(), + ): CompletableFuture> = + retrieve(workspaceId, params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + params: RuleStatRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see retrieve */ + fun retrieve( + params: RuleStatRetrieveParams + ): CompletableFuture> = + retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + workspaceId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + retrieve(workspaceId, RuleStatRetrieveParams.none(), requestOptions) + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/RuleStatServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/RuleStatServiceAsyncImpl.kt new file mode 100644 index 00000000..00d2358c --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/RuleStatServiceAsyncImpl.kt @@ -0,0 +1,89 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.async.governance + +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.handlers.errorBodyHandler +import com.openlayer.api.core.handlers.errorHandler +import com.openlayer.api.core.handlers.jsonHandler +import com.openlayer.api.core.http.HttpMethod +import com.openlayer.api.core.http.HttpRequest +import com.openlayer.api.core.http.HttpResponse +import com.openlayer.api.core.http.HttpResponse.Handler +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.core.http.parseable +import com.openlayer.api.core.prepareAsync +import com.openlayer.api.models.governance.rulestats.RuleStatRetrieveParams +import com.openlayer.api.models.governance.rulestats.RuleStatRetrieveResponse +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer +import kotlin.jvm.optionals.getOrNull + +class RuleStatServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + RuleStatServiceAsync { + + private val withRawResponse: RuleStatServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): RuleStatServiceAsync.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): RuleStatServiceAsync = + RuleStatServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun retrieve( + params: RuleStatRetrieveParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // get /workspaces/{workspaceId}/rule-stats + withRawResponse().retrieve(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + RuleStatServiceAsync.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + override fun withOptions( + modifier: Consumer + ): RuleStatServiceAsync.WithRawResponse = + RuleStatServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun retrieve( + params: RuleStatRetrieveParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("workspaceId", params.workspaceId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("workspaces", params._pathParam(0), "rule-stats") + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { retrieveHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/RuleTagServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/RuleTagServiceAsync.kt new file mode 100644 index 00000000..22a4d294 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/RuleTagServiceAsync.kt @@ -0,0 +1,123 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.async.governance + +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.models.governance.ruletags.RuleTagListParams +import com.openlayer.api.models.governance.ruletags.RuleTagListResponse +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer + +interface RuleTagServiceAsync { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): RuleTagServiceAsync + + /** + * List the rule tags in a workspace. + * + * Tags group rules across frameworks, for example by team or by control family. Use the ids + * returned here with the `tags` filter on + * [List rules](/api-reference/rest/governance/list-rules). + */ + fun list(workspaceId: String): CompletableFuture = + list(workspaceId, RuleTagListParams.none()) + + /** @see list */ + fun list( + workspaceId: String, + params: RuleTagListParams = RuleTagListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + list(params.toBuilder().workspaceId(workspaceId).build(), requestOptions) + + /** @see list */ + fun list( + workspaceId: String, + params: RuleTagListParams = RuleTagListParams.none(), + ): CompletableFuture = list(workspaceId, params, RequestOptions.none()) + + /** @see list */ + fun list( + params: RuleTagListParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see list */ + fun list(params: RuleTagListParams): CompletableFuture = + list(params, RequestOptions.none()) + + /** @see list */ + fun list( + workspaceId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + list(workspaceId, RuleTagListParams.none(), requestOptions) + + /** + * A view of [RuleTagServiceAsync] that provides access to raw HTTP responses for each method. + */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): RuleTagServiceAsync.WithRawResponse + + /** + * Returns a raw HTTP response for `get /workspaces/{workspaceId}/rule-tags`, but is + * otherwise the same as [RuleTagServiceAsync.list]. + */ + fun list(workspaceId: String): CompletableFuture> = + list(workspaceId, RuleTagListParams.none()) + + /** @see list */ + fun list( + workspaceId: String, + params: RuleTagListParams = RuleTagListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + list(params.toBuilder().workspaceId(workspaceId).build(), requestOptions) + + /** @see list */ + fun list( + workspaceId: String, + params: RuleTagListParams = RuleTagListParams.none(), + ): CompletableFuture> = + list(workspaceId, params, RequestOptions.none()) + + /** @see list */ + fun list( + params: RuleTagListParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see list */ + fun list( + params: RuleTagListParams + ): CompletableFuture> = + list(params, RequestOptions.none()) + + /** @see list */ + fun list( + workspaceId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + list(workspaceId, RuleTagListParams.none(), requestOptions) + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/RuleTagServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/RuleTagServiceAsyncImpl.kt new file mode 100644 index 00000000..e0130429 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/RuleTagServiceAsyncImpl.kt @@ -0,0 +1,89 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.async.governance + +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.handlers.errorBodyHandler +import com.openlayer.api.core.handlers.errorHandler +import com.openlayer.api.core.handlers.jsonHandler +import com.openlayer.api.core.http.HttpMethod +import com.openlayer.api.core.http.HttpRequest +import com.openlayer.api.core.http.HttpResponse +import com.openlayer.api.core.http.HttpResponse.Handler +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.core.http.parseable +import com.openlayer.api.core.prepareAsync +import com.openlayer.api.models.governance.ruletags.RuleTagListParams +import com.openlayer.api.models.governance.ruletags.RuleTagListResponse +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer +import kotlin.jvm.optionals.getOrNull + +class RuleTagServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + RuleTagServiceAsync { + + private val withRawResponse: RuleTagServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): RuleTagServiceAsync.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): RuleTagServiceAsync = + RuleTagServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun list( + params: RuleTagListParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // get /workspaces/{workspaceId}/rule-tags + withRawResponse().list(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + RuleTagServiceAsync.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + override fun withOptions( + modifier: Consumer + ): RuleTagServiceAsync.WithRawResponse = + RuleTagServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun list( + params: RuleTagListParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("workspaceId", params.workspaceId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("workspaces", params._pathParam(0), "rule-tags") + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/frameworks/DocumentServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/frameworks/DocumentServiceAsync.kt new file mode 100644 index 00000000..40f4920a --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/frameworks/DocumentServiceAsync.kt @@ -0,0 +1,186 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.async.governance.frameworks + +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.models.governance.frameworks.documents.DocumentListParams +import com.openlayer.api.models.governance.frameworks.documents.DocumentListResponse +import com.openlayer.api.models.governance.frameworks.documents.DocumentRetrieveParams +import com.openlayer.api.models.governance.frameworks.documents.DocumentRetrieveResponse +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer + +interface DocumentServiceAsync { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): DocumentServiceAsync + + /** + * Retrieve a framework document, including its sections, subsections, and the rules mapped to + * each. + * + * Each section and subsection carries a `ruleCount`, so you can tell which requirements have + * rules mapped to them before drilling in. + */ + fun retrieve( + documentId: String, + params: DocumentRetrieveParams, + ): CompletableFuture = + retrieve(documentId, params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + documentId: String, + params: DocumentRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + retrieve(params.toBuilder().documentId(documentId).build(), requestOptions) + + /** @see retrieve */ + fun retrieve(params: DocumentRetrieveParams): CompletableFuture = + retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + params: DocumentRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** + * List the documents attached to a framework. + * + * A document holds the text of the standard the framework is based on, split into sections and + * subsections. Retrieve a single document to get that structure, along with the rules mapped to + * each part of it. + */ + fun list(frameworkId: String): CompletableFuture = + list(frameworkId, DocumentListParams.none()) + + /** @see list */ + fun list( + frameworkId: String, + params: DocumentListParams = DocumentListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + list(params.toBuilder().frameworkId(frameworkId).build(), requestOptions) + + /** @see list */ + fun list( + frameworkId: String, + params: DocumentListParams = DocumentListParams.none(), + ): CompletableFuture = list(frameworkId, params, RequestOptions.none()) + + /** @see list */ + fun list( + params: DocumentListParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see list */ + fun list(params: DocumentListParams): CompletableFuture = + list(params, RequestOptions.none()) + + /** @see list */ + fun list( + frameworkId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + list(frameworkId, DocumentListParams.none(), requestOptions) + + /** + * A view of [DocumentServiceAsync] that provides access to raw HTTP responses for each method. + */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): DocumentServiceAsync.WithRawResponse + + /** + * Returns a raw HTTP response for `get /frameworks/{frameworkId}/documents/{documentId}`, + * but is otherwise the same as [DocumentServiceAsync.retrieve]. + */ + fun retrieve( + documentId: String, + params: DocumentRetrieveParams, + ): CompletableFuture> = + retrieve(documentId, params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + documentId: String, + params: DocumentRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + retrieve(params.toBuilder().documentId(documentId).build(), requestOptions) + + /** @see retrieve */ + fun retrieve( + params: DocumentRetrieveParams + ): CompletableFuture> = + retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + params: DocumentRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** + * Returns a raw HTTP response for `get /frameworks/{frameworkId}/documents`, but is + * otherwise the same as [DocumentServiceAsync.list]. + */ + fun list(frameworkId: String): CompletableFuture> = + list(frameworkId, DocumentListParams.none()) + + /** @see list */ + fun list( + frameworkId: String, + params: DocumentListParams = DocumentListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + list(params.toBuilder().frameworkId(frameworkId).build(), requestOptions) + + /** @see list */ + fun list( + frameworkId: String, + params: DocumentListParams = DocumentListParams.none(), + ): CompletableFuture> = + list(frameworkId, params, RequestOptions.none()) + + /** @see list */ + fun list( + params: DocumentListParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see list */ + fun list( + params: DocumentListParams + ): CompletableFuture> = + list(params, RequestOptions.none()) + + /** @see list */ + fun list( + frameworkId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + list(frameworkId, DocumentListParams.none(), requestOptions) + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/frameworks/DocumentServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/frameworks/DocumentServiceAsyncImpl.kt new file mode 100644 index 00000000..8db69971 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/frameworks/DocumentServiceAsyncImpl.kt @@ -0,0 +1,136 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.async.governance.frameworks + +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.handlers.errorBodyHandler +import com.openlayer.api.core.handlers.errorHandler +import com.openlayer.api.core.handlers.jsonHandler +import com.openlayer.api.core.http.HttpMethod +import com.openlayer.api.core.http.HttpRequest +import com.openlayer.api.core.http.HttpResponse +import com.openlayer.api.core.http.HttpResponse.Handler +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.core.http.parseable +import com.openlayer.api.core.prepareAsync +import com.openlayer.api.models.governance.frameworks.documents.DocumentListParams +import com.openlayer.api.models.governance.frameworks.documents.DocumentListResponse +import com.openlayer.api.models.governance.frameworks.documents.DocumentRetrieveParams +import com.openlayer.api.models.governance.frameworks.documents.DocumentRetrieveResponse +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer +import kotlin.jvm.optionals.getOrNull + +class DocumentServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + DocumentServiceAsync { + + private val withRawResponse: DocumentServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): DocumentServiceAsync.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): DocumentServiceAsync = + DocumentServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun retrieve( + params: DocumentRetrieveParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // get /frameworks/{frameworkId}/documents/{documentId} + withRawResponse().retrieve(params, requestOptions).thenApply { it.parse() } + + override fun list( + params: DocumentListParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // get /frameworks/{frameworkId}/documents + withRawResponse().list(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + DocumentServiceAsync.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + override fun withOptions( + modifier: Consumer + ): DocumentServiceAsync.WithRawResponse = + DocumentServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun retrieve( + params: DocumentRetrieveParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("documentId", params.documentId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments( + "frameworks", + params._pathParam(0), + "documents", + params._pathParam(1), + ) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { retrieveHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun list( + params: DocumentListParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("frameworkId", params.frameworkId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("frameworks", params._pathParam(0), "documents") + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/frameworks/SectionServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/frameworks/SectionServiceAsync.kt new file mode 100644 index 00000000..14af5e5f --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/frameworks/SectionServiceAsync.kt @@ -0,0 +1,102 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.async.governance.frameworks + +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.models.governance.frameworks.sections.SectionListRulesParams +import com.openlayer.api.models.governance.frameworks.sections.SectionListRulesResponse +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer + +interface SectionServiceAsync { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): SectionServiceAsync + + /** + * List the rules mapped to a section of a framework document. + * + * Pass `includeSubsectionRules=true` to also return the rules mapped to the section's + * subsections, which is how you get every rule covering a requirement and everything under it. + */ + fun listRules( + sectionId: String, + params: SectionListRulesParams, + ): CompletableFuture = + listRules(sectionId, params, RequestOptions.none()) + + /** @see listRules */ + fun listRules( + sectionId: String, + params: SectionListRulesParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + listRules(params.toBuilder().sectionId(sectionId).build(), requestOptions) + + /** @see listRules */ + fun listRules(params: SectionListRulesParams): CompletableFuture = + listRules(params, RequestOptions.none()) + + /** @see listRules */ + fun listRules( + params: SectionListRulesParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** + * A view of [SectionServiceAsync] that provides access to raw HTTP responses for each method. + */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): SectionServiceAsync.WithRawResponse + + /** + * Returns a raw HTTP response for `get + * /frameworks/{frameworkId}/sections/{sectionId}/rules`, but is otherwise the same as + * [SectionServiceAsync.listRules]. + */ + fun listRules( + sectionId: String, + params: SectionListRulesParams, + ): CompletableFuture> = + listRules(sectionId, params, RequestOptions.none()) + + /** @see listRules */ + fun listRules( + sectionId: String, + params: SectionListRulesParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + listRules(params.toBuilder().sectionId(sectionId).build(), requestOptions) + + /** @see listRules */ + fun listRules( + params: SectionListRulesParams + ): CompletableFuture> = + listRules(params, RequestOptions.none()) + + /** @see listRules */ + fun listRules( + params: SectionListRulesParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/frameworks/SectionServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/frameworks/SectionServiceAsyncImpl.kt new file mode 100644 index 00000000..23d64f3b --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/frameworks/SectionServiceAsyncImpl.kt @@ -0,0 +1,95 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.async.governance.frameworks + +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.handlers.errorBodyHandler +import com.openlayer.api.core.handlers.errorHandler +import com.openlayer.api.core.handlers.jsonHandler +import com.openlayer.api.core.http.HttpMethod +import com.openlayer.api.core.http.HttpRequest +import com.openlayer.api.core.http.HttpResponse +import com.openlayer.api.core.http.HttpResponse.Handler +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.core.http.parseable +import com.openlayer.api.core.prepareAsync +import com.openlayer.api.models.governance.frameworks.sections.SectionListRulesParams +import com.openlayer.api.models.governance.frameworks.sections.SectionListRulesResponse +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer +import kotlin.jvm.optionals.getOrNull + +class SectionServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + SectionServiceAsync { + + private val withRawResponse: SectionServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): SectionServiceAsync.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): SectionServiceAsync = + SectionServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun listRules( + params: SectionListRulesParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // get /frameworks/{frameworkId}/sections/{sectionId}/rules + withRawResponse().listRules(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + SectionServiceAsync.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + override fun withOptions( + modifier: Consumer + ): SectionServiceAsync.WithRawResponse = + SectionServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + private val listRulesHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun listRules( + params: SectionListRulesParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("sectionId", params.sectionId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments( + "frameworks", + params._pathParam(0), + "sections", + params._pathParam(1), + "rules", + ) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { listRulesHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/frameworks/SubsectionServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/frameworks/SubsectionServiceAsync.kt new file mode 100644 index 00000000..36121f8e --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/frameworks/SubsectionServiceAsync.kt @@ -0,0 +1,104 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.async.governance.frameworks + +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.models.governance.frameworks.subsections.SubsectionListRulesParams +import com.openlayer.api.models.governance.frameworks.subsections.SubsectionListRulesResponse +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer + +interface SubsectionServiceAsync { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): SubsectionServiceAsync + + /** + * List the rules mapped to a subsection of a framework document. + * + * A subsection is usually the level at which a standard states an individual requirement, so + * this is the endpoint to use when you want to show which rules cover a specific clause. + */ + fun listRules( + subsectionId: String, + params: SubsectionListRulesParams, + ): CompletableFuture = + listRules(subsectionId, params, RequestOptions.none()) + + /** @see listRules */ + fun listRules( + subsectionId: String, + params: SubsectionListRulesParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + listRules(params.toBuilder().subsectionId(subsectionId).build(), requestOptions) + + /** @see listRules */ + fun listRules( + params: SubsectionListRulesParams + ): CompletableFuture = listRules(params, RequestOptions.none()) + + /** @see listRules */ + fun listRules( + params: SubsectionListRulesParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** + * A view of [SubsectionServiceAsync] that provides access to raw HTTP responses for each + * method. + */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): SubsectionServiceAsync.WithRawResponse + + /** + * Returns a raw HTTP response for `get + * /frameworks/{frameworkId}/subsections/{subsectionId}/rules`, but is otherwise the same as + * [SubsectionServiceAsync.listRules]. + */ + fun listRules( + subsectionId: String, + params: SubsectionListRulesParams, + ): CompletableFuture> = + listRules(subsectionId, params, RequestOptions.none()) + + /** @see listRules */ + fun listRules( + subsectionId: String, + params: SubsectionListRulesParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + listRules(params.toBuilder().subsectionId(subsectionId).build(), requestOptions) + + /** @see listRules */ + fun listRules( + params: SubsectionListRulesParams + ): CompletableFuture> = + listRules(params, RequestOptions.none()) + + /** @see listRules */ + fun listRules( + params: SubsectionListRulesParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/frameworks/SubsectionServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/frameworks/SubsectionServiceAsyncImpl.kt new file mode 100644 index 00000000..c24cfc3c --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/governance/frameworks/SubsectionServiceAsyncImpl.kt @@ -0,0 +1,95 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.async.governance.frameworks + +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.handlers.errorBodyHandler +import com.openlayer.api.core.handlers.errorHandler +import com.openlayer.api.core.handlers.jsonHandler +import com.openlayer.api.core.http.HttpMethod +import com.openlayer.api.core.http.HttpRequest +import com.openlayer.api.core.http.HttpResponse +import com.openlayer.api.core.http.HttpResponse.Handler +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.core.http.parseable +import com.openlayer.api.core.prepareAsync +import com.openlayer.api.models.governance.frameworks.subsections.SubsectionListRulesParams +import com.openlayer.api.models.governance.frameworks.subsections.SubsectionListRulesResponse +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer +import kotlin.jvm.optionals.getOrNull + +class SubsectionServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + SubsectionServiceAsync { + + private val withRawResponse: SubsectionServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): SubsectionServiceAsync.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): SubsectionServiceAsync = + SubsectionServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun listRules( + params: SubsectionListRulesParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // get /frameworks/{frameworkId}/subsections/{subsectionId}/rules + withRawResponse().listRules(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + SubsectionServiceAsync.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + override fun withOptions( + modifier: Consumer + ): SubsectionServiceAsync.WithRawResponse = + SubsectionServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + private val listRulesHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun listRules( + params: SubsectionListRulesParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("subsectionId", params.subsectionId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments( + "frameworks", + params._pathParam(0), + "subsections", + params._pathParam(1), + "rules", + ) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { listRulesHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsync.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsync.kt index f23fde00..a85494b6 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsync.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsync.kt @@ -7,6 +7,8 @@ import com.openlayer.api.core.RequestOptions import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.models.storage.presignedurl.PresignedUrlCreateParams import com.openlayer.api.models.storage.presignedurl.PresignedUrlCreateResponse +import com.openlayer.api.models.storage.presignedurl.PresignedUrlRetrieveParams +import com.openlayer.api.models.storage.presignedurl.PresignedUrlRetrieveResponse import java.util.concurrent.CompletableFuture import java.util.function.Consumer @@ -34,6 +36,27 @@ interface PresignedUrlServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** + * Exchange a `storageUri` for a short-lived presigned url you can download the object from. + * + * Use it to collect anything the platform stored on your behalf -- for example the archive a + * framework export leaves behind, whose `storageUri` comes back in the background task's + * `outputs`. + * + * The workspace is taken from the API key, so there is nothing else to send. The url is only + * issued for objects your workspace owns, and `404` covers both "no such object" and "not + * yours". + */ + fun retrieve( + params: PresignedUrlRetrieveParams + ): CompletableFuture = retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + params: PresignedUrlRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + /** * A view of [PresignedUrlServiceAsync] that provides access to raw HTTP responses for each * method. @@ -63,5 +86,20 @@ interface PresignedUrlServiceAsync { params: PresignedUrlCreateParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + + /** + * Returns a raw HTTP response for `get /storage/presigned-url`, but is otherwise the same + * as [PresignedUrlServiceAsync.retrieve]. + */ + fun retrieve( + params: PresignedUrlRetrieveParams + ): CompletableFuture> = + retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + params: PresignedUrlRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsyncImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsyncImpl.kt index bca37b4d..25bb20ee 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsyncImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsyncImpl.kt @@ -17,6 +17,8 @@ import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepareAsync import com.openlayer.api.models.storage.presignedurl.PresignedUrlCreateParams import com.openlayer.api.models.storage.presignedurl.PresignedUrlCreateResponse +import com.openlayer.api.models.storage.presignedurl.PresignedUrlRetrieveParams +import com.openlayer.api.models.storage.presignedurl.PresignedUrlRetrieveResponse import java.util.concurrent.CompletableFuture import java.util.function.Consumer @@ -39,6 +41,13 @@ class PresignedUrlServiceAsyncImpl internal constructor(private val clientOption // post /storage/presigned-url withRawResponse().create(params, requestOptions).thenApply { it.parse() } + override fun retrieve( + params: PresignedUrlRetrieveParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // get /storage/presigned-url + withRawResponse().retrieve(params, requestOptions).thenApply { it.parse() } + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : PresignedUrlServiceAsync.WithRawResponse { @@ -82,5 +91,35 @@ class PresignedUrlServiceAsyncImpl internal constructor(private val clientOption } } } + + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun retrieve( + params: PresignedUrlRetrieveParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("storage", "presigned-url") + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { retrieveHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/BackgroundTaskService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/BackgroundTaskService.kt new file mode 100644 index 00000000..e61964a3 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/BackgroundTaskService.kt @@ -0,0 +1,125 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.blocking + +import com.google.errorprone.annotations.MustBeClosed +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.models.backgroundtasks.BackgroundTaskRetrieveParams +import com.openlayer.api.models.backgroundtasks.BackgroundTaskRetrieveResponse +import java.util.function.Consumer + +interface BackgroundTaskService { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): BackgroundTaskService + + /** + * Retrieve a background task's status, progress and results. + * + * Endpoints that cannot answer within one request queue a task and hand back its id -- for + * example `POST /frameworks/{frameworkId}/export`. Poll this endpoint until `complete` is + * `true`, then read what the task produced from `outputs`. + */ + fun retrieve(taskId: String): BackgroundTaskRetrieveResponse = + retrieve(taskId, BackgroundTaskRetrieveParams.none()) + + /** @see retrieve */ + fun retrieve( + taskId: String, + params: BackgroundTaskRetrieveParams = BackgroundTaskRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): BackgroundTaskRetrieveResponse = + retrieve(params.toBuilder().taskId(taskId).build(), requestOptions) + + /** @see retrieve */ + fun retrieve( + taskId: String, + params: BackgroundTaskRetrieveParams = BackgroundTaskRetrieveParams.none(), + ): BackgroundTaskRetrieveResponse = retrieve(taskId, params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + params: BackgroundTaskRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): BackgroundTaskRetrieveResponse + + /** @see retrieve */ + fun retrieve(params: BackgroundTaskRetrieveParams): BackgroundTaskRetrieveResponse = + retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve(taskId: String, requestOptions: RequestOptions): BackgroundTaskRetrieveResponse = + retrieve(taskId, BackgroundTaskRetrieveParams.none(), requestOptions) + + /** + * A view of [BackgroundTaskService] that provides access to raw HTTP responses for each method. + */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): BackgroundTaskService.WithRawResponse + + /** + * Returns a raw HTTP response for `get /background-tasks/{taskId}`, but is otherwise the + * same as [BackgroundTaskService.retrieve]. + */ + @MustBeClosed + fun retrieve(taskId: String): HttpResponseFor = + retrieve(taskId, BackgroundTaskRetrieveParams.none()) + + /** @see retrieve */ + @MustBeClosed + fun retrieve( + taskId: String, + params: BackgroundTaskRetrieveParams = BackgroundTaskRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + retrieve(params.toBuilder().taskId(taskId).build(), requestOptions) + + /** @see retrieve */ + @MustBeClosed + fun retrieve( + taskId: String, + params: BackgroundTaskRetrieveParams = BackgroundTaskRetrieveParams.none(), + ): HttpResponseFor = + retrieve(taskId, params, RequestOptions.none()) + + /** @see retrieve */ + @MustBeClosed + fun retrieve( + params: BackgroundTaskRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see retrieve */ + @MustBeClosed + fun retrieve( + params: BackgroundTaskRetrieveParams + ): HttpResponseFor = retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + @MustBeClosed + fun retrieve( + taskId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + retrieve(taskId, BackgroundTaskRetrieveParams.none(), requestOptions) + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/BackgroundTaskServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/BackgroundTaskServiceImpl.kt new file mode 100644 index 00000000..5cb82cc6 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/BackgroundTaskServiceImpl.kt @@ -0,0 +1,85 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.blocking + +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.handlers.errorBodyHandler +import com.openlayer.api.core.handlers.errorHandler +import com.openlayer.api.core.handlers.jsonHandler +import com.openlayer.api.core.http.HttpMethod +import com.openlayer.api.core.http.HttpRequest +import com.openlayer.api.core.http.HttpResponse +import com.openlayer.api.core.http.HttpResponse.Handler +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.core.http.parseable +import com.openlayer.api.core.prepare +import com.openlayer.api.models.backgroundtasks.BackgroundTaskRetrieveParams +import com.openlayer.api.models.backgroundtasks.BackgroundTaskRetrieveResponse +import java.util.function.Consumer +import kotlin.jvm.optionals.getOrNull + +class BackgroundTaskServiceImpl internal constructor(private val clientOptions: ClientOptions) : + BackgroundTaskService { + + private val withRawResponse: BackgroundTaskService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): BackgroundTaskService.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): BackgroundTaskService = + BackgroundTaskServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun retrieve( + params: BackgroundTaskRetrieveParams, + requestOptions: RequestOptions, + ): BackgroundTaskRetrieveResponse = + // get /background-tasks/{taskId} + withRawResponse().retrieve(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + BackgroundTaskService.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + override fun withOptions( + modifier: Consumer + ): BackgroundTaskService.WithRawResponse = + BackgroundTaskServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun retrieve( + params: BackgroundTaskRetrieveParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("taskId", params.taskId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("background-tasks", params._pathParam(0)) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { retrieveHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/GovernanceService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/GovernanceService.kt new file mode 100644 index 00000000..b5fbb353 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/GovernanceService.kt @@ -0,0 +1,59 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.blocking + +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.services.blocking.governance.FrameworkService +import com.openlayer.api.services.blocking.governance.RuleResultService +import com.openlayer.api.services.blocking.governance.RuleService +import com.openlayer.api.services.blocking.governance.RuleStatService +import com.openlayer.api.services.blocking.governance.RuleTagService +import java.util.function.Consumer + +interface GovernanceService { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): GovernanceService + + fun frameworks(): FrameworkService + + fun rules(): RuleService + + fun ruleResults(): RuleResultService + + fun ruleStats(): RuleStatService + + fun ruleTags(): RuleTagService + + /** A view of [GovernanceService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): GovernanceService.WithRawResponse + + fun frameworks(): FrameworkService.WithRawResponse + + fun rules(): RuleService.WithRawResponse + + fun ruleResults(): RuleResultService.WithRawResponse + + fun ruleStats(): RuleStatService.WithRawResponse + + fun ruleTags(): RuleTagService.WithRawResponse + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/GovernanceServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/GovernanceServiceImpl.kt new file mode 100644 index 00000000..847441bd --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/GovernanceServiceImpl.kt @@ -0,0 +1,90 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.blocking + +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.services.blocking.governance.FrameworkService +import com.openlayer.api.services.blocking.governance.FrameworkServiceImpl +import com.openlayer.api.services.blocking.governance.RuleResultService +import com.openlayer.api.services.blocking.governance.RuleResultServiceImpl +import com.openlayer.api.services.blocking.governance.RuleService +import com.openlayer.api.services.blocking.governance.RuleServiceImpl +import com.openlayer.api.services.blocking.governance.RuleStatService +import com.openlayer.api.services.blocking.governance.RuleStatServiceImpl +import com.openlayer.api.services.blocking.governance.RuleTagService +import com.openlayer.api.services.blocking.governance.RuleTagServiceImpl +import java.util.function.Consumer + +class GovernanceServiceImpl internal constructor(private val clientOptions: ClientOptions) : + GovernanceService { + + private val withRawResponse: GovernanceService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + private val frameworks: FrameworkService by lazy { FrameworkServiceImpl(clientOptions) } + + private val rules: RuleService by lazy { RuleServiceImpl(clientOptions) } + + private val ruleResults: RuleResultService by lazy { RuleResultServiceImpl(clientOptions) } + + private val ruleStats: RuleStatService by lazy { RuleStatServiceImpl(clientOptions) } + + private val ruleTags: RuleTagService by lazy { RuleTagServiceImpl(clientOptions) } + + override fun withRawResponse(): GovernanceService.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): GovernanceService = + GovernanceServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun frameworks(): FrameworkService = frameworks + + override fun rules(): RuleService = rules + + override fun ruleResults(): RuleResultService = ruleResults + + override fun ruleStats(): RuleStatService = ruleStats + + override fun ruleTags(): RuleTagService = ruleTags + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + GovernanceService.WithRawResponse { + + private val frameworks: FrameworkService.WithRawResponse by lazy { + FrameworkServiceImpl.WithRawResponseImpl(clientOptions) + } + + private val rules: RuleService.WithRawResponse by lazy { + RuleServiceImpl.WithRawResponseImpl(clientOptions) + } + + private val ruleResults: RuleResultService.WithRawResponse by lazy { + RuleResultServiceImpl.WithRawResponseImpl(clientOptions) + } + + private val ruleStats: RuleStatService.WithRawResponse by lazy { + RuleStatServiceImpl.WithRawResponseImpl(clientOptions) + } + + private val ruleTags: RuleTagService.WithRawResponse by lazy { + RuleTagServiceImpl.WithRawResponseImpl(clientOptions) + } + + override fun withOptions( + modifier: Consumer + ): GovernanceService.WithRawResponse = + GovernanceServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + override fun frameworks(): FrameworkService.WithRawResponse = frameworks + + override fun rules(): RuleService.WithRawResponse = rules + + override fun ruleResults(): RuleResultService.WithRawResponse = ruleResults + + override fun ruleStats(): RuleStatService.WithRawResponse = ruleStats + + override fun ruleTags(): RuleTagService.WithRawResponse = ruleTags + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/FrameworkService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/FrameworkService.kt new file mode 100644 index 00000000..c6736178 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/FrameworkService.kt @@ -0,0 +1,748 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.blocking.governance + +import com.google.errorprone.annotations.MustBeClosed +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.models.governance.frameworks.FrameworkCreateParams +import com.openlayer.api.models.governance.frameworks.FrameworkCreateResponse +import com.openlayer.api.models.governance.frameworks.FrameworkExportParams +import com.openlayer.api.models.governance.frameworks.FrameworkExportResponse +import com.openlayer.api.models.governance.frameworks.FrameworkListParams +import com.openlayer.api.models.governance.frameworks.FrameworkListProjectRuleStatsParams +import com.openlayer.api.models.governance.frameworks.FrameworkListProjectRuleStatsResponse +import com.openlayer.api.models.governance.frameworks.FrameworkListProjectsParams +import com.openlayer.api.models.governance.frameworks.FrameworkListProjectsResponse +import com.openlayer.api.models.governance.frameworks.FrameworkListResponse +import com.openlayer.api.models.governance.frameworks.FrameworkListRulesParams +import com.openlayer.api.models.governance.frameworks.FrameworkListRulesResponse +import com.openlayer.api.models.governance.frameworks.FrameworkRetrieveParams +import com.openlayer.api.models.governance.frameworks.FrameworkRetrieveResponse +import com.openlayer.api.models.governance.frameworks.FrameworkUpdateParams +import com.openlayer.api.models.governance.frameworks.FrameworkUpdateResponse +import com.openlayer.api.services.blocking.governance.frameworks.DocumentService +import com.openlayer.api.services.blocking.governance.frameworks.SectionService +import com.openlayer.api.services.blocking.governance.frameworks.SubsectionService +import java.util.function.Consumer + +interface FrameworkService { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): FrameworkService + + fun documents(): DocumentService + + fun sections(): SectionService + + fun subsections(): SubsectionService + + /** + * Create a custom governance framework in a workspace. + * + * Use this to track compliance against an internal policy, or against a standard Openlayer does + * not ship as a built-in framework. A new framework starts with no rules -- add them from the + * Openlayer app, or map an existing rule to it. + * + * A framework is created disabled unless you pass `enabled: true`. While it is disabled its + * rules are not evaluated and do not count towards compliance. + */ + fun create(workspaceId: String, params: FrameworkCreateParams): FrameworkCreateResponse = + create(workspaceId, params, RequestOptions.none()) + + /** @see create */ + fun create( + workspaceId: String, + params: FrameworkCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): FrameworkCreateResponse = + create(params.toBuilder().workspaceId(workspaceId).build(), requestOptions) + + /** @see create */ + fun create(params: FrameworkCreateParams): FrameworkCreateResponse = + create(params, RequestOptions.none()) + + /** @see create */ + fun create( + params: FrameworkCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): FrameworkCreateResponse + + /** Retrieve a governance framework by its id. */ + fun retrieve(frameworkId: String): FrameworkRetrieveResponse = + retrieve(frameworkId, FrameworkRetrieveParams.none()) + + /** @see retrieve */ + fun retrieve( + frameworkId: String, + params: FrameworkRetrieveParams = FrameworkRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): FrameworkRetrieveResponse = + retrieve(params.toBuilder().frameworkId(frameworkId).build(), requestOptions) + + /** @see retrieve */ + fun retrieve( + frameworkId: String, + params: FrameworkRetrieveParams = FrameworkRetrieveParams.none(), + ): FrameworkRetrieveResponse = retrieve(frameworkId, params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + params: FrameworkRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): FrameworkRetrieveResponse + + /** @see retrieve */ + fun retrieve(params: FrameworkRetrieveParams): FrameworkRetrieveResponse = + retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve(frameworkId: String, requestOptions: RequestOptions): FrameworkRetrieveResponse = + retrieve(frameworkId, FrameworkRetrieveParams.none(), requestOptions) + + /** + * Update a governance framework. + * + * The most common use is activating or deactivating a framework for the workspace by setting + * `enabled`. Rules of a disabled framework are not evaluated and do not count towards + * compliance. + * + * Frameworks that ship with Openlayer report `immutable: true`. For those, only `enabled`, + * `tags`, and `projectSelector` can be changed -- their name and definition are managed by + * Openlayer. + * + * Only the fields you send are changed. + */ + fun update(frameworkId: String): FrameworkUpdateResponse = + update(frameworkId, FrameworkUpdateParams.none()) + + /** @see update */ + fun update( + frameworkId: String, + params: FrameworkUpdateParams = FrameworkUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): FrameworkUpdateResponse = + update(params.toBuilder().frameworkId(frameworkId).build(), requestOptions) + + /** @see update */ + fun update( + frameworkId: String, + params: FrameworkUpdateParams = FrameworkUpdateParams.none(), + ): FrameworkUpdateResponse = update(frameworkId, params, RequestOptions.none()) + + /** @see update */ + fun update( + params: FrameworkUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): FrameworkUpdateResponse + + /** @see update */ + fun update(params: FrameworkUpdateParams): FrameworkUpdateResponse = + update(params, RequestOptions.none()) + + /** @see update */ + fun update(frameworkId: String, requestOptions: RequestOptions): FrameworkUpdateResponse = + update(frameworkId, FrameworkUpdateParams.none(), requestOptions) + + /** + * List the governance frameworks in a workspace. + * + * A framework is a set of rules -- drawn from a regulation, a standard, or your own internal + * policy -- that Openlayer tracks compliance against. Use this endpoint to find the framework + * you want to report on, then read its rules and rule results. + */ + fun list(workspaceId: String): FrameworkListResponse = + list(workspaceId, FrameworkListParams.none()) + + /** @see list */ + fun list( + workspaceId: String, + params: FrameworkListParams = FrameworkListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): FrameworkListResponse = + list(params.toBuilder().workspaceId(workspaceId).build(), requestOptions) + + /** @see list */ + fun list( + workspaceId: String, + params: FrameworkListParams = FrameworkListParams.none(), + ): FrameworkListResponse = list(workspaceId, params, RequestOptions.none()) + + /** @see list */ + fun list( + params: FrameworkListParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): FrameworkListResponse + + /** @see list */ + fun list(params: FrameworkListParams): FrameworkListResponse = + list(params, RequestOptions.none()) + + /** @see list */ + fun list(workspaceId: String, requestOptions: RequestOptions): FrameworkListResponse = + list(workspaceId, FrameworkListParams.none(), requestOptions) + + /** + * Export a framework's evidence and progress as an audit-ready zip archive. + * + * The archive holds every evidence file uploaded against the framework's evidence-based rules, + * a markdown report of the framework's progress and the status of all its rules (broken down by + * documentation section when the framework has documents), and CSV manifests of rules and + * evidence with SHA-256 checksums. + * + * Send `projectId` to export one project's compliance with the framework. Omit it for the + * workspace-wide view across every project in the framework, including workspace-scoped rules. + * + * The export runs as a background task, so this returns `202` immediately. To collect the + * archive: + * 1. Poll `GET /background-tasks/{taskId}` with the returned `taskResultId` until `complete` is + * `true`. + * 2. Read `outputs.storageUri` off that task. + * 3. Exchange it for a download link at `GET /storage/presigned-url?storageUri=`. + * + * Rate limited to 2 requests per minute per framework. Asking for an export while an identical + * one is still queued returns that task rather than starting a second one. + */ + fun export(frameworkId: String): FrameworkExportResponse = + export(frameworkId, FrameworkExportParams.none()) + + /** @see export */ + fun export( + frameworkId: String, + params: FrameworkExportParams = FrameworkExportParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): FrameworkExportResponse = + export(params.toBuilder().frameworkId(frameworkId).build(), requestOptions) + + /** @see export */ + fun export( + frameworkId: String, + params: FrameworkExportParams = FrameworkExportParams.none(), + ): FrameworkExportResponse = export(frameworkId, params, RequestOptions.none()) + + /** @see export */ + fun export( + params: FrameworkExportParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): FrameworkExportResponse + + /** @see export */ + fun export(params: FrameworkExportParams): FrameworkExportResponse = + export(params, RequestOptions.none()) + + /** @see export */ + fun export(frameworkId: String, requestOptions: RequestOptions): FrameworkExportResponse = + export(frameworkId, FrameworkExportParams.none(), requestOptions) + + /** + * Get a compliance roll-up for a framework, one row per project it applies to. + * + * Each row counts the project's rule results by status, so you can report on where a framework + * is complete and where it is not without fetching every individual rule result. + */ + fun listProjectRuleStats(frameworkId: String): FrameworkListProjectRuleStatsResponse = + listProjectRuleStats(frameworkId, FrameworkListProjectRuleStatsParams.none()) + + /** @see listProjectRuleStats */ + fun listProjectRuleStats( + frameworkId: String, + params: FrameworkListProjectRuleStatsParams = FrameworkListProjectRuleStatsParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): FrameworkListProjectRuleStatsResponse = + listProjectRuleStats(params.toBuilder().frameworkId(frameworkId).build(), requestOptions) + + /** @see listProjectRuleStats */ + fun listProjectRuleStats( + frameworkId: String, + params: FrameworkListProjectRuleStatsParams = FrameworkListProjectRuleStatsParams.none(), + ): FrameworkListProjectRuleStatsResponse = + listProjectRuleStats(frameworkId, params, RequestOptions.none()) + + /** @see listProjectRuleStats */ + fun listProjectRuleStats( + params: FrameworkListProjectRuleStatsParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): FrameworkListProjectRuleStatsResponse + + /** @see listProjectRuleStats */ + fun listProjectRuleStats( + params: FrameworkListProjectRuleStatsParams + ): FrameworkListProjectRuleStatsResponse = listProjectRuleStats(params, RequestOptions.none()) + + /** @see listProjectRuleStats */ + fun listProjectRuleStats( + frameworkId: String, + requestOptions: RequestOptions, + ): FrameworkListProjectRuleStatsResponse = + listProjectRuleStats( + frameworkId, + FrameworkListProjectRuleStatsParams.none(), + requestOptions, + ) + + /** + * List the projects a framework applies to. + * + * Which projects a framework covers is determined by its `projectSelector`. A framework with an + * empty selector applies to every project in the workspace. + */ + fun listProjects(frameworkId: String): FrameworkListProjectsResponse = + listProjects(frameworkId, FrameworkListProjectsParams.none()) + + /** @see listProjects */ + fun listProjects( + frameworkId: String, + params: FrameworkListProjectsParams = FrameworkListProjectsParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): FrameworkListProjectsResponse = + listProjects(params.toBuilder().frameworkId(frameworkId).build(), requestOptions) + + /** @see listProjects */ + fun listProjects( + frameworkId: String, + params: FrameworkListProjectsParams = FrameworkListProjectsParams.none(), + ): FrameworkListProjectsResponse = listProjects(frameworkId, params, RequestOptions.none()) + + /** @see listProjects */ + fun listProjects( + params: FrameworkListProjectsParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): FrameworkListProjectsResponse + + /** @see listProjects */ + fun listProjects(params: FrameworkListProjectsParams): FrameworkListProjectsResponse = + listProjects(params, RequestOptions.none()) + + /** @see listProjects */ + fun listProjects( + frameworkId: String, + requestOptions: RequestOptions, + ): FrameworkListProjectsResponse = + listProjects(frameworkId, FrameworkListProjectsParams.none(), requestOptions) + + /** + * List the rules that belong to a framework. + * + * To read the compliance status of these rules, use + * [List rule results](/api-reference/rest/governance/list-rule-results) with the `frameworkId` + * filter, or fetch the results of an individual rule. + */ + fun listRules(frameworkId: String): FrameworkListRulesResponse = + listRules(frameworkId, FrameworkListRulesParams.none()) + + /** @see listRules */ + fun listRules( + frameworkId: String, + params: FrameworkListRulesParams = FrameworkListRulesParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): FrameworkListRulesResponse = + listRules(params.toBuilder().frameworkId(frameworkId).build(), requestOptions) + + /** @see listRules */ + fun listRules( + frameworkId: String, + params: FrameworkListRulesParams = FrameworkListRulesParams.none(), + ): FrameworkListRulesResponse = listRules(frameworkId, params, RequestOptions.none()) + + /** @see listRules */ + fun listRules( + params: FrameworkListRulesParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): FrameworkListRulesResponse + + /** @see listRules */ + fun listRules(params: FrameworkListRulesParams): FrameworkListRulesResponse = + listRules(params, RequestOptions.none()) + + /** @see listRules */ + fun listRules(frameworkId: String, requestOptions: RequestOptions): FrameworkListRulesResponse = + listRules(frameworkId, FrameworkListRulesParams.none(), requestOptions) + + /** A view of [FrameworkService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): FrameworkService.WithRawResponse + + fun documents(): DocumentService.WithRawResponse + + fun sections(): SectionService.WithRawResponse + + fun subsections(): SubsectionService.WithRawResponse + + /** + * Returns a raw HTTP response for `post /workspaces/{workspaceId}/frameworks`, but is + * otherwise the same as [FrameworkService.create]. + */ + @MustBeClosed + fun create( + workspaceId: String, + params: FrameworkCreateParams, + ): HttpResponseFor = + create(workspaceId, params, RequestOptions.none()) + + /** @see create */ + @MustBeClosed + fun create( + workspaceId: String, + params: FrameworkCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + create(params.toBuilder().workspaceId(workspaceId).build(), requestOptions) + + /** @see create */ + @MustBeClosed + fun create(params: FrameworkCreateParams): HttpResponseFor = + create(params, RequestOptions.none()) + + /** @see create */ + @MustBeClosed + fun create( + params: FrameworkCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** + * Returns a raw HTTP response for `get /frameworks/{frameworkId}`, but is otherwise the + * same as [FrameworkService.retrieve]. + */ + @MustBeClosed + fun retrieve(frameworkId: String): HttpResponseFor = + retrieve(frameworkId, FrameworkRetrieveParams.none()) + + /** @see retrieve */ + @MustBeClosed + fun retrieve( + frameworkId: String, + params: FrameworkRetrieveParams = FrameworkRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + retrieve(params.toBuilder().frameworkId(frameworkId).build(), requestOptions) + + /** @see retrieve */ + @MustBeClosed + fun retrieve( + frameworkId: String, + params: FrameworkRetrieveParams = FrameworkRetrieveParams.none(), + ): HttpResponseFor = + retrieve(frameworkId, params, RequestOptions.none()) + + /** @see retrieve */ + @MustBeClosed + fun retrieve( + params: FrameworkRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see retrieve */ + @MustBeClosed + fun retrieve(params: FrameworkRetrieveParams): HttpResponseFor = + retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + @MustBeClosed + fun retrieve( + frameworkId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + retrieve(frameworkId, FrameworkRetrieveParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `put /frameworks/{frameworkId}`, but is otherwise the + * same as [FrameworkService.update]. + */ + @MustBeClosed + fun update(frameworkId: String): HttpResponseFor = + update(frameworkId, FrameworkUpdateParams.none()) + + /** @see update */ + @MustBeClosed + fun update( + frameworkId: String, + params: FrameworkUpdateParams = FrameworkUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + update(params.toBuilder().frameworkId(frameworkId).build(), requestOptions) + + /** @see update */ + @MustBeClosed + fun update( + frameworkId: String, + params: FrameworkUpdateParams = FrameworkUpdateParams.none(), + ): HttpResponseFor = + update(frameworkId, params, RequestOptions.none()) + + /** @see update */ + @MustBeClosed + fun update( + params: FrameworkUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see update */ + @MustBeClosed + fun update(params: FrameworkUpdateParams): HttpResponseFor = + update(params, RequestOptions.none()) + + /** @see update */ + @MustBeClosed + fun update( + frameworkId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + update(frameworkId, FrameworkUpdateParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `get /workspaces/{workspaceId}/frameworks`, but is + * otherwise the same as [FrameworkService.list]. + */ + @MustBeClosed + fun list(workspaceId: String): HttpResponseFor = + list(workspaceId, FrameworkListParams.none()) + + /** @see list */ + @MustBeClosed + fun list( + workspaceId: String, + params: FrameworkListParams = FrameworkListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + list(params.toBuilder().workspaceId(workspaceId).build(), requestOptions) + + /** @see list */ + @MustBeClosed + fun list( + workspaceId: String, + params: FrameworkListParams = FrameworkListParams.none(), + ): HttpResponseFor = list(workspaceId, params, RequestOptions.none()) + + /** @see list */ + @MustBeClosed + fun list( + params: FrameworkListParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see list */ + @MustBeClosed + fun list(params: FrameworkListParams): HttpResponseFor = + list(params, RequestOptions.none()) + + /** @see list */ + @MustBeClosed + fun list( + workspaceId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + list(workspaceId, FrameworkListParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `post /frameworks/{frameworkId}/export`, but is otherwise + * the same as [FrameworkService.export]. + */ + @MustBeClosed + fun export(frameworkId: String): HttpResponseFor = + export(frameworkId, FrameworkExportParams.none()) + + /** @see export */ + @MustBeClosed + fun export( + frameworkId: String, + params: FrameworkExportParams = FrameworkExportParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + export(params.toBuilder().frameworkId(frameworkId).build(), requestOptions) + + /** @see export */ + @MustBeClosed + fun export( + frameworkId: String, + params: FrameworkExportParams = FrameworkExportParams.none(), + ): HttpResponseFor = + export(frameworkId, params, RequestOptions.none()) + + /** @see export */ + @MustBeClosed + fun export( + params: FrameworkExportParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see export */ + @MustBeClosed + fun export(params: FrameworkExportParams): HttpResponseFor = + export(params, RequestOptions.none()) + + /** @see export */ + @MustBeClosed + fun export( + frameworkId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + export(frameworkId, FrameworkExportParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `get /frameworks/{frameworkId}/project-rule-stats`, but + * is otherwise the same as [FrameworkService.listProjectRuleStats]. + */ + @MustBeClosed + fun listProjectRuleStats( + frameworkId: String + ): HttpResponseFor = + listProjectRuleStats(frameworkId, FrameworkListProjectRuleStatsParams.none()) + + /** @see listProjectRuleStats */ + @MustBeClosed + fun listProjectRuleStats( + frameworkId: String, + params: FrameworkListProjectRuleStatsParams = + FrameworkListProjectRuleStatsParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + listProjectRuleStats( + params.toBuilder().frameworkId(frameworkId).build(), + requestOptions, + ) + + /** @see listProjectRuleStats */ + @MustBeClosed + fun listProjectRuleStats( + frameworkId: String, + params: FrameworkListProjectRuleStatsParams = FrameworkListProjectRuleStatsParams.none(), + ): HttpResponseFor = + listProjectRuleStats(frameworkId, params, RequestOptions.none()) + + /** @see listProjectRuleStats */ + @MustBeClosed + fun listProjectRuleStats( + params: FrameworkListProjectRuleStatsParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see listProjectRuleStats */ + @MustBeClosed + fun listProjectRuleStats( + params: FrameworkListProjectRuleStatsParams + ): HttpResponseFor = + listProjectRuleStats(params, RequestOptions.none()) + + /** @see listProjectRuleStats */ + @MustBeClosed + fun listProjectRuleStats( + frameworkId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + listProjectRuleStats( + frameworkId, + FrameworkListProjectRuleStatsParams.none(), + requestOptions, + ) + + /** + * Returns a raw HTTP response for `get /frameworks/{frameworkId}/projects`, but is + * otherwise the same as [FrameworkService.listProjects]. + */ + @MustBeClosed + fun listProjects(frameworkId: String): HttpResponseFor = + listProjects(frameworkId, FrameworkListProjectsParams.none()) + + /** @see listProjects */ + @MustBeClosed + fun listProjects( + frameworkId: String, + params: FrameworkListProjectsParams = FrameworkListProjectsParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + listProjects(params.toBuilder().frameworkId(frameworkId).build(), requestOptions) + + /** @see listProjects */ + @MustBeClosed + fun listProjects( + frameworkId: String, + params: FrameworkListProjectsParams = FrameworkListProjectsParams.none(), + ): HttpResponseFor = + listProjects(frameworkId, params, RequestOptions.none()) + + /** @see listProjects */ + @MustBeClosed + fun listProjects( + params: FrameworkListProjectsParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see listProjects */ + @MustBeClosed + fun listProjects( + params: FrameworkListProjectsParams + ): HttpResponseFor = + listProjects(params, RequestOptions.none()) + + /** @see listProjects */ + @MustBeClosed + fun listProjects( + frameworkId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + listProjects(frameworkId, FrameworkListProjectsParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `get /frameworks/{frameworkId}/rules`, but is otherwise + * the same as [FrameworkService.listRules]. + */ + @MustBeClosed + fun listRules(frameworkId: String): HttpResponseFor = + listRules(frameworkId, FrameworkListRulesParams.none()) + + /** @see listRules */ + @MustBeClosed + fun listRules( + frameworkId: String, + params: FrameworkListRulesParams = FrameworkListRulesParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + listRules(params.toBuilder().frameworkId(frameworkId).build(), requestOptions) + + /** @see listRules */ + @MustBeClosed + fun listRules( + frameworkId: String, + params: FrameworkListRulesParams = FrameworkListRulesParams.none(), + ): HttpResponseFor = + listRules(frameworkId, params, RequestOptions.none()) + + /** @see listRules */ + @MustBeClosed + fun listRules( + params: FrameworkListRulesParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see listRules */ + @MustBeClosed + fun listRules( + params: FrameworkListRulesParams + ): HttpResponseFor = listRules(params, RequestOptions.none()) + + /** @see listRules */ + @MustBeClosed + fun listRules( + frameworkId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + listRules(frameworkId, FrameworkListRulesParams.none(), requestOptions) + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/FrameworkServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/FrameworkServiceImpl.kt new file mode 100644 index 00000000..f9c523fb --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/FrameworkServiceImpl.kt @@ -0,0 +1,398 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.blocking.governance + +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.handlers.errorBodyHandler +import com.openlayer.api.core.handlers.errorHandler +import com.openlayer.api.core.handlers.jsonHandler +import com.openlayer.api.core.http.HttpMethod +import com.openlayer.api.core.http.HttpRequest +import com.openlayer.api.core.http.HttpResponse +import com.openlayer.api.core.http.HttpResponse.Handler +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.core.http.json +import com.openlayer.api.core.http.parseable +import com.openlayer.api.core.prepare +import com.openlayer.api.models.governance.frameworks.FrameworkCreateParams +import com.openlayer.api.models.governance.frameworks.FrameworkCreateResponse +import com.openlayer.api.models.governance.frameworks.FrameworkExportParams +import com.openlayer.api.models.governance.frameworks.FrameworkExportResponse +import com.openlayer.api.models.governance.frameworks.FrameworkListParams +import com.openlayer.api.models.governance.frameworks.FrameworkListProjectRuleStatsParams +import com.openlayer.api.models.governance.frameworks.FrameworkListProjectRuleStatsResponse +import com.openlayer.api.models.governance.frameworks.FrameworkListProjectsParams +import com.openlayer.api.models.governance.frameworks.FrameworkListProjectsResponse +import com.openlayer.api.models.governance.frameworks.FrameworkListResponse +import com.openlayer.api.models.governance.frameworks.FrameworkListRulesParams +import com.openlayer.api.models.governance.frameworks.FrameworkListRulesResponse +import com.openlayer.api.models.governance.frameworks.FrameworkRetrieveParams +import com.openlayer.api.models.governance.frameworks.FrameworkRetrieveResponse +import com.openlayer.api.models.governance.frameworks.FrameworkUpdateParams +import com.openlayer.api.models.governance.frameworks.FrameworkUpdateResponse +import com.openlayer.api.services.blocking.governance.frameworks.DocumentService +import com.openlayer.api.services.blocking.governance.frameworks.DocumentServiceImpl +import com.openlayer.api.services.blocking.governance.frameworks.SectionService +import com.openlayer.api.services.blocking.governance.frameworks.SectionServiceImpl +import com.openlayer.api.services.blocking.governance.frameworks.SubsectionService +import com.openlayer.api.services.blocking.governance.frameworks.SubsectionServiceImpl +import java.util.function.Consumer +import kotlin.jvm.optionals.getOrNull + +class FrameworkServiceImpl internal constructor(private val clientOptions: ClientOptions) : + FrameworkService { + + private val withRawResponse: FrameworkService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + private val documents: DocumentService by lazy { DocumentServiceImpl(clientOptions) } + + private val sections: SectionService by lazy { SectionServiceImpl(clientOptions) } + + private val subsections: SubsectionService by lazy { SubsectionServiceImpl(clientOptions) } + + override fun withRawResponse(): FrameworkService.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): FrameworkService = + FrameworkServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun documents(): DocumentService = documents + + override fun sections(): SectionService = sections + + override fun subsections(): SubsectionService = subsections + + override fun create( + params: FrameworkCreateParams, + requestOptions: RequestOptions, + ): FrameworkCreateResponse = + // post /workspaces/{workspaceId}/frameworks + withRawResponse().create(params, requestOptions).parse() + + override fun retrieve( + params: FrameworkRetrieveParams, + requestOptions: RequestOptions, + ): FrameworkRetrieveResponse = + // get /frameworks/{frameworkId} + withRawResponse().retrieve(params, requestOptions).parse() + + override fun update( + params: FrameworkUpdateParams, + requestOptions: RequestOptions, + ): FrameworkUpdateResponse = + // put /frameworks/{frameworkId} + withRawResponse().update(params, requestOptions).parse() + + override fun list( + params: FrameworkListParams, + requestOptions: RequestOptions, + ): FrameworkListResponse = + // get /workspaces/{workspaceId}/frameworks + withRawResponse().list(params, requestOptions).parse() + + override fun export( + params: FrameworkExportParams, + requestOptions: RequestOptions, + ): FrameworkExportResponse = + // post /frameworks/{frameworkId}/export + withRawResponse().export(params, requestOptions).parse() + + override fun listProjectRuleStats( + params: FrameworkListProjectRuleStatsParams, + requestOptions: RequestOptions, + ): FrameworkListProjectRuleStatsResponse = + // get /frameworks/{frameworkId}/project-rule-stats + withRawResponse().listProjectRuleStats(params, requestOptions).parse() + + override fun listProjects( + params: FrameworkListProjectsParams, + requestOptions: RequestOptions, + ): FrameworkListProjectsResponse = + // get /frameworks/{frameworkId}/projects + withRawResponse().listProjects(params, requestOptions).parse() + + override fun listRules( + params: FrameworkListRulesParams, + requestOptions: RequestOptions, + ): FrameworkListRulesResponse = + // get /frameworks/{frameworkId}/rules + withRawResponse().listRules(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + FrameworkService.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + private val documents: DocumentService.WithRawResponse by lazy { + DocumentServiceImpl.WithRawResponseImpl(clientOptions) + } + + private val sections: SectionService.WithRawResponse by lazy { + SectionServiceImpl.WithRawResponseImpl(clientOptions) + } + + private val subsections: SubsectionService.WithRawResponse by lazy { + SubsectionServiceImpl.WithRawResponseImpl(clientOptions) + } + + override fun withOptions( + modifier: Consumer + ): FrameworkService.WithRawResponse = + FrameworkServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + override fun documents(): DocumentService.WithRawResponse = documents + + override fun sections(): SectionService.WithRawResponse = sections + + override fun subsections(): SubsectionService.WithRawResponse = subsections + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun create( + params: FrameworkCreateParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("workspaceId", params.workspaceId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("workspaces", params._pathParam(0), "frameworks") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun retrieve( + params: FrameworkRetrieveParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("frameworkId", params.frameworkId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("frameworks", params._pathParam(0)) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { retrieveHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val updateHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun update( + params: FrameworkUpdateParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("frameworkId", params.frameworkId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.PUT) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("frameworks", params._pathParam(0)) + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { updateHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun list( + params: FrameworkListParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("workspaceId", params.workspaceId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("workspaces", params._pathParam(0), "frameworks") + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val exportHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun export( + params: FrameworkExportParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("frameworkId", params.frameworkId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("frameworks", params._pathParam(0), "export") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { exportHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val listProjectRuleStatsHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun listProjectRuleStats( + params: FrameworkListProjectRuleStatsParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("frameworkId", params.frameworkId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("frameworks", params._pathParam(0), "project-rule-stats") + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { listProjectRuleStatsHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val listProjectsHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun listProjects( + params: FrameworkListProjectsParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("frameworkId", params.frameworkId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("frameworks", params._pathParam(0), "projects") + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { listProjectsHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val listRulesHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun listRules( + params: FrameworkListRulesParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("frameworkId", params.frameworkId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("frameworks", params._pathParam(0), "rules") + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { listRulesHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/RuleResultService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/RuleResultService.kt new file mode 100644 index 00000000..3485065a --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/RuleResultService.kt @@ -0,0 +1,483 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.blocking.governance + +import com.google.errorprone.annotations.MustBeClosed +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.models.governance.ruleresults.RuleResultCreateEvidenceParams +import com.openlayer.api.models.governance.ruleresults.RuleResultCreateEvidenceResponse +import com.openlayer.api.models.governance.ruleresults.RuleResultListEvidenceParams +import com.openlayer.api.models.governance.ruleresults.RuleResultListEvidenceResponse +import com.openlayer.api.models.governance.ruleresults.RuleResultListParams +import com.openlayer.api.models.governance.ruleresults.RuleResultListResponse +import com.openlayer.api.models.governance.ruleresults.RuleResultRetrieveParams +import com.openlayer.api.models.governance.ruleresults.RuleResultRetrieveResponse +import com.openlayer.api.models.governance.ruleresults.RuleResultUpdateParams +import com.openlayer.api.models.governance.ruleresults.RuleResultUpdateResponse +import java.util.function.Consumer + +interface RuleResultService { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): RuleResultService + + /** + * Retrieve a rule result by its id. + * + * Alongside the status, the response carries the evaluation and renewal dates that explain it: + * `dateLastEvaluated` and `dateOfNextEvaluation` for platform rules, `dateOfLatestEvidence` and + * `dateOfRenewal` for evidence rules. + */ + fun retrieve(ruleResultId: String): RuleResultRetrieveResponse = + retrieve(ruleResultId, RuleResultRetrieveParams.none()) + + /** @see retrieve */ + fun retrieve( + ruleResultId: String, + params: RuleResultRetrieveParams = RuleResultRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): RuleResultRetrieveResponse = + retrieve(params.toBuilder().ruleResultId(ruleResultId).build(), requestOptions) + + /** @see retrieve */ + fun retrieve( + ruleResultId: String, + params: RuleResultRetrieveParams = RuleResultRetrieveParams.none(), + ): RuleResultRetrieveResponse = retrieve(ruleResultId, params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + params: RuleResultRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): RuleResultRetrieveResponse + + /** @see retrieve */ + fun retrieve(params: RuleResultRetrieveParams): RuleResultRetrieveResponse = + retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve(ruleResultId: String, requestOptions: RequestOptions): RuleResultRetrieveResponse = + retrieve(ruleResultId, RuleResultRetrieveParams.none(), requestOptions) + + /** + * Update a rule result. Only the fields you send are changed. + * + * Use this to assign an owner, or to exclude a single result from compliance without + * deactivating the rule everywhere. `deactivatedReason` is required when setting `deactivated` + * to `true`. + * + * A result's `status` is computed by Openlayer and cannot be set directly. + */ + fun update(ruleResultId: String): RuleResultUpdateResponse = + update(ruleResultId, RuleResultUpdateParams.none()) + + /** @see update */ + fun update( + ruleResultId: String, + params: RuleResultUpdateParams = RuleResultUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): RuleResultUpdateResponse = + update(params.toBuilder().ruleResultId(ruleResultId).build(), requestOptions) + + /** @see update */ + fun update( + ruleResultId: String, + params: RuleResultUpdateParams = RuleResultUpdateParams.none(), + ): RuleResultUpdateResponse = update(ruleResultId, params, RequestOptions.none()) + + /** @see update */ + fun update( + params: RuleResultUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): RuleResultUpdateResponse + + /** @see update */ + fun update(params: RuleResultUpdateParams): RuleResultUpdateResponse = + update(params, RequestOptions.none()) + + /** @see update */ + fun update(ruleResultId: String, requestOptions: RequestOptions): RuleResultUpdateResponse = + update(ruleResultId, RuleResultUpdateParams.none(), requestOptions) + + /** + * List rule results across a workspace. + * + * A rule result is the compliance status of one rule for one entity: a project for + * project-scoped rules, or the workspace itself for workspace-scoped rules. This is the + * endpoint to poll or export when you want your current compliance state, filtered to a + * framework, a project, or a status. + */ + fun list(workspaceId: String): RuleResultListResponse = + list(workspaceId, RuleResultListParams.none()) + + /** @see list */ + fun list( + workspaceId: String, + params: RuleResultListParams = RuleResultListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): RuleResultListResponse = + list(params.toBuilder().workspaceId(workspaceId).build(), requestOptions) + + /** @see list */ + fun list( + workspaceId: String, + params: RuleResultListParams = RuleResultListParams.none(), + ): RuleResultListResponse = list(workspaceId, params, RequestOptions.none()) + + /** @see list */ + fun list( + params: RuleResultListParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): RuleResultListResponse + + /** @see list */ + fun list(params: RuleResultListParams): RuleResultListResponse = + list(params, RequestOptions.none()) + + /** @see list */ + fun list(workspaceId: String, requestOptions: RequestOptions): RuleResultListResponse = + list(workspaceId, RuleResultListParams.none(), requestOptions) + + /** + * Attach evidence to a rule result, satisfying an evidence rule. + * + * Send the field that matches the rule's `evidenceType`: `storageUri` for an uploaded document, + * `text` for a written statement, or `url` for a link. + * + * For a document, upload the file first with `POST /storage/presigned-url` and send the + * resulting storage URI as `storageUri`. + * + * Attaching evidence re-evaluates the rule result. If the rule sets `renewalCadenceDays`, the + * renewal window restarts from this evidence. + */ + fun createEvidence(ruleResultId: String): RuleResultCreateEvidenceResponse = + createEvidence(ruleResultId, RuleResultCreateEvidenceParams.none()) + + /** @see createEvidence */ + fun createEvidence( + ruleResultId: String, + params: RuleResultCreateEvidenceParams = RuleResultCreateEvidenceParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): RuleResultCreateEvidenceResponse = + createEvidence(params.toBuilder().ruleResultId(ruleResultId).build(), requestOptions) + + /** @see createEvidence */ + fun createEvidence( + ruleResultId: String, + params: RuleResultCreateEvidenceParams = RuleResultCreateEvidenceParams.none(), + ): RuleResultCreateEvidenceResponse = + createEvidence(ruleResultId, params, RequestOptions.none()) + + /** @see createEvidence */ + fun createEvidence( + params: RuleResultCreateEvidenceParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): RuleResultCreateEvidenceResponse + + /** @see createEvidence */ + fun createEvidence(params: RuleResultCreateEvidenceParams): RuleResultCreateEvidenceResponse = + createEvidence(params, RequestOptions.none()) + + /** @see createEvidence */ + fun createEvidence( + ruleResultId: String, + requestOptions: RequestOptions, + ): RuleResultCreateEvidenceResponse = + createEvidence(ruleResultId, RuleResultCreateEvidenceParams.none(), requestOptions) + + /** + * List the evidence attached to a rule result. + * + * Which field carries the evidence depends on the rule's `evidenceType`: `storageUri` for + * uploaded documents, `text` for written statements, and `url` for links. + */ + fun listEvidence(ruleResultId: String): RuleResultListEvidenceResponse = + listEvidence(ruleResultId, RuleResultListEvidenceParams.none()) + + /** @see listEvidence */ + fun listEvidence( + ruleResultId: String, + params: RuleResultListEvidenceParams = RuleResultListEvidenceParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): RuleResultListEvidenceResponse = + listEvidence(params.toBuilder().ruleResultId(ruleResultId).build(), requestOptions) + + /** @see listEvidence */ + fun listEvidence( + ruleResultId: String, + params: RuleResultListEvidenceParams = RuleResultListEvidenceParams.none(), + ): RuleResultListEvidenceResponse = listEvidence(ruleResultId, params, RequestOptions.none()) + + /** @see listEvidence */ + fun listEvidence( + params: RuleResultListEvidenceParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): RuleResultListEvidenceResponse + + /** @see listEvidence */ + fun listEvidence(params: RuleResultListEvidenceParams): RuleResultListEvidenceResponse = + listEvidence(params, RequestOptions.none()) + + /** @see listEvidence */ + fun listEvidence( + ruleResultId: String, + requestOptions: RequestOptions, + ): RuleResultListEvidenceResponse = + listEvidence(ruleResultId, RuleResultListEvidenceParams.none(), requestOptions) + + /** A view of [RuleResultService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): RuleResultService.WithRawResponse + + /** + * Returns a raw HTTP response for `get /rule-results/{ruleResultId}`, but is otherwise the + * same as [RuleResultService.retrieve]. + */ + @MustBeClosed + fun retrieve(ruleResultId: String): HttpResponseFor = + retrieve(ruleResultId, RuleResultRetrieveParams.none()) + + /** @see retrieve */ + @MustBeClosed + fun retrieve( + ruleResultId: String, + params: RuleResultRetrieveParams = RuleResultRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + retrieve(params.toBuilder().ruleResultId(ruleResultId).build(), requestOptions) + + /** @see retrieve */ + @MustBeClosed + fun retrieve( + ruleResultId: String, + params: RuleResultRetrieveParams = RuleResultRetrieveParams.none(), + ): HttpResponseFor = + retrieve(ruleResultId, params, RequestOptions.none()) + + /** @see retrieve */ + @MustBeClosed + fun retrieve( + params: RuleResultRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see retrieve */ + @MustBeClosed + fun retrieve( + params: RuleResultRetrieveParams + ): HttpResponseFor = retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + @MustBeClosed + fun retrieve( + ruleResultId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + retrieve(ruleResultId, RuleResultRetrieveParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `patch /rule-results/{ruleResultId}`, but is otherwise + * the same as [RuleResultService.update]. + */ + @MustBeClosed + fun update(ruleResultId: String): HttpResponseFor = + update(ruleResultId, RuleResultUpdateParams.none()) + + /** @see update */ + @MustBeClosed + fun update( + ruleResultId: String, + params: RuleResultUpdateParams = RuleResultUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + update(params.toBuilder().ruleResultId(ruleResultId).build(), requestOptions) + + /** @see update */ + @MustBeClosed + fun update( + ruleResultId: String, + params: RuleResultUpdateParams = RuleResultUpdateParams.none(), + ): HttpResponseFor = + update(ruleResultId, params, RequestOptions.none()) + + /** @see update */ + @MustBeClosed + fun update( + params: RuleResultUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see update */ + @MustBeClosed + fun update(params: RuleResultUpdateParams): HttpResponseFor = + update(params, RequestOptions.none()) + + /** @see update */ + @MustBeClosed + fun update( + ruleResultId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + update(ruleResultId, RuleResultUpdateParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `get /workspaces/{workspaceId}/rule-results`, but is + * otherwise the same as [RuleResultService.list]. + */ + @MustBeClosed + fun list(workspaceId: String): HttpResponseFor = + list(workspaceId, RuleResultListParams.none()) + + /** @see list */ + @MustBeClosed + fun list( + workspaceId: String, + params: RuleResultListParams = RuleResultListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + list(params.toBuilder().workspaceId(workspaceId).build(), requestOptions) + + /** @see list */ + @MustBeClosed + fun list( + workspaceId: String, + params: RuleResultListParams = RuleResultListParams.none(), + ): HttpResponseFor = + list(workspaceId, params, RequestOptions.none()) + + /** @see list */ + @MustBeClosed + fun list( + params: RuleResultListParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see list */ + @MustBeClosed + fun list(params: RuleResultListParams): HttpResponseFor = + list(params, RequestOptions.none()) + + /** @see list */ + @MustBeClosed + fun list( + workspaceId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + list(workspaceId, RuleResultListParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `post /rule-results/{ruleResultId}/evidence`, but is + * otherwise the same as [RuleResultService.createEvidence]. + */ + @MustBeClosed + fun createEvidence( + ruleResultId: String + ): HttpResponseFor = + createEvidence(ruleResultId, RuleResultCreateEvidenceParams.none()) + + /** @see createEvidence */ + @MustBeClosed + fun createEvidence( + ruleResultId: String, + params: RuleResultCreateEvidenceParams = RuleResultCreateEvidenceParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + createEvidence(params.toBuilder().ruleResultId(ruleResultId).build(), requestOptions) + + /** @see createEvidence */ + @MustBeClosed + fun createEvidence( + ruleResultId: String, + params: RuleResultCreateEvidenceParams = RuleResultCreateEvidenceParams.none(), + ): HttpResponseFor = + createEvidence(ruleResultId, params, RequestOptions.none()) + + /** @see createEvidence */ + @MustBeClosed + fun createEvidence( + params: RuleResultCreateEvidenceParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see createEvidence */ + @MustBeClosed + fun createEvidence( + params: RuleResultCreateEvidenceParams + ): HttpResponseFor = + createEvidence(params, RequestOptions.none()) + + /** @see createEvidence */ + @MustBeClosed + fun createEvidence( + ruleResultId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + createEvidence(ruleResultId, RuleResultCreateEvidenceParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `get /rule-results/{ruleResultId}/evidence`, but is + * otherwise the same as [RuleResultService.listEvidence]. + */ + @MustBeClosed + fun listEvidence(ruleResultId: String): HttpResponseFor = + listEvidence(ruleResultId, RuleResultListEvidenceParams.none()) + + /** @see listEvidence */ + @MustBeClosed + fun listEvidence( + ruleResultId: String, + params: RuleResultListEvidenceParams = RuleResultListEvidenceParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + listEvidence(params.toBuilder().ruleResultId(ruleResultId).build(), requestOptions) + + /** @see listEvidence */ + @MustBeClosed + fun listEvidence( + ruleResultId: String, + params: RuleResultListEvidenceParams = RuleResultListEvidenceParams.none(), + ): HttpResponseFor = + listEvidence(ruleResultId, params, RequestOptions.none()) + + /** @see listEvidence */ + @MustBeClosed + fun listEvidence( + params: RuleResultListEvidenceParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see listEvidence */ + @MustBeClosed + fun listEvidence( + params: RuleResultListEvidenceParams + ): HttpResponseFor = + listEvidence(params, RequestOptions.none()) + + /** @see listEvidence */ + @MustBeClosed + fun listEvidence( + ruleResultId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + listEvidence(ruleResultId, RuleResultListEvidenceParams.none(), requestOptions) + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/RuleResultServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/RuleResultServiceImpl.kt new file mode 100644 index 00000000..90010830 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/RuleResultServiceImpl.kt @@ -0,0 +1,244 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.blocking.governance + +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.handlers.errorBodyHandler +import com.openlayer.api.core.handlers.errorHandler +import com.openlayer.api.core.handlers.jsonHandler +import com.openlayer.api.core.http.HttpMethod +import com.openlayer.api.core.http.HttpRequest +import com.openlayer.api.core.http.HttpResponse +import com.openlayer.api.core.http.HttpResponse.Handler +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.core.http.json +import com.openlayer.api.core.http.parseable +import com.openlayer.api.core.prepare +import com.openlayer.api.models.governance.ruleresults.RuleResultCreateEvidenceParams +import com.openlayer.api.models.governance.ruleresults.RuleResultCreateEvidenceResponse +import com.openlayer.api.models.governance.ruleresults.RuleResultListEvidenceParams +import com.openlayer.api.models.governance.ruleresults.RuleResultListEvidenceResponse +import com.openlayer.api.models.governance.ruleresults.RuleResultListParams +import com.openlayer.api.models.governance.ruleresults.RuleResultListResponse +import com.openlayer.api.models.governance.ruleresults.RuleResultRetrieveParams +import com.openlayer.api.models.governance.ruleresults.RuleResultRetrieveResponse +import com.openlayer.api.models.governance.ruleresults.RuleResultUpdateParams +import com.openlayer.api.models.governance.ruleresults.RuleResultUpdateResponse +import java.util.function.Consumer +import kotlin.jvm.optionals.getOrNull + +class RuleResultServiceImpl internal constructor(private val clientOptions: ClientOptions) : + RuleResultService { + + private val withRawResponse: RuleResultService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): RuleResultService.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): RuleResultService = + RuleResultServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun retrieve( + params: RuleResultRetrieveParams, + requestOptions: RequestOptions, + ): RuleResultRetrieveResponse = + // get /rule-results/{ruleResultId} + withRawResponse().retrieve(params, requestOptions).parse() + + override fun update( + params: RuleResultUpdateParams, + requestOptions: RequestOptions, + ): RuleResultUpdateResponse = + // patch /rule-results/{ruleResultId} + withRawResponse().update(params, requestOptions).parse() + + override fun list( + params: RuleResultListParams, + requestOptions: RequestOptions, + ): RuleResultListResponse = + // get /workspaces/{workspaceId}/rule-results + withRawResponse().list(params, requestOptions).parse() + + override fun createEvidence( + params: RuleResultCreateEvidenceParams, + requestOptions: RequestOptions, + ): RuleResultCreateEvidenceResponse = + // post /rule-results/{ruleResultId}/evidence + withRawResponse().createEvidence(params, requestOptions).parse() + + override fun listEvidence( + params: RuleResultListEvidenceParams, + requestOptions: RequestOptions, + ): RuleResultListEvidenceResponse = + // get /rule-results/{ruleResultId}/evidence + withRawResponse().listEvidence(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + RuleResultService.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + override fun withOptions( + modifier: Consumer + ): RuleResultService.WithRawResponse = + RuleResultServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun retrieve( + params: RuleResultRetrieveParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("ruleResultId", params.ruleResultId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("rule-results", params._pathParam(0)) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { retrieveHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val updateHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun update( + params: RuleResultUpdateParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("ruleResultId", params.ruleResultId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.PATCH) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("rule-results", params._pathParam(0)) + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { updateHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun list( + params: RuleResultListParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("workspaceId", params.workspaceId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("workspaces", params._pathParam(0), "rule-results") + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val createEvidenceHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun createEvidence( + params: RuleResultCreateEvidenceParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("ruleResultId", params.ruleResultId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("rule-results", params._pathParam(0), "evidence") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { createEvidenceHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val listEvidenceHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun listEvidence( + params: RuleResultListEvidenceParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("ruleResultId", params.ruleResultId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("rule-results", params._pathParam(0), "evidence") + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { listEvidenceHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/RuleService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/RuleService.kt new file mode 100644 index 00000000..7493af00 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/RuleService.kt @@ -0,0 +1,417 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.blocking.governance + +import com.google.errorprone.annotations.MustBeClosed +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpResponse +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.models.governance.rules.RuleCreateParams +import com.openlayer.api.models.governance.rules.RuleCreateResponse +import com.openlayer.api.models.governance.rules.RuleDeleteParams +import com.openlayer.api.models.governance.rules.RuleListParams +import com.openlayer.api.models.governance.rules.RuleListResponse +import com.openlayer.api.models.governance.rules.RuleRetrieveParams +import com.openlayer.api.models.governance.rules.RuleRetrieveResponse +import com.openlayer.api.models.governance.rules.RuleUpdateParams +import com.openlayer.api.models.governance.rules.RuleUpdateResponse +import java.util.function.Consumer + +interface RuleService { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): RuleService + + /** + * Create a governance rule in a workspace. + * + * A rule is one requirement. Its `type` decides how it is satisfied, and the two types accept + * different fields: + * - `platform` rules are evaluated automatically from the state of your workspace. Set + * `automationType` to the signal to check. Their `scope` must be `project`, and + * `evidenceType` and `renewalCadenceDays` must be omitted or `null`. + * - `evidence` rules are satisfied by attaching evidence. Set `evidenceType` to the kind of + * evidence that satisfies them. `automationType` and `automationParams` must be omitted or + * `null`. + * + * A new rule belongs to no framework. Map it to one from the Openlayer app. + */ + fun create(workspaceId: String, params: RuleCreateParams): RuleCreateResponse = + create(workspaceId, params, RequestOptions.none()) + + /** @see create */ + fun create( + workspaceId: String, + params: RuleCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): RuleCreateResponse = + create(params.toBuilder().workspaceId(workspaceId).build(), requestOptions) + + /** @see create */ + fun create(params: RuleCreateParams): RuleCreateResponse = create(params, RequestOptions.none()) + + /** @see create */ + fun create( + params: RuleCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): RuleCreateResponse + + /** + * Retrieve a governance rule by its id, including the frameworks it belongs to and its tags. + */ + fun retrieve(ruleId: String): RuleRetrieveResponse = retrieve(ruleId, RuleRetrieveParams.none()) + + /** @see retrieve */ + fun retrieve( + ruleId: String, + params: RuleRetrieveParams = RuleRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): RuleRetrieveResponse = retrieve(params.toBuilder().ruleId(ruleId).build(), requestOptions) + + /** @see retrieve */ + fun retrieve( + ruleId: String, + params: RuleRetrieveParams = RuleRetrieveParams.none(), + ): RuleRetrieveResponse = retrieve(ruleId, params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + params: RuleRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): RuleRetrieveResponse + + /** @see retrieve */ + fun retrieve(params: RuleRetrieveParams): RuleRetrieveResponse = + retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve(ruleId: String, requestOptions: RequestOptions): RuleRetrieveResponse = + retrieve(ruleId, RuleRetrieveParams.none(), requestOptions) + + /** + * Update a governance rule. Only the fields you send are changed. + * + * Rules that ship with Openlayer report `immutable: true` and cannot be edited. + * + * A rule's `scope`, `type`, `evidenceType`, and automation are fixed once it exists -- create a + * new rule instead of converting one. + */ + fun update(ruleId: String): RuleUpdateResponse = update(ruleId, RuleUpdateParams.none()) + + /** @see update */ + fun update( + ruleId: String, + params: RuleUpdateParams = RuleUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): RuleUpdateResponse = update(params.toBuilder().ruleId(ruleId).build(), requestOptions) + + /** @see update */ + fun update( + ruleId: String, + params: RuleUpdateParams = RuleUpdateParams.none(), + ): RuleUpdateResponse = update(ruleId, params, RequestOptions.none()) + + /** @see update */ + fun update( + params: RuleUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): RuleUpdateResponse + + /** @see update */ + fun update(params: RuleUpdateParams): RuleUpdateResponse = update(params, RequestOptions.none()) + + /** @see update */ + fun update(ruleId: String, requestOptions: RequestOptions): RuleUpdateResponse = + update(ruleId, RuleUpdateParams.none(), requestOptions) + + /** + * List the governance rules in a workspace. + * + * A rule is a single requirement Openlayer tracks. `platform` rules are evaluated automatically + * from the state of your workspace; `evidence` rules are satisfied by attaching evidence. A + * rule can belong to several frameworks at once, and rules that belong to none are returned too + * unless you pass `includeUnframed=false`. + * + * Pass `includeResults=true` to get each rule's compliance results inline instead of fetching + * them separately. + */ + fun list(workspaceId: String): RuleListResponse = list(workspaceId, RuleListParams.none()) + + /** @see list */ + fun list( + workspaceId: String, + params: RuleListParams = RuleListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): RuleListResponse = list(params.toBuilder().workspaceId(workspaceId).build(), requestOptions) + + /** @see list */ + fun list( + workspaceId: String, + params: RuleListParams = RuleListParams.none(), + ): RuleListResponse = list(workspaceId, params, RequestOptions.none()) + + /** @see list */ + fun list( + params: RuleListParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): RuleListResponse + + /** @see list */ + fun list(params: RuleListParams): RuleListResponse = list(params, RequestOptions.none()) + + /** @see list */ + fun list(workspaceId: String, requestOptions: RequestOptions): RuleListResponse = + list(workspaceId, RuleListParams.none(), requestOptions) + + /** + * Delete a governance rule and its rule results. + * + * Only rules you created can be deleted. Rules that ship with Openlayer report `immutable: + * true` and cannot be deleted -- exclude one from compliance by setting `deactivated` with `PUT + * /rules/{ruleId}` instead. + */ + fun delete(ruleId: String) = delete(ruleId, RuleDeleteParams.none()) + + /** @see delete */ + fun delete( + ruleId: String, + params: RuleDeleteParams = RuleDeleteParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ) = delete(params.toBuilder().ruleId(ruleId).build(), requestOptions) + + /** @see delete */ + fun delete(ruleId: String, params: RuleDeleteParams = RuleDeleteParams.none()) = + delete(ruleId, params, RequestOptions.none()) + + /** @see delete */ + fun delete(params: RuleDeleteParams, requestOptions: RequestOptions = RequestOptions.none()) + + /** @see delete */ + fun delete(params: RuleDeleteParams) = delete(params, RequestOptions.none()) + + /** @see delete */ + fun delete(ruleId: String, requestOptions: RequestOptions) = + delete(ruleId, RuleDeleteParams.none(), requestOptions) + + /** A view of [RuleService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): RuleService.WithRawResponse + + /** + * Returns a raw HTTP response for `post /workspaces/{workspaceId}/rules`, but is otherwise + * the same as [RuleService.create]. + */ + @MustBeClosed + fun create( + workspaceId: String, + params: RuleCreateParams, + ): HttpResponseFor = create(workspaceId, params, RequestOptions.none()) + + /** @see create */ + @MustBeClosed + fun create( + workspaceId: String, + params: RuleCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + create(params.toBuilder().workspaceId(workspaceId).build(), requestOptions) + + /** @see create */ + @MustBeClosed + fun create(params: RuleCreateParams): HttpResponseFor = + create(params, RequestOptions.none()) + + /** @see create */ + @MustBeClosed + fun create( + params: RuleCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** + * Returns a raw HTTP response for `get /rules/{ruleId}`, but is otherwise the same as + * [RuleService.retrieve]. + */ + @MustBeClosed + fun retrieve(ruleId: String): HttpResponseFor = + retrieve(ruleId, RuleRetrieveParams.none()) + + /** @see retrieve */ + @MustBeClosed + fun retrieve( + ruleId: String, + params: RuleRetrieveParams = RuleRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + retrieve(params.toBuilder().ruleId(ruleId).build(), requestOptions) + + /** @see retrieve */ + @MustBeClosed + fun retrieve( + ruleId: String, + params: RuleRetrieveParams = RuleRetrieveParams.none(), + ): HttpResponseFor = retrieve(ruleId, params, RequestOptions.none()) + + /** @see retrieve */ + @MustBeClosed + fun retrieve( + params: RuleRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see retrieve */ + @MustBeClosed + fun retrieve(params: RuleRetrieveParams): HttpResponseFor = + retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + @MustBeClosed + fun retrieve( + ruleId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + retrieve(ruleId, RuleRetrieveParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `put /rules/{ruleId}`, but is otherwise the same as + * [RuleService.update]. + */ + @MustBeClosed + fun update(ruleId: String): HttpResponseFor = + update(ruleId, RuleUpdateParams.none()) + + /** @see update */ + @MustBeClosed + fun update( + ruleId: String, + params: RuleUpdateParams = RuleUpdateParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + update(params.toBuilder().ruleId(ruleId).build(), requestOptions) + + /** @see update */ + @MustBeClosed + fun update( + ruleId: String, + params: RuleUpdateParams = RuleUpdateParams.none(), + ): HttpResponseFor = update(ruleId, params, RequestOptions.none()) + + /** @see update */ + @MustBeClosed + fun update( + params: RuleUpdateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see update */ + @MustBeClosed + fun update(params: RuleUpdateParams): HttpResponseFor = + update(params, RequestOptions.none()) + + /** @see update */ + @MustBeClosed + fun update( + ruleId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + update(ruleId, RuleUpdateParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `get /workspaces/{workspaceId}/rules`, but is otherwise + * the same as [RuleService.list]. + */ + @MustBeClosed + fun list(workspaceId: String): HttpResponseFor = + list(workspaceId, RuleListParams.none()) + + /** @see list */ + @MustBeClosed + fun list( + workspaceId: String, + params: RuleListParams = RuleListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + list(params.toBuilder().workspaceId(workspaceId).build(), requestOptions) + + /** @see list */ + @MustBeClosed + fun list( + workspaceId: String, + params: RuleListParams = RuleListParams.none(), + ): HttpResponseFor = list(workspaceId, params, RequestOptions.none()) + + /** @see list */ + @MustBeClosed + fun list( + params: RuleListParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see list */ + @MustBeClosed + fun list(params: RuleListParams): HttpResponseFor = + list(params, RequestOptions.none()) + + /** @see list */ + @MustBeClosed + fun list( + workspaceId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + list(workspaceId, RuleListParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `delete /rules/{ruleId}`, but is otherwise the same as + * [RuleService.delete]. + */ + @MustBeClosed + fun delete(ruleId: String): HttpResponse = delete(ruleId, RuleDeleteParams.none()) + + /** @see delete */ + @MustBeClosed + fun delete( + ruleId: String, + params: RuleDeleteParams = RuleDeleteParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponse = delete(params.toBuilder().ruleId(ruleId).build(), requestOptions) + + /** @see delete */ + @MustBeClosed + fun delete( + ruleId: String, + params: RuleDeleteParams = RuleDeleteParams.none(), + ): HttpResponse = delete(ruleId, params, RequestOptions.none()) + + /** @see delete */ + @MustBeClosed + fun delete( + params: RuleDeleteParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponse + + /** @see delete */ + @MustBeClosed + fun delete(params: RuleDeleteParams): HttpResponse = delete(params, RequestOptions.none()) + + /** @see delete */ + @MustBeClosed + fun delete(ruleId: String, requestOptions: RequestOptions): HttpResponse = + delete(ruleId, RuleDeleteParams.none(), requestOptions) + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/RuleServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/RuleServiceImpl.kt new file mode 100644 index 00000000..703fd752 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/RuleServiceImpl.kt @@ -0,0 +1,232 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.blocking.governance + +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.handlers.emptyHandler +import com.openlayer.api.core.handlers.errorBodyHandler +import com.openlayer.api.core.handlers.errorHandler +import com.openlayer.api.core.handlers.jsonHandler +import com.openlayer.api.core.http.HttpMethod +import com.openlayer.api.core.http.HttpRequest +import com.openlayer.api.core.http.HttpResponse +import com.openlayer.api.core.http.HttpResponse.Handler +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.core.http.json +import com.openlayer.api.core.http.parseable +import com.openlayer.api.core.prepare +import com.openlayer.api.models.governance.rules.RuleCreateParams +import com.openlayer.api.models.governance.rules.RuleCreateResponse +import com.openlayer.api.models.governance.rules.RuleDeleteParams +import com.openlayer.api.models.governance.rules.RuleListParams +import com.openlayer.api.models.governance.rules.RuleListResponse +import com.openlayer.api.models.governance.rules.RuleRetrieveParams +import com.openlayer.api.models.governance.rules.RuleRetrieveResponse +import com.openlayer.api.models.governance.rules.RuleUpdateParams +import com.openlayer.api.models.governance.rules.RuleUpdateResponse +import java.util.function.Consumer +import kotlin.jvm.optionals.getOrNull + +class RuleServiceImpl internal constructor(private val clientOptions: ClientOptions) : RuleService { + + private val withRawResponse: RuleService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): RuleService.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): RuleService = + RuleServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun create( + params: RuleCreateParams, + requestOptions: RequestOptions, + ): RuleCreateResponse = + // post /workspaces/{workspaceId}/rules + withRawResponse().create(params, requestOptions).parse() + + override fun retrieve( + params: RuleRetrieveParams, + requestOptions: RequestOptions, + ): RuleRetrieveResponse = + // get /rules/{ruleId} + withRawResponse().retrieve(params, requestOptions).parse() + + override fun update( + params: RuleUpdateParams, + requestOptions: RequestOptions, + ): RuleUpdateResponse = + // put /rules/{ruleId} + withRawResponse().update(params, requestOptions).parse() + + override fun list(params: RuleListParams, requestOptions: RequestOptions): RuleListResponse = + // get /workspaces/{workspaceId}/rules + withRawResponse().list(params, requestOptions).parse() + + override fun delete(params: RuleDeleteParams, requestOptions: RequestOptions) { + // delete /rules/{ruleId} + withRawResponse().delete(params, requestOptions) + } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + RuleService.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + override fun withOptions( + modifier: Consumer + ): RuleService.WithRawResponse = + RuleServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun create( + params: RuleCreateParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("workspaceId", params.workspaceId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("workspaces", params._pathParam(0), "rules") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun retrieve( + params: RuleRetrieveParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("ruleId", params.ruleId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("rules", params._pathParam(0)) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { retrieveHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val updateHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun update( + params: RuleUpdateParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("ruleId", params.ruleId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.PUT) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("rules", params._pathParam(0)) + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { updateHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun list( + params: RuleListParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("workspaceId", params.workspaceId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("workspaces", params._pathParam(0), "rules") + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val deleteHandler: Handler = emptyHandler() + + override fun delete( + params: RuleDeleteParams, + requestOptions: RequestOptions, + ): HttpResponse { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("ruleId", params.ruleId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.DELETE) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("rules", params._pathParam(0)) + .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response.use { deleteHandler.handle(it) } + } + } + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/RuleStatService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/RuleStatService.kt new file mode 100644 index 00000000..cc727c61 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/RuleStatService.kt @@ -0,0 +1,120 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.blocking.governance + +import com.google.errorprone.annotations.MustBeClosed +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.models.governance.rulestats.RuleStatRetrieveParams +import com.openlayer.api.models.governance.rulestats.RuleStatRetrieveResponse +import java.util.function.Consumer + +interface RuleStatService { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): RuleStatService + + /** + * Get a compliance roll-up for a workspace: how many rules exist, and how many of their results + * are passing, failing, pending, or due for renewal. + * + * Counts respect the filters you pass, so `frameworkId` gives you a single framework's overall + * compliance and `projectId` gives you a single project's. + */ + fun retrieve(workspaceId: String): RuleStatRetrieveResponse = + retrieve(workspaceId, RuleStatRetrieveParams.none()) + + /** @see retrieve */ + fun retrieve( + workspaceId: String, + params: RuleStatRetrieveParams = RuleStatRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): RuleStatRetrieveResponse = + retrieve(params.toBuilder().workspaceId(workspaceId).build(), requestOptions) + + /** @see retrieve */ + fun retrieve( + workspaceId: String, + params: RuleStatRetrieveParams = RuleStatRetrieveParams.none(), + ): RuleStatRetrieveResponse = retrieve(workspaceId, params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + params: RuleStatRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): RuleStatRetrieveResponse + + /** @see retrieve */ + fun retrieve(params: RuleStatRetrieveParams): RuleStatRetrieveResponse = + retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve(workspaceId: String, requestOptions: RequestOptions): RuleStatRetrieveResponse = + retrieve(workspaceId, RuleStatRetrieveParams.none(), requestOptions) + + /** A view of [RuleStatService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): RuleStatService.WithRawResponse + + /** + * Returns a raw HTTP response for `get /workspaces/{workspaceId}/rule-stats`, but is + * otherwise the same as [RuleStatService.retrieve]. + */ + @MustBeClosed + fun retrieve(workspaceId: String): HttpResponseFor = + retrieve(workspaceId, RuleStatRetrieveParams.none()) + + /** @see retrieve */ + @MustBeClosed + fun retrieve( + workspaceId: String, + params: RuleStatRetrieveParams = RuleStatRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + retrieve(params.toBuilder().workspaceId(workspaceId).build(), requestOptions) + + /** @see retrieve */ + @MustBeClosed + fun retrieve( + workspaceId: String, + params: RuleStatRetrieveParams = RuleStatRetrieveParams.none(), + ): HttpResponseFor = + retrieve(workspaceId, params, RequestOptions.none()) + + /** @see retrieve */ + @MustBeClosed + fun retrieve( + params: RuleStatRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see retrieve */ + @MustBeClosed + fun retrieve(params: RuleStatRetrieveParams): HttpResponseFor = + retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + @MustBeClosed + fun retrieve( + workspaceId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + retrieve(workspaceId, RuleStatRetrieveParams.none(), requestOptions) + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/RuleStatServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/RuleStatServiceImpl.kt new file mode 100644 index 00000000..bd24102d --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/RuleStatServiceImpl.kt @@ -0,0 +1,85 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.blocking.governance + +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.handlers.errorBodyHandler +import com.openlayer.api.core.handlers.errorHandler +import com.openlayer.api.core.handlers.jsonHandler +import com.openlayer.api.core.http.HttpMethod +import com.openlayer.api.core.http.HttpRequest +import com.openlayer.api.core.http.HttpResponse +import com.openlayer.api.core.http.HttpResponse.Handler +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.core.http.parseable +import com.openlayer.api.core.prepare +import com.openlayer.api.models.governance.rulestats.RuleStatRetrieveParams +import com.openlayer.api.models.governance.rulestats.RuleStatRetrieveResponse +import java.util.function.Consumer +import kotlin.jvm.optionals.getOrNull + +class RuleStatServiceImpl internal constructor(private val clientOptions: ClientOptions) : + RuleStatService { + + private val withRawResponse: RuleStatService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): RuleStatService.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): RuleStatService = + RuleStatServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun retrieve( + params: RuleStatRetrieveParams, + requestOptions: RequestOptions, + ): RuleStatRetrieveResponse = + // get /workspaces/{workspaceId}/rule-stats + withRawResponse().retrieve(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + RuleStatService.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + override fun withOptions( + modifier: Consumer + ): RuleStatService.WithRawResponse = + RuleStatServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun retrieve( + params: RuleStatRetrieveParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("workspaceId", params.workspaceId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("workspaces", params._pathParam(0), "rule-stats") + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { retrieveHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/RuleTagService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/RuleTagService.kt new file mode 100644 index 00000000..c66cee2b --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/RuleTagService.kt @@ -0,0 +1,117 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.blocking.governance + +import com.google.errorprone.annotations.MustBeClosed +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.models.governance.ruletags.RuleTagListParams +import com.openlayer.api.models.governance.ruletags.RuleTagListResponse +import java.util.function.Consumer + +interface RuleTagService { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): RuleTagService + + /** + * List the rule tags in a workspace. + * + * Tags group rules across frameworks, for example by team or by control family. Use the ids + * returned here with the `tags` filter on + * [List rules](/api-reference/rest/governance/list-rules). + */ + fun list(workspaceId: String): RuleTagListResponse = list(workspaceId, RuleTagListParams.none()) + + /** @see list */ + fun list( + workspaceId: String, + params: RuleTagListParams = RuleTagListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): RuleTagListResponse = + list(params.toBuilder().workspaceId(workspaceId).build(), requestOptions) + + /** @see list */ + fun list( + workspaceId: String, + params: RuleTagListParams = RuleTagListParams.none(), + ): RuleTagListResponse = list(workspaceId, params, RequestOptions.none()) + + /** @see list */ + fun list( + params: RuleTagListParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): RuleTagListResponse + + /** @see list */ + fun list(params: RuleTagListParams): RuleTagListResponse = list(params, RequestOptions.none()) + + /** @see list */ + fun list(workspaceId: String, requestOptions: RequestOptions): RuleTagListResponse = + list(workspaceId, RuleTagListParams.none(), requestOptions) + + /** A view of [RuleTagService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): RuleTagService.WithRawResponse + + /** + * Returns a raw HTTP response for `get /workspaces/{workspaceId}/rule-tags`, but is + * otherwise the same as [RuleTagService.list]. + */ + @MustBeClosed + fun list(workspaceId: String): HttpResponseFor = + list(workspaceId, RuleTagListParams.none()) + + /** @see list */ + @MustBeClosed + fun list( + workspaceId: String, + params: RuleTagListParams = RuleTagListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + list(params.toBuilder().workspaceId(workspaceId).build(), requestOptions) + + /** @see list */ + @MustBeClosed + fun list( + workspaceId: String, + params: RuleTagListParams = RuleTagListParams.none(), + ): HttpResponseFor = list(workspaceId, params, RequestOptions.none()) + + /** @see list */ + @MustBeClosed + fun list( + params: RuleTagListParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see list */ + @MustBeClosed + fun list(params: RuleTagListParams): HttpResponseFor = + list(params, RequestOptions.none()) + + /** @see list */ + @MustBeClosed + fun list( + workspaceId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + list(workspaceId, RuleTagListParams.none(), requestOptions) + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/RuleTagServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/RuleTagServiceImpl.kt new file mode 100644 index 00000000..5318e57f --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/RuleTagServiceImpl.kt @@ -0,0 +1,85 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.blocking.governance + +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.handlers.errorBodyHandler +import com.openlayer.api.core.handlers.errorHandler +import com.openlayer.api.core.handlers.jsonHandler +import com.openlayer.api.core.http.HttpMethod +import com.openlayer.api.core.http.HttpRequest +import com.openlayer.api.core.http.HttpResponse +import com.openlayer.api.core.http.HttpResponse.Handler +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.core.http.parseable +import com.openlayer.api.core.prepare +import com.openlayer.api.models.governance.ruletags.RuleTagListParams +import com.openlayer.api.models.governance.ruletags.RuleTagListResponse +import java.util.function.Consumer +import kotlin.jvm.optionals.getOrNull + +class RuleTagServiceImpl internal constructor(private val clientOptions: ClientOptions) : + RuleTagService { + + private val withRawResponse: RuleTagService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): RuleTagService.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): RuleTagService = + RuleTagServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun list( + params: RuleTagListParams, + requestOptions: RequestOptions, + ): RuleTagListResponse = + // get /workspaces/{workspaceId}/rule-tags + withRawResponse().list(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + RuleTagService.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + override fun withOptions( + modifier: Consumer + ): RuleTagService.WithRawResponse = + RuleTagServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun list( + params: RuleTagListParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("workspaceId", params.workspaceId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("workspaces", params._pathParam(0), "rule-tags") + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/frameworks/DocumentService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/frameworks/DocumentService.kt new file mode 100644 index 00000000..8a8779c7 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/frameworks/DocumentService.kt @@ -0,0 +1,180 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.blocking.governance.frameworks + +import com.google.errorprone.annotations.MustBeClosed +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.models.governance.frameworks.documents.DocumentListParams +import com.openlayer.api.models.governance.frameworks.documents.DocumentListResponse +import com.openlayer.api.models.governance.frameworks.documents.DocumentRetrieveParams +import com.openlayer.api.models.governance.frameworks.documents.DocumentRetrieveResponse +import java.util.function.Consumer + +interface DocumentService { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): DocumentService + + /** + * Retrieve a framework document, including its sections, subsections, and the rules mapped to + * each. + * + * Each section and subsection carries a `ruleCount`, so you can tell which requirements have + * rules mapped to them before drilling in. + */ + fun retrieve(documentId: String, params: DocumentRetrieveParams): DocumentRetrieveResponse = + retrieve(documentId, params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + documentId: String, + params: DocumentRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): DocumentRetrieveResponse = + retrieve(params.toBuilder().documentId(documentId).build(), requestOptions) + + /** @see retrieve */ + fun retrieve(params: DocumentRetrieveParams): DocumentRetrieveResponse = + retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + params: DocumentRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): DocumentRetrieveResponse + + /** + * List the documents attached to a framework. + * + * A document holds the text of the standard the framework is based on, split into sections and + * subsections. Retrieve a single document to get that structure, along with the rules mapped to + * each part of it. + */ + fun list(frameworkId: String): DocumentListResponse = + list(frameworkId, DocumentListParams.none()) + + /** @see list */ + fun list( + frameworkId: String, + params: DocumentListParams = DocumentListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): DocumentListResponse = + list(params.toBuilder().frameworkId(frameworkId).build(), requestOptions) + + /** @see list */ + fun list( + frameworkId: String, + params: DocumentListParams = DocumentListParams.none(), + ): DocumentListResponse = list(frameworkId, params, RequestOptions.none()) + + /** @see list */ + fun list( + params: DocumentListParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): DocumentListResponse + + /** @see list */ + fun list(params: DocumentListParams): DocumentListResponse = list(params, RequestOptions.none()) + + /** @see list */ + fun list(frameworkId: String, requestOptions: RequestOptions): DocumentListResponse = + list(frameworkId, DocumentListParams.none(), requestOptions) + + /** A view of [DocumentService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): DocumentService.WithRawResponse + + /** + * Returns a raw HTTP response for `get /frameworks/{frameworkId}/documents/{documentId}`, + * but is otherwise the same as [DocumentService.retrieve]. + */ + @MustBeClosed + fun retrieve( + documentId: String, + params: DocumentRetrieveParams, + ): HttpResponseFor = + retrieve(documentId, params, RequestOptions.none()) + + /** @see retrieve */ + @MustBeClosed + fun retrieve( + documentId: String, + params: DocumentRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + retrieve(params.toBuilder().documentId(documentId).build(), requestOptions) + + /** @see retrieve */ + @MustBeClosed + fun retrieve(params: DocumentRetrieveParams): HttpResponseFor = + retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + @MustBeClosed + fun retrieve( + params: DocumentRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** + * Returns a raw HTTP response for `get /frameworks/{frameworkId}/documents`, but is + * otherwise the same as [DocumentService.list]. + */ + @MustBeClosed + fun list(frameworkId: String): HttpResponseFor = + list(frameworkId, DocumentListParams.none()) + + /** @see list */ + @MustBeClosed + fun list( + frameworkId: String, + params: DocumentListParams = DocumentListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + list(params.toBuilder().frameworkId(frameworkId).build(), requestOptions) + + /** @see list */ + @MustBeClosed + fun list( + frameworkId: String, + params: DocumentListParams = DocumentListParams.none(), + ): HttpResponseFor = list(frameworkId, params, RequestOptions.none()) + + /** @see list */ + @MustBeClosed + fun list( + params: DocumentListParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see list */ + @MustBeClosed + fun list(params: DocumentListParams): HttpResponseFor = + list(params, RequestOptions.none()) + + /** @see list */ + @MustBeClosed + fun list( + frameworkId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + list(frameworkId, DocumentListParams.none(), requestOptions) + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/frameworks/DocumentServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/frameworks/DocumentServiceImpl.kt new file mode 100644 index 00000000..6376e427 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/frameworks/DocumentServiceImpl.kt @@ -0,0 +1,129 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.blocking.governance.frameworks + +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.handlers.errorBodyHandler +import com.openlayer.api.core.handlers.errorHandler +import com.openlayer.api.core.handlers.jsonHandler +import com.openlayer.api.core.http.HttpMethod +import com.openlayer.api.core.http.HttpRequest +import com.openlayer.api.core.http.HttpResponse +import com.openlayer.api.core.http.HttpResponse.Handler +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.core.http.parseable +import com.openlayer.api.core.prepare +import com.openlayer.api.models.governance.frameworks.documents.DocumentListParams +import com.openlayer.api.models.governance.frameworks.documents.DocumentListResponse +import com.openlayer.api.models.governance.frameworks.documents.DocumentRetrieveParams +import com.openlayer.api.models.governance.frameworks.documents.DocumentRetrieveResponse +import java.util.function.Consumer +import kotlin.jvm.optionals.getOrNull + +class DocumentServiceImpl internal constructor(private val clientOptions: ClientOptions) : + DocumentService { + + private val withRawResponse: DocumentService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): DocumentService.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): DocumentService = + DocumentServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun retrieve( + params: DocumentRetrieveParams, + requestOptions: RequestOptions, + ): DocumentRetrieveResponse = + // get /frameworks/{frameworkId}/documents/{documentId} + withRawResponse().retrieve(params, requestOptions).parse() + + override fun list( + params: DocumentListParams, + requestOptions: RequestOptions, + ): DocumentListResponse = + // get /frameworks/{frameworkId}/documents + withRawResponse().list(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + DocumentService.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + override fun withOptions( + modifier: Consumer + ): DocumentService.WithRawResponse = + DocumentServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun retrieve( + params: DocumentRetrieveParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("documentId", params.documentId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments( + "frameworks", + params._pathParam(0), + "documents", + params._pathParam(1), + ) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { retrieveHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun list( + params: DocumentListParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("frameworkId", params.frameworkId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("frameworks", params._pathParam(0), "documents") + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/frameworks/SectionService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/frameworks/SectionService.kt new file mode 100644 index 00000000..8fa08f3a --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/frameworks/SectionService.kt @@ -0,0 +1,97 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.blocking.governance.frameworks + +import com.google.errorprone.annotations.MustBeClosed +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.models.governance.frameworks.sections.SectionListRulesParams +import com.openlayer.api.models.governance.frameworks.sections.SectionListRulesResponse +import java.util.function.Consumer + +interface SectionService { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): SectionService + + /** + * List the rules mapped to a section of a framework document. + * + * Pass `includeSubsectionRules=true` to also return the rules mapped to the section's + * subsections, which is how you get every rule covering a requirement and everything under it. + */ + fun listRules(sectionId: String, params: SectionListRulesParams): SectionListRulesResponse = + listRules(sectionId, params, RequestOptions.none()) + + /** @see listRules */ + fun listRules( + sectionId: String, + params: SectionListRulesParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): SectionListRulesResponse = + listRules(params.toBuilder().sectionId(sectionId).build(), requestOptions) + + /** @see listRules */ + fun listRules(params: SectionListRulesParams): SectionListRulesResponse = + listRules(params, RequestOptions.none()) + + /** @see listRules */ + fun listRules( + params: SectionListRulesParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): SectionListRulesResponse + + /** A view of [SectionService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): SectionService.WithRawResponse + + /** + * Returns a raw HTTP response for `get + * /frameworks/{frameworkId}/sections/{sectionId}/rules`, but is otherwise the same as + * [SectionService.listRules]. + */ + @MustBeClosed + fun listRules( + sectionId: String, + params: SectionListRulesParams, + ): HttpResponseFor = + listRules(sectionId, params, RequestOptions.none()) + + /** @see listRules */ + @MustBeClosed + fun listRules( + sectionId: String, + params: SectionListRulesParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + listRules(params.toBuilder().sectionId(sectionId).build(), requestOptions) + + /** @see listRules */ + @MustBeClosed + fun listRules(params: SectionListRulesParams): HttpResponseFor = + listRules(params, RequestOptions.none()) + + /** @see listRules */ + @MustBeClosed + fun listRules( + params: SectionListRulesParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/frameworks/SectionServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/frameworks/SectionServiceImpl.kt new file mode 100644 index 00000000..b79e09dd --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/frameworks/SectionServiceImpl.kt @@ -0,0 +1,91 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.blocking.governance.frameworks + +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.handlers.errorBodyHandler +import com.openlayer.api.core.handlers.errorHandler +import com.openlayer.api.core.handlers.jsonHandler +import com.openlayer.api.core.http.HttpMethod +import com.openlayer.api.core.http.HttpRequest +import com.openlayer.api.core.http.HttpResponse +import com.openlayer.api.core.http.HttpResponse.Handler +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.core.http.parseable +import com.openlayer.api.core.prepare +import com.openlayer.api.models.governance.frameworks.sections.SectionListRulesParams +import com.openlayer.api.models.governance.frameworks.sections.SectionListRulesResponse +import java.util.function.Consumer +import kotlin.jvm.optionals.getOrNull + +class SectionServiceImpl internal constructor(private val clientOptions: ClientOptions) : + SectionService { + + private val withRawResponse: SectionService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): SectionService.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): SectionService = + SectionServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun listRules( + params: SectionListRulesParams, + requestOptions: RequestOptions, + ): SectionListRulesResponse = + // get /frameworks/{frameworkId}/sections/{sectionId}/rules + withRawResponse().listRules(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + SectionService.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + override fun withOptions( + modifier: Consumer + ): SectionService.WithRawResponse = + SectionServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + private val listRulesHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun listRules( + params: SectionListRulesParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("sectionId", params.sectionId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments( + "frameworks", + params._pathParam(0), + "sections", + params._pathParam(1), + "rules", + ) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { listRulesHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/frameworks/SubsectionService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/frameworks/SubsectionService.kt new file mode 100644 index 00000000..2286f214 --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/frameworks/SubsectionService.kt @@ -0,0 +1,102 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.blocking.governance.frameworks + +import com.google.errorprone.annotations.MustBeClosed +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.models.governance.frameworks.subsections.SubsectionListRulesParams +import com.openlayer.api.models.governance.frameworks.subsections.SubsectionListRulesResponse +import java.util.function.Consumer + +interface SubsectionService { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): SubsectionService + + /** + * List the rules mapped to a subsection of a framework document. + * + * A subsection is usually the level at which a standard states an individual requirement, so + * this is the endpoint to use when you want to show which rules cover a specific clause. + */ + fun listRules( + subsectionId: String, + params: SubsectionListRulesParams, + ): SubsectionListRulesResponse = listRules(subsectionId, params, RequestOptions.none()) + + /** @see listRules */ + fun listRules( + subsectionId: String, + params: SubsectionListRulesParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): SubsectionListRulesResponse = + listRules(params.toBuilder().subsectionId(subsectionId).build(), requestOptions) + + /** @see listRules */ + fun listRules(params: SubsectionListRulesParams): SubsectionListRulesResponse = + listRules(params, RequestOptions.none()) + + /** @see listRules */ + fun listRules( + params: SubsectionListRulesParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): SubsectionListRulesResponse + + /** A view of [SubsectionService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): SubsectionService.WithRawResponse + + /** + * Returns a raw HTTP response for `get + * /frameworks/{frameworkId}/subsections/{subsectionId}/rules`, but is otherwise the same as + * [SubsectionService.listRules]. + */ + @MustBeClosed + fun listRules( + subsectionId: String, + params: SubsectionListRulesParams, + ): HttpResponseFor = + listRules(subsectionId, params, RequestOptions.none()) + + /** @see listRules */ + @MustBeClosed + fun listRules( + subsectionId: String, + params: SubsectionListRulesParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + listRules(params.toBuilder().subsectionId(subsectionId).build(), requestOptions) + + /** @see listRules */ + @MustBeClosed + fun listRules( + params: SubsectionListRulesParams + ): HttpResponseFor = listRules(params, RequestOptions.none()) + + /** @see listRules */ + @MustBeClosed + fun listRules( + params: SubsectionListRulesParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/frameworks/SubsectionServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/frameworks/SubsectionServiceImpl.kt new file mode 100644 index 00000000..42f655fe --- /dev/null +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/governance/frameworks/SubsectionServiceImpl.kt @@ -0,0 +1,91 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.blocking.governance.frameworks + +import com.openlayer.api.core.ClientOptions +import com.openlayer.api.core.RequestOptions +import com.openlayer.api.core.checkRequired +import com.openlayer.api.core.handlers.errorBodyHandler +import com.openlayer.api.core.handlers.errorHandler +import com.openlayer.api.core.handlers.jsonHandler +import com.openlayer.api.core.http.HttpMethod +import com.openlayer.api.core.http.HttpRequest +import com.openlayer.api.core.http.HttpResponse +import com.openlayer.api.core.http.HttpResponse.Handler +import com.openlayer.api.core.http.HttpResponseFor +import com.openlayer.api.core.http.parseable +import com.openlayer.api.core.prepare +import com.openlayer.api.models.governance.frameworks.subsections.SubsectionListRulesParams +import com.openlayer.api.models.governance.frameworks.subsections.SubsectionListRulesResponse +import java.util.function.Consumer +import kotlin.jvm.optionals.getOrNull + +class SubsectionServiceImpl internal constructor(private val clientOptions: ClientOptions) : + SubsectionService { + + private val withRawResponse: SubsectionService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): SubsectionService.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): SubsectionService = + SubsectionServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun listRules( + params: SubsectionListRulesParams, + requestOptions: RequestOptions, + ): SubsectionListRulesResponse = + // get /frameworks/{frameworkId}/subsections/{subsectionId}/rules + withRawResponse().listRules(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + SubsectionService.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + override fun withOptions( + modifier: Consumer + ): SubsectionService.WithRawResponse = + SubsectionServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + private val listRulesHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun listRules( + params: SubsectionListRulesParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("subsectionId", params.subsectionId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments( + "frameworks", + params._pathParam(0), + "subsections", + params._pathParam(1), + "rules", + ) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { listRulesHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } +} diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlService.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlService.kt index baf0099c..69e5bc92 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlService.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlService.kt @@ -8,6 +8,8 @@ import com.openlayer.api.core.RequestOptions import com.openlayer.api.core.http.HttpResponseFor import com.openlayer.api.models.storage.presignedurl.PresignedUrlCreateParams import com.openlayer.api.models.storage.presignedurl.PresignedUrlCreateResponse +import com.openlayer.api.models.storage.presignedurl.PresignedUrlRetrieveParams +import com.openlayer.api.models.storage.presignedurl.PresignedUrlRetrieveResponse import java.util.function.Consumer interface PresignedUrlService { @@ -34,6 +36,26 @@ interface PresignedUrlService { requestOptions: RequestOptions = RequestOptions.none(), ): PresignedUrlCreateResponse + /** + * Exchange a `storageUri` for a short-lived presigned url you can download the object from. + * + * Use it to collect anything the platform stored on your behalf -- for example the archive a + * framework export leaves behind, whose `storageUri` comes back in the background task's + * `outputs`. + * + * The workspace is taken from the API key, so there is nothing else to send. The url is only + * issued for objects your workspace owns, and `404` covers both "no such object" and "not + * yours". + */ + fun retrieve(params: PresignedUrlRetrieveParams): PresignedUrlRetrieveResponse = + retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + params: PresignedUrlRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): PresignedUrlRetrieveResponse + /** * A view of [PresignedUrlService] that provides access to raw HTTP responses for each method. */ @@ -62,5 +84,21 @@ interface PresignedUrlService { params: PresignedUrlCreateParams, requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + + /** + * Returns a raw HTTP response for `get /storage/presigned-url`, but is otherwise the same + * as [PresignedUrlService.retrieve]. + */ + @MustBeClosed + fun retrieve( + params: PresignedUrlRetrieveParams + ): HttpResponseFor = retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + @MustBeClosed + fun retrieve( + params: PresignedUrlRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor } } diff --git a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceImpl.kt b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceImpl.kt index e5180481..f0577ac2 100644 --- a/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceImpl.kt +++ b/openlayer-java-core/src/main/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceImpl.kt @@ -17,6 +17,8 @@ import com.openlayer.api.core.http.parseable import com.openlayer.api.core.prepare import com.openlayer.api.models.storage.presignedurl.PresignedUrlCreateParams import com.openlayer.api.models.storage.presignedurl.PresignedUrlCreateResponse +import com.openlayer.api.models.storage.presignedurl.PresignedUrlRetrieveParams +import com.openlayer.api.models.storage.presignedurl.PresignedUrlRetrieveResponse import java.util.function.Consumer class PresignedUrlServiceImpl internal constructor(private val clientOptions: ClientOptions) : @@ -38,6 +40,13 @@ class PresignedUrlServiceImpl internal constructor(private val clientOptions: Cl // post /storage/presigned-url withRawResponse().create(params, requestOptions).parse() + override fun retrieve( + params: PresignedUrlRetrieveParams, + requestOptions: RequestOptions, + ): PresignedUrlRetrieveResponse = + // get /storage/presigned-url + withRawResponse().retrieve(params, requestOptions).parse() + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : PresignedUrlService.WithRawResponse { @@ -78,5 +87,32 @@ class PresignedUrlServiceImpl internal constructor(private val clientOptions: Cl } } } + + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun retrieve( + params: PresignedUrlRetrieveParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("storage", "presigned-url") + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { retrieveHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/backgroundtasks/BackgroundTaskRetrieveParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/backgroundtasks/BackgroundTaskRetrieveParamsTest.kt new file mode 100644 index 00000000..c1a579e9 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/backgroundtasks/BackgroundTaskRetrieveParamsTest.kt @@ -0,0 +1,28 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.backgroundtasks + +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class BackgroundTaskRetrieveParamsTest { + + @Test + fun create() { + BackgroundTaskRetrieveParams.builder() + .taskId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + } + + @Test + fun pathParams() { + val params = + BackgroundTaskRetrieveParams.builder() + .taskId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + + assertThat(params._pathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/backgroundtasks/BackgroundTaskRetrieveResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/backgroundtasks/BackgroundTaskRetrieveResponseTest.kt new file mode 100644 index 00000000..ff6e4c5b --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/backgroundtasks/BackgroundTaskRetrieveResponseTest.kt @@ -0,0 +1,103 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.backgroundtasks + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.jsonMapper +import java.time.OffsetDateTime +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class BackgroundTaskRetrieveResponseTest { + + @Test + fun create() { + val backgroundTaskRetrieveResponse = + BackgroundTaskRetrieveResponse.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .complete(true) + .dateCreated(OffsetDateTime.parse("2026-09-15T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-09-15T11:33:47.902Z")) + .name( + "ExportFrameworkRunner(framework_id=9f1b3c2d-4e5a-4f60-8a71-2b3c4d5e6f70, project_id=None)" + ) + .progress(95.0f) + .error("error") + .outputs( + JsonValue.from( + mapOf( + "storageUri" to "s3://openlayer-storage/exports/soc2-2026-09-15.zip", + "filename" to "soc2-2026-09-15.zip", + "controlCount" to 64, + "evidenceCount" to 51, + "missingEvidenceCount" to 13, + ) + ) + ) + .build() + + assertThat(backgroundTaskRetrieveResponse.id()) + .isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(backgroundTaskRetrieveResponse.complete()).isEqualTo(true) + assertThat(backgroundTaskRetrieveResponse.dateCreated()) + .isEqualTo(OffsetDateTime.parse("2026-09-15T11:31:01.185Z")) + assertThat(backgroundTaskRetrieveResponse.dateUpdated()) + .isEqualTo(OffsetDateTime.parse("2026-09-15T11:33:47.902Z")) + assertThat(backgroundTaskRetrieveResponse.name()) + .isEqualTo( + "ExportFrameworkRunner(framework_id=9f1b3c2d-4e5a-4f60-8a71-2b3c4d5e6f70, project_id=None)" + ) + assertThat(backgroundTaskRetrieveResponse.progress()).isEqualTo(95.0f) + assertThat(backgroundTaskRetrieveResponse.error()).contains("error") + assertThat(backgroundTaskRetrieveResponse._outputs()) + .isEqualTo( + JsonValue.from( + mapOf( + "storageUri" to "s3://openlayer-storage/exports/soc2-2026-09-15.zip", + "filename" to "soc2-2026-09-15.zip", + "controlCount" to 64, + "evidenceCount" to 51, + "missingEvidenceCount" to 13, + ) + ) + ) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val backgroundTaskRetrieveResponse = + BackgroundTaskRetrieveResponse.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .complete(true) + .dateCreated(OffsetDateTime.parse("2026-09-15T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-09-15T11:33:47.902Z")) + .name( + "ExportFrameworkRunner(framework_id=9f1b3c2d-4e5a-4f60-8a71-2b3c4d5e6f70, project_id=None)" + ) + .progress(95.0f) + .error("error") + .outputs( + JsonValue.from( + mapOf( + "storageUri" to "s3://openlayer-storage/exports/soc2-2026-09-15.zip", + "filename" to "soc2-2026-09-15.zip", + "controlCount" to 64, + "evidenceCount" to 51, + "missingEvidenceCount" to 13, + ) + ) + ) + .build() + + val roundtrippedBackgroundTaskRetrieveResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(backgroundTaskRetrieveResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBackgroundTaskRetrieveResponse) + .isEqualTo(backgroundTaskRetrieveResponse) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkCreateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkCreateParamsTest.kt new file mode 100644 index 00000000..451d18bf --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkCreateParamsTest.kt @@ -0,0 +1,110 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.frameworks + +import com.openlayer.api.core.JsonValue +import kotlin.jvm.optionals.getOrNull +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class FrameworkCreateParamsTest { + + @Test + fun create() { + FrameworkCreateParams.builder() + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .name("EU AI Act") + .description("Requirements for high-risk AI systems under the EU AI Act.") + .enabled(true) + .projectSelector( + FrameworkCreateParams.ProjectSelector.builder() + .addMatch( + FrameworkCreateParams.ProjectSelector.Match.builder() + .property( + FrameworkCreateParams.ProjectSelector.Match.Property.RISK_LEVEL + ) + .value(JsonValue.from(listOf("high", "critical"))) + .operator("operator") + .build() + ) + .build() + ) + .addTag("regulation") + .addTag("eu") + .build() + } + + @Test + fun pathParams() { + val params = + FrameworkCreateParams.builder() + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .name("EU AI Act") + .build() + + assertThat(params._pathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } + + @Test + fun body() { + val params = + FrameworkCreateParams.builder() + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .name("EU AI Act") + .description("Requirements for high-risk AI systems under the EU AI Act.") + .enabled(true) + .projectSelector( + FrameworkCreateParams.ProjectSelector.builder() + .addMatch( + FrameworkCreateParams.ProjectSelector.Match.builder() + .property( + FrameworkCreateParams.ProjectSelector.Match.Property.RISK_LEVEL + ) + .value(JsonValue.from(listOf("high", "critical"))) + .operator("operator") + .build() + ) + .build() + ) + .addTag("regulation") + .addTag("eu") + .build() + + val body = params._body() + + assertThat(body.name()).isEqualTo("EU AI Act") + assertThat(body.description()) + .contains("Requirements for high-risk AI systems under the EU AI Act.") + assertThat(body.enabled()).contains(true) + assertThat(body.projectSelector()) + .contains( + FrameworkCreateParams.ProjectSelector.builder() + .addMatch( + FrameworkCreateParams.ProjectSelector.Match.builder() + .property( + FrameworkCreateParams.ProjectSelector.Match.Property.RISK_LEVEL + ) + .value(JsonValue.from(listOf("high", "critical"))) + .operator("operator") + .build() + ) + .build() + ) + assertThat(body.tags().getOrNull()).containsExactly("regulation", "eu") + } + + @Test + fun bodyWithoutOptionalFields() { + val params = + FrameworkCreateParams.builder() + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .name("EU AI Act") + .build() + + val body = params._body() + + assertThat(body.name()).isEqualTo("EU AI Act") + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkCreateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkCreateResponseTest.kt new file mode 100644 index 00000000..72cdd571 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkCreateResponseTest.kt @@ -0,0 +1,227 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.frameworks + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.jsonMapper +import java.time.OffsetDateTime +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class FrameworkCreateResponseTest { + + @Test + fun create() { + val frameworkCreateResponse = + FrameworkCreateResponse.builder() + .id("9f1b3c2d-4e5a-4f60-8a71-2b3c4d5e6f70") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .enabled(true) + .name("EU AI Act") + .addTag("regulation") + .addTag("eu") + .workspaceId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .avatar( + FrameworkCreateResponse.Avatar.builder() + .type(FrameworkCreateResponse.Avatar.Type.EMOJI) + .value("🧭") + .build() + ) + .builtInSlug("eu_ai_act") + .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .description("Requirements for high-risk AI systems under the EU AI Act.") + .extendedDescription( + FrameworkCreateResponse.ExtendedDescription.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .href("href") + .immutable(true) + .projectSelector( + FrameworkCreateResponse.ProjectSelector.builder() + .addMatch( + FrameworkCreateResponse.ProjectSelector.Match.builder() + .property( + FrameworkCreateResponse.ProjectSelector.Match.Property + .RISK_LEVEL + ) + .value(JsonValue.from(listOf("high", "critical"))) + .operator("operator") + .build() + ) + .build() + ) + .ruleStats( + FrameworkCreateResponse.RuleStats.builder() + .projectCompletion( + FrameworkCreateResponse.RuleStats.ProjectCompletion.builder() + .high(0L) + .low(0L) + .mid(0L) + .build() + ) + .ruleResults( + FrameworkCreateResponse.RuleStats.RuleResults.builder() + .total(0L) + .totalDueSoon(0L) + .totalError(0L) + .totalFailing(0L) + .totalPassing(0L) + .totalPending(0L) + .totalRunning(0L) + .totalSkipped(0L) + .build() + ) + .build() + ) + .build() + + assertThat(frameworkCreateResponse.id()).isEqualTo("9f1b3c2d-4e5a-4f60-8a71-2b3c4d5e6f70") + assertThat(frameworkCreateResponse.dateCreated()) + .isEqualTo(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + assertThat(frameworkCreateResponse.dateUpdated()) + .isEqualTo(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + assertThat(frameworkCreateResponse.enabled()).isEqualTo(true) + assertThat(frameworkCreateResponse.name()).isEqualTo("EU AI Act") + assertThat(frameworkCreateResponse.tags()).containsExactly("regulation", "eu") + assertThat(frameworkCreateResponse.workspaceId()) + .isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(frameworkCreateResponse.avatar()) + .contains( + FrameworkCreateResponse.Avatar.builder() + .type(FrameworkCreateResponse.Avatar.Type.EMOJI) + .value("🧭") + .build() + ) + assertThat(frameworkCreateResponse.builtInSlug()).contains("eu_ai_act") + assertThat(frameworkCreateResponse.creatorId()) + .contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(frameworkCreateResponse.description()) + .contains("Requirements for high-risk AI systems under the EU AI Act.") + assertThat(frameworkCreateResponse.extendedDescription()) + .contains( + FrameworkCreateResponse.ExtendedDescription.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + assertThat(frameworkCreateResponse.href()).contains("href") + assertThat(frameworkCreateResponse.immutable()).contains(true) + assertThat(frameworkCreateResponse.projectSelector()) + .contains( + FrameworkCreateResponse.ProjectSelector.builder() + .addMatch( + FrameworkCreateResponse.ProjectSelector.Match.builder() + .property( + FrameworkCreateResponse.ProjectSelector.Match.Property.RISK_LEVEL + ) + .value(JsonValue.from(listOf("high", "critical"))) + .operator("operator") + .build() + ) + .build() + ) + assertThat(frameworkCreateResponse.ruleStats()) + .contains( + FrameworkCreateResponse.RuleStats.builder() + .projectCompletion( + FrameworkCreateResponse.RuleStats.ProjectCompletion.builder() + .high(0L) + .low(0L) + .mid(0L) + .build() + ) + .ruleResults( + FrameworkCreateResponse.RuleStats.RuleResults.builder() + .total(0L) + .totalDueSoon(0L) + .totalError(0L) + .totalFailing(0L) + .totalPassing(0L) + .totalPending(0L) + .totalRunning(0L) + .totalSkipped(0L) + .build() + ) + .build() + ) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val frameworkCreateResponse = + FrameworkCreateResponse.builder() + .id("9f1b3c2d-4e5a-4f60-8a71-2b3c4d5e6f70") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .enabled(true) + .name("EU AI Act") + .addTag("regulation") + .addTag("eu") + .workspaceId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .avatar( + FrameworkCreateResponse.Avatar.builder() + .type(FrameworkCreateResponse.Avatar.Type.EMOJI) + .value("🧭") + .build() + ) + .builtInSlug("eu_ai_act") + .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .description("Requirements for high-risk AI systems under the EU AI Act.") + .extendedDescription( + FrameworkCreateResponse.ExtendedDescription.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .href("href") + .immutable(true) + .projectSelector( + FrameworkCreateResponse.ProjectSelector.builder() + .addMatch( + FrameworkCreateResponse.ProjectSelector.Match.builder() + .property( + FrameworkCreateResponse.ProjectSelector.Match.Property + .RISK_LEVEL + ) + .value(JsonValue.from(listOf("high", "critical"))) + .operator("operator") + .build() + ) + .build() + ) + .ruleStats( + FrameworkCreateResponse.RuleStats.builder() + .projectCompletion( + FrameworkCreateResponse.RuleStats.ProjectCompletion.builder() + .high(0L) + .low(0L) + .mid(0L) + .build() + ) + .ruleResults( + FrameworkCreateResponse.RuleStats.RuleResults.builder() + .total(0L) + .totalDueSoon(0L) + .totalError(0L) + .totalFailing(0L) + .totalPassing(0L) + .totalPending(0L) + .totalRunning(0L) + .totalSkipped(0L) + .build() + ) + .build() + ) + .build() + + val roundtrippedFrameworkCreateResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(frameworkCreateResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedFrameworkCreateResponse).isEqualTo(frameworkCreateResponse) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkExportParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkExportParamsTest.kt new file mode 100644 index 00000000..683ad204 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkExportParamsTest.kt @@ -0,0 +1,52 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.frameworks + +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class FrameworkExportParamsTest { + + @Test + fun create() { + FrameworkExportParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .build() + } + + @Test + fun pathParams() { + val params = + FrameworkExportParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + + assertThat(params._pathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } + + @Test + fun body() { + val params = + FrameworkExportParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .build() + + val body = params._body() + + assertThat(body.projectId()).contains("3fa85f64-5717-4562-b3fc-2c963f66afa6") + } + + @Test + fun bodyWithoutOptionalFields() { + val params = + FrameworkExportParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + + val body = params._body() + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkExportResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkExportResponseTest.kt new file mode 100644 index 00000000..48d618d7 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkExportResponseTest.kt @@ -0,0 +1,43 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.frameworks + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.jsonMapper +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class FrameworkExportResponseTest { + + @Test + fun create() { + val frameworkExportResponse = + FrameworkExportResponse.builder() + .taskResultId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .taskResultUrl("/v1/background-tasks/3fa85f64-5717-4562-b3fc-2c963f66afa6") + .build() + + assertThat(frameworkExportResponse.taskResultId()) + .isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(frameworkExportResponse.taskResultUrl()) + .isEqualTo("/v1/background-tasks/3fa85f64-5717-4562-b3fc-2c963f66afa6") + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val frameworkExportResponse = + FrameworkExportResponse.builder() + .taskResultId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .taskResultUrl("/v1/background-tasks/3fa85f64-5717-4562-b3fc-2c963f66afa6") + .build() + + val roundtrippedFrameworkExportResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(frameworkExportResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedFrameworkExportResponse).isEqualTo(frameworkExportResponse) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListParamsTest.kt new file mode 100644 index 00000000..a8a78194 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListParamsTest.kt @@ -0,0 +1,90 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.frameworks + +import com.openlayer.api.core.http.QueryParams +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class FrameworkListParamsTest { + + @Test + fun create() { + FrameworkListParams.builder() + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .asc(true) + .completionOperator(FrameworkListParams.CompletionOperator.IS) + .completionValue(0L) + .enabled(true) + .includeRuleStats(true) + .page(1L) + .perPage(1L) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .searchQuery("searchQuery") + .sortColumn(FrameworkListParams.SortColumn.NAME) + .addTag("string") + .build() + } + + @Test + fun pathParams() { + val params = + FrameworkListParams.builder() + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + + assertThat(params._pathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } + + @Test + fun queryParams() { + val params = + FrameworkListParams.builder() + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .asc(true) + .completionOperator(FrameworkListParams.CompletionOperator.IS) + .completionValue(0L) + .enabled(true) + .includeRuleStats(true) + .page(1L) + .perPage(1L) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .searchQuery("searchQuery") + .sortColumn(FrameworkListParams.SortColumn.NAME) + .addTag("string") + .build() + + val queryParams = params._queryParams() + + assertThat(queryParams) + .isEqualTo( + QueryParams.builder() + .put("asc", "true") + .put("completionOperator", "is") + .put("completionValue", "0") + .put("enabled", "true") + .put("includeRuleStats", "true") + .put("page", "1") + .put("perPage", "1") + .put("projectId", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .put("searchQuery", "searchQuery") + .put("sortColumn", "name") + .put("tags", listOf("string").joinToString(",")) + .build() + ) + } + + @Test + fun queryParamsWithoutOptionalFields() { + val params = + FrameworkListParams.builder() + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + + val queryParams = params._queryParams() + + assertThat(queryParams).isEqualTo(QueryParams.builder().build()) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListProjectRuleStatsParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListProjectRuleStatsParamsTest.kt new file mode 100644 index 00000000..fe117258 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListProjectRuleStatsParamsTest.kt @@ -0,0 +1,69 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.frameworks + +import com.openlayer.api.core.http.QueryParams +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class FrameworkListProjectRuleStatsParamsTest { + + @Test + fun create() { + FrameworkListProjectRuleStatsParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .asc(true) + .page(1L) + .perPage(1L) + .sortColumn(FrameworkListProjectRuleStatsParams.SortColumn.PROJECT_NAME) + .build() + } + + @Test + fun pathParams() { + val params = + FrameworkListProjectRuleStatsParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + + assertThat(params._pathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } + + @Test + fun queryParams() { + val params = + FrameworkListProjectRuleStatsParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .asc(true) + .page(1L) + .perPage(1L) + .sortColumn(FrameworkListProjectRuleStatsParams.SortColumn.PROJECT_NAME) + .build() + + val queryParams = params._queryParams() + + assertThat(queryParams) + .isEqualTo( + QueryParams.builder() + .put("asc", "true") + .put("page", "1") + .put("perPage", "1") + .put("sortColumn", "projectName") + .build() + ) + } + + @Test + fun queryParamsWithoutOptionalFields() { + val params = + FrameworkListProjectRuleStatsParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + + val queryParams = params._queryParams() + + assertThat(queryParams).isEqualTo(QueryParams.builder().build()) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListProjectRuleStatsResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListProjectRuleStatsResponseTest.kt new file mode 100644 index 00000000..aa91954e --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListProjectRuleStatsResponseTest.kt @@ -0,0 +1,172 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.frameworks + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.jsonMapper +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class FrameworkListProjectRuleStatsResponseTest { + + @Test + fun create() { + val frameworkListProjectRuleStatsResponse = + FrameworkListProjectRuleStatsResponse.builder() + .addItem( + FrameworkListProjectRuleStatsResponse.Item.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .projectName("Customer chatbot") + .taskType("llm-base") + .total(0L) + .totalDueSoon(0L) + .totalError(0L) + .totalFailing(0L) + .totalPassing(0L) + .totalPending(0L) + .totalRunning(0L) + .totalSkipped(0L) + .byRuleType( + FrameworkListProjectRuleStatsResponse.Item.ByRuleType.builder() + .evidence( + FrameworkListProjectRuleStatsResponse.Item.ByRuleType.Evidence + .builder() + .total(0L) + .totalDueSoon(0L) + .totalError(0L) + .totalFailing(0L) + .totalPassing(0L) + .totalPending(0L) + .totalRunning(0L) + .totalSkipped(0L) + .build() + ) + .platform( + FrameworkListProjectRuleStatsResponse.Item.ByRuleType.Platform + .builder() + .total(0L) + .totalDueSoon(0L) + .totalError(0L) + .totalFailing(0L) + .totalPassing(0L) + .totalPending(0L) + .totalRunning(0L) + .totalSkipped(0L) + .build() + ) + .build() + ) + .build() + ) + .build() + + assertThat(frameworkListProjectRuleStatsResponse.items()) + .containsExactly( + FrameworkListProjectRuleStatsResponse.Item.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .projectName("Customer chatbot") + .taskType("llm-base") + .total(0L) + .totalDueSoon(0L) + .totalError(0L) + .totalFailing(0L) + .totalPassing(0L) + .totalPending(0L) + .totalRunning(0L) + .totalSkipped(0L) + .byRuleType( + FrameworkListProjectRuleStatsResponse.Item.ByRuleType.builder() + .evidence( + FrameworkListProjectRuleStatsResponse.Item.ByRuleType.Evidence + .builder() + .total(0L) + .totalDueSoon(0L) + .totalError(0L) + .totalFailing(0L) + .totalPassing(0L) + .totalPending(0L) + .totalRunning(0L) + .totalSkipped(0L) + .build() + ) + .platform( + FrameworkListProjectRuleStatsResponse.Item.ByRuleType.Platform + .builder() + .total(0L) + .totalDueSoon(0L) + .totalError(0L) + .totalFailing(0L) + .totalPassing(0L) + .totalPending(0L) + .totalRunning(0L) + .totalSkipped(0L) + .build() + ) + .build() + ) + .build() + ) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val frameworkListProjectRuleStatsResponse = + FrameworkListProjectRuleStatsResponse.builder() + .addItem( + FrameworkListProjectRuleStatsResponse.Item.builder() + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .projectName("Customer chatbot") + .taskType("llm-base") + .total(0L) + .totalDueSoon(0L) + .totalError(0L) + .totalFailing(0L) + .totalPassing(0L) + .totalPending(0L) + .totalRunning(0L) + .totalSkipped(0L) + .byRuleType( + FrameworkListProjectRuleStatsResponse.Item.ByRuleType.builder() + .evidence( + FrameworkListProjectRuleStatsResponse.Item.ByRuleType.Evidence + .builder() + .total(0L) + .totalDueSoon(0L) + .totalError(0L) + .totalFailing(0L) + .totalPassing(0L) + .totalPending(0L) + .totalRunning(0L) + .totalSkipped(0L) + .build() + ) + .platform( + FrameworkListProjectRuleStatsResponse.Item.ByRuleType.Platform + .builder() + .total(0L) + .totalDueSoon(0L) + .totalError(0L) + .totalFailing(0L) + .totalPassing(0L) + .totalPending(0L) + .totalRunning(0L) + .totalSkipped(0L) + .build() + ) + .build() + ) + .build() + ) + .build() + + val roundtrippedFrameworkListProjectRuleStatsResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(frameworkListProjectRuleStatsResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedFrameworkListProjectRuleStatsResponse) + .isEqualTo(frameworkListProjectRuleStatsResponse) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListProjectsParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListProjectsParamsTest.kt new file mode 100644 index 00000000..e8082eb5 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListProjectsParamsTest.kt @@ -0,0 +1,58 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.frameworks + +import com.openlayer.api.core.http.QueryParams +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class FrameworkListProjectsParamsTest { + + @Test + fun create() { + FrameworkListProjectsParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .page(1L) + .perPage(1L) + .build() + } + + @Test + fun pathParams() { + val params = + FrameworkListProjectsParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + + assertThat(params._pathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } + + @Test + fun queryParams() { + val params = + FrameworkListProjectsParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .page(1L) + .perPage(1L) + .build() + + val queryParams = params._queryParams() + + assertThat(queryParams) + .isEqualTo(QueryParams.builder().put("page", "1").put("perPage", "1").build()) + } + + @Test + fun queryParamsWithoutOptionalFields() { + val params = + FrameworkListProjectsParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + + val queryParams = params._queryParams() + + assertThat(queryParams).isEqualTo(QueryParams.builder().build()) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListProjectsResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListProjectsResponseTest.kt new file mode 100644 index 00000000..a15a8e64 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListProjectsResponseTest.kt @@ -0,0 +1,173 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.frameworks + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.jsonMapper +import java.time.OffsetDateTime +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class FrameworkListProjectsResponseTest { + + @Test + fun create() { + val frameworkListProjectsResponse = + FrameworkListProjectsResponse.builder() + .addItem( + FrameworkListProjectsResponse.Item.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .developmentGoalCount(5L) + .goalCount(10L) + .inferencePipelineCount(1L) + .links( + FrameworkListProjectsResponse.Item.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .monitoringGoalCount(5L) + .name("My Project") + .source(FrameworkListProjectsResponse.Item.Source.WEB) + .taskType(FrameworkListProjectsResponse.Item.TaskType.LLM_BASE) + .versionCount(2L) + .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") + .dataRetentionDays(30L) + .description("My project description.") + .gitRepo( + FrameworkListProjectsResponse.Item.GitRepo.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateConnected(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .gitAccountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .gitId(0L) + .name("name") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("slug") + .url("url") + .branch("branch") + .rootDir("rootDir") + .build() + ) + .modelDeveloper("Acme AI") + .addModelType("llm") + .purpose("Answer customer billing questions.") + .build() + ) + .build() + + assertThat(frameworkListProjectsResponse.items()) + .containsExactly( + FrameworkListProjectsResponse.Item.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .developmentGoalCount(5L) + .goalCount(10L) + .inferencePipelineCount(1L) + .links( + FrameworkListProjectsResponse.Item.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .monitoringGoalCount(5L) + .name("My Project") + .source(FrameworkListProjectsResponse.Item.Source.WEB) + .taskType(FrameworkListProjectsResponse.Item.TaskType.LLM_BASE) + .versionCount(2L) + .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") + .dataRetentionDays(30L) + .description("My project description.") + .gitRepo( + FrameworkListProjectsResponse.Item.GitRepo.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateConnected(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .gitAccountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .gitId(0L) + .name("name") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("slug") + .url("url") + .branch("branch") + .rootDir("rootDir") + .build() + ) + .modelDeveloper("Acme AI") + .addModelType("llm") + .purpose("Answer customer billing questions.") + .build() + ) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val frameworkListProjectsResponse = + FrameworkListProjectsResponse.builder() + .addItem( + FrameworkListProjectsResponse.Item.builder() + .id("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .creatorId("589ece63-49a2-41b4-98e1-10547761d4b0") + .dateCreated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2024-03-22T11:31:01.185Z")) + .developmentGoalCount(5L) + .goalCount(10L) + .inferencePipelineCount(1L) + .links( + FrameworkListProjectsResponse.Item.Links.builder() + .app( + "https://app.openlayer.com/myWorkspace/3fa85f64-5717-4562-b3fc-2c963f66afa6" + ) + .build() + ) + .monitoringGoalCount(5L) + .name("My Project") + .source(FrameworkListProjectsResponse.Item.Source.WEB) + .taskType(FrameworkListProjectsResponse.Item.TaskType.LLM_BASE) + .versionCount(2L) + .workspaceId("055fddb1-261f-4654-8598-f6347ee46a09") + .dataRetentionDays(30L) + .description("My project description.") + .gitRepo( + FrameworkListProjectsResponse.Item.GitRepo.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateConnected(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateUpdated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .gitAccountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .gitId(0L) + .name("name") + .private_(true) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .slug("slug") + .url("url") + .branch("branch") + .rootDir("rootDir") + .build() + ) + .modelDeveloper("Acme AI") + .addModelType("llm") + .purpose("Answer customer billing questions.") + .build() + ) + .build() + + val roundtrippedFrameworkListProjectsResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(frameworkListProjectsResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedFrameworkListProjectsResponse) + .isEqualTo(frameworkListProjectsResponse) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListResponseTest.kt new file mode 100644 index 00000000..3b750fee --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListResponseTest.kt @@ -0,0 +1,235 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.frameworks + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.jsonMapper +import java.time.OffsetDateTime +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class FrameworkListResponseTest { + + @Test + fun create() { + val frameworkListResponse = + FrameworkListResponse.builder() + .addItem( + FrameworkListResponse.Item.builder() + .id("9f1b3c2d-4e5a-4f60-8a71-2b3c4d5e6f70") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .enabled(true) + .name("EU AI Act") + .addTag("regulation") + .addTag("eu") + .workspaceId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .avatar( + FrameworkListResponse.Item.Avatar.builder() + .type(FrameworkListResponse.Item.Avatar.Type.EMOJI) + .value("🧭") + .build() + ) + .builtInSlug("eu_ai_act") + .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .description("Requirements for high-risk AI systems under the EU AI Act.") + .extendedDescription( + FrameworkListResponse.Item.ExtendedDescription.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .href("href") + .immutable(true) + .projectSelector( + FrameworkListResponse.Item.ProjectSelector.builder() + .addMatch( + FrameworkListResponse.Item.ProjectSelector.Match.builder() + .property( + FrameworkListResponse.Item.ProjectSelector.Match + .Property + .RISK_LEVEL + ) + .value(JsonValue.from(listOf("high", "critical"))) + .operator("operator") + .build() + ) + .build() + ) + .ruleStats( + FrameworkListResponse.Item.RuleStats.builder() + .projectCompletion( + FrameworkListResponse.Item.RuleStats.ProjectCompletion.builder() + .high(0L) + .low(0L) + .mid(0L) + .build() + ) + .ruleResults( + FrameworkListResponse.Item.RuleStats.RuleResults.builder() + .total(0L) + .totalDueSoon(0L) + .totalError(0L) + .totalFailing(0L) + .totalPassing(0L) + .totalPending(0L) + .totalRunning(0L) + .totalSkipped(0L) + .build() + ) + .build() + ) + .build() + ) + .build() + + assertThat(frameworkListResponse.items()) + .containsExactly( + FrameworkListResponse.Item.builder() + .id("9f1b3c2d-4e5a-4f60-8a71-2b3c4d5e6f70") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .enabled(true) + .name("EU AI Act") + .addTag("regulation") + .addTag("eu") + .workspaceId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .avatar( + FrameworkListResponse.Item.Avatar.builder() + .type(FrameworkListResponse.Item.Avatar.Type.EMOJI) + .value("🧭") + .build() + ) + .builtInSlug("eu_ai_act") + .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .description("Requirements for high-risk AI systems under the EU AI Act.") + .extendedDescription( + FrameworkListResponse.Item.ExtendedDescription.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .href("href") + .immutable(true) + .projectSelector( + FrameworkListResponse.Item.ProjectSelector.builder() + .addMatch( + FrameworkListResponse.Item.ProjectSelector.Match.builder() + .property( + FrameworkListResponse.Item.ProjectSelector.Match.Property + .RISK_LEVEL + ) + .value(JsonValue.from(listOf("high", "critical"))) + .operator("operator") + .build() + ) + .build() + ) + .ruleStats( + FrameworkListResponse.Item.RuleStats.builder() + .projectCompletion( + FrameworkListResponse.Item.RuleStats.ProjectCompletion.builder() + .high(0L) + .low(0L) + .mid(0L) + .build() + ) + .ruleResults( + FrameworkListResponse.Item.RuleStats.RuleResults.builder() + .total(0L) + .totalDueSoon(0L) + .totalError(0L) + .totalFailing(0L) + .totalPassing(0L) + .totalPending(0L) + .totalRunning(0L) + .totalSkipped(0L) + .build() + ) + .build() + ) + .build() + ) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val frameworkListResponse = + FrameworkListResponse.builder() + .addItem( + FrameworkListResponse.Item.builder() + .id("9f1b3c2d-4e5a-4f60-8a71-2b3c4d5e6f70") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .enabled(true) + .name("EU AI Act") + .addTag("regulation") + .addTag("eu") + .workspaceId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .avatar( + FrameworkListResponse.Item.Avatar.builder() + .type(FrameworkListResponse.Item.Avatar.Type.EMOJI) + .value("🧭") + .build() + ) + .builtInSlug("eu_ai_act") + .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .description("Requirements for high-risk AI systems under the EU AI Act.") + .extendedDescription( + FrameworkListResponse.Item.ExtendedDescription.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .href("href") + .immutable(true) + .projectSelector( + FrameworkListResponse.Item.ProjectSelector.builder() + .addMatch( + FrameworkListResponse.Item.ProjectSelector.Match.builder() + .property( + FrameworkListResponse.Item.ProjectSelector.Match + .Property + .RISK_LEVEL + ) + .value(JsonValue.from(listOf("high", "critical"))) + .operator("operator") + .build() + ) + .build() + ) + .ruleStats( + FrameworkListResponse.Item.RuleStats.builder() + .projectCompletion( + FrameworkListResponse.Item.RuleStats.ProjectCompletion.builder() + .high(0L) + .low(0L) + .mid(0L) + .build() + ) + .ruleResults( + FrameworkListResponse.Item.RuleStats.RuleResults.builder() + .total(0L) + .totalDueSoon(0L) + .totalError(0L) + .totalFailing(0L) + .totalPassing(0L) + .totalPending(0L) + .totalRunning(0L) + .totalSkipped(0L) + .build() + ) + .build() + ) + .build() + ) + .build() + + val roundtrippedFrameworkListResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(frameworkListResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedFrameworkListResponse).isEqualTo(frameworkListResponse) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListRulesParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListRulesParamsTest.kt new file mode 100644 index 00000000..c4413bb2 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListRulesParamsTest.kt @@ -0,0 +1,58 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.frameworks + +import com.openlayer.api.core.http.QueryParams +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class FrameworkListRulesParamsTest { + + @Test + fun create() { + FrameworkListRulesParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .page(1L) + .perPage(1L) + .build() + } + + @Test + fun pathParams() { + val params = + FrameworkListRulesParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + + assertThat(params._pathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } + + @Test + fun queryParams() { + val params = + FrameworkListRulesParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .page(1L) + .perPage(1L) + .build() + + val queryParams = params._queryParams() + + assertThat(queryParams) + .isEqualTo(QueryParams.builder().put("page", "1").put("perPage", "1").build()) + } + + @Test + fun queryParamsWithoutOptionalFields() { + val params = + FrameworkListRulesParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + + val queryParams = params._queryParams() + + assertThat(queryParams).isEqualTo(QueryParams.builder().build()) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListRulesResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListRulesResponseTest.kt new file mode 100644 index 00000000..ec3e0190 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkListRulesResponseTest.kt @@ -0,0 +1,333 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.frameworks + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.jsonMapper +import java.time.OffsetDateTime +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class FrameworkListRulesResponseTest { + + @Test + fun create() { + val frameworkListRulesResponse = + FrameworkListRulesResponse.builder() + .addItem( + FrameworkListRulesResponse.Item.builder() + .id("7c9a1e2b-3d4f-4a5b-8c6d-7e8f9a0b1c2d") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .name("Monitoring enabled") + .scope(FrameworkListRulesResponse.Item.Scope.PROJECT) + .type(FrameworkListRulesResponse.Item.Type.PLATFORM) + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .automationParams( + FrameworkListRulesResponse.Item.AutomationParams.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .automationType("monitoring_mode_enabled") + .deactivated(true) + .description("Each project must have Openlayer monitoring mode enabled.") + .evidenceType(FrameworkListRulesResponse.Item.EvidenceType.DOCUMENT) + .addFramework( + FrameworkListRulesResponse.Item.Framework.builder() + .id("9f1b3c2d-4e5a-4f60-8a71-2b3c4d5e6f70") + .avatar( + FrameworkListRulesResponse.Item.Framework.Avatar.builder() + .type( + FrameworkListRulesResponse.Item.Framework.Avatar.Type + .EMOJI + ) + .value("🧭") + .build() + ) + .builtInSlug("eu_ai_act") + .enabled(true) + .name("EU AI Act") + .build() + ) + .immutable(true) + .renewalCadenceDays(90L) + .addResult( + FrameworkListRulesResponse.Item.Result.builder() + .id("5b7d9f1a-2c3e-4d5f-8a6b-9c0d1e2f3a4b") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .deactivated(true) + .ruleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(FrameworkListRulesResponse.Item.Result.Status.PASSING) + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addBlockedBy( + FrameworkListRulesResponse.Item.Result.BlockedBy.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status( + FrameworkListRulesResponse.Item.Result.BlockedBy.Status + .PASSING + ) + .build() + ) + .addBlocking( + FrameworkListRulesResponse.Item.Result.Blocking.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status( + FrameworkListRulesResponse.Item.Result.Blocking.Status + .PASSING + ) + .build() + ) + .dateLastEvaluated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfLatestEvidence( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) + .dateOfNextEvaluation( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) + .dateOfRenewal(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .deactivatedReason("deactivatedReason") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .statusMessage("statusMessage") + .build() + ) + .resultsSummary( + FrameworkListRulesResponse.Item.ResultsSummary.builder() + .passing(0L) + .total(0L) + .build() + ) + .addTagId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addTag( + FrameworkListRulesResponse.Item.Tag.builder() + .id("6e8a0c2d-4f5b-4a3c-9d7e-8f0a1b2c3d4e") + .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .immutable(true) + .name("Evaluation") + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .color("color") + .build() + ) + .build() + ) + .build() + + assertThat(frameworkListRulesResponse.items()) + .containsExactly( + FrameworkListRulesResponse.Item.builder() + .id("7c9a1e2b-3d4f-4a5b-8c6d-7e8f9a0b1c2d") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .name("Monitoring enabled") + .scope(FrameworkListRulesResponse.Item.Scope.PROJECT) + .type(FrameworkListRulesResponse.Item.Type.PLATFORM) + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .automationParams( + FrameworkListRulesResponse.Item.AutomationParams.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .automationType("monitoring_mode_enabled") + .deactivated(true) + .description("Each project must have Openlayer monitoring mode enabled.") + .evidenceType(FrameworkListRulesResponse.Item.EvidenceType.DOCUMENT) + .addFramework( + FrameworkListRulesResponse.Item.Framework.builder() + .id("9f1b3c2d-4e5a-4f60-8a71-2b3c4d5e6f70") + .avatar( + FrameworkListRulesResponse.Item.Framework.Avatar.builder() + .type( + FrameworkListRulesResponse.Item.Framework.Avatar.Type.EMOJI + ) + .value("🧭") + .build() + ) + .builtInSlug("eu_ai_act") + .enabled(true) + .name("EU AI Act") + .build() + ) + .immutable(true) + .renewalCadenceDays(90L) + .addResult( + FrameworkListRulesResponse.Item.Result.builder() + .id("5b7d9f1a-2c3e-4d5f-8a6b-9c0d1e2f3a4b") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .deactivated(true) + .ruleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(FrameworkListRulesResponse.Item.Result.Status.PASSING) + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addBlockedBy( + FrameworkListRulesResponse.Item.Result.BlockedBy.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status( + FrameworkListRulesResponse.Item.Result.BlockedBy.Status + .PASSING + ) + .build() + ) + .addBlocking( + FrameworkListRulesResponse.Item.Result.Blocking.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status( + FrameworkListRulesResponse.Item.Result.Blocking.Status + .PASSING + ) + .build() + ) + .dateLastEvaluated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfLatestEvidence(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfNextEvaluation(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfRenewal(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .deactivatedReason("deactivatedReason") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .statusMessage("statusMessage") + .build() + ) + .resultsSummary( + FrameworkListRulesResponse.Item.ResultsSummary.builder() + .passing(0L) + .total(0L) + .build() + ) + .addTagId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addTag( + FrameworkListRulesResponse.Item.Tag.builder() + .id("6e8a0c2d-4f5b-4a3c-9d7e-8f0a1b2c3d4e") + .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .immutable(true) + .name("Evaluation") + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .color("color") + .build() + ) + .build() + ) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val frameworkListRulesResponse = + FrameworkListRulesResponse.builder() + .addItem( + FrameworkListRulesResponse.Item.builder() + .id("7c9a1e2b-3d4f-4a5b-8c6d-7e8f9a0b1c2d") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .name("Monitoring enabled") + .scope(FrameworkListRulesResponse.Item.Scope.PROJECT) + .type(FrameworkListRulesResponse.Item.Type.PLATFORM) + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .automationParams( + FrameworkListRulesResponse.Item.AutomationParams.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .automationType("monitoring_mode_enabled") + .deactivated(true) + .description("Each project must have Openlayer monitoring mode enabled.") + .evidenceType(FrameworkListRulesResponse.Item.EvidenceType.DOCUMENT) + .addFramework( + FrameworkListRulesResponse.Item.Framework.builder() + .id("9f1b3c2d-4e5a-4f60-8a71-2b3c4d5e6f70") + .avatar( + FrameworkListRulesResponse.Item.Framework.Avatar.builder() + .type( + FrameworkListRulesResponse.Item.Framework.Avatar.Type + .EMOJI + ) + .value("🧭") + .build() + ) + .builtInSlug("eu_ai_act") + .enabled(true) + .name("EU AI Act") + .build() + ) + .immutable(true) + .renewalCadenceDays(90L) + .addResult( + FrameworkListRulesResponse.Item.Result.builder() + .id("5b7d9f1a-2c3e-4d5f-8a6b-9c0d1e2f3a4b") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .deactivated(true) + .ruleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(FrameworkListRulesResponse.Item.Result.Status.PASSING) + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addBlockedBy( + FrameworkListRulesResponse.Item.Result.BlockedBy.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status( + FrameworkListRulesResponse.Item.Result.BlockedBy.Status + .PASSING + ) + .build() + ) + .addBlocking( + FrameworkListRulesResponse.Item.Result.Blocking.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status( + FrameworkListRulesResponse.Item.Result.Blocking.Status + .PASSING + ) + .build() + ) + .dateLastEvaluated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfLatestEvidence( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) + .dateOfNextEvaluation( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) + .dateOfRenewal(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .deactivatedReason("deactivatedReason") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .statusMessage("statusMessage") + .build() + ) + .resultsSummary( + FrameworkListRulesResponse.Item.ResultsSummary.builder() + .passing(0L) + .total(0L) + .build() + ) + .addTagId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addTag( + FrameworkListRulesResponse.Item.Tag.builder() + .id("6e8a0c2d-4f5b-4a3c-9d7e-8f0a1b2c3d4e") + .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .immutable(true) + .name("Evaluation") + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .color("color") + .build() + ) + .build() + ) + .build() + + val roundtrippedFrameworkListRulesResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(frameworkListRulesResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedFrameworkListRulesResponse).isEqualTo(frameworkListRulesResponse) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkRetrieveParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkRetrieveParamsTest.kt new file mode 100644 index 00000000..9bf2d60a --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkRetrieveParamsTest.kt @@ -0,0 +1,28 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.frameworks + +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class FrameworkRetrieveParamsTest { + + @Test + fun create() { + FrameworkRetrieveParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + } + + @Test + fun pathParams() { + val params = + FrameworkRetrieveParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + + assertThat(params._pathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkRetrieveResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkRetrieveResponseTest.kt new file mode 100644 index 00000000..b1946a8b --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkRetrieveResponseTest.kt @@ -0,0 +1,227 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.frameworks + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.jsonMapper +import java.time.OffsetDateTime +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class FrameworkRetrieveResponseTest { + + @Test + fun create() { + val frameworkRetrieveResponse = + FrameworkRetrieveResponse.builder() + .id("9f1b3c2d-4e5a-4f60-8a71-2b3c4d5e6f70") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .enabled(true) + .name("EU AI Act") + .addTag("regulation") + .addTag("eu") + .workspaceId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .avatar( + FrameworkRetrieveResponse.Avatar.builder() + .type(FrameworkRetrieveResponse.Avatar.Type.EMOJI) + .value("🧭") + .build() + ) + .builtInSlug("eu_ai_act") + .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .description("Requirements for high-risk AI systems under the EU AI Act.") + .extendedDescription( + FrameworkRetrieveResponse.ExtendedDescription.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .href("href") + .immutable(true) + .projectSelector( + FrameworkRetrieveResponse.ProjectSelector.builder() + .addMatch( + FrameworkRetrieveResponse.ProjectSelector.Match.builder() + .property( + FrameworkRetrieveResponse.ProjectSelector.Match.Property + .RISK_LEVEL + ) + .value(JsonValue.from(listOf("high", "critical"))) + .operator("operator") + .build() + ) + .build() + ) + .ruleStats( + FrameworkRetrieveResponse.RuleStats.builder() + .projectCompletion( + FrameworkRetrieveResponse.RuleStats.ProjectCompletion.builder() + .high(0L) + .low(0L) + .mid(0L) + .build() + ) + .ruleResults( + FrameworkRetrieveResponse.RuleStats.RuleResults.builder() + .total(0L) + .totalDueSoon(0L) + .totalError(0L) + .totalFailing(0L) + .totalPassing(0L) + .totalPending(0L) + .totalRunning(0L) + .totalSkipped(0L) + .build() + ) + .build() + ) + .build() + + assertThat(frameworkRetrieveResponse.id()).isEqualTo("9f1b3c2d-4e5a-4f60-8a71-2b3c4d5e6f70") + assertThat(frameworkRetrieveResponse.dateCreated()) + .isEqualTo(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + assertThat(frameworkRetrieveResponse.dateUpdated()) + .isEqualTo(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + assertThat(frameworkRetrieveResponse.enabled()).isEqualTo(true) + assertThat(frameworkRetrieveResponse.name()).isEqualTo("EU AI Act") + assertThat(frameworkRetrieveResponse.tags()).containsExactly("regulation", "eu") + assertThat(frameworkRetrieveResponse.workspaceId()) + .isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(frameworkRetrieveResponse.avatar()) + .contains( + FrameworkRetrieveResponse.Avatar.builder() + .type(FrameworkRetrieveResponse.Avatar.Type.EMOJI) + .value("🧭") + .build() + ) + assertThat(frameworkRetrieveResponse.builtInSlug()).contains("eu_ai_act") + assertThat(frameworkRetrieveResponse.creatorId()) + .contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(frameworkRetrieveResponse.description()) + .contains("Requirements for high-risk AI systems under the EU AI Act.") + assertThat(frameworkRetrieveResponse.extendedDescription()) + .contains( + FrameworkRetrieveResponse.ExtendedDescription.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + assertThat(frameworkRetrieveResponse.href()).contains("href") + assertThat(frameworkRetrieveResponse.immutable()).contains(true) + assertThat(frameworkRetrieveResponse.projectSelector()) + .contains( + FrameworkRetrieveResponse.ProjectSelector.builder() + .addMatch( + FrameworkRetrieveResponse.ProjectSelector.Match.builder() + .property( + FrameworkRetrieveResponse.ProjectSelector.Match.Property.RISK_LEVEL + ) + .value(JsonValue.from(listOf("high", "critical"))) + .operator("operator") + .build() + ) + .build() + ) + assertThat(frameworkRetrieveResponse.ruleStats()) + .contains( + FrameworkRetrieveResponse.RuleStats.builder() + .projectCompletion( + FrameworkRetrieveResponse.RuleStats.ProjectCompletion.builder() + .high(0L) + .low(0L) + .mid(0L) + .build() + ) + .ruleResults( + FrameworkRetrieveResponse.RuleStats.RuleResults.builder() + .total(0L) + .totalDueSoon(0L) + .totalError(0L) + .totalFailing(0L) + .totalPassing(0L) + .totalPending(0L) + .totalRunning(0L) + .totalSkipped(0L) + .build() + ) + .build() + ) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val frameworkRetrieveResponse = + FrameworkRetrieveResponse.builder() + .id("9f1b3c2d-4e5a-4f60-8a71-2b3c4d5e6f70") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .enabled(true) + .name("EU AI Act") + .addTag("regulation") + .addTag("eu") + .workspaceId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .avatar( + FrameworkRetrieveResponse.Avatar.builder() + .type(FrameworkRetrieveResponse.Avatar.Type.EMOJI) + .value("🧭") + .build() + ) + .builtInSlug("eu_ai_act") + .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .description("Requirements for high-risk AI systems under the EU AI Act.") + .extendedDescription( + FrameworkRetrieveResponse.ExtendedDescription.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .href("href") + .immutable(true) + .projectSelector( + FrameworkRetrieveResponse.ProjectSelector.builder() + .addMatch( + FrameworkRetrieveResponse.ProjectSelector.Match.builder() + .property( + FrameworkRetrieveResponse.ProjectSelector.Match.Property + .RISK_LEVEL + ) + .value(JsonValue.from(listOf("high", "critical"))) + .operator("operator") + .build() + ) + .build() + ) + .ruleStats( + FrameworkRetrieveResponse.RuleStats.builder() + .projectCompletion( + FrameworkRetrieveResponse.RuleStats.ProjectCompletion.builder() + .high(0L) + .low(0L) + .mid(0L) + .build() + ) + .ruleResults( + FrameworkRetrieveResponse.RuleStats.RuleResults.builder() + .total(0L) + .totalDueSoon(0L) + .totalError(0L) + .totalFailing(0L) + .totalPassing(0L) + .totalPending(0L) + .totalRunning(0L) + .totalSkipped(0L) + .build() + ) + .build() + ) + .build() + + val roundtrippedFrameworkRetrieveResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(frameworkRetrieveResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedFrameworkRetrieveResponse).isEqualTo(frameworkRetrieveResponse) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkUpdateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkUpdateParamsTest.kt new file mode 100644 index 00000000..e521937e --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkUpdateParamsTest.kt @@ -0,0 +1,144 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.frameworks + +import com.openlayer.api.core.JsonValue +import kotlin.jvm.optionals.getOrNull +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class FrameworkUpdateParamsTest { + + @Test + fun create() { + FrameworkUpdateParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .avatar( + FrameworkUpdateParams.Avatar.builder() + .type(FrameworkUpdateParams.Avatar.Type.EMOJI) + .value("🧭") + .build() + ) + .description("Requirements for high-risk AI systems under the EU AI Act.") + .enabled(true) + .extendedDescription( + FrameworkUpdateParams.ExtendedDescription.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .href("href") + .name("EU AI Act") + .projectSelector( + FrameworkUpdateParams.ProjectSelector.builder() + .addMatch( + FrameworkUpdateParams.ProjectSelector.Match.builder() + .property( + FrameworkUpdateParams.ProjectSelector.Match.Property.RISK_LEVEL + ) + .value(JsonValue.from(listOf("high", "critical"))) + .operator("operator") + .build() + ) + .build() + ) + .addTag("regulation") + .addTag("eu") + .build() + } + + @Test + fun pathParams() { + val params = + FrameworkUpdateParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + + assertThat(params._pathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } + + @Test + fun body() { + val params = + FrameworkUpdateParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .avatar( + FrameworkUpdateParams.Avatar.builder() + .type(FrameworkUpdateParams.Avatar.Type.EMOJI) + .value("🧭") + .build() + ) + .description("Requirements for high-risk AI systems under the EU AI Act.") + .enabled(true) + .extendedDescription( + FrameworkUpdateParams.ExtendedDescription.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .href("href") + .name("EU AI Act") + .projectSelector( + FrameworkUpdateParams.ProjectSelector.builder() + .addMatch( + FrameworkUpdateParams.ProjectSelector.Match.builder() + .property( + FrameworkUpdateParams.ProjectSelector.Match.Property.RISK_LEVEL + ) + .value(JsonValue.from(listOf("high", "critical"))) + .operator("operator") + .build() + ) + .build() + ) + .addTag("regulation") + .addTag("eu") + .build() + + val body = params._body() + + assertThat(body.avatar()) + .contains( + FrameworkUpdateParams.Avatar.builder() + .type(FrameworkUpdateParams.Avatar.Type.EMOJI) + .value("🧭") + .build() + ) + assertThat(body.description()) + .contains("Requirements for high-risk AI systems under the EU AI Act.") + assertThat(body.enabled()).contains(true) + assertThat(body.extendedDescription()) + .contains( + FrameworkUpdateParams.ExtendedDescription.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + assertThat(body.href()).contains("href") + assertThat(body.name()).contains("EU AI Act") + assertThat(body.projectSelector()) + .contains( + FrameworkUpdateParams.ProjectSelector.builder() + .addMatch( + FrameworkUpdateParams.ProjectSelector.Match.builder() + .property( + FrameworkUpdateParams.ProjectSelector.Match.Property.RISK_LEVEL + ) + .value(JsonValue.from(listOf("high", "critical"))) + .operator("operator") + .build() + ) + .build() + ) + assertThat(body.tags().getOrNull()).containsExactly("regulation", "eu") + } + + @Test + fun bodyWithoutOptionalFields() { + val params = + FrameworkUpdateParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + + val body = params._body() + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkUpdateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkUpdateResponseTest.kt new file mode 100644 index 00000000..87175292 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/FrameworkUpdateResponseTest.kt @@ -0,0 +1,227 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.frameworks + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.jsonMapper +import java.time.OffsetDateTime +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class FrameworkUpdateResponseTest { + + @Test + fun create() { + val frameworkUpdateResponse = + FrameworkUpdateResponse.builder() + .id("9f1b3c2d-4e5a-4f60-8a71-2b3c4d5e6f70") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .enabled(true) + .name("EU AI Act") + .addTag("regulation") + .addTag("eu") + .workspaceId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .avatar( + FrameworkUpdateResponse.Avatar.builder() + .type(FrameworkUpdateResponse.Avatar.Type.EMOJI) + .value("🧭") + .build() + ) + .builtInSlug("eu_ai_act") + .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .description("Requirements for high-risk AI systems under the EU AI Act.") + .extendedDescription( + FrameworkUpdateResponse.ExtendedDescription.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .href("href") + .immutable(true) + .projectSelector( + FrameworkUpdateResponse.ProjectSelector.builder() + .addMatch( + FrameworkUpdateResponse.ProjectSelector.Match.builder() + .property( + FrameworkUpdateResponse.ProjectSelector.Match.Property + .RISK_LEVEL + ) + .value(JsonValue.from(listOf("high", "critical"))) + .operator("operator") + .build() + ) + .build() + ) + .ruleStats( + FrameworkUpdateResponse.RuleStats.builder() + .projectCompletion( + FrameworkUpdateResponse.RuleStats.ProjectCompletion.builder() + .high(0L) + .low(0L) + .mid(0L) + .build() + ) + .ruleResults( + FrameworkUpdateResponse.RuleStats.RuleResults.builder() + .total(0L) + .totalDueSoon(0L) + .totalError(0L) + .totalFailing(0L) + .totalPassing(0L) + .totalPending(0L) + .totalRunning(0L) + .totalSkipped(0L) + .build() + ) + .build() + ) + .build() + + assertThat(frameworkUpdateResponse.id()).isEqualTo("9f1b3c2d-4e5a-4f60-8a71-2b3c4d5e6f70") + assertThat(frameworkUpdateResponse.dateCreated()) + .isEqualTo(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + assertThat(frameworkUpdateResponse.dateUpdated()) + .isEqualTo(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + assertThat(frameworkUpdateResponse.enabled()).isEqualTo(true) + assertThat(frameworkUpdateResponse.name()).isEqualTo("EU AI Act") + assertThat(frameworkUpdateResponse.tags()).containsExactly("regulation", "eu") + assertThat(frameworkUpdateResponse.workspaceId()) + .isEqualTo("3fa85f64-5717-4562-b3fc-2c963f66afa6") + assertThat(frameworkUpdateResponse.avatar()) + .contains( + FrameworkUpdateResponse.Avatar.builder() + .type(FrameworkUpdateResponse.Avatar.Type.EMOJI) + .value("🧭") + .build() + ) + assertThat(frameworkUpdateResponse.builtInSlug()).contains("eu_ai_act") + assertThat(frameworkUpdateResponse.creatorId()) + .contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(frameworkUpdateResponse.description()) + .contains("Requirements for high-risk AI systems under the EU AI Act.") + assertThat(frameworkUpdateResponse.extendedDescription()) + .contains( + FrameworkUpdateResponse.ExtendedDescription.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + assertThat(frameworkUpdateResponse.href()).contains("href") + assertThat(frameworkUpdateResponse.immutable()).contains(true) + assertThat(frameworkUpdateResponse.projectSelector()) + .contains( + FrameworkUpdateResponse.ProjectSelector.builder() + .addMatch( + FrameworkUpdateResponse.ProjectSelector.Match.builder() + .property( + FrameworkUpdateResponse.ProjectSelector.Match.Property.RISK_LEVEL + ) + .value(JsonValue.from(listOf("high", "critical"))) + .operator("operator") + .build() + ) + .build() + ) + assertThat(frameworkUpdateResponse.ruleStats()) + .contains( + FrameworkUpdateResponse.RuleStats.builder() + .projectCompletion( + FrameworkUpdateResponse.RuleStats.ProjectCompletion.builder() + .high(0L) + .low(0L) + .mid(0L) + .build() + ) + .ruleResults( + FrameworkUpdateResponse.RuleStats.RuleResults.builder() + .total(0L) + .totalDueSoon(0L) + .totalError(0L) + .totalFailing(0L) + .totalPassing(0L) + .totalPending(0L) + .totalRunning(0L) + .totalSkipped(0L) + .build() + ) + .build() + ) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val frameworkUpdateResponse = + FrameworkUpdateResponse.builder() + .id("9f1b3c2d-4e5a-4f60-8a71-2b3c4d5e6f70") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .enabled(true) + .name("EU AI Act") + .addTag("regulation") + .addTag("eu") + .workspaceId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .avatar( + FrameworkUpdateResponse.Avatar.builder() + .type(FrameworkUpdateResponse.Avatar.Type.EMOJI) + .value("🧭") + .build() + ) + .builtInSlug("eu_ai_act") + .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .description("Requirements for high-risk AI systems under the EU AI Act.") + .extendedDescription( + FrameworkUpdateResponse.ExtendedDescription.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .href("href") + .immutable(true) + .projectSelector( + FrameworkUpdateResponse.ProjectSelector.builder() + .addMatch( + FrameworkUpdateResponse.ProjectSelector.Match.builder() + .property( + FrameworkUpdateResponse.ProjectSelector.Match.Property + .RISK_LEVEL + ) + .value(JsonValue.from(listOf("high", "critical"))) + .operator("operator") + .build() + ) + .build() + ) + .ruleStats( + FrameworkUpdateResponse.RuleStats.builder() + .projectCompletion( + FrameworkUpdateResponse.RuleStats.ProjectCompletion.builder() + .high(0L) + .low(0L) + .mid(0L) + .build() + ) + .ruleResults( + FrameworkUpdateResponse.RuleStats.RuleResults.builder() + .total(0L) + .totalDueSoon(0L) + .totalError(0L) + .totalFailing(0L) + .totalPassing(0L) + .totalPending(0L) + .totalRunning(0L) + .totalSkipped(0L) + .build() + ) + .build() + ) + .build() + + val roundtrippedFrameworkUpdateResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(frameworkUpdateResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedFrameworkUpdateResponse).isEqualTo(frameworkUpdateResponse) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/documents/DocumentListParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/documents/DocumentListParamsTest.kt new file mode 100644 index 00000000..5050f092 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/documents/DocumentListParamsTest.kt @@ -0,0 +1,54 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.frameworks.documents + +import com.openlayer.api.core.http.QueryParams +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class DocumentListParamsTest { + + @Test + fun create() { + DocumentListParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .page(1L) + .perPage(1L) + .build() + } + + @Test + fun pathParams() { + val params = + DocumentListParams.builder().frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e").build() + + assertThat(params._pathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } + + @Test + fun queryParams() { + val params = + DocumentListParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .page(1L) + .perPage(1L) + .build() + + val queryParams = params._queryParams() + + assertThat(queryParams) + .isEqualTo(QueryParams.builder().put("page", "1").put("perPage", "1").build()) + } + + @Test + fun queryParamsWithoutOptionalFields() { + val params = + DocumentListParams.builder().frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e").build() + + val queryParams = params._queryParams() + + assertThat(queryParams).isEqualTo(QueryParams.builder().build()) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/documents/DocumentListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/documents/DocumentListResponseTest.kt new file mode 100644 index 00000000..01742e1a --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/documents/DocumentListResponseTest.kt @@ -0,0 +1,361 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.frameworks.documents + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.jsonMapper +import java.time.OffsetDateTime +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class DocumentListResponseTest { + + @Test + fun create() { + val documentListResponse = + DocumentListResponse.builder() + .addItem( + DocumentListResponse.Item.builder() + .id("4a6c8e0f-1b2d-4e3f-9a5b-6c7d8e9f0a1b") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .title("EU AI Act -- Regulation (EU) 2024/1689") + .addSection( + DocumentListResponse.Item.Section.builder() + .id("2e4f6a8c-9b1d-4c3e-8f5a-7b9c0d1e2f3a") + .documentId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .number("Article 9") + .sortOrder(0L) + .title("Risk management system") + .ruleCount(0L) + .addRule( + DocumentListResponse.Item.Section.Rule.builder() + .id("7c9a1e2b-3d4f-4a5b-8c6d-7e8f9a0b1c2d") + .name("Monitoring enabled") + .scope(DocumentListResponse.Item.Section.Rule.Scope.PROJECT) + .type(DocumentListResponse.Item.Section.Rule.Type.PLATFORM) + .automationParams( + DocumentListResponse.Item.Section.Rule.AutomationParams + .builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .automationType("monitoring_mode_enabled") + .dateCreated( + OffsetDateTime.parse("2026-03-22T11:31:01.185Z") + ) + .dateUpdated( + OffsetDateTime.parse("2026-03-22T11:31:01.185Z") + ) + .deactivated(true) + .description( + "Each project must have Openlayer monitoring mode enabled." + ) + .evidenceType( + DocumentListResponse.Item.Section.Rule.EvidenceType + .DOCUMENT + ) + .immutable(true) + .renewalCadenceDays(90L) + .build() + ) + .addSubsection( + DocumentListResponse.Item.Section.Subsection.builder() + .id("1d3f5a7b-8c9e-4b2d-9f6a-0c1e2d3f4a5b") + .number("9.2") + .sectionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .sortOrder(0L) + .title("Identification of known and foreseeable risks") + .ruleCount(0L) + .addRule( + DocumentListResponse.Item.Section.Subsection.Rule + .builder() + .id("7c9a1e2b-3d4f-4a5b-8c6d-7e8f9a0b1c2d") + .name("Monitoring enabled") + .scope( + DocumentListResponse.Item.Section.Subsection + .Rule + .Scope + .PROJECT + ) + .type( + DocumentListResponse.Item.Section.Subsection + .Rule + .Type + .PLATFORM + ) + .automationParams( + DocumentListResponse.Item.Section.Subsection + .Rule + .AutomationParams + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) + .automationType("monitoring_mode_enabled") + .dateCreated( + OffsetDateTime.parse("2026-03-22T11:31:01.185Z") + ) + .dateUpdated( + OffsetDateTime.parse("2026-03-22T11:31:01.185Z") + ) + .deactivated(true) + .description( + "Each project must have Openlayer monitoring mode enabled." + ) + .evidenceType( + DocumentListResponse.Item.Section.Subsection + .Rule + .EvidenceType + .DOCUMENT + ) + .immutable(true) + .renewalCadenceDays(90L) + .build() + ) + .text("text") + .build() + ) + .text("text") + .build() + ) + .build() + ) + .build() + + assertThat(documentListResponse.items()) + .containsExactly( + DocumentListResponse.Item.builder() + .id("4a6c8e0f-1b2d-4e3f-9a5b-6c7d8e9f0a1b") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .title("EU AI Act -- Regulation (EU) 2024/1689") + .addSection( + DocumentListResponse.Item.Section.builder() + .id("2e4f6a8c-9b1d-4c3e-8f5a-7b9c0d1e2f3a") + .documentId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .number("Article 9") + .sortOrder(0L) + .title("Risk management system") + .ruleCount(0L) + .addRule( + DocumentListResponse.Item.Section.Rule.builder() + .id("7c9a1e2b-3d4f-4a5b-8c6d-7e8f9a0b1c2d") + .name("Monitoring enabled") + .scope(DocumentListResponse.Item.Section.Rule.Scope.PROJECT) + .type(DocumentListResponse.Item.Section.Rule.Type.PLATFORM) + .automationParams( + DocumentListResponse.Item.Section.Rule.AutomationParams + .builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .automationType("monitoring_mode_enabled") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .deactivated(true) + .description( + "Each project must have Openlayer monitoring mode enabled." + ) + .evidenceType( + DocumentListResponse.Item.Section.Rule.EvidenceType.DOCUMENT + ) + .immutable(true) + .renewalCadenceDays(90L) + .build() + ) + .addSubsection( + DocumentListResponse.Item.Section.Subsection.builder() + .id("1d3f5a7b-8c9e-4b2d-9f6a-0c1e2d3f4a5b") + .number("9.2") + .sectionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .sortOrder(0L) + .title("Identification of known and foreseeable risks") + .ruleCount(0L) + .addRule( + DocumentListResponse.Item.Section.Subsection.Rule.builder() + .id("7c9a1e2b-3d4f-4a5b-8c6d-7e8f9a0b1c2d") + .name("Monitoring enabled") + .scope( + DocumentListResponse.Item.Section.Subsection.Rule + .Scope + .PROJECT + ) + .type( + DocumentListResponse.Item.Section.Subsection.Rule + .Type + .PLATFORM + ) + .automationParams( + DocumentListResponse.Item.Section.Subsection.Rule + .AutomationParams + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) + .automationType("monitoring_mode_enabled") + .dateCreated( + OffsetDateTime.parse("2026-03-22T11:31:01.185Z") + ) + .dateUpdated( + OffsetDateTime.parse("2026-03-22T11:31:01.185Z") + ) + .deactivated(true) + .description( + "Each project must have Openlayer monitoring mode enabled." + ) + .evidenceType( + DocumentListResponse.Item.Section.Subsection.Rule + .EvidenceType + .DOCUMENT + ) + .immutable(true) + .renewalCadenceDays(90L) + .build() + ) + .text("text") + .build() + ) + .text("text") + .build() + ) + .build() + ) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val documentListResponse = + DocumentListResponse.builder() + .addItem( + DocumentListResponse.Item.builder() + .id("4a6c8e0f-1b2d-4e3f-9a5b-6c7d8e9f0a1b") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .title("EU AI Act -- Regulation (EU) 2024/1689") + .addSection( + DocumentListResponse.Item.Section.builder() + .id("2e4f6a8c-9b1d-4c3e-8f5a-7b9c0d1e2f3a") + .documentId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .number("Article 9") + .sortOrder(0L) + .title("Risk management system") + .ruleCount(0L) + .addRule( + DocumentListResponse.Item.Section.Rule.builder() + .id("7c9a1e2b-3d4f-4a5b-8c6d-7e8f9a0b1c2d") + .name("Monitoring enabled") + .scope(DocumentListResponse.Item.Section.Rule.Scope.PROJECT) + .type(DocumentListResponse.Item.Section.Rule.Type.PLATFORM) + .automationParams( + DocumentListResponse.Item.Section.Rule.AutomationParams + .builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .automationType("monitoring_mode_enabled") + .dateCreated( + OffsetDateTime.parse("2026-03-22T11:31:01.185Z") + ) + .dateUpdated( + OffsetDateTime.parse("2026-03-22T11:31:01.185Z") + ) + .deactivated(true) + .description( + "Each project must have Openlayer monitoring mode enabled." + ) + .evidenceType( + DocumentListResponse.Item.Section.Rule.EvidenceType + .DOCUMENT + ) + .immutable(true) + .renewalCadenceDays(90L) + .build() + ) + .addSubsection( + DocumentListResponse.Item.Section.Subsection.builder() + .id("1d3f5a7b-8c9e-4b2d-9f6a-0c1e2d3f4a5b") + .number("9.2") + .sectionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .sortOrder(0L) + .title("Identification of known and foreseeable risks") + .ruleCount(0L) + .addRule( + DocumentListResponse.Item.Section.Subsection.Rule + .builder() + .id("7c9a1e2b-3d4f-4a5b-8c6d-7e8f9a0b1c2d") + .name("Monitoring enabled") + .scope( + DocumentListResponse.Item.Section.Subsection + .Rule + .Scope + .PROJECT + ) + .type( + DocumentListResponse.Item.Section.Subsection + .Rule + .Type + .PLATFORM + ) + .automationParams( + DocumentListResponse.Item.Section.Subsection + .Rule + .AutomationParams + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) + .automationType("monitoring_mode_enabled") + .dateCreated( + OffsetDateTime.parse("2026-03-22T11:31:01.185Z") + ) + .dateUpdated( + OffsetDateTime.parse("2026-03-22T11:31:01.185Z") + ) + .deactivated(true) + .description( + "Each project must have Openlayer monitoring mode enabled." + ) + .evidenceType( + DocumentListResponse.Item.Section.Subsection + .Rule + .EvidenceType + .DOCUMENT + ) + .immutable(true) + .renewalCadenceDays(90L) + .build() + ) + .text("text") + .build() + ) + .text("text") + .build() + ) + .build() + ) + .build() + + val roundtrippedDocumentListResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(documentListResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedDocumentListResponse).isEqualTo(documentListResponse) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/documents/DocumentRetrieveParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/documents/DocumentRetrieveParamsTest.kt new file mode 100644 index 00000000..c3886e9e --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/documents/DocumentRetrieveParamsTest.kt @@ -0,0 +1,31 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.frameworks.documents + +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class DocumentRetrieveParamsTest { + + @Test + fun create() { + DocumentRetrieveParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .documentId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + } + + @Test + fun pathParams() { + val params = + DocumentRetrieveParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .documentId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + + assertThat(params._pathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(params._pathParam(1)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + // out-of-bound path param + assertThat(params._pathParam(2)).isEqualTo("") + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/documents/DocumentRetrieveResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/documents/DocumentRetrieveResponseTest.kt new file mode 100644 index 00000000..808ddf3b --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/documents/DocumentRetrieveResponseTest.kt @@ -0,0 +1,312 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.frameworks.documents + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.jsonMapper +import java.time.OffsetDateTime +import kotlin.jvm.optionals.getOrNull +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class DocumentRetrieveResponseTest { + + @Test + fun create() { + val documentRetrieveResponse = + DocumentRetrieveResponse.builder() + .id("4a6c8e0f-1b2d-4e3f-9a5b-6c7d8e9f0a1b") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .title("EU AI Act -- Regulation (EU) 2024/1689") + .addSection( + DocumentRetrieveResponse.Section.builder() + .id("2e4f6a8c-9b1d-4c3e-8f5a-7b9c0d1e2f3a") + .documentId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .number("Article 9") + .sortOrder(0L) + .title("Risk management system") + .ruleCount(0L) + .addRule( + DocumentRetrieveResponse.Section.Rule.builder() + .id("7c9a1e2b-3d4f-4a5b-8c6d-7e8f9a0b1c2d") + .name("Monitoring enabled") + .scope(DocumentRetrieveResponse.Section.Rule.Scope.PROJECT) + .type(DocumentRetrieveResponse.Section.Rule.Type.PLATFORM) + .automationParams( + DocumentRetrieveResponse.Section.Rule.AutomationParams.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .automationType("monitoring_mode_enabled") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .deactivated(true) + .description( + "Each project must have Openlayer monitoring mode enabled." + ) + .evidenceType( + DocumentRetrieveResponse.Section.Rule.EvidenceType.DOCUMENT + ) + .immutable(true) + .renewalCadenceDays(90L) + .build() + ) + .addSubsection( + DocumentRetrieveResponse.Section.Subsection.builder() + .id("1d3f5a7b-8c9e-4b2d-9f6a-0c1e2d3f4a5b") + .number("9.2") + .sectionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .sortOrder(0L) + .title("Identification of known and foreseeable risks") + .ruleCount(0L) + .addRule( + DocumentRetrieveResponse.Section.Subsection.Rule.builder() + .id("7c9a1e2b-3d4f-4a5b-8c6d-7e8f9a0b1c2d") + .name("Monitoring enabled") + .scope( + DocumentRetrieveResponse.Section.Subsection.Rule.Scope + .PROJECT + ) + .type( + DocumentRetrieveResponse.Section.Subsection.Rule.Type + .PLATFORM + ) + .automationParams( + DocumentRetrieveResponse.Section.Subsection.Rule + .AutomationParams + .builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .automationType("monitoring_mode_enabled") + .dateCreated( + OffsetDateTime.parse("2026-03-22T11:31:01.185Z") + ) + .dateUpdated( + OffsetDateTime.parse("2026-03-22T11:31:01.185Z") + ) + .deactivated(true) + .description( + "Each project must have Openlayer monitoring mode enabled." + ) + .evidenceType( + DocumentRetrieveResponse.Section.Subsection.Rule + .EvidenceType + .DOCUMENT + ) + .immutable(true) + .renewalCadenceDays(90L) + .build() + ) + .text("text") + .build() + ) + .text("text") + .build() + ) + .build() + + assertThat(documentRetrieveResponse.id()).isEqualTo("4a6c8e0f-1b2d-4e3f-9a5b-6c7d8e9f0a1b") + assertThat(documentRetrieveResponse.dateCreated()) + .isEqualTo(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + assertThat(documentRetrieveResponse.dateUpdated()) + .isEqualTo(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + assertThat(documentRetrieveResponse.frameworkId()) + .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(documentRetrieveResponse.title()) + .isEqualTo("EU AI Act -- Regulation (EU) 2024/1689") + assertThat(documentRetrieveResponse.sections().getOrNull()) + .containsExactly( + DocumentRetrieveResponse.Section.builder() + .id("2e4f6a8c-9b1d-4c3e-8f5a-7b9c0d1e2f3a") + .documentId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .number("Article 9") + .sortOrder(0L) + .title("Risk management system") + .ruleCount(0L) + .addRule( + DocumentRetrieveResponse.Section.Rule.builder() + .id("7c9a1e2b-3d4f-4a5b-8c6d-7e8f9a0b1c2d") + .name("Monitoring enabled") + .scope(DocumentRetrieveResponse.Section.Rule.Scope.PROJECT) + .type(DocumentRetrieveResponse.Section.Rule.Type.PLATFORM) + .automationParams( + DocumentRetrieveResponse.Section.Rule.AutomationParams.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .automationType("monitoring_mode_enabled") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .deactivated(true) + .description( + "Each project must have Openlayer monitoring mode enabled." + ) + .evidenceType( + DocumentRetrieveResponse.Section.Rule.EvidenceType.DOCUMENT + ) + .immutable(true) + .renewalCadenceDays(90L) + .build() + ) + .addSubsection( + DocumentRetrieveResponse.Section.Subsection.builder() + .id("1d3f5a7b-8c9e-4b2d-9f6a-0c1e2d3f4a5b") + .number("9.2") + .sectionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .sortOrder(0L) + .title("Identification of known and foreseeable risks") + .ruleCount(0L) + .addRule( + DocumentRetrieveResponse.Section.Subsection.Rule.builder() + .id("7c9a1e2b-3d4f-4a5b-8c6d-7e8f9a0b1c2d") + .name("Monitoring enabled") + .scope( + DocumentRetrieveResponse.Section.Subsection.Rule.Scope + .PROJECT + ) + .type( + DocumentRetrieveResponse.Section.Subsection.Rule.Type + .PLATFORM + ) + .automationParams( + DocumentRetrieveResponse.Section.Subsection.Rule + .AutomationParams + .builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .automationType("monitoring_mode_enabled") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .deactivated(true) + .description( + "Each project must have Openlayer monitoring mode enabled." + ) + .evidenceType( + DocumentRetrieveResponse.Section.Subsection.Rule + .EvidenceType + .DOCUMENT + ) + .immutable(true) + .renewalCadenceDays(90L) + .build() + ) + .text("text") + .build() + ) + .text("text") + .build() + ) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val documentRetrieveResponse = + DocumentRetrieveResponse.builder() + .id("4a6c8e0f-1b2d-4e3f-9a5b-6c7d8e9f0a1b") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .title("EU AI Act -- Regulation (EU) 2024/1689") + .addSection( + DocumentRetrieveResponse.Section.builder() + .id("2e4f6a8c-9b1d-4c3e-8f5a-7b9c0d1e2f3a") + .documentId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .number("Article 9") + .sortOrder(0L) + .title("Risk management system") + .ruleCount(0L) + .addRule( + DocumentRetrieveResponse.Section.Rule.builder() + .id("7c9a1e2b-3d4f-4a5b-8c6d-7e8f9a0b1c2d") + .name("Monitoring enabled") + .scope(DocumentRetrieveResponse.Section.Rule.Scope.PROJECT) + .type(DocumentRetrieveResponse.Section.Rule.Type.PLATFORM) + .automationParams( + DocumentRetrieveResponse.Section.Rule.AutomationParams.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .automationType("monitoring_mode_enabled") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .deactivated(true) + .description( + "Each project must have Openlayer monitoring mode enabled." + ) + .evidenceType( + DocumentRetrieveResponse.Section.Rule.EvidenceType.DOCUMENT + ) + .immutable(true) + .renewalCadenceDays(90L) + .build() + ) + .addSubsection( + DocumentRetrieveResponse.Section.Subsection.builder() + .id("1d3f5a7b-8c9e-4b2d-9f6a-0c1e2d3f4a5b") + .number("9.2") + .sectionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .sortOrder(0L) + .title("Identification of known and foreseeable risks") + .ruleCount(0L) + .addRule( + DocumentRetrieveResponse.Section.Subsection.Rule.builder() + .id("7c9a1e2b-3d4f-4a5b-8c6d-7e8f9a0b1c2d") + .name("Monitoring enabled") + .scope( + DocumentRetrieveResponse.Section.Subsection.Rule.Scope + .PROJECT + ) + .type( + DocumentRetrieveResponse.Section.Subsection.Rule.Type + .PLATFORM + ) + .automationParams( + DocumentRetrieveResponse.Section.Subsection.Rule + .AutomationParams + .builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .automationType("monitoring_mode_enabled") + .dateCreated( + OffsetDateTime.parse("2026-03-22T11:31:01.185Z") + ) + .dateUpdated( + OffsetDateTime.parse("2026-03-22T11:31:01.185Z") + ) + .deactivated(true) + .description( + "Each project must have Openlayer monitoring mode enabled." + ) + .evidenceType( + DocumentRetrieveResponse.Section.Subsection.Rule + .EvidenceType + .DOCUMENT + ) + .immutable(true) + .renewalCadenceDays(90L) + .build() + ) + .text("text") + .build() + ) + .text("text") + .build() + ) + .build() + + val roundtrippedDocumentRetrieveResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(documentRetrieveResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedDocumentRetrieveResponse).isEqualTo(documentRetrieveResponse) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/sections/SectionListRulesParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/sections/SectionListRulesParamsTest.kt new file mode 100644 index 00000000..c7459b5c --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/sections/SectionListRulesParamsTest.kt @@ -0,0 +1,80 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.frameworks.sections + +import com.openlayer.api.core.http.QueryParams +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class SectionListRulesParamsTest { + + @Test + fun create() { + SectionListRulesParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .sectionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .includeResults(true) + .includeSubsectionRules(true) + .page(1L) + .perPage(1L) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(SectionListRulesParams.Status.PASSING) + .build() + } + + @Test + fun pathParams() { + val params = + SectionListRulesParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .sectionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + + assertThat(params._pathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(params._pathParam(1)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + // out-of-bound path param + assertThat(params._pathParam(2)).isEqualTo("") + } + + @Test + fun queryParams() { + val params = + SectionListRulesParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .sectionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .includeResults(true) + .includeSubsectionRules(true) + .page(1L) + .perPage(1L) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(SectionListRulesParams.Status.PASSING) + .build() + + val queryParams = params._queryParams() + + assertThat(queryParams) + .isEqualTo( + QueryParams.builder() + .put("includeResults", "true") + .put("includeSubsectionRules", "true") + .put("page", "1") + .put("perPage", "1") + .put("projectId", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .put("status", "passing") + .build() + ) + } + + @Test + fun queryParamsWithoutOptionalFields() { + val params = + SectionListRulesParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .sectionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + + val queryParams = params._queryParams() + + assertThat(queryParams).isEqualTo(QueryParams.builder().build()) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/sections/SectionListRulesResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/sections/SectionListRulesResponseTest.kt new file mode 100644 index 00000000..ca4fb43c --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/sections/SectionListRulesResponseTest.kt @@ -0,0 +1,330 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.frameworks.sections + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.jsonMapper +import java.time.OffsetDateTime +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class SectionListRulesResponseTest { + + @Test + fun create() { + val sectionListRulesResponse = + SectionListRulesResponse.builder() + .addItem( + SectionListRulesResponse.Item.builder() + .id("7c9a1e2b-3d4f-4a5b-8c6d-7e8f9a0b1c2d") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .name("Monitoring enabled") + .scope(SectionListRulesResponse.Item.Scope.PROJECT) + .type(SectionListRulesResponse.Item.Type.PLATFORM) + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .automationParams( + SectionListRulesResponse.Item.AutomationParams.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .automationType("monitoring_mode_enabled") + .deactivated(true) + .description("Each project must have Openlayer monitoring mode enabled.") + .evidenceType(SectionListRulesResponse.Item.EvidenceType.DOCUMENT) + .addFramework( + SectionListRulesResponse.Item.Framework.builder() + .id("9f1b3c2d-4e5a-4f60-8a71-2b3c4d5e6f70") + .avatar( + SectionListRulesResponse.Item.Framework.Avatar.builder() + .type( + SectionListRulesResponse.Item.Framework.Avatar.Type + .EMOJI + ) + .value("🧭") + .build() + ) + .builtInSlug("eu_ai_act") + .enabled(true) + .name("EU AI Act") + .build() + ) + .immutable(true) + .renewalCadenceDays(90L) + .addResult( + SectionListRulesResponse.Item.Result.builder() + .id("5b7d9f1a-2c3e-4d5f-8a6b-9c0d1e2f3a4b") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .deactivated(true) + .ruleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(SectionListRulesResponse.Item.Result.Status.PASSING) + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addBlockedBy( + SectionListRulesResponse.Item.Result.BlockedBy.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status( + SectionListRulesResponse.Item.Result.BlockedBy.Status + .PASSING + ) + .build() + ) + .addBlocking( + SectionListRulesResponse.Item.Result.Blocking.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status( + SectionListRulesResponse.Item.Result.Blocking.Status + .PASSING + ) + .build() + ) + .dateLastEvaluated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfLatestEvidence( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) + .dateOfNextEvaluation( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) + .dateOfRenewal(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .deactivatedReason("deactivatedReason") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .statusMessage("statusMessage") + .build() + ) + .resultsSummary( + SectionListRulesResponse.Item.ResultsSummary.builder() + .passing(0L) + .total(0L) + .build() + ) + .addTagId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addTag( + SectionListRulesResponse.Item.Tag.builder() + .id("6e8a0c2d-4f5b-4a3c-9d7e-8f0a1b2c3d4e") + .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .immutable(true) + .name("Evaluation") + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .color("color") + .build() + ) + .build() + ) + .build() + + assertThat(sectionListRulesResponse.items()) + .containsExactly( + SectionListRulesResponse.Item.builder() + .id("7c9a1e2b-3d4f-4a5b-8c6d-7e8f9a0b1c2d") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .name("Monitoring enabled") + .scope(SectionListRulesResponse.Item.Scope.PROJECT) + .type(SectionListRulesResponse.Item.Type.PLATFORM) + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .automationParams( + SectionListRulesResponse.Item.AutomationParams.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .automationType("monitoring_mode_enabled") + .deactivated(true) + .description("Each project must have Openlayer monitoring mode enabled.") + .evidenceType(SectionListRulesResponse.Item.EvidenceType.DOCUMENT) + .addFramework( + SectionListRulesResponse.Item.Framework.builder() + .id("9f1b3c2d-4e5a-4f60-8a71-2b3c4d5e6f70") + .avatar( + SectionListRulesResponse.Item.Framework.Avatar.builder() + .type(SectionListRulesResponse.Item.Framework.Avatar.Type.EMOJI) + .value("🧭") + .build() + ) + .builtInSlug("eu_ai_act") + .enabled(true) + .name("EU AI Act") + .build() + ) + .immutable(true) + .renewalCadenceDays(90L) + .addResult( + SectionListRulesResponse.Item.Result.builder() + .id("5b7d9f1a-2c3e-4d5f-8a6b-9c0d1e2f3a4b") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .deactivated(true) + .ruleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(SectionListRulesResponse.Item.Result.Status.PASSING) + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addBlockedBy( + SectionListRulesResponse.Item.Result.BlockedBy.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status( + SectionListRulesResponse.Item.Result.BlockedBy.Status + .PASSING + ) + .build() + ) + .addBlocking( + SectionListRulesResponse.Item.Result.Blocking.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status( + SectionListRulesResponse.Item.Result.Blocking.Status.PASSING + ) + .build() + ) + .dateLastEvaluated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfLatestEvidence(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfNextEvaluation(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfRenewal(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .deactivatedReason("deactivatedReason") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .statusMessage("statusMessage") + .build() + ) + .resultsSummary( + SectionListRulesResponse.Item.ResultsSummary.builder() + .passing(0L) + .total(0L) + .build() + ) + .addTagId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addTag( + SectionListRulesResponse.Item.Tag.builder() + .id("6e8a0c2d-4f5b-4a3c-9d7e-8f0a1b2c3d4e") + .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .immutable(true) + .name("Evaluation") + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .color("color") + .build() + ) + .build() + ) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val sectionListRulesResponse = + SectionListRulesResponse.builder() + .addItem( + SectionListRulesResponse.Item.builder() + .id("7c9a1e2b-3d4f-4a5b-8c6d-7e8f9a0b1c2d") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .name("Monitoring enabled") + .scope(SectionListRulesResponse.Item.Scope.PROJECT) + .type(SectionListRulesResponse.Item.Type.PLATFORM) + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .automationParams( + SectionListRulesResponse.Item.AutomationParams.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .automationType("monitoring_mode_enabled") + .deactivated(true) + .description("Each project must have Openlayer monitoring mode enabled.") + .evidenceType(SectionListRulesResponse.Item.EvidenceType.DOCUMENT) + .addFramework( + SectionListRulesResponse.Item.Framework.builder() + .id("9f1b3c2d-4e5a-4f60-8a71-2b3c4d5e6f70") + .avatar( + SectionListRulesResponse.Item.Framework.Avatar.builder() + .type( + SectionListRulesResponse.Item.Framework.Avatar.Type + .EMOJI + ) + .value("🧭") + .build() + ) + .builtInSlug("eu_ai_act") + .enabled(true) + .name("EU AI Act") + .build() + ) + .immutable(true) + .renewalCadenceDays(90L) + .addResult( + SectionListRulesResponse.Item.Result.builder() + .id("5b7d9f1a-2c3e-4d5f-8a6b-9c0d1e2f3a4b") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .deactivated(true) + .ruleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(SectionListRulesResponse.Item.Result.Status.PASSING) + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addBlockedBy( + SectionListRulesResponse.Item.Result.BlockedBy.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status( + SectionListRulesResponse.Item.Result.BlockedBy.Status + .PASSING + ) + .build() + ) + .addBlocking( + SectionListRulesResponse.Item.Result.Blocking.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status( + SectionListRulesResponse.Item.Result.Blocking.Status + .PASSING + ) + .build() + ) + .dateLastEvaluated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfLatestEvidence( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) + .dateOfNextEvaluation( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) + .dateOfRenewal(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .deactivatedReason("deactivatedReason") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .statusMessage("statusMessage") + .build() + ) + .resultsSummary( + SectionListRulesResponse.Item.ResultsSummary.builder() + .passing(0L) + .total(0L) + .build() + ) + .addTagId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addTag( + SectionListRulesResponse.Item.Tag.builder() + .id("6e8a0c2d-4f5b-4a3c-9d7e-8f0a1b2c3d4e") + .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .immutable(true) + .name("Evaluation") + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .color("color") + .build() + ) + .build() + ) + .build() + + val roundtrippedSectionListRulesResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(sectionListRulesResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedSectionListRulesResponse).isEqualTo(sectionListRulesResponse) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/subsections/SubsectionListRulesParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/subsections/SubsectionListRulesParamsTest.kt new file mode 100644 index 00000000..f48ceb56 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/subsections/SubsectionListRulesParamsTest.kt @@ -0,0 +1,77 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.frameworks.subsections + +import com.openlayer.api.core.http.QueryParams +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class SubsectionListRulesParamsTest { + + @Test + fun create() { + SubsectionListRulesParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .subsectionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .includeResults(true) + .page(1L) + .perPage(1L) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(SubsectionListRulesParams.Status.PASSING) + .build() + } + + @Test + fun pathParams() { + val params = + SubsectionListRulesParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .subsectionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + + assertThat(params._pathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(params._pathParam(1)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + // out-of-bound path param + assertThat(params._pathParam(2)).isEqualTo("") + } + + @Test + fun queryParams() { + val params = + SubsectionListRulesParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .subsectionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .includeResults(true) + .page(1L) + .perPage(1L) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(SubsectionListRulesParams.Status.PASSING) + .build() + + val queryParams = params._queryParams() + + assertThat(queryParams) + .isEqualTo( + QueryParams.builder() + .put("includeResults", "true") + .put("page", "1") + .put("perPage", "1") + .put("projectId", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .put("status", "passing") + .build() + ) + } + + @Test + fun queryParamsWithoutOptionalFields() { + val params = + SubsectionListRulesParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .subsectionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + + val queryParams = params._queryParams() + + assertThat(queryParams).isEqualTo(QueryParams.builder().build()) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/subsections/SubsectionListRulesResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/subsections/SubsectionListRulesResponseTest.kt new file mode 100644 index 00000000..1b46d7f0 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/frameworks/subsections/SubsectionListRulesResponseTest.kt @@ -0,0 +1,333 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.frameworks.subsections + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.jsonMapper +import java.time.OffsetDateTime +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class SubsectionListRulesResponseTest { + + @Test + fun create() { + val subsectionListRulesResponse = + SubsectionListRulesResponse.builder() + .addItem( + SubsectionListRulesResponse.Item.builder() + .id("7c9a1e2b-3d4f-4a5b-8c6d-7e8f9a0b1c2d") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .name("Monitoring enabled") + .scope(SubsectionListRulesResponse.Item.Scope.PROJECT) + .type(SubsectionListRulesResponse.Item.Type.PLATFORM) + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .automationParams( + SubsectionListRulesResponse.Item.AutomationParams.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .automationType("monitoring_mode_enabled") + .deactivated(true) + .description("Each project must have Openlayer monitoring mode enabled.") + .evidenceType(SubsectionListRulesResponse.Item.EvidenceType.DOCUMENT) + .addFramework( + SubsectionListRulesResponse.Item.Framework.builder() + .id("9f1b3c2d-4e5a-4f60-8a71-2b3c4d5e6f70") + .avatar( + SubsectionListRulesResponse.Item.Framework.Avatar.builder() + .type( + SubsectionListRulesResponse.Item.Framework.Avatar.Type + .EMOJI + ) + .value("🧭") + .build() + ) + .builtInSlug("eu_ai_act") + .enabled(true) + .name("EU AI Act") + .build() + ) + .immutable(true) + .renewalCadenceDays(90L) + .addResult( + SubsectionListRulesResponse.Item.Result.builder() + .id("5b7d9f1a-2c3e-4d5f-8a6b-9c0d1e2f3a4b") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .deactivated(true) + .ruleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(SubsectionListRulesResponse.Item.Result.Status.PASSING) + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addBlockedBy( + SubsectionListRulesResponse.Item.Result.BlockedBy.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status( + SubsectionListRulesResponse.Item.Result.BlockedBy.Status + .PASSING + ) + .build() + ) + .addBlocking( + SubsectionListRulesResponse.Item.Result.Blocking.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status( + SubsectionListRulesResponse.Item.Result.Blocking.Status + .PASSING + ) + .build() + ) + .dateLastEvaluated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfLatestEvidence( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) + .dateOfNextEvaluation( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) + .dateOfRenewal(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .deactivatedReason("deactivatedReason") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .statusMessage("statusMessage") + .build() + ) + .resultsSummary( + SubsectionListRulesResponse.Item.ResultsSummary.builder() + .passing(0L) + .total(0L) + .build() + ) + .addTagId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addTag( + SubsectionListRulesResponse.Item.Tag.builder() + .id("6e8a0c2d-4f5b-4a3c-9d7e-8f0a1b2c3d4e") + .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .immutable(true) + .name("Evaluation") + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .color("color") + .build() + ) + .build() + ) + .build() + + assertThat(subsectionListRulesResponse.items()) + .containsExactly( + SubsectionListRulesResponse.Item.builder() + .id("7c9a1e2b-3d4f-4a5b-8c6d-7e8f9a0b1c2d") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .name("Monitoring enabled") + .scope(SubsectionListRulesResponse.Item.Scope.PROJECT) + .type(SubsectionListRulesResponse.Item.Type.PLATFORM) + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .automationParams( + SubsectionListRulesResponse.Item.AutomationParams.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .automationType("monitoring_mode_enabled") + .deactivated(true) + .description("Each project must have Openlayer monitoring mode enabled.") + .evidenceType(SubsectionListRulesResponse.Item.EvidenceType.DOCUMENT) + .addFramework( + SubsectionListRulesResponse.Item.Framework.builder() + .id("9f1b3c2d-4e5a-4f60-8a71-2b3c4d5e6f70") + .avatar( + SubsectionListRulesResponse.Item.Framework.Avatar.builder() + .type( + SubsectionListRulesResponse.Item.Framework.Avatar.Type.EMOJI + ) + .value("🧭") + .build() + ) + .builtInSlug("eu_ai_act") + .enabled(true) + .name("EU AI Act") + .build() + ) + .immutable(true) + .renewalCadenceDays(90L) + .addResult( + SubsectionListRulesResponse.Item.Result.builder() + .id("5b7d9f1a-2c3e-4d5f-8a6b-9c0d1e2f3a4b") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .deactivated(true) + .ruleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(SubsectionListRulesResponse.Item.Result.Status.PASSING) + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addBlockedBy( + SubsectionListRulesResponse.Item.Result.BlockedBy.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status( + SubsectionListRulesResponse.Item.Result.BlockedBy.Status + .PASSING + ) + .build() + ) + .addBlocking( + SubsectionListRulesResponse.Item.Result.Blocking.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status( + SubsectionListRulesResponse.Item.Result.Blocking.Status + .PASSING + ) + .build() + ) + .dateLastEvaluated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfLatestEvidence(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfNextEvaluation(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfRenewal(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .deactivatedReason("deactivatedReason") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .statusMessage("statusMessage") + .build() + ) + .resultsSummary( + SubsectionListRulesResponse.Item.ResultsSummary.builder() + .passing(0L) + .total(0L) + .build() + ) + .addTagId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addTag( + SubsectionListRulesResponse.Item.Tag.builder() + .id("6e8a0c2d-4f5b-4a3c-9d7e-8f0a1b2c3d4e") + .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .immutable(true) + .name("Evaluation") + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .color("color") + .build() + ) + .build() + ) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val subsectionListRulesResponse = + SubsectionListRulesResponse.builder() + .addItem( + SubsectionListRulesResponse.Item.builder() + .id("7c9a1e2b-3d4f-4a5b-8c6d-7e8f9a0b1c2d") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .name("Monitoring enabled") + .scope(SubsectionListRulesResponse.Item.Scope.PROJECT) + .type(SubsectionListRulesResponse.Item.Type.PLATFORM) + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .automationParams( + SubsectionListRulesResponse.Item.AutomationParams.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .automationType("monitoring_mode_enabled") + .deactivated(true) + .description("Each project must have Openlayer monitoring mode enabled.") + .evidenceType(SubsectionListRulesResponse.Item.EvidenceType.DOCUMENT) + .addFramework( + SubsectionListRulesResponse.Item.Framework.builder() + .id("9f1b3c2d-4e5a-4f60-8a71-2b3c4d5e6f70") + .avatar( + SubsectionListRulesResponse.Item.Framework.Avatar.builder() + .type( + SubsectionListRulesResponse.Item.Framework.Avatar.Type + .EMOJI + ) + .value("🧭") + .build() + ) + .builtInSlug("eu_ai_act") + .enabled(true) + .name("EU AI Act") + .build() + ) + .immutable(true) + .renewalCadenceDays(90L) + .addResult( + SubsectionListRulesResponse.Item.Result.builder() + .id("5b7d9f1a-2c3e-4d5f-8a6b-9c0d1e2f3a4b") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .deactivated(true) + .ruleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(SubsectionListRulesResponse.Item.Result.Status.PASSING) + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addBlockedBy( + SubsectionListRulesResponse.Item.Result.BlockedBy.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status( + SubsectionListRulesResponse.Item.Result.BlockedBy.Status + .PASSING + ) + .build() + ) + .addBlocking( + SubsectionListRulesResponse.Item.Result.Blocking.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status( + SubsectionListRulesResponse.Item.Result.Blocking.Status + .PASSING + ) + .build() + ) + .dateLastEvaluated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfLatestEvidence( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) + .dateOfNextEvaluation( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) + .dateOfRenewal(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .deactivatedReason("deactivatedReason") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .statusMessage("statusMessage") + .build() + ) + .resultsSummary( + SubsectionListRulesResponse.Item.ResultsSummary.builder() + .passing(0L) + .total(0L) + .build() + ) + .addTagId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addTag( + SubsectionListRulesResponse.Item.Tag.builder() + .id("6e8a0c2d-4f5b-4a3c-9d7e-8f0a1b2c3d4e") + .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .immutable(true) + .name("Evaluation") + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .color("color") + .build() + ) + .build() + ) + .build() + + val roundtrippedSubsectionListRulesResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(subsectionListRulesResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedSubsectionListRulesResponse).isEqualTo(subsectionListRulesResponse) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultCreateEvidenceParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultCreateEvidenceParamsTest.kt new file mode 100644 index 00000000..f1d86f57 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultCreateEvidenceParamsTest.kt @@ -0,0 +1,64 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.ruleresults + +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class RuleResultCreateEvidenceParamsTest { + + @Test + fun create() { + RuleResultCreateEvidenceParams.builder() + .ruleResultId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .description("description") + .name("Model risk assessment 2026") + .storageUri("s3://openlayer-evidence/evidence.pdf") + .text("text") + .url("https://openlayer.com/evidence") + .build() + } + + @Test + fun pathParams() { + val params = + RuleResultCreateEvidenceParams.builder() + .ruleResultId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + + assertThat(params._pathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } + + @Test + fun body() { + val params = + RuleResultCreateEvidenceParams.builder() + .ruleResultId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .description("description") + .name("Model risk assessment 2026") + .storageUri("s3://openlayer-evidence/evidence.pdf") + .text("text") + .url("https://openlayer.com/evidence") + .build() + + val body = params._body() + + assertThat(body.description()).contains("description") + assertThat(body.name()).contains("Model risk assessment 2026") + assertThat(body.storageUri()).contains("s3://openlayer-evidence/evidence.pdf") + assertThat(body.text()).contains("text") + assertThat(body.url()).contains("https://openlayer.com/evidence") + } + + @Test + fun bodyWithoutOptionalFields() { + val params = + RuleResultCreateEvidenceParams.builder() + .ruleResultId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + + val body = params._body() + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultCreateEvidenceResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultCreateEvidenceResponseTest.kt new file mode 100644 index 00000000..ce5fd792 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultCreateEvidenceResponseTest.kt @@ -0,0 +1,70 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.ruleresults + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.jsonMapper +import java.time.OffsetDateTime +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class RuleResultCreateEvidenceResponseTest { + + @Test + fun create() { + val ruleResultCreateEvidenceResponse = + RuleResultCreateEvidenceResponse.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .description("description") + .name("Model risk assessment 2026") + .storageUri("s3://openlayer-evidence/evidence.pdf") + .text("text") + .url("https://openlayer.com/evidence") + .build() + + assertThat(ruleResultCreateEvidenceResponse.id()) + .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(ruleResultCreateEvidenceResponse.creatorId()) + .contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(ruleResultCreateEvidenceResponse.dateCreated()) + .isEqualTo(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + assertThat(ruleResultCreateEvidenceResponse.dateUpdated()) + .isEqualTo(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + assertThat(ruleResultCreateEvidenceResponse.description()).contains("description") + assertThat(ruleResultCreateEvidenceResponse.name()).contains("Model risk assessment 2026") + assertThat(ruleResultCreateEvidenceResponse.storageUri()) + .contains("s3://openlayer-evidence/evidence.pdf") + assertThat(ruleResultCreateEvidenceResponse.text()).contains("text") + assertThat(ruleResultCreateEvidenceResponse.url()) + .contains("https://openlayer.com/evidence") + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val ruleResultCreateEvidenceResponse = + RuleResultCreateEvidenceResponse.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .description("description") + .name("Model risk assessment 2026") + .storageUri("s3://openlayer-evidence/evidence.pdf") + .text("text") + .url("https://openlayer.com/evidence") + .build() + + val roundtrippedRuleResultCreateEvidenceResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(ruleResultCreateEvidenceResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedRuleResultCreateEvidenceResponse) + .isEqualTo(ruleResultCreateEvidenceResponse) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultListEvidenceParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultListEvidenceParamsTest.kt new file mode 100644 index 00000000..45eb8e45 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultListEvidenceParamsTest.kt @@ -0,0 +1,58 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.ruleresults + +import com.openlayer.api.core.http.QueryParams +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class RuleResultListEvidenceParamsTest { + + @Test + fun create() { + RuleResultListEvidenceParams.builder() + .ruleResultId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .page(1L) + .perPage(1L) + .build() + } + + @Test + fun pathParams() { + val params = + RuleResultListEvidenceParams.builder() + .ruleResultId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + + assertThat(params._pathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } + + @Test + fun queryParams() { + val params = + RuleResultListEvidenceParams.builder() + .ruleResultId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .page(1L) + .perPage(1L) + .build() + + val queryParams = params._queryParams() + + assertThat(queryParams) + .isEqualTo(QueryParams.builder().put("page", "1").put("perPage", "1").build()) + } + + @Test + fun queryParamsWithoutOptionalFields() { + val params = + RuleResultListEvidenceParams.builder() + .ruleResultId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + + val queryParams = params._queryParams() + + assertThat(queryParams).isEqualTo(QueryParams.builder().build()) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultListEvidenceResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultListEvidenceResponseTest.kt new file mode 100644 index 00000000..62d4c220 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultListEvidenceResponseTest.kt @@ -0,0 +1,77 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.ruleresults + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.jsonMapper +import java.time.OffsetDateTime +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class RuleResultListEvidenceResponseTest { + + @Test + fun create() { + val ruleResultListEvidenceResponse = + RuleResultListEvidenceResponse.builder() + .addItem( + RuleResultListEvidenceResponse.Item.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .description("description") + .name("Model risk assessment 2026") + .storageUri("s3://openlayer-evidence/evidence.pdf") + .text("text") + .url("https://openlayer.com/evidence") + .build() + ) + .build() + + assertThat(ruleResultListEvidenceResponse.items()) + .containsExactly( + RuleResultListEvidenceResponse.Item.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .description("description") + .name("Model risk assessment 2026") + .storageUri("s3://openlayer-evidence/evidence.pdf") + .text("text") + .url("https://openlayer.com/evidence") + .build() + ) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val ruleResultListEvidenceResponse = + RuleResultListEvidenceResponse.builder() + .addItem( + RuleResultListEvidenceResponse.Item.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .description("description") + .name("Model risk assessment 2026") + .storageUri("s3://openlayer-evidence/evidence.pdf") + .text("text") + .url("https://openlayer.com/evidence") + .build() + ) + .build() + + val roundtrippedRuleResultListEvidenceResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(ruleResultListEvidenceResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedRuleResultListEvidenceResponse) + .isEqualTo(ruleResultListEvidenceResponse) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultListParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultListParamsTest.kt new file mode 100644 index 00000000..742f1268 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultListParamsTest.kt @@ -0,0 +1,90 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.ruleresults + +import com.openlayer.api.core.http.QueryParams +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class RuleResultListParamsTest { + + @Test + fun create() { + RuleResultListParams.builder() + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .enabledFrameworkOnly(true) + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .includeUnframed(true) + .page(1L) + .perPage(1L) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .ruleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .scope(RuleResultListParams.Scope.PROJECT) + .searchQuery("searchQuery") + .status(RuleResultListParams.Status.PASSING) + .type(RuleResultListParams.Type.PLATFORM) + .build() + } + + @Test + fun pathParams() { + val params = + RuleResultListParams.builder() + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + + assertThat(params._pathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } + + @Test + fun queryParams() { + val params = + RuleResultListParams.builder() + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .enabledFrameworkOnly(true) + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .includeUnframed(true) + .page(1L) + .perPage(1L) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .ruleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .scope(RuleResultListParams.Scope.PROJECT) + .searchQuery("searchQuery") + .status(RuleResultListParams.Status.PASSING) + .type(RuleResultListParams.Type.PLATFORM) + .build() + + val queryParams = params._queryParams() + + assertThat(queryParams) + .isEqualTo( + QueryParams.builder() + .put("enabledFrameworkOnly", "true") + .put("frameworkId", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .put("includeUnframed", "true") + .put("page", "1") + .put("perPage", "1") + .put("projectId", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .put("ruleId", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .put("scope", "project") + .put("searchQuery", "searchQuery") + .put("status", "passing") + .put("type", "platform") + .build() + ) + } + + @Test + fun queryParamsWithoutOptionalFields() { + val params = + RuleResultListParams.builder() + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + + val queryParams = params._queryParams() + + assertThat(queryParams).isEqualTo(QueryParams.builder().build()) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultListResponseTest.kt new file mode 100644 index 00000000..010177f1 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultListResponseTest.kt @@ -0,0 +1,130 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.ruleresults + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.jsonMapper +import java.time.OffsetDateTime +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class RuleResultListResponseTest { + + @Test + fun create() { + val ruleResultListResponse = + RuleResultListResponse.builder() + .addItem( + RuleResultListResponse.Item.builder() + .id("5b7d9f1a-2c3e-4d5f-8a6b-9c0d1e2f3a4b") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .deactivated(true) + .ruleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleResultListResponse.Item.Status.PASSING) + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addBlockedBy( + RuleResultListResponse.Item.BlockedBy.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleResultListResponse.Item.BlockedBy.Status.PASSING) + .build() + ) + .addBlocking( + RuleResultListResponse.Item.Blocking.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleResultListResponse.Item.Blocking.Status.PASSING) + .build() + ) + .dateLastEvaluated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfLatestEvidence(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfNextEvaluation(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfRenewal(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .deactivatedReason("deactivatedReason") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .statusMessage("statusMessage") + .build() + ) + .build() + + assertThat(ruleResultListResponse.items()) + .containsExactly( + RuleResultListResponse.Item.builder() + .id("5b7d9f1a-2c3e-4d5f-8a6b-9c0d1e2f3a4b") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .deactivated(true) + .ruleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleResultListResponse.Item.Status.PASSING) + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addBlockedBy( + RuleResultListResponse.Item.BlockedBy.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleResultListResponse.Item.BlockedBy.Status.PASSING) + .build() + ) + .addBlocking( + RuleResultListResponse.Item.Blocking.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleResultListResponse.Item.Blocking.Status.PASSING) + .build() + ) + .dateLastEvaluated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfLatestEvidence(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfNextEvaluation(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfRenewal(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .deactivatedReason("deactivatedReason") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .statusMessage("statusMessage") + .build() + ) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val ruleResultListResponse = + RuleResultListResponse.builder() + .addItem( + RuleResultListResponse.Item.builder() + .id("5b7d9f1a-2c3e-4d5f-8a6b-9c0d1e2f3a4b") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .deactivated(true) + .ruleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleResultListResponse.Item.Status.PASSING) + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addBlockedBy( + RuleResultListResponse.Item.BlockedBy.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleResultListResponse.Item.BlockedBy.Status.PASSING) + .build() + ) + .addBlocking( + RuleResultListResponse.Item.Blocking.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleResultListResponse.Item.Blocking.Status.PASSING) + .build() + ) + .dateLastEvaluated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfLatestEvidence(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfNextEvaluation(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfRenewal(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .deactivatedReason("deactivatedReason") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .statusMessage("statusMessage") + .build() + ) + .build() + + val roundtrippedRuleResultListResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(ruleResultListResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedRuleResultListResponse).isEqualTo(ruleResultListResponse) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultRetrieveParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultRetrieveParamsTest.kt new file mode 100644 index 00000000..277b8edd --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultRetrieveParamsTest.kt @@ -0,0 +1,28 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.ruleresults + +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class RuleResultRetrieveParamsTest { + + @Test + fun create() { + RuleResultRetrieveParams.builder() + .ruleResultId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + } + + @Test + fun pathParams() { + val params = + RuleResultRetrieveParams.builder() + .ruleResultId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + + assertThat(params._pathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultRetrieveResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultRetrieveResponseTest.kt new file mode 100644 index 00000000..46d6526e --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultRetrieveResponseTest.kt @@ -0,0 +1,132 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.ruleresults + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.jsonMapper +import java.time.OffsetDateTime +import kotlin.jvm.optionals.getOrNull +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class RuleResultRetrieveResponseTest { + + @Test + fun create() { + val ruleResultRetrieveResponse = + RuleResultRetrieveResponse.builder() + .id("5b7d9f1a-2c3e-4d5f-8a6b-9c0d1e2f3a4b") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .deactivated(true) + .ruleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleResultRetrieveResponse.Status.PASSING) + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addBlockedBy( + RuleResultRetrieveResponse.BlockedBy.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleResultRetrieveResponse.BlockedBy.Status.PASSING) + .build() + ) + .addBlocking( + RuleResultRetrieveResponse.Blocking.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleResultRetrieveResponse.Blocking.Status.PASSING) + .build() + ) + .dateLastEvaluated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfLatestEvidence(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfNextEvaluation(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfRenewal(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .deactivatedReason("deactivatedReason") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .statusMessage("statusMessage") + .build() + + assertThat(ruleResultRetrieveResponse.id()) + .isEqualTo("5b7d9f1a-2c3e-4d5f-8a6b-9c0d1e2f3a4b") + assertThat(ruleResultRetrieveResponse.dateCreated()) + .isEqualTo(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + assertThat(ruleResultRetrieveResponse.dateUpdated()) + .isEqualTo(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + assertThat(ruleResultRetrieveResponse.deactivated()).isEqualTo(true) + assertThat(ruleResultRetrieveResponse.ruleId()) + .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(ruleResultRetrieveResponse.status()) + .isEqualTo(RuleResultRetrieveResponse.Status.PASSING) + assertThat(ruleResultRetrieveResponse.workspaceId()) + .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(ruleResultRetrieveResponse.assigneeId()) + .contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(ruleResultRetrieveResponse.blockedBy().getOrNull()) + .containsExactly( + RuleResultRetrieveResponse.BlockedBy.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleResultRetrieveResponse.BlockedBy.Status.PASSING) + .build() + ) + assertThat(ruleResultRetrieveResponse.blocking().getOrNull()) + .containsExactly( + RuleResultRetrieveResponse.Blocking.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleResultRetrieveResponse.Blocking.Status.PASSING) + .build() + ) + assertThat(ruleResultRetrieveResponse.dateLastEvaluated()) + .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(ruleResultRetrieveResponse.dateOfLatestEvidence()) + .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(ruleResultRetrieveResponse.dateOfNextEvaluation()) + .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(ruleResultRetrieveResponse.dateOfRenewal()) + .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(ruleResultRetrieveResponse.deactivatedReason()).contains("deactivatedReason") + assertThat(ruleResultRetrieveResponse.projectId()) + .contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(ruleResultRetrieveResponse.statusMessage()).contains("statusMessage") + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val ruleResultRetrieveResponse = + RuleResultRetrieveResponse.builder() + .id("5b7d9f1a-2c3e-4d5f-8a6b-9c0d1e2f3a4b") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .deactivated(true) + .ruleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleResultRetrieveResponse.Status.PASSING) + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addBlockedBy( + RuleResultRetrieveResponse.BlockedBy.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleResultRetrieveResponse.BlockedBy.Status.PASSING) + .build() + ) + .addBlocking( + RuleResultRetrieveResponse.Blocking.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleResultRetrieveResponse.Blocking.Status.PASSING) + .build() + ) + .dateLastEvaluated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfLatestEvidence(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfNextEvaluation(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfRenewal(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .deactivatedReason("deactivatedReason") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .statusMessage("statusMessage") + .build() + + val roundtrippedRuleResultRetrieveResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(ruleResultRetrieveResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedRuleResultRetrieveResponse).isEqualTo(ruleResultRetrieveResponse) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultUpdateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultUpdateParamsTest.kt new file mode 100644 index 00000000..868d4d04 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultUpdateParamsTest.kt @@ -0,0 +1,97 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.ruleresults + +import kotlin.jvm.optionals.getOrNull +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class RuleResultUpdateParamsTest { + + @Test + fun create() { + RuleResultUpdateParams.builder() + .ruleResultId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addBlockedBy( + RuleResultUpdateParams.BlockedBy.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleResultUpdateParams.BlockedBy.Status.PASSING) + .build() + ) + .addBlocking( + RuleResultUpdateParams.Blocking.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleResultUpdateParams.Blocking.Status.PASSING) + .build() + ) + .deactivated(true) + .deactivatedReason("deactivatedReason") + .build() + } + + @Test + fun pathParams() { + val params = + RuleResultUpdateParams.builder() + .ruleResultId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + + assertThat(params._pathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } + + @Test + fun body() { + val params = + RuleResultUpdateParams.builder() + .ruleResultId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addBlockedBy( + RuleResultUpdateParams.BlockedBy.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleResultUpdateParams.BlockedBy.Status.PASSING) + .build() + ) + .addBlocking( + RuleResultUpdateParams.Blocking.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleResultUpdateParams.Blocking.Status.PASSING) + .build() + ) + .deactivated(true) + .deactivatedReason("deactivatedReason") + .build() + + val body = params._body() + + assertThat(body.assigneeId()).contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(body.blockedBy().getOrNull()) + .containsExactly( + RuleResultUpdateParams.BlockedBy.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleResultUpdateParams.BlockedBy.Status.PASSING) + .build() + ) + assertThat(body.blocking().getOrNull()) + .containsExactly( + RuleResultUpdateParams.Blocking.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleResultUpdateParams.Blocking.Status.PASSING) + .build() + ) + assertThat(body.deactivated()).contains(true) + assertThat(body.deactivatedReason()).contains("deactivatedReason") + } + + @Test + fun bodyWithoutOptionalFields() { + val params = + RuleResultUpdateParams.builder() + .ruleResultId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + + val body = params._body() + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultUpdateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultUpdateResponseTest.kt new file mode 100644 index 00000000..7204086f --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/ruleresults/RuleResultUpdateResponseTest.kt @@ -0,0 +1,131 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.ruleresults + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.jsonMapper +import java.time.OffsetDateTime +import kotlin.jvm.optionals.getOrNull +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class RuleResultUpdateResponseTest { + + @Test + fun create() { + val ruleResultUpdateResponse = + RuleResultUpdateResponse.builder() + .id("5b7d9f1a-2c3e-4d5f-8a6b-9c0d1e2f3a4b") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .deactivated(true) + .ruleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleResultUpdateResponse.Status.PASSING) + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addBlockedBy( + RuleResultUpdateResponse.BlockedBy.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleResultUpdateResponse.BlockedBy.Status.PASSING) + .build() + ) + .addBlocking( + RuleResultUpdateResponse.Blocking.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleResultUpdateResponse.Blocking.Status.PASSING) + .build() + ) + .dateLastEvaluated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfLatestEvidence(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfNextEvaluation(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfRenewal(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .deactivatedReason("deactivatedReason") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .statusMessage("statusMessage") + .build() + + assertThat(ruleResultUpdateResponse.id()).isEqualTo("5b7d9f1a-2c3e-4d5f-8a6b-9c0d1e2f3a4b") + assertThat(ruleResultUpdateResponse.dateCreated()) + .isEqualTo(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + assertThat(ruleResultUpdateResponse.dateUpdated()) + .isEqualTo(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + assertThat(ruleResultUpdateResponse.deactivated()).isEqualTo(true) + assertThat(ruleResultUpdateResponse.ruleId()) + .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(ruleResultUpdateResponse.status()) + .isEqualTo(RuleResultUpdateResponse.Status.PASSING) + assertThat(ruleResultUpdateResponse.workspaceId()) + .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(ruleResultUpdateResponse.assigneeId()) + .contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(ruleResultUpdateResponse.blockedBy().getOrNull()) + .containsExactly( + RuleResultUpdateResponse.BlockedBy.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleResultUpdateResponse.BlockedBy.Status.PASSING) + .build() + ) + assertThat(ruleResultUpdateResponse.blocking().getOrNull()) + .containsExactly( + RuleResultUpdateResponse.Blocking.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleResultUpdateResponse.Blocking.Status.PASSING) + .build() + ) + assertThat(ruleResultUpdateResponse.dateLastEvaluated()) + .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(ruleResultUpdateResponse.dateOfLatestEvidence()) + .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(ruleResultUpdateResponse.dateOfNextEvaluation()) + .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(ruleResultUpdateResponse.dateOfRenewal()) + .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(ruleResultUpdateResponse.deactivatedReason()).contains("deactivatedReason") + assertThat(ruleResultUpdateResponse.projectId()) + .contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(ruleResultUpdateResponse.statusMessage()).contains("statusMessage") + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val ruleResultUpdateResponse = + RuleResultUpdateResponse.builder() + .id("5b7d9f1a-2c3e-4d5f-8a6b-9c0d1e2f3a4b") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .deactivated(true) + .ruleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleResultUpdateResponse.Status.PASSING) + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addBlockedBy( + RuleResultUpdateResponse.BlockedBy.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleResultUpdateResponse.BlockedBy.Status.PASSING) + .build() + ) + .addBlocking( + RuleResultUpdateResponse.Blocking.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleResultUpdateResponse.Blocking.Status.PASSING) + .build() + ) + .dateLastEvaluated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfLatestEvidence(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfNextEvaluation(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfRenewal(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .deactivatedReason("deactivatedReason") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .statusMessage("statusMessage") + .build() + + val roundtrippedRuleResultUpdateResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(ruleResultUpdateResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedRuleResultUpdateResponse).isEqualTo(ruleResultUpdateResponse) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/rules/RuleCreateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/rules/RuleCreateParamsTest.kt new file mode 100644 index 00000000..d42cb1b9 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/rules/RuleCreateParamsTest.kt @@ -0,0 +1,109 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.rules + +import com.openlayer.api.core.JsonValue +import kotlin.jvm.optionals.getOrNull +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class RuleCreateParamsTest { + + @Test + fun create() { + RuleCreateParams.builder() + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .name("Monitoring enabled") + .scope(RuleCreateParams.Scope.PROJECT) + .type(RuleCreateParams.Type.PLATFORM) + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .automationParams( + RuleCreateParams.AutomationParams.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .automationType("monitoring_mode_enabled") + .deactivated(true) + .description("Each project must have Openlayer monitoring mode enabled.") + .evidenceType(RuleCreateParams.EvidenceType.DOCUMENT) + .renewalCadenceDays(90L) + .addTagId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + } + + @Test + fun pathParams() { + val params = + RuleCreateParams.builder() + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .name("Monitoring enabled") + .scope(RuleCreateParams.Scope.PROJECT) + .type(RuleCreateParams.Type.PLATFORM) + .build() + + assertThat(params._pathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } + + @Test + fun body() { + val params = + RuleCreateParams.builder() + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .name("Monitoring enabled") + .scope(RuleCreateParams.Scope.PROJECT) + .type(RuleCreateParams.Type.PLATFORM) + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .automationParams( + RuleCreateParams.AutomationParams.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .automationType("monitoring_mode_enabled") + .deactivated(true) + .description("Each project must have Openlayer monitoring mode enabled.") + .evidenceType(RuleCreateParams.EvidenceType.DOCUMENT) + .renewalCadenceDays(90L) + .addTagId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + + val body = params._body() + + assertThat(body.name()).isEqualTo("Monitoring enabled") + assertThat(body.scope()).isEqualTo(RuleCreateParams.Scope.PROJECT) + assertThat(body.type()).isEqualTo(RuleCreateParams.Type.PLATFORM) + assertThat(body.assigneeId()).contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(body.automationParams()) + .contains( + RuleCreateParams.AutomationParams.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + assertThat(body.automationType()).contains("monitoring_mode_enabled") + assertThat(body.deactivated()).contains(true) + assertThat(body.description()) + .contains("Each project must have Openlayer monitoring mode enabled.") + assertThat(body.evidenceType()).contains(RuleCreateParams.EvidenceType.DOCUMENT) + assertThat(body.renewalCadenceDays()).contains(90L) + assertThat(body.tagIds().getOrNull()) + .containsExactly("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + } + + @Test + fun bodyWithoutOptionalFields() { + val params = + RuleCreateParams.builder() + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .name("Monitoring enabled") + .scope(RuleCreateParams.Scope.PROJECT) + .type(RuleCreateParams.Type.PLATFORM) + .build() + + val body = params._body() + + assertThat(body.name()).isEqualTo("Monitoring enabled") + assertThat(body.scope()).isEqualTo(RuleCreateParams.Scope.PROJECT) + assertThat(body.type()).isEqualTo(RuleCreateParams.Type.PLATFORM) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/rules/RuleCreateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/rules/RuleCreateResponseTest.kt new file mode 100644 index 00000000..f6525a9f --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/rules/RuleCreateResponseTest.kt @@ -0,0 +1,287 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.rules + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.jsonMapper +import java.time.OffsetDateTime +import kotlin.jvm.optionals.getOrNull +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class RuleCreateResponseTest { + + @Test + fun create() { + val ruleCreateResponse = + RuleCreateResponse.builder() + .id("7c9a1e2b-3d4f-4a5b-8c6d-7e8f9a0b1c2d") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .name("Monitoring enabled") + .scope(RuleCreateResponse.Scope.PROJECT) + .type(RuleCreateResponse.Type.PLATFORM) + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .automationParams( + RuleCreateResponse.AutomationParams.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .automationType("monitoring_mode_enabled") + .deactivated(true) + .description("Each project must have Openlayer monitoring mode enabled.") + .evidenceType(RuleCreateResponse.EvidenceType.DOCUMENT) + .addFramework( + RuleCreateResponse.Framework.builder() + .id("9f1b3c2d-4e5a-4f60-8a71-2b3c4d5e6f70") + .avatar( + RuleCreateResponse.Framework.Avatar.builder() + .type(RuleCreateResponse.Framework.Avatar.Type.EMOJI) + .value("🧭") + .build() + ) + .builtInSlug("eu_ai_act") + .enabled(true) + .name("EU AI Act") + .build() + ) + .immutable(true) + .renewalCadenceDays(90L) + .addResult( + RuleCreateResponse.Result.builder() + .id("5b7d9f1a-2c3e-4d5f-8a6b-9c0d1e2f3a4b") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .deactivated(true) + .ruleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleCreateResponse.Result.Status.PASSING) + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addBlockedBy( + RuleCreateResponse.Result.BlockedBy.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleCreateResponse.Result.BlockedBy.Status.PASSING) + .build() + ) + .addBlocking( + RuleCreateResponse.Result.Blocking.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleCreateResponse.Result.Blocking.Status.PASSING) + .build() + ) + .dateLastEvaluated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfLatestEvidence(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfNextEvaluation(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfRenewal(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .deactivatedReason("deactivatedReason") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .statusMessage("statusMessage") + .build() + ) + .resultsSummary( + RuleCreateResponse.ResultsSummary.builder().passing(0L).total(0L).build() + ) + .addTagId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addTag( + RuleCreateResponse.Tag.builder() + .id("6e8a0c2d-4f5b-4a3c-9d7e-8f0a1b2c3d4e") + .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .immutable(true) + .name("Evaluation") + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .color("color") + .build() + ) + .build() + + assertThat(ruleCreateResponse.id()).isEqualTo("7c9a1e2b-3d4f-4a5b-8c6d-7e8f9a0b1c2d") + assertThat(ruleCreateResponse.dateCreated()) + .isEqualTo(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + assertThat(ruleCreateResponse.dateUpdated()) + .isEqualTo(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + assertThat(ruleCreateResponse.name()).isEqualTo("Monitoring enabled") + assertThat(ruleCreateResponse.scope()).isEqualTo(RuleCreateResponse.Scope.PROJECT) + assertThat(ruleCreateResponse.type()).isEqualTo(RuleCreateResponse.Type.PLATFORM) + assertThat(ruleCreateResponse.workspaceId()) + .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(ruleCreateResponse.assigneeId()).contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(ruleCreateResponse.automationParams()) + .contains( + RuleCreateResponse.AutomationParams.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + assertThat(ruleCreateResponse.automationType()).contains("monitoring_mode_enabled") + assertThat(ruleCreateResponse.deactivated()).contains(true) + assertThat(ruleCreateResponse.description()) + .contains("Each project must have Openlayer monitoring mode enabled.") + assertThat(ruleCreateResponse.evidenceType()) + .contains(RuleCreateResponse.EvidenceType.DOCUMENT) + assertThat(ruleCreateResponse.frameworks().getOrNull()) + .containsExactly( + RuleCreateResponse.Framework.builder() + .id("9f1b3c2d-4e5a-4f60-8a71-2b3c4d5e6f70") + .avatar( + RuleCreateResponse.Framework.Avatar.builder() + .type(RuleCreateResponse.Framework.Avatar.Type.EMOJI) + .value("🧭") + .build() + ) + .builtInSlug("eu_ai_act") + .enabled(true) + .name("EU AI Act") + .build() + ) + assertThat(ruleCreateResponse.immutable()).contains(true) + assertThat(ruleCreateResponse.renewalCadenceDays()).contains(90L) + assertThat(ruleCreateResponse.results().getOrNull()) + .containsExactly( + RuleCreateResponse.Result.builder() + .id("5b7d9f1a-2c3e-4d5f-8a6b-9c0d1e2f3a4b") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .deactivated(true) + .ruleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleCreateResponse.Result.Status.PASSING) + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addBlockedBy( + RuleCreateResponse.Result.BlockedBy.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleCreateResponse.Result.BlockedBy.Status.PASSING) + .build() + ) + .addBlocking( + RuleCreateResponse.Result.Blocking.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleCreateResponse.Result.Blocking.Status.PASSING) + .build() + ) + .dateLastEvaluated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfLatestEvidence(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfNextEvaluation(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfRenewal(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .deactivatedReason("deactivatedReason") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .statusMessage("statusMessage") + .build() + ) + assertThat(ruleCreateResponse.resultsSummary()) + .contains(RuleCreateResponse.ResultsSummary.builder().passing(0L).total(0L).build()) + assertThat(ruleCreateResponse.tagIds().getOrNull()) + .containsExactly("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(ruleCreateResponse.tags().getOrNull()) + .containsExactly( + RuleCreateResponse.Tag.builder() + .id("6e8a0c2d-4f5b-4a3c-9d7e-8f0a1b2c3d4e") + .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .immutable(true) + .name("Evaluation") + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .color("color") + .build() + ) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val ruleCreateResponse = + RuleCreateResponse.builder() + .id("7c9a1e2b-3d4f-4a5b-8c6d-7e8f9a0b1c2d") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .name("Monitoring enabled") + .scope(RuleCreateResponse.Scope.PROJECT) + .type(RuleCreateResponse.Type.PLATFORM) + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .automationParams( + RuleCreateResponse.AutomationParams.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .automationType("monitoring_mode_enabled") + .deactivated(true) + .description("Each project must have Openlayer monitoring mode enabled.") + .evidenceType(RuleCreateResponse.EvidenceType.DOCUMENT) + .addFramework( + RuleCreateResponse.Framework.builder() + .id("9f1b3c2d-4e5a-4f60-8a71-2b3c4d5e6f70") + .avatar( + RuleCreateResponse.Framework.Avatar.builder() + .type(RuleCreateResponse.Framework.Avatar.Type.EMOJI) + .value("🧭") + .build() + ) + .builtInSlug("eu_ai_act") + .enabled(true) + .name("EU AI Act") + .build() + ) + .immutable(true) + .renewalCadenceDays(90L) + .addResult( + RuleCreateResponse.Result.builder() + .id("5b7d9f1a-2c3e-4d5f-8a6b-9c0d1e2f3a4b") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .deactivated(true) + .ruleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleCreateResponse.Result.Status.PASSING) + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addBlockedBy( + RuleCreateResponse.Result.BlockedBy.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleCreateResponse.Result.BlockedBy.Status.PASSING) + .build() + ) + .addBlocking( + RuleCreateResponse.Result.Blocking.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleCreateResponse.Result.Blocking.Status.PASSING) + .build() + ) + .dateLastEvaluated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfLatestEvidence(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfNextEvaluation(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfRenewal(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .deactivatedReason("deactivatedReason") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .statusMessage("statusMessage") + .build() + ) + .resultsSummary( + RuleCreateResponse.ResultsSummary.builder().passing(0L).total(0L).build() + ) + .addTagId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addTag( + RuleCreateResponse.Tag.builder() + .id("6e8a0c2d-4f5b-4a3c-9d7e-8f0a1b2c3d4e") + .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .immutable(true) + .name("Evaluation") + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .color("color") + .build() + ) + .build() + + val roundtrippedRuleCreateResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(ruleCreateResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedRuleCreateResponse).isEqualTo(ruleCreateResponse) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/rules/RuleDeleteParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/rules/RuleDeleteParamsTest.kt new file mode 100644 index 00000000..91f67ed0 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/rules/RuleDeleteParamsTest.kt @@ -0,0 +1,24 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.rules + +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class RuleDeleteParamsTest { + + @Test + fun create() { + RuleDeleteParams.builder().ruleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e").build() + } + + @Test + fun pathParams() { + val params = + RuleDeleteParams.builder().ruleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e").build() + + assertThat(params._pathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/rules/RuleListParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/rules/RuleListParamsTest.kt new file mode 100644 index 00000000..82f055aa --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/rules/RuleListParamsTest.kt @@ -0,0 +1,104 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.rules + +import com.openlayer.api.core.http.QueryParams +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class RuleListParamsTest { + + @Test + fun create() { + RuleListParams.builder() + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .asc(true) + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .deactivated(true) + .enabledFrameworkOnly(true) + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .group(RuleListParams.Group.OPEN) + .includeResults(true) + .includeUnframed(true) + .page(1L) + .perPage(1L) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .scope(RuleListParams.Scope.PROJECT) + .searchQuery("searchQuery") + .sortBy(RuleListParams.SortBy.NAME) + .status(RuleListParams.Status.PASSING) + .addTag("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .type(RuleListParams.Type.PLATFORM) + .build() + } + + @Test + fun pathParams() { + val params = + RuleListParams.builder().workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e").build() + + assertThat(params._pathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } + + @Test + fun queryParams() { + val params = + RuleListParams.builder() + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .asc(true) + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .deactivated(true) + .enabledFrameworkOnly(true) + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .group(RuleListParams.Group.OPEN) + .includeResults(true) + .includeUnframed(true) + .page(1L) + .perPage(1L) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .scope(RuleListParams.Scope.PROJECT) + .searchQuery("searchQuery") + .sortBy(RuleListParams.SortBy.NAME) + .status(RuleListParams.Status.PASSING) + .addTag("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .type(RuleListParams.Type.PLATFORM) + .build() + + val queryParams = params._queryParams() + + assertThat(queryParams) + .isEqualTo( + QueryParams.builder() + .put("asc", "true") + .put("assigneeId", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .put("deactivated", "true") + .put("enabledFrameworkOnly", "true") + .put("frameworkId", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .put("group", "open") + .put("includeResults", "true") + .put("includeUnframed", "true") + .put("page", "1") + .put("perPage", "1") + .put("projectId", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .put("scope", "project") + .put("searchQuery", "searchQuery") + .put("sortBy", "name") + .put("status", "passing") + .put("tags", listOf("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e").joinToString(",")) + .put("type", "platform") + .build() + ) + } + + @Test + fun queryParamsWithoutOptionalFields() { + val params = + RuleListParams.builder().workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e").build() + + val queryParams = params._queryParams() + + assertThat(queryParams).isEqualTo(QueryParams.builder().build()) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/rules/RuleListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/rules/RuleListResponseTest.kt new file mode 100644 index 00000000..3c8c6c69 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/rules/RuleListResponseTest.kt @@ -0,0 +1,312 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.rules + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.jsonMapper +import java.time.OffsetDateTime +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class RuleListResponseTest { + + @Test + fun create() { + val ruleListResponse = + RuleListResponse.builder() + .addItem( + RuleListResponse.Item.builder() + .id("7c9a1e2b-3d4f-4a5b-8c6d-7e8f9a0b1c2d") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .name("Monitoring enabled") + .scope(RuleListResponse.Item.Scope.PROJECT) + .type(RuleListResponse.Item.Type.PLATFORM) + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .automationParams( + RuleListResponse.Item.AutomationParams.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .automationType("monitoring_mode_enabled") + .deactivated(true) + .description("Each project must have Openlayer monitoring mode enabled.") + .evidenceType(RuleListResponse.Item.EvidenceType.DOCUMENT) + .addFramework( + RuleListResponse.Item.Framework.builder() + .id("9f1b3c2d-4e5a-4f60-8a71-2b3c4d5e6f70") + .avatar( + RuleListResponse.Item.Framework.Avatar.builder() + .type(RuleListResponse.Item.Framework.Avatar.Type.EMOJI) + .value("🧭") + .build() + ) + .builtInSlug("eu_ai_act") + .enabled(true) + .name("EU AI Act") + .build() + ) + .immutable(true) + .renewalCadenceDays(90L) + .addResult( + RuleListResponse.Item.Result.builder() + .id("5b7d9f1a-2c3e-4d5f-8a6b-9c0d1e2f3a4b") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .deactivated(true) + .ruleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleListResponse.Item.Result.Status.PASSING) + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addBlockedBy( + RuleListResponse.Item.Result.BlockedBy.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status( + RuleListResponse.Item.Result.BlockedBy.Status.PASSING + ) + .build() + ) + .addBlocking( + RuleListResponse.Item.Result.Blocking.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status( + RuleListResponse.Item.Result.Blocking.Status.PASSING + ) + .build() + ) + .dateLastEvaluated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfLatestEvidence( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) + .dateOfNextEvaluation( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) + .dateOfRenewal(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .deactivatedReason("deactivatedReason") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .statusMessage("statusMessage") + .build() + ) + .resultsSummary( + RuleListResponse.Item.ResultsSummary.builder() + .passing(0L) + .total(0L) + .build() + ) + .addTagId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addTag( + RuleListResponse.Item.Tag.builder() + .id("6e8a0c2d-4f5b-4a3c-9d7e-8f0a1b2c3d4e") + .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .immutable(true) + .name("Evaluation") + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .color("color") + .build() + ) + .build() + ) + .build() + + assertThat(ruleListResponse.items()) + .containsExactly( + RuleListResponse.Item.builder() + .id("7c9a1e2b-3d4f-4a5b-8c6d-7e8f9a0b1c2d") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .name("Monitoring enabled") + .scope(RuleListResponse.Item.Scope.PROJECT) + .type(RuleListResponse.Item.Type.PLATFORM) + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .automationParams( + RuleListResponse.Item.AutomationParams.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .automationType("monitoring_mode_enabled") + .deactivated(true) + .description("Each project must have Openlayer monitoring mode enabled.") + .evidenceType(RuleListResponse.Item.EvidenceType.DOCUMENT) + .addFramework( + RuleListResponse.Item.Framework.builder() + .id("9f1b3c2d-4e5a-4f60-8a71-2b3c4d5e6f70") + .avatar( + RuleListResponse.Item.Framework.Avatar.builder() + .type(RuleListResponse.Item.Framework.Avatar.Type.EMOJI) + .value("🧭") + .build() + ) + .builtInSlug("eu_ai_act") + .enabled(true) + .name("EU AI Act") + .build() + ) + .immutable(true) + .renewalCadenceDays(90L) + .addResult( + RuleListResponse.Item.Result.builder() + .id("5b7d9f1a-2c3e-4d5f-8a6b-9c0d1e2f3a4b") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .deactivated(true) + .ruleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleListResponse.Item.Result.Status.PASSING) + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addBlockedBy( + RuleListResponse.Item.Result.BlockedBy.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleListResponse.Item.Result.BlockedBy.Status.PASSING) + .build() + ) + .addBlocking( + RuleListResponse.Item.Result.Blocking.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleListResponse.Item.Result.Blocking.Status.PASSING) + .build() + ) + .dateLastEvaluated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfLatestEvidence(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfNextEvaluation(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfRenewal(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .deactivatedReason("deactivatedReason") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .statusMessage("statusMessage") + .build() + ) + .resultsSummary( + RuleListResponse.Item.ResultsSummary.builder().passing(0L).total(0L).build() + ) + .addTagId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addTag( + RuleListResponse.Item.Tag.builder() + .id("6e8a0c2d-4f5b-4a3c-9d7e-8f0a1b2c3d4e") + .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .immutable(true) + .name("Evaluation") + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .color("color") + .build() + ) + .build() + ) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val ruleListResponse = + RuleListResponse.builder() + .addItem( + RuleListResponse.Item.builder() + .id("7c9a1e2b-3d4f-4a5b-8c6d-7e8f9a0b1c2d") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .name("Monitoring enabled") + .scope(RuleListResponse.Item.Scope.PROJECT) + .type(RuleListResponse.Item.Type.PLATFORM) + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .automationParams( + RuleListResponse.Item.AutomationParams.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .automationType("monitoring_mode_enabled") + .deactivated(true) + .description("Each project must have Openlayer monitoring mode enabled.") + .evidenceType(RuleListResponse.Item.EvidenceType.DOCUMENT) + .addFramework( + RuleListResponse.Item.Framework.builder() + .id("9f1b3c2d-4e5a-4f60-8a71-2b3c4d5e6f70") + .avatar( + RuleListResponse.Item.Framework.Avatar.builder() + .type(RuleListResponse.Item.Framework.Avatar.Type.EMOJI) + .value("🧭") + .build() + ) + .builtInSlug("eu_ai_act") + .enabled(true) + .name("EU AI Act") + .build() + ) + .immutable(true) + .renewalCadenceDays(90L) + .addResult( + RuleListResponse.Item.Result.builder() + .id("5b7d9f1a-2c3e-4d5f-8a6b-9c0d1e2f3a4b") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .deactivated(true) + .ruleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleListResponse.Item.Result.Status.PASSING) + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addBlockedBy( + RuleListResponse.Item.Result.BlockedBy.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status( + RuleListResponse.Item.Result.BlockedBy.Status.PASSING + ) + .build() + ) + .addBlocking( + RuleListResponse.Item.Result.Blocking.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status( + RuleListResponse.Item.Result.Blocking.Status.PASSING + ) + .build() + ) + .dateLastEvaluated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfLatestEvidence( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) + .dateOfNextEvaluation( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) + .dateOfRenewal(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .deactivatedReason("deactivatedReason") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .statusMessage("statusMessage") + .build() + ) + .resultsSummary( + RuleListResponse.Item.ResultsSummary.builder() + .passing(0L) + .total(0L) + .build() + ) + .addTagId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addTag( + RuleListResponse.Item.Tag.builder() + .id("6e8a0c2d-4f5b-4a3c-9d7e-8f0a1b2c3d4e") + .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .immutable(true) + .name("Evaluation") + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .color("color") + .build() + ) + .build() + ) + .build() + + val roundtrippedRuleListResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(ruleListResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedRuleListResponse).isEqualTo(ruleListResponse) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/rules/RuleRetrieveParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/rules/RuleRetrieveParamsTest.kt new file mode 100644 index 00000000..358fd0fa --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/rules/RuleRetrieveParamsTest.kt @@ -0,0 +1,24 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.rules + +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class RuleRetrieveParamsTest { + + @Test + fun create() { + RuleRetrieveParams.builder().ruleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e").build() + } + + @Test + fun pathParams() { + val params = + RuleRetrieveParams.builder().ruleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e").build() + + assertThat(params._pathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/rules/RuleRetrieveResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/rules/RuleRetrieveResponseTest.kt new file mode 100644 index 00000000..b552fd5d --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/rules/RuleRetrieveResponseTest.kt @@ -0,0 +1,288 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.rules + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.jsonMapper +import java.time.OffsetDateTime +import kotlin.jvm.optionals.getOrNull +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class RuleRetrieveResponseTest { + + @Test + fun create() { + val ruleRetrieveResponse = + RuleRetrieveResponse.builder() + .id("7c9a1e2b-3d4f-4a5b-8c6d-7e8f9a0b1c2d") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .name("Monitoring enabled") + .scope(RuleRetrieveResponse.Scope.PROJECT) + .type(RuleRetrieveResponse.Type.PLATFORM) + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .automationParams( + RuleRetrieveResponse.AutomationParams.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .automationType("monitoring_mode_enabled") + .deactivated(true) + .description("Each project must have Openlayer monitoring mode enabled.") + .evidenceType(RuleRetrieveResponse.EvidenceType.DOCUMENT) + .addFramework( + RuleRetrieveResponse.Framework.builder() + .id("9f1b3c2d-4e5a-4f60-8a71-2b3c4d5e6f70") + .avatar( + RuleRetrieveResponse.Framework.Avatar.builder() + .type(RuleRetrieveResponse.Framework.Avatar.Type.EMOJI) + .value("🧭") + .build() + ) + .builtInSlug("eu_ai_act") + .enabled(true) + .name("EU AI Act") + .build() + ) + .immutable(true) + .renewalCadenceDays(90L) + .addResult( + RuleRetrieveResponse.Result.builder() + .id("5b7d9f1a-2c3e-4d5f-8a6b-9c0d1e2f3a4b") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .deactivated(true) + .ruleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleRetrieveResponse.Result.Status.PASSING) + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addBlockedBy( + RuleRetrieveResponse.Result.BlockedBy.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleRetrieveResponse.Result.BlockedBy.Status.PASSING) + .build() + ) + .addBlocking( + RuleRetrieveResponse.Result.Blocking.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleRetrieveResponse.Result.Blocking.Status.PASSING) + .build() + ) + .dateLastEvaluated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfLatestEvidence(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfNextEvaluation(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfRenewal(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .deactivatedReason("deactivatedReason") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .statusMessage("statusMessage") + .build() + ) + .resultsSummary( + RuleRetrieveResponse.ResultsSummary.builder().passing(0L).total(0L).build() + ) + .addTagId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addTag( + RuleRetrieveResponse.Tag.builder() + .id("6e8a0c2d-4f5b-4a3c-9d7e-8f0a1b2c3d4e") + .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .immutable(true) + .name("Evaluation") + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .color("color") + .build() + ) + .build() + + assertThat(ruleRetrieveResponse.id()).isEqualTo("7c9a1e2b-3d4f-4a5b-8c6d-7e8f9a0b1c2d") + assertThat(ruleRetrieveResponse.dateCreated()) + .isEqualTo(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + assertThat(ruleRetrieveResponse.dateUpdated()) + .isEqualTo(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + assertThat(ruleRetrieveResponse.name()).isEqualTo("Monitoring enabled") + assertThat(ruleRetrieveResponse.scope()).isEqualTo(RuleRetrieveResponse.Scope.PROJECT) + assertThat(ruleRetrieveResponse.type()).isEqualTo(RuleRetrieveResponse.Type.PLATFORM) + assertThat(ruleRetrieveResponse.workspaceId()) + .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(ruleRetrieveResponse.assigneeId()) + .contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(ruleRetrieveResponse.automationParams()) + .contains( + RuleRetrieveResponse.AutomationParams.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + assertThat(ruleRetrieveResponse.automationType()).contains("monitoring_mode_enabled") + assertThat(ruleRetrieveResponse.deactivated()).contains(true) + assertThat(ruleRetrieveResponse.description()) + .contains("Each project must have Openlayer monitoring mode enabled.") + assertThat(ruleRetrieveResponse.evidenceType()) + .contains(RuleRetrieveResponse.EvidenceType.DOCUMENT) + assertThat(ruleRetrieveResponse.frameworks().getOrNull()) + .containsExactly( + RuleRetrieveResponse.Framework.builder() + .id("9f1b3c2d-4e5a-4f60-8a71-2b3c4d5e6f70") + .avatar( + RuleRetrieveResponse.Framework.Avatar.builder() + .type(RuleRetrieveResponse.Framework.Avatar.Type.EMOJI) + .value("🧭") + .build() + ) + .builtInSlug("eu_ai_act") + .enabled(true) + .name("EU AI Act") + .build() + ) + assertThat(ruleRetrieveResponse.immutable()).contains(true) + assertThat(ruleRetrieveResponse.renewalCadenceDays()).contains(90L) + assertThat(ruleRetrieveResponse.results().getOrNull()) + .containsExactly( + RuleRetrieveResponse.Result.builder() + .id("5b7d9f1a-2c3e-4d5f-8a6b-9c0d1e2f3a4b") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .deactivated(true) + .ruleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleRetrieveResponse.Result.Status.PASSING) + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addBlockedBy( + RuleRetrieveResponse.Result.BlockedBy.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleRetrieveResponse.Result.BlockedBy.Status.PASSING) + .build() + ) + .addBlocking( + RuleRetrieveResponse.Result.Blocking.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleRetrieveResponse.Result.Blocking.Status.PASSING) + .build() + ) + .dateLastEvaluated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfLatestEvidence(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfNextEvaluation(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfRenewal(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .deactivatedReason("deactivatedReason") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .statusMessage("statusMessage") + .build() + ) + assertThat(ruleRetrieveResponse.resultsSummary()) + .contains(RuleRetrieveResponse.ResultsSummary.builder().passing(0L).total(0L).build()) + assertThat(ruleRetrieveResponse.tagIds().getOrNull()) + .containsExactly("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(ruleRetrieveResponse.tags().getOrNull()) + .containsExactly( + RuleRetrieveResponse.Tag.builder() + .id("6e8a0c2d-4f5b-4a3c-9d7e-8f0a1b2c3d4e") + .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .immutable(true) + .name("Evaluation") + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .color("color") + .build() + ) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val ruleRetrieveResponse = + RuleRetrieveResponse.builder() + .id("7c9a1e2b-3d4f-4a5b-8c6d-7e8f9a0b1c2d") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .name("Monitoring enabled") + .scope(RuleRetrieveResponse.Scope.PROJECT) + .type(RuleRetrieveResponse.Type.PLATFORM) + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .automationParams( + RuleRetrieveResponse.AutomationParams.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .automationType("monitoring_mode_enabled") + .deactivated(true) + .description("Each project must have Openlayer monitoring mode enabled.") + .evidenceType(RuleRetrieveResponse.EvidenceType.DOCUMENT) + .addFramework( + RuleRetrieveResponse.Framework.builder() + .id("9f1b3c2d-4e5a-4f60-8a71-2b3c4d5e6f70") + .avatar( + RuleRetrieveResponse.Framework.Avatar.builder() + .type(RuleRetrieveResponse.Framework.Avatar.Type.EMOJI) + .value("🧭") + .build() + ) + .builtInSlug("eu_ai_act") + .enabled(true) + .name("EU AI Act") + .build() + ) + .immutable(true) + .renewalCadenceDays(90L) + .addResult( + RuleRetrieveResponse.Result.builder() + .id("5b7d9f1a-2c3e-4d5f-8a6b-9c0d1e2f3a4b") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .deactivated(true) + .ruleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleRetrieveResponse.Result.Status.PASSING) + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addBlockedBy( + RuleRetrieveResponse.Result.BlockedBy.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleRetrieveResponse.Result.BlockedBy.Status.PASSING) + .build() + ) + .addBlocking( + RuleRetrieveResponse.Result.Blocking.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleRetrieveResponse.Result.Blocking.Status.PASSING) + .build() + ) + .dateLastEvaluated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfLatestEvidence(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfNextEvaluation(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfRenewal(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .deactivatedReason("deactivatedReason") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .statusMessage("statusMessage") + .build() + ) + .resultsSummary( + RuleRetrieveResponse.ResultsSummary.builder().passing(0L).total(0L).build() + ) + .addTagId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addTag( + RuleRetrieveResponse.Tag.builder() + .id("6e8a0c2d-4f5b-4a3c-9d7e-8f0a1b2c3d4e") + .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .immutable(true) + .name("Evaluation") + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .color("color") + .build() + ) + .build() + + val roundtrippedRuleRetrieveResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(ruleRetrieveResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedRuleRetrieveResponse).isEqualTo(ruleRetrieveResponse) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/rules/RuleUpdateParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/rules/RuleUpdateParamsTest.kt new file mode 100644 index 00000000..4c2c01a5 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/rules/RuleUpdateParamsTest.kt @@ -0,0 +1,66 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.rules + +import kotlin.jvm.optionals.getOrNull +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class RuleUpdateParamsTest { + + @Test + fun create() { + RuleUpdateParams.builder() + .ruleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .deactivated(true) + .description("Each project must have Openlayer monitoring mode enabled.") + .name("Monitoring enabled") + .renewalCadenceDays(90L) + .addTagId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + } + + @Test + fun pathParams() { + val params = + RuleUpdateParams.builder().ruleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e").build() + + assertThat(params._pathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } + + @Test + fun body() { + val params = + RuleUpdateParams.builder() + .ruleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .deactivated(true) + .description("Each project must have Openlayer monitoring mode enabled.") + .name("Monitoring enabled") + .renewalCadenceDays(90L) + .addTagId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + + val body = params._body() + + assertThat(body.assigneeId()).contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(body.deactivated()).contains(true) + assertThat(body.description()) + .contains("Each project must have Openlayer monitoring mode enabled.") + assertThat(body.name()).contains("Monitoring enabled") + assertThat(body.renewalCadenceDays()).contains(90L) + assertThat(body.tagIds().getOrNull()) + .containsExactly("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + } + + @Test + fun bodyWithoutOptionalFields() { + val params = + RuleUpdateParams.builder().ruleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e").build() + + val body = params._body() + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/rules/RuleUpdateResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/rules/RuleUpdateResponseTest.kt new file mode 100644 index 00000000..b0a0e20d --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/rules/RuleUpdateResponseTest.kt @@ -0,0 +1,287 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.rules + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.JsonValue +import com.openlayer.api.core.jsonMapper +import java.time.OffsetDateTime +import kotlin.jvm.optionals.getOrNull +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class RuleUpdateResponseTest { + + @Test + fun create() { + val ruleUpdateResponse = + RuleUpdateResponse.builder() + .id("7c9a1e2b-3d4f-4a5b-8c6d-7e8f9a0b1c2d") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .name("Monitoring enabled") + .scope(RuleUpdateResponse.Scope.PROJECT) + .type(RuleUpdateResponse.Type.PLATFORM) + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .automationParams( + RuleUpdateResponse.AutomationParams.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .automationType("monitoring_mode_enabled") + .deactivated(true) + .description("Each project must have Openlayer monitoring mode enabled.") + .evidenceType(RuleUpdateResponse.EvidenceType.DOCUMENT) + .addFramework( + RuleUpdateResponse.Framework.builder() + .id("9f1b3c2d-4e5a-4f60-8a71-2b3c4d5e6f70") + .avatar( + RuleUpdateResponse.Framework.Avatar.builder() + .type(RuleUpdateResponse.Framework.Avatar.Type.EMOJI) + .value("🧭") + .build() + ) + .builtInSlug("eu_ai_act") + .enabled(true) + .name("EU AI Act") + .build() + ) + .immutable(true) + .renewalCadenceDays(90L) + .addResult( + RuleUpdateResponse.Result.builder() + .id("5b7d9f1a-2c3e-4d5f-8a6b-9c0d1e2f3a4b") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .deactivated(true) + .ruleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleUpdateResponse.Result.Status.PASSING) + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addBlockedBy( + RuleUpdateResponse.Result.BlockedBy.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleUpdateResponse.Result.BlockedBy.Status.PASSING) + .build() + ) + .addBlocking( + RuleUpdateResponse.Result.Blocking.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleUpdateResponse.Result.Blocking.Status.PASSING) + .build() + ) + .dateLastEvaluated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfLatestEvidence(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfNextEvaluation(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfRenewal(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .deactivatedReason("deactivatedReason") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .statusMessage("statusMessage") + .build() + ) + .resultsSummary( + RuleUpdateResponse.ResultsSummary.builder().passing(0L).total(0L).build() + ) + .addTagId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addTag( + RuleUpdateResponse.Tag.builder() + .id("6e8a0c2d-4f5b-4a3c-9d7e-8f0a1b2c3d4e") + .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .immutable(true) + .name("Evaluation") + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .color("color") + .build() + ) + .build() + + assertThat(ruleUpdateResponse.id()).isEqualTo("7c9a1e2b-3d4f-4a5b-8c6d-7e8f9a0b1c2d") + assertThat(ruleUpdateResponse.dateCreated()) + .isEqualTo(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + assertThat(ruleUpdateResponse.dateUpdated()) + .isEqualTo(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + assertThat(ruleUpdateResponse.name()).isEqualTo("Monitoring enabled") + assertThat(ruleUpdateResponse.scope()).isEqualTo(RuleUpdateResponse.Scope.PROJECT) + assertThat(ruleUpdateResponse.type()).isEqualTo(RuleUpdateResponse.Type.PLATFORM) + assertThat(ruleUpdateResponse.workspaceId()) + .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(ruleUpdateResponse.assigneeId()).contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(ruleUpdateResponse.automationParams()) + .contains( + RuleUpdateResponse.AutomationParams.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + assertThat(ruleUpdateResponse.automationType()).contains("monitoring_mode_enabled") + assertThat(ruleUpdateResponse.deactivated()).contains(true) + assertThat(ruleUpdateResponse.description()) + .contains("Each project must have Openlayer monitoring mode enabled.") + assertThat(ruleUpdateResponse.evidenceType()) + .contains(RuleUpdateResponse.EvidenceType.DOCUMENT) + assertThat(ruleUpdateResponse.frameworks().getOrNull()) + .containsExactly( + RuleUpdateResponse.Framework.builder() + .id("9f1b3c2d-4e5a-4f60-8a71-2b3c4d5e6f70") + .avatar( + RuleUpdateResponse.Framework.Avatar.builder() + .type(RuleUpdateResponse.Framework.Avatar.Type.EMOJI) + .value("🧭") + .build() + ) + .builtInSlug("eu_ai_act") + .enabled(true) + .name("EU AI Act") + .build() + ) + assertThat(ruleUpdateResponse.immutable()).contains(true) + assertThat(ruleUpdateResponse.renewalCadenceDays()).contains(90L) + assertThat(ruleUpdateResponse.results().getOrNull()) + .containsExactly( + RuleUpdateResponse.Result.builder() + .id("5b7d9f1a-2c3e-4d5f-8a6b-9c0d1e2f3a4b") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .deactivated(true) + .ruleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleUpdateResponse.Result.Status.PASSING) + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addBlockedBy( + RuleUpdateResponse.Result.BlockedBy.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleUpdateResponse.Result.BlockedBy.Status.PASSING) + .build() + ) + .addBlocking( + RuleUpdateResponse.Result.Blocking.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleUpdateResponse.Result.Blocking.Status.PASSING) + .build() + ) + .dateLastEvaluated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfLatestEvidence(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfNextEvaluation(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfRenewal(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .deactivatedReason("deactivatedReason") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .statusMessage("statusMessage") + .build() + ) + assertThat(ruleUpdateResponse.resultsSummary()) + .contains(RuleUpdateResponse.ResultsSummary.builder().passing(0L).total(0L).build()) + assertThat(ruleUpdateResponse.tagIds().getOrNull()) + .containsExactly("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(ruleUpdateResponse.tags().getOrNull()) + .containsExactly( + RuleUpdateResponse.Tag.builder() + .id("6e8a0c2d-4f5b-4a3c-9d7e-8f0a1b2c3d4e") + .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .immutable(true) + .name("Evaluation") + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .color("color") + .build() + ) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val ruleUpdateResponse = + RuleUpdateResponse.builder() + .id("7c9a1e2b-3d4f-4a5b-8c6d-7e8f9a0b1c2d") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .name("Monitoring enabled") + .scope(RuleUpdateResponse.Scope.PROJECT) + .type(RuleUpdateResponse.Type.PLATFORM) + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .automationParams( + RuleUpdateResponse.AutomationParams.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .automationType("monitoring_mode_enabled") + .deactivated(true) + .description("Each project must have Openlayer monitoring mode enabled.") + .evidenceType(RuleUpdateResponse.EvidenceType.DOCUMENT) + .addFramework( + RuleUpdateResponse.Framework.builder() + .id("9f1b3c2d-4e5a-4f60-8a71-2b3c4d5e6f70") + .avatar( + RuleUpdateResponse.Framework.Avatar.builder() + .type(RuleUpdateResponse.Framework.Avatar.Type.EMOJI) + .value("🧭") + .build() + ) + .builtInSlug("eu_ai_act") + .enabled(true) + .name("EU AI Act") + .build() + ) + .immutable(true) + .renewalCadenceDays(90L) + .addResult( + RuleUpdateResponse.Result.builder() + .id("5b7d9f1a-2c3e-4d5f-8a6b-9c0d1e2f3a4b") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .deactivated(true) + .ruleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleUpdateResponse.Result.Status.PASSING) + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addBlockedBy( + RuleUpdateResponse.Result.BlockedBy.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleUpdateResponse.Result.BlockedBy.Status.PASSING) + .build() + ) + .addBlocking( + RuleUpdateResponse.Result.Blocking.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleUpdateResponse.Result.Blocking.Status.PASSING) + .build() + ) + .dateLastEvaluated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfLatestEvidence(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfNextEvaluation(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .dateOfRenewal(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .deactivatedReason("deactivatedReason") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .statusMessage("statusMessage") + .build() + ) + .resultsSummary( + RuleUpdateResponse.ResultsSummary.builder().passing(0L).total(0L).build() + ) + .addTagId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addTag( + RuleUpdateResponse.Tag.builder() + .id("6e8a0c2d-4f5b-4a3c-9d7e-8f0a1b2c3d4e") + .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .immutable(true) + .name("Evaluation") + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .color("color") + .build() + ) + .build() + + val roundtrippedRuleUpdateResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(ruleUpdateResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedRuleUpdateResponse).isEqualTo(ruleUpdateResponse) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/rulestats/RuleStatRetrieveParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/rulestats/RuleStatRetrieveParamsTest.kt new file mode 100644 index 00000000..2ff1a0b1 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/rulestats/RuleStatRetrieveParamsTest.kt @@ -0,0 +1,63 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.rulestats + +import com.openlayer.api.core.http.QueryParams +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class RuleStatRetrieveParamsTest { + + @Test + fun create() { + RuleStatRetrieveParams.builder() + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + } + + @Test + fun pathParams() { + val params = + RuleStatRetrieveParams.builder() + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + + assertThat(params._pathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } + + @Test + fun queryParams() { + val params = + RuleStatRetrieveParams.builder() + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + + val queryParams = params._queryParams() + + assertThat(queryParams) + .isEqualTo( + QueryParams.builder() + .put("frameworkId", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .put("projectId", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) + } + + @Test + fun queryParamsWithoutOptionalFields() { + val params = + RuleStatRetrieveParams.builder() + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + + val queryParams = params._queryParams() + + assertThat(queryParams).isEqualTo(QueryParams.builder().build()) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/rulestats/RuleStatRetrieveResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/rulestats/RuleStatRetrieveResponseTest.kt new file mode 100644 index 00000000..c603ad2c --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/rulestats/RuleStatRetrieveResponseTest.kt @@ -0,0 +1,300 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.rulestats + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.jsonMapper +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class RuleStatRetrieveResponseTest { + + @Test + fun create() { + val ruleStatRetrieveResponse = + RuleStatRetrieveResponse.builder() + .ruleResults( + RuleStatRetrieveResponse.RuleResults.builder() + .total(0L) + .totalDueSoon(0L) + .totalError(0L) + .totalFailing(0L) + .totalPassing(0L) + .totalPending(0L) + .totalRunning(0L) + .totalSkipped(0L) + .byRuleScope( + RuleStatRetrieveResponse.RuleResults.ByRuleScope.builder() + .project( + RuleStatRetrieveResponse.RuleResults.ByRuleScope.Project + .builder() + .total(0L) + .totalDueSoon(0L) + .totalError(0L) + .totalFailing(0L) + .totalPassing(0L) + .totalPending(0L) + .totalRunning(0L) + .totalSkipped(0L) + .build() + ) + .workspace( + RuleStatRetrieveResponse.RuleResults.ByRuleScope.Workspace + .builder() + .total(0L) + .totalDueSoon(0L) + .totalError(0L) + .totalFailing(0L) + .totalPassing(0L) + .totalPending(0L) + .totalRunning(0L) + .totalSkipped(0L) + .build() + ) + .build() + ) + .byRuleType( + RuleStatRetrieveResponse.RuleResults.ByRuleType.builder() + .evidence( + RuleStatRetrieveResponse.RuleResults.ByRuleType.Evidence + .builder() + .total(0L) + .totalDueSoon(0L) + .totalError(0L) + .totalFailing(0L) + .totalPassing(0L) + .totalPending(0L) + .totalRunning(0L) + .totalSkipped(0L) + .build() + ) + .platform( + RuleStatRetrieveResponse.RuleResults.ByRuleType.Platform + .builder() + .total(0L) + .totalDueSoon(0L) + .totalError(0L) + .totalFailing(0L) + .totalPassing(0L) + .totalPending(0L) + .totalRunning(0L) + .totalSkipped(0L) + .build() + ) + .build() + ) + .build() + ) + .rules( + RuleStatRetrieveResponse.Rules.builder() + .byScope( + RuleStatRetrieveResponse.Rules.ByScope.builder() + .project(0L) + .workspace(0L) + .build() + ) + .byType( + RuleStatRetrieveResponse.Rules.ByType.builder() + .evidence(0L) + .platform(0L) + .build() + ) + .total(0L) + .build() + ) + .build() + + assertThat(ruleStatRetrieveResponse.ruleResults()) + .isEqualTo( + RuleStatRetrieveResponse.RuleResults.builder() + .total(0L) + .totalDueSoon(0L) + .totalError(0L) + .totalFailing(0L) + .totalPassing(0L) + .totalPending(0L) + .totalRunning(0L) + .totalSkipped(0L) + .byRuleScope( + RuleStatRetrieveResponse.RuleResults.ByRuleScope.builder() + .project( + RuleStatRetrieveResponse.RuleResults.ByRuleScope.Project.builder() + .total(0L) + .totalDueSoon(0L) + .totalError(0L) + .totalFailing(0L) + .totalPassing(0L) + .totalPending(0L) + .totalRunning(0L) + .totalSkipped(0L) + .build() + ) + .workspace( + RuleStatRetrieveResponse.RuleResults.ByRuleScope.Workspace.builder() + .total(0L) + .totalDueSoon(0L) + .totalError(0L) + .totalFailing(0L) + .totalPassing(0L) + .totalPending(0L) + .totalRunning(0L) + .totalSkipped(0L) + .build() + ) + .build() + ) + .byRuleType( + RuleStatRetrieveResponse.RuleResults.ByRuleType.builder() + .evidence( + RuleStatRetrieveResponse.RuleResults.ByRuleType.Evidence.builder() + .total(0L) + .totalDueSoon(0L) + .totalError(0L) + .totalFailing(0L) + .totalPassing(0L) + .totalPending(0L) + .totalRunning(0L) + .totalSkipped(0L) + .build() + ) + .platform( + RuleStatRetrieveResponse.RuleResults.ByRuleType.Platform.builder() + .total(0L) + .totalDueSoon(0L) + .totalError(0L) + .totalFailing(0L) + .totalPassing(0L) + .totalPending(0L) + .totalRunning(0L) + .totalSkipped(0L) + .build() + ) + .build() + ) + .build() + ) + assertThat(ruleStatRetrieveResponse.rules()) + .isEqualTo( + RuleStatRetrieveResponse.Rules.builder() + .byScope( + RuleStatRetrieveResponse.Rules.ByScope.builder() + .project(0L) + .workspace(0L) + .build() + ) + .byType( + RuleStatRetrieveResponse.Rules.ByType.builder() + .evidence(0L) + .platform(0L) + .build() + ) + .total(0L) + .build() + ) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val ruleStatRetrieveResponse = + RuleStatRetrieveResponse.builder() + .ruleResults( + RuleStatRetrieveResponse.RuleResults.builder() + .total(0L) + .totalDueSoon(0L) + .totalError(0L) + .totalFailing(0L) + .totalPassing(0L) + .totalPending(0L) + .totalRunning(0L) + .totalSkipped(0L) + .byRuleScope( + RuleStatRetrieveResponse.RuleResults.ByRuleScope.builder() + .project( + RuleStatRetrieveResponse.RuleResults.ByRuleScope.Project + .builder() + .total(0L) + .totalDueSoon(0L) + .totalError(0L) + .totalFailing(0L) + .totalPassing(0L) + .totalPending(0L) + .totalRunning(0L) + .totalSkipped(0L) + .build() + ) + .workspace( + RuleStatRetrieveResponse.RuleResults.ByRuleScope.Workspace + .builder() + .total(0L) + .totalDueSoon(0L) + .totalError(0L) + .totalFailing(0L) + .totalPassing(0L) + .totalPending(0L) + .totalRunning(0L) + .totalSkipped(0L) + .build() + ) + .build() + ) + .byRuleType( + RuleStatRetrieveResponse.RuleResults.ByRuleType.builder() + .evidence( + RuleStatRetrieveResponse.RuleResults.ByRuleType.Evidence + .builder() + .total(0L) + .totalDueSoon(0L) + .totalError(0L) + .totalFailing(0L) + .totalPassing(0L) + .totalPending(0L) + .totalRunning(0L) + .totalSkipped(0L) + .build() + ) + .platform( + RuleStatRetrieveResponse.RuleResults.ByRuleType.Platform + .builder() + .total(0L) + .totalDueSoon(0L) + .totalError(0L) + .totalFailing(0L) + .totalPassing(0L) + .totalPending(0L) + .totalRunning(0L) + .totalSkipped(0L) + .build() + ) + .build() + ) + .build() + ) + .rules( + RuleStatRetrieveResponse.Rules.builder() + .byScope( + RuleStatRetrieveResponse.Rules.ByScope.builder() + .project(0L) + .workspace(0L) + .build() + ) + .byType( + RuleStatRetrieveResponse.Rules.ByType.builder() + .evidence(0L) + .platform(0L) + .build() + ) + .total(0L) + .build() + ) + .build() + + val roundtrippedRuleStatRetrieveResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(ruleStatRetrieveResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedRuleStatRetrieveResponse).isEqualTo(ruleStatRetrieveResponse) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/ruletags/RuleTagListParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/ruletags/RuleTagListParamsTest.kt new file mode 100644 index 00000000..09b81613 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/ruletags/RuleTagListParamsTest.kt @@ -0,0 +1,54 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.ruletags + +import com.openlayer.api.core.http.QueryParams +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class RuleTagListParamsTest { + + @Test + fun create() { + RuleTagListParams.builder() + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .page(1L) + .perPage(1L) + .build() + } + + @Test + fun pathParams() { + val params = + RuleTagListParams.builder().workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e").build() + + assertThat(params._pathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } + + @Test + fun queryParams() { + val params = + RuleTagListParams.builder() + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .page(1L) + .perPage(1L) + .build() + + val queryParams = params._queryParams() + + assertThat(queryParams) + .isEqualTo(QueryParams.builder().put("page", "1").put("perPage", "1").build()) + } + + @Test + fun queryParamsWithoutOptionalFields() { + val params = + RuleTagListParams.builder().workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e").build() + + val queryParams = params._queryParams() + + assertThat(queryParams).isEqualTo(QueryParams.builder().build()) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/ruletags/RuleTagListResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/ruletags/RuleTagListResponseTest.kt new file mode 100644 index 00000000..edb0cb19 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/governance/ruletags/RuleTagListResponseTest.kt @@ -0,0 +1,73 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.governance.ruletags + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.jsonMapper +import java.time.OffsetDateTime +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class RuleTagListResponseTest { + + @Test + fun create() { + val ruleTagListResponse = + RuleTagListResponse.builder() + .addItem( + RuleTagListResponse.Item.builder() + .id("6e8a0c2d-4f5b-4a3c-9d7e-8f0a1b2c3d4e") + .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .immutable(true) + .name("Evaluation") + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .color("color") + .build() + ) + .build() + + assertThat(ruleTagListResponse.items()) + .containsExactly( + RuleTagListResponse.Item.builder() + .id("6e8a0c2d-4f5b-4a3c-9d7e-8f0a1b2c3d4e") + .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .immutable(true) + .name("Evaluation") + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .color("color") + .build() + ) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val ruleTagListResponse = + RuleTagListResponse.builder() + .addItem( + RuleTagListResponse.Item.builder() + .id("6e8a0c2d-4f5b-4a3c-9d7e-8f0a1b2c3d4e") + .creatorId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .dateCreated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .dateUpdated(OffsetDateTime.parse("2026-03-22T11:31:01.185Z")) + .immutable(true) + .name("Evaluation") + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .color("color") + .build() + ) + .build() + + val roundtrippedRuleTagListResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(ruleTagListResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedRuleTagListResponse).isEqualTo(ruleTagListResponse) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlRetrieveParamsTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlRetrieveParamsTest.kt new file mode 100644 index 00000000..2ca7f16b --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlRetrieveParamsTest.kt @@ -0,0 +1,25 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.storage.presignedurl + +import com.openlayer.api.core.http.QueryParams +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class PresignedUrlRetrieveParamsTest { + + @Test + fun create() { + PresignedUrlRetrieveParams.builder().storageUri("storageUri").build() + } + + @Test + fun queryParams() { + val params = PresignedUrlRetrieveParams.builder().storageUri("storageUri").build() + + val queryParams = params._queryParams() + + assertThat(queryParams) + .isEqualTo(QueryParams.builder().put("storageUri", "storageUri").build()) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlRetrieveResponseTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlRetrieveResponseTest.kt new file mode 100644 index 00000000..750d209a --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/models/storage/presignedurl/PresignedUrlRetrieveResponseTest.kt @@ -0,0 +1,32 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.models.storage.presignedurl + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.openlayer.api.core.jsonMapper +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class PresignedUrlRetrieveResponseTest { + + @Test + fun create() { + val presignedUrlRetrieveResponse = PresignedUrlRetrieveResponse.builder().url("url").build() + + assertThat(presignedUrlRetrieveResponse.url()).isEqualTo("url") + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val presignedUrlRetrieveResponse = PresignedUrlRetrieveResponse.builder().url("url").build() + + val roundtrippedPresignedUrlRetrieveResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(presignedUrlRetrieveResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedPresignedUrlRetrieveResponse).isEqualTo(presignedUrlRetrieveResponse) + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/BackgroundTaskServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/BackgroundTaskServiceAsyncTest.kt new file mode 100644 index 00000000..5f656d61 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/BackgroundTaskServiceAsyncTest.kt @@ -0,0 +1,28 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.async + +import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClientAsync +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +internal class BackgroundTaskServiceAsyncTest { + + @Test + fun retrieve() { + val client = + OpenlayerOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val backgroundTaskServiceAsync = client.backgroundTasks() + + val backgroundTaskFuture = + backgroundTaskServiceAsync.retrieve("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + + val backgroundTask = backgroundTaskFuture.get() + backgroundTask.validate() + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/governance/FrameworkServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/governance/FrameworkServiceAsyncTest.kt new file mode 100644 index 00000000..4fe25350 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/governance/FrameworkServiceAsyncTest.kt @@ -0,0 +1,245 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.async.governance + +import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClientAsync +import com.openlayer.api.core.JsonValue +import com.openlayer.api.models.governance.frameworks.FrameworkCreateParams +import com.openlayer.api.models.governance.frameworks.FrameworkExportParams +import com.openlayer.api.models.governance.frameworks.FrameworkListParams +import com.openlayer.api.models.governance.frameworks.FrameworkListProjectRuleStatsParams +import com.openlayer.api.models.governance.frameworks.FrameworkListProjectsParams +import com.openlayer.api.models.governance.frameworks.FrameworkListRulesParams +import com.openlayer.api.models.governance.frameworks.FrameworkUpdateParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +internal class FrameworkServiceAsyncTest { + + @Test + fun create() { + val client = + OpenlayerOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val frameworkServiceAsync = client.governance().frameworks() + + val frameworkFuture = + frameworkServiceAsync.create( + FrameworkCreateParams.builder() + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .name("EU AI Act") + .description("Requirements for high-risk AI systems under the EU AI Act.") + .enabled(true) + .projectSelector( + FrameworkCreateParams.ProjectSelector.builder() + .addMatch( + FrameworkCreateParams.ProjectSelector.Match.builder() + .property( + FrameworkCreateParams.ProjectSelector.Match.Property + .RISK_LEVEL + ) + .value(JsonValue.from(listOf("high", "critical"))) + .operator("operator") + .build() + ) + .build() + ) + .addTag("regulation") + .addTag("eu") + .build() + ) + + val framework = frameworkFuture.get() + framework.validate() + } + + @Test + fun retrieve() { + val client = + OpenlayerOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val frameworkServiceAsync = client.governance().frameworks() + + val frameworkFuture = frameworkServiceAsync.retrieve("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + + val framework = frameworkFuture.get() + framework.validate() + } + + @Test + fun update() { + val client = + OpenlayerOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val frameworkServiceAsync = client.governance().frameworks() + + val frameworkFuture = + frameworkServiceAsync.update( + FrameworkUpdateParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .avatar( + FrameworkUpdateParams.Avatar.builder() + .type(FrameworkUpdateParams.Avatar.Type.EMOJI) + .value("🧭") + .build() + ) + .description("Requirements for high-risk AI systems under the EU AI Act.") + .enabled(true) + .extendedDescription( + FrameworkUpdateParams.ExtendedDescription.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .href("href") + .name("EU AI Act") + .projectSelector( + FrameworkUpdateParams.ProjectSelector.builder() + .addMatch( + FrameworkUpdateParams.ProjectSelector.Match.builder() + .property( + FrameworkUpdateParams.ProjectSelector.Match.Property + .RISK_LEVEL + ) + .value(JsonValue.from(listOf("high", "critical"))) + .operator("operator") + .build() + ) + .build() + ) + .addTag("regulation") + .addTag("eu") + .build() + ) + + val framework = frameworkFuture.get() + framework.validate() + } + + @Test + fun list() { + val client = + OpenlayerOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val frameworkServiceAsync = client.governance().frameworks() + + val frameworksFuture = + frameworkServiceAsync.list( + FrameworkListParams.builder() + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .asc(true) + .completionOperator(FrameworkListParams.CompletionOperator.IS) + .completionValue(0L) + .enabled(true) + .includeRuleStats(true) + .page(1L) + .perPage(1L) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .searchQuery("searchQuery") + .sortColumn(FrameworkListParams.SortColumn.NAME) + .addTag("string") + .build() + ) + + val frameworks = frameworksFuture.get() + frameworks.validate() + } + + @Test + fun export() { + val client = + OpenlayerOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val frameworkServiceAsync = client.governance().frameworks() + + val responseFuture = + frameworkServiceAsync.export( + FrameworkExportParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .build() + ) + + val response = responseFuture.get() + response.validate() + } + + @Test + fun listProjectRuleStats() { + val client = + OpenlayerOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val frameworkServiceAsync = client.governance().frameworks() + + val responseFuture = + frameworkServiceAsync.listProjectRuleStats( + FrameworkListProjectRuleStatsParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .asc(true) + .page(1L) + .perPage(1L) + .sortColumn(FrameworkListProjectRuleStatsParams.SortColumn.PROJECT_NAME) + .build() + ) + + val response = responseFuture.get() + response.validate() + } + + @Test + fun listProjects() { + val client = + OpenlayerOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val frameworkServiceAsync = client.governance().frameworks() + + val responseFuture = + frameworkServiceAsync.listProjects( + FrameworkListProjectsParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .page(1L) + .perPage(1L) + .build() + ) + + val response = responseFuture.get() + response.validate() + } + + @Test + fun listRules() { + val client = + OpenlayerOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val frameworkServiceAsync = client.governance().frameworks() + + val responseFuture = + frameworkServiceAsync.listRules( + FrameworkListRulesParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .page(1L) + .perPage(1L) + .build() + ) + + val response = responseFuture.get() + response.validate() + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/governance/RuleResultServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/governance/RuleResultServiceAsyncTest.kt new file mode 100644 index 00000000..f961c508 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/governance/RuleResultServiceAsyncTest.kt @@ -0,0 +1,145 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.async.governance + +import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClientAsync +import com.openlayer.api.models.governance.ruleresults.RuleResultCreateEvidenceParams +import com.openlayer.api.models.governance.ruleresults.RuleResultListEvidenceParams +import com.openlayer.api.models.governance.ruleresults.RuleResultListParams +import com.openlayer.api.models.governance.ruleresults.RuleResultUpdateParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +internal class RuleResultServiceAsyncTest { + + @Test + fun retrieve() { + val client = + OpenlayerOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val ruleResultServiceAsync = client.governance().ruleResults() + + val ruleResultFuture = + ruleResultServiceAsync.retrieve("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + + val ruleResult = ruleResultFuture.get() + ruleResult.validate() + } + + @Test + fun update() { + val client = + OpenlayerOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val ruleResultServiceAsync = client.governance().ruleResults() + + val ruleResultFuture = + ruleResultServiceAsync.update( + RuleResultUpdateParams.builder() + .ruleResultId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addBlockedBy( + RuleResultUpdateParams.BlockedBy.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleResultUpdateParams.BlockedBy.Status.PASSING) + .build() + ) + .addBlocking( + RuleResultUpdateParams.Blocking.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleResultUpdateParams.Blocking.Status.PASSING) + .build() + ) + .deactivated(true) + .deactivatedReason("deactivatedReason") + .build() + ) + + val ruleResult = ruleResultFuture.get() + ruleResult.validate() + } + + @Test + fun list() { + val client = + OpenlayerOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val ruleResultServiceAsync = client.governance().ruleResults() + + val ruleResultsFuture = + ruleResultServiceAsync.list( + RuleResultListParams.builder() + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .enabledFrameworkOnly(true) + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .includeUnframed(true) + .page(1L) + .perPage(1L) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .ruleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .scope(RuleResultListParams.Scope.PROJECT) + .searchQuery("searchQuery") + .status(RuleResultListParams.Status.PASSING) + .type(RuleResultListParams.Type.PLATFORM) + .build() + ) + + val ruleResults = ruleResultsFuture.get() + ruleResults.validate() + } + + @Test + fun createEvidence() { + val client = + OpenlayerOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val ruleResultServiceAsync = client.governance().ruleResults() + + val responseFuture = + ruleResultServiceAsync.createEvidence( + RuleResultCreateEvidenceParams.builder() + .ruleResultId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .description("description") + .name("Model risk assessment 2026") + .storageUri("s3://openlayer-evidence/evidence.pdf") + .text("text") + .url("https://openlayer.com/evidence") + .build() + ) + + val response = responseFuture.get() + response.validate() + } + + @Test + fun listEvidence() { + val client = + OpenlayerOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val ruleResultServiceAsync = client.governance().ruleResults() + + val responseFuture = + ruleResultServiceAsync.listEvidence( + RuleResultListEvidenceParams.builder() + .ruleResultId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .page(1L) + .perPage(1L) + .build() + ) + + val response = responseFuture.get() + response.validate() + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/governance/RuleServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/governance/RuleServiceAsyncTest.kt new file mode 100644 index 00000000..93cd39dd --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/governance/RuleServiceAsyncTest.kt @@ -0,0 +1,143 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.async.governance + +import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClientAsync +import com.openlayer.api.core.JsonValue +import com.openlayer.api.models.governance.rules.RuleCreateParams +import com.openlayer.api.models.governance.rules.RuleListParams +import com.openlayer.api.models.governance.rules.RuleUpdateParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +internal class RuleServiceAsyncTest { + + @Test + fun create() { + val client = + OpenlayerOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val ruleServiceAsync = client.governance().rules() + + val ruleFuture = + ruleServiceAsync.create( + RuleCreateParams.builder() + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .name("Monitoring enabled") + .scope(RuleCreateParams.Scope.PROJECT) + .type(RuleCreateParams.Type.PLATFORM) + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .automationParams( + RuleCreateParams.AutomationParams.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .automationType("monitoring_mode_enabled") + .deactivated(true) + .description("Each project must have Openlayer monitoring mode enabled.") + .evidenceType(RuleCreateParams.EvidenceType.DOCUMENT) + .renewalCadenceDays(90L) + .addTagId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) + + val rule = ruleFuture.get() + rule.validate() + } + + @Test + fun retrieve() { + val client = + OpenlayerOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val ruleServiceAsync = client.governance().rules() + + val ruleFuture = ruleServiceAsync.retrieve("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + + val rule = ruleFuture.get() + rule.validate() + } + + @Test + fun update() { + val client = + OpenlayerOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val ruleServiceAsync = client.governance().rules() + + val ruleFuture = + ruleServiceAsync.update( + RuleUpdateParams.builder() + .ruleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .deactivated(true) + .description("Each project must have Openlayer monitoring mode enabled.") + .name("Monitoring enabled") + .renewalCadenceDays(90L) + .addTagId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) + + val rule = ruleFuture.get() + rule.validate() + } + + @Test + fun list() { + val client = + OpenlayerOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val ruleServiceAsync = client.governance().rules() + + val rulesFuture = + ruleServiceAsync.list( + RuleListParams.builder() + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .asc(true) + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .deactivated(true) + .enabledFrameworkOnly(true) + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .group(RuleListParams.Group.OPEN) + .includeResults(true) + .includeUnframed(true) + .page(1L) + .perPage(1L) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .scope(RuleListParams.Scope.PROJECT) + .searchQuery("searchQuery") + .sortBy(RuleListParams.SortBy.NAME) + .status(RuleListParams.Status.PASSING) + .addTag("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .type(RuleListParams.Type.PLATFORM) + .build() + ) + + val rules = rulesFuture.get() + rules.validate() + } + + @Test + fun delete() { + val client = + OpenlayerOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val ruleServiceAsync = client.governance().rules() + + val future = ruleServiceAsync.delete("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + + val response = future.get() + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/governance/RuleStatServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/governance/RuleStatServiceAsyncTest.kt new file mode 100644 index 00000000..330c1463 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/governance/RuleStatServiceAsyncTest.kt @@ -0,0 +1,35 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.async.governance + +import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClientAsync +import com.openlayer.api.models.governance.rulestats.RuleStatRetrieveParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +internal class RuleStatServiceAsyncTest { + + @Test + fun retrieve() { + val client = + OpenlayerOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val ruleStatServiceAsync = client.governance().ruleStats() + + val ruleStatFuture = + ruleStatServiceAsync.retrieve( + RuleStatRetrieveParams.builder() + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) + + val ruleStat = ruleStatFuture.get() + ruleStat.validate() + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/governance/RuleTagServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/governance/RuleTagServiceAsyncTest.kt new file mode 100644 index 00000000..4fe39174 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/governance/RuleTagServiceAsyncTest.kt @@ -0,0 +1,35 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.async.governance + +import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClientAsync +import com.openlayer.api.models.governance.ruletags.RuleTagListParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +internal class RuleTagServiceAsyncTest { + + @Test + fun list() { + val client = + OpenlayerOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val ruleTagServiceAsync = client.governance().ruleTags() + + val ruleTagsFuture = + ruleTagServiceAsync.list( + RuleTagListParams.builder() + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .page(1L) + .perPage(1L) + .build() + ) + + val ruleTags = ruleTagsFuture.get() + ruleTags.validate() + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/governance/frameworks/DocumentServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/governance/frameworks/DocumentServiceAsyncTest.kt new file mode 100644 index 00000000..e7b2feb0 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/governance/frameworks/DocumentServiceAsyncTest.kt @@ -0,0 +1,57 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.async.governance.frameworks + +import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClientAsync +import com.openlayer.api.models.governance.frameworks.documents.DocumentListParams +import com.openlayer.api.models.governance.frameworks.documents.DocumentRetrieveParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +internal class DocumentServiceAsyncTest { + + @Test + fun retrieve() { + val client = + OpenlayerOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val documentServiceAsync = client.governance().frameworks().documents() + + val documentFuture = + documentServiceAsync.retrieve( + DocumentRetrieveParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .documentId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) + + val document = documentFuture.get() + document.validate() + } + + @Test + fun list() { + val client = + OpenlayerOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val documentServiceAsync = client.governance().frameworks().documents() + + val documentsFuture = + documentServiceAsync.list( + DocumentListParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .page(1L) + .perPage(1L) + .build() + ) + + val documents = documentsFuture.get() + documents.validate() + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/governance/frameworks/SectionServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/governance/frameworks/SectionServiceAsyncTest.kt new file mode 100644 index 00000000..9347b379 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/governance/frameworks/SectionServiceAsyncTest.kt @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.async.governance.frameworks + +import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClientAsync +import com.openlayer.api.models.governance.frameworks.sections.SectionListRulesParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +internal class SectionServiceAsyncTest { + + @Test + fun listRules() { + val client = + OpenlayerOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val sectionServiceAsync = client.governance().frameworks().sections() + + val responseFuture = + sectionServiceAsync.listRules( + SectionListRulesParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .sectionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .includeResults(true) + .includeSubsectionRules(true) + .page(1L) + .perPage(1L) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(SectionListRulesParams.Status.PASSING) + .build() + ) + + val response = responseFuture.get() + response.validate() + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/governance/frameworks/SubsectionServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/governance/frameworks/SubsectionServiceAsyncTest.kt new file mode 100644 index 00000000..94076c65 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/governance/frameworks/SubsectionServiceAsyncTest.kt @@ -0,0 +1,39 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.async.governance.frameworks + +import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClientAsync +import com.openlayer.api.models.governance.frameworks.subsections.SubsectionListRulesParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +internal class SubsectionServiceAsyncTest { + + @Test + fun listRules() { + val client = + OpenlayerOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val subsectionServiceAsync = client.governance().frameworks().subsections() + + val responseFuture = + subsectionServiceAsync.listRules( + SubsectionListRulesParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .subsectionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .includeResults(true) + .page(1L) + .perPage(1L) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(SubsectionListRulesParams.Status.PASSING) + .build() + ) + + val response = responseFuture.get() + response.validate() + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsyncTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsyncTest.kt index e98d12f7..1e470130 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsyncTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/async/storage/PresignedUrlServiceAsyncTest.kt @@ -5,6 +5,7 @@ package com.openlayer.api.services.async.storage import com.openlayer.api.TestServerExtension import com.openlayer.api.client.okhttp.OpenlayerOkHttpClientAsync import com.openlayer.api.models.storage.presignedurl.PresignedUrlCreateParams +import com.openlayer.api.models.storage.presignedurl.PresignedUrlRetrieveParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -28,4 +29,22 @@ internal class PresignedUrlServiceAsyncTest { val presignedUrl = presignedUrlFuture.get() presignedUrl.validate() } + + @Test + fun retrieve() { + val client = + OpenlayerOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val presignedUrlServiceAsync = client.storage().presignedUrl() + + val presignedUrlFuture = + presignedUrlServiceAsync.retrieve( + PresignedUrlRetrieveParams.builder().storageUri("storageUri").build() + ) + + val presignedUrl = presignedUrlFuture.get() + presignedUrl.validate() + } } diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/BackgroundTaskServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/BackgroundTaskServiceTest.kt new file mode 100644 index 00000000..42122775 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/BackgroundTaskServiceTest.kt @@ -0,0 +1,26 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.blocking + +import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +internal class BackgroundTaskServiceTest { + + @Test + fun retrieve() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val backgroundTaskService = client.backgroundTasks() + + val backgroundTask = backgroundTaskService.retrieve("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + + backgroundTask.validate() + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/governance/FrameworkServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/governance/FrameworkServiceTest.kt new file mode 100644 index 00000000..46863be5 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/governance/FrameworkServiceTest.kt @@ -0,0 +1,237 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.blocking.governance + +import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient +import com.openlayer.api.core.JsonValue +import com.openlayer.api.models.governance.frameworks.FrameworkCreateParams +import com.openlayer.api.models.governance.frameworks.FrameworkExportParams +import com.openlayer.api.models.governance.frameworks.FrameworkListParams +import com.openlayer.api.models.governance.frameworks.FrameworkListProjectRuleStatsParams +import com.openlayer.api.models.governance.frameworks.FrameworkListProjectsParams +import com.openlayer.api.models.governance.frameworks.FrameworkListRulesParams +import com.openlayer.api.models.governance.frameworks.FrameworkUpdateParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +internal class FrameworkServiceTest { + + @Test + fun create() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val frameworkService = client.governance().frameworks() + + val framework = + frameworkService.create( + FrameworkCreateParams.builder() + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .name("EU AI Act") + .description("Requirements for high-risk AI systems under the EU AI Act.") + .enabled(true) + .projectSelector( + FrameworkCreateParams.ProjectSelector.builder() + .addMatch( + FrameworkCreateParams.ProjectSelector.Match.builder() + .property( + FrameworkCreateParams.ProjectSelector.Match.Property + .RISK_LEVEL + ) + .value(JsonValue.from(listOf("high", "critical"))) + .operator("operator") + .build() + ) + .build() + ) + .addTag("regulation") + .addTag("eu") + .build() + ) + + framework.validate() + } + + @Test + fun retrieve() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val frameworkService = client.governance().frameworks() + + val framework = frameworkService.retrieve("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + + framework.validate() + } + + @Test + fun update() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val frameworkService = client.governance().frameworks() + + val framework = + frameworkService.update( + FrameworkUpdateParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .avatar( + FrameworkUpdateParams.Avatar.builder() + .type(FrameworkUpdateParams.Avatar.Type.EMOJI) + .value("🧭") + .build() + ) + .description("Requirements for high-risk AI systems under the EU AI Act.") + .enabled(true) + .extendedDescription( + FrameworkUpdateParams.ExtendedDescription.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .href("href") + .name("EU AI Act") + .projectSelector( + FrameworkUpdateParams.ProjectSelector.builder() + .addMatch( + FrameworkUpdateParams.ProjectSelector.Match.builder() + .property( + FrameworkUpdateParams.ProjectSelector.Match.Property + .RISK_LEVEL + ) + .value(JsonValue.from(listOf("high", "critical"))) + .operator("operator") + .build() + ) + .build() + ) + .addTag("regulation") + .addTag("eu") + .build() + ) + + framework.validate() + } + + @Test + fun list() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val frameworkService = client.governance().frameworks() + + val frameworks = + frameworkService.list( + FrameworkListParams.builder() + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .asc(true) + .completionOperator(FrameworkListParams.CompletionOperator.IS) + .completionValue(0L) + .enabled(true) + .includeRuleStats(true) + .page(1L) + .perPage(1L) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .searchQuery("searchQuery") + .sortColumn(FrameworkListParams.SortColumn.NAME) + .addTag("string") + .build() + ) + + frameworks.validate() + } + + @Test + fun export() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val frameworkService = client.governance().frameworks() + + val response = + frameworkService.export( + FrameworkExportParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .projectId("3fa85f64-5717-4562-b3fc-2c963f66afa6") + .build() + ) + + response.validate() + } + + @Test + fun listProjectRuleStats() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val frameworkService = client.governance().frameworks() + + val response = + frameworkService.listProjectRuleStats( + FrameworkListProjectRuleStatsParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .asc(true) + .page(1L) + .perPage(1L) + .sortColumn(FrameworkListProjectRuleStatsParams.SortColumn.PROJECT_NAME) + .build() + ) + + response.validate() + } + + @Test + fun listProjects() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val frameworkService = client.governance().frameworks() + + val response = + frameworkService.listProjects( + FrameworkListProjectsParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .page(1L) + .perPage(1L) + .build() + ) + + response.validate() + } + + @Test + fun listRules() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val frameworkService = client.governance().frameworks() + + val response = + frameworkService.listRules( + FrameworkListRulesParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .page(1L) + .perPage(1L) + .build() + ) + + response.validate() + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/governance/RuleResultServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/governance/RuleResultServiceTest.kt new file mode 100644 index 00000000..8777232a --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/governance/RuleResultServiceTest.kt @@ -0,0 +1,139 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.blocking.governance + +import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient +import com.openlayer.api.models.governance.ruleresults.RuleResultCreateEvidenceParams +import com.openlayer.api.models.governance.ruleresults.RuleResultListEvidenceParams +import com.openlayer.api.models.governance.ruleresults.RuleResultListParams +import com.openlayer.api.models.governance.ruleresults.RuleResultUpdateParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +internal class RuleResultServiceTest { + + @Test + fun retrieve() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val ruleResultService = client.governance().ruleResults() + + val ruleResult = ruleResultService.retrieve("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + + ruleResult.validate() + } + + @Test + fun update() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val ruleResultService = client.governance().ruleResults() + + val ruleResult = + ruleResultService.update( + RuleResultUpdateParams.builder() + .ruleResultId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addBlockedBy( + RuleResultUpdateParams.BlockedBy.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleResultUpdateParams.BlockedBy.Status.PASSING) + .build() + ) + .addBlocking( + RuleResultUpdateParams.Blocking.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(RuleResultUpdateParams.Blocking.Status.PASSING) + .build() + ) + .deactivated(true) + .deactivatedReason("deactivatedReason") + .build() + ) + + ruleResult.validate() + } + + @Test + fun list() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val ruleResultService = client.governance().ruleResults() + + val ruleResults = + ruleResultService.list( + RuleResultListParams.builder() + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .enabledFrameworkOnly(true) + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .includeUnframed(true) + .page(1L) + .perPage(1L) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .ruleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .scope(RuleResultListParams.Scope.PROJECT) + .searchQuery("searchQuery") + .status(RuleResultListParams.Status.PASSING) + .type(RuleResultListParams.Type.PLATFORM) + .build() + ) + + ruleResults.validate() + } + + @Test + fun createEvidence() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val ruleResultService = client.governance().ruleResults() + + val response = + ruleResultService.createEvidence( + RuleResultCreateEvidenceParams.builder() + .ruleResultId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .description("description") + .name("Model risk assessment 2026") + .storageUri("s3://openlayer-evidence/evidence.pdf") + .text("text") + .url("https://openlayer.com/evidence") + .build() + ) + + response.validate() + } + + @Test + fun listEvidence() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val ruleResultService = client.governance().ruleResults() + + val response = + ruleResultService.listEvidence( + RuleResultListEvidenceParams.builder() + .ruleResultId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .page(1L) + .perPage(1L) + .build() + ) + + response.validate() + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/governance/RuleServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/governance/RuleServiceTest.kt new file mode 100644 index 00000000..594ce978 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/governance/RuleServiceTest.kt @@ -0,0 +1,137 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.blocking.governance + +import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient +import com.openlayer.api.core.JsonValue +import com.openlayer.api.models.governance.rules.RuleCreateParams +import com.openlayer.api.models.governance.rules.RuleListParams +import com.openlayer.api.models.governance.rules.RuleUpdateParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +internal class RuleServiceTest { + + @Test + fun create() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val ruleService = client.governance().rules() + + val rule = + ruleService.create( + RuleCreateParams.builder() + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .name("Monitoring enabled") + .scope(RuleCreateParams.Scope.PROJECT) + .type(RuleCreateParams.Type.PLATFORM) + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .automationParams( + RuleCreateParams.AutomationParams.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .automationType("monitoring_mode_enabled") + .deactivated(true) + .description("Each project must have Openlayer monitoring mode enabled.") + .evidenceType(RuleCreateParams.EvidenceType.DOCUMENT) + .renewalCadenceDays(90L) + .addTagId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) + + rule.validate() + } + + @Test + fun retrieve() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val ruleService = client.governance().rules() + + val rule = ruleService.retrieve("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + + rule.validate() + } + + @Test + fun update() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val ruleService = client.governance().rules() + + val rule = + ruleService.update( + RuleUpdateParams.builder() + .ruleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .deactivated(true) + .description("Each project must have Openlayer monitoring mode enabled.") + .name("Monitoring enabled") + .renewalCadenceDays(90L) + .addTagId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) + + rule.validate() + } + + @Test + fun list() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val ruleService = client.governance().rules() + + val rules = + ruleService.list( + RuleListParams.builder() + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .asc(true) + .assigneeId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .deactivated(true) + .enabledFrameworkOnly(true) + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .group(RuleListParams.Group.OPEN) + .includeResults(true) + .includeUnframed(true) + .page(1L) + .perPage(1L) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .scope(RuleListParams.Scope.PROJECT) + .searchQuery("searchQuery") + .sortBy(RuleListParams.SortBy.NAME) + .status(RuleListParams.Status.PASSING) + .addTag("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .type(RuleListParams.Type.PLATFORM) + .build() + ) + + rules.validate() + } + + @Test + fun delete() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val ruleService = client.governance().rules() + + ruleService.delete("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/governance/RuleStatServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/governance/RuleStatServiceTest.kt new file mode 100644 index 00000000..f06ec100 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/governance/RuleStatServiceTest.kt @@ -0,0 +1,34 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.blocking.governance + +import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient +import com.openlayer.api.models.governance.rulestats.RuleStatRetrieveParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +internal class RuleStatServiceTest { + + @Test + fun retrieve() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val ruleStatService = client.governance().ruleStats() + + val ruleStat = + ruleStatService.retrieve( + RuleStatRetrieveParams.builder() + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) + + ruleStat.validate() + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/governance/RuleTagServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/governance/RuleTagServiceTest.kt new file mode 100644 index 00000000..1a8901dd --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/governance/RuleTagServiceTest.kt @@ -0,0 +1,34 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.blocking.governance + +import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient +import com.openlayer.api.models.governance.ruletags.RuleTagListParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +internal class RuleTagServiceTest { + + @Test + fun list() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val ruleTagService = client.governance().ruleTags() + + val ruleTags = + ruleTagService.list( + RuleTagListParams.builder() + .workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .page(1L) + .perPage(1L) + .build() + ) + + ruleTags.validate() + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/governance/frameworks/DocumentServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/governance/frameworks/DocumentServiceTest.kt new file mode 100644 index 00000000..10b3e2a9 --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/governance/frameworks/DocumentServiceTest.kt @@ -0,0 +1,55 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.blocking.governance.frameworks + +import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient +import com.openlayer.api.models.governance.frameworks.documents.DocumentListParams +import com.openlayer.api.models.governance.frameworks.documents.DocumentRetrieveParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +internal class DocumentServiceTest { + + @Test + fun retrieve() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val documentService = client.governance().frameworks().documents() + + val document = + documentService.retrieve( + DocumentRetrieveParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .documentId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) + + document.validate() + } + + @Test + fun list() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val documentService = client.governance().frameworks().documents() + + val documents = + documentService.list( + DocumentListParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .page(1L) + .perPage(1L) + .build() + ) + + documents.validate() + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/governance/frameworks/SectionServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/governance/frameworks/SectionServiceTest.kt new file mode 100644 index 00000000..4b76f36c --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/governance/frameworks/SectionServiceTest.kt @@ -0,0 +1,39 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.blocking.governance.frameworks + +import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient +import com.openlayer.api.models.governance.frameworks.sections.SectionListRulesParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +internal class SectionServiceTest { + + @Test + fun listRules() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val sectionService = client.governance().frameworks().sections() + + val response = + sectionService.listRules( + SectionListRulesParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .sectionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .includeResults(true) + .includeSubsectionRules(true) + .page(1L) + .perPage(1L) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(SectionListRulesParams.Status.PASSING) + .build() + ) + + response.validate() + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/governance/frameworks/SubsectionServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/governance/frameworks/SubsectionServiceTest.kt new file mode 100644 index 00000000..c6ae586f --- /dev/null +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/governance/frameworks/SubsectionServiceTest.kt @@ -0,0 +1,38 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.openlayer.api.services.blocking.governance.frameworks + +import com.openlayer.api.TestServerExtension +import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient +import com.openlayer.api.models.governance.frameworks.subsections.SubsectionListRulesParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +internal class SubsectionServiceTest { + + @Test + fun listRules() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val subsectionService = client.governance().frameworks().subsections() + + val response = + subsectionService.listRules( + SubsectionListRulesParams.builder() + .frameworkId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .subsectionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .includeResults(true) + .page(1L) + .perPage(1L) + .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .status(SubsectionListRulesParams.Status.PASSING) + .build() + ) + + response.validate() + } +} diff --git a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceTest.kt b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceTest.kt index f165113e..52ff3674 100644 --- a/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceTest.kt +++ b/openlayer-java-core/src/test/kotlin/com/openlayer/api/services/blocking/storage/PresignedUrlServiceTest.kt @@ -5,6 +5,7 @@ package com.openlayer.api.services.blocking.storage import com.openlayer.api.TestServerExtension import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient import com.openlayer.api.models.storage.presignedurl.PresignedUrlCreateParams +import com.openlayer.api.models.storage.presignedurl.PresignedUrlRetrieveParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -27,4 +28,21 @@ internal class PresignedUrlServiceTest { presignedUrl.validate() } + + @Test + fun retrieve() { + val client = + OpenlayerOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val presignedUrlService = client.storage().presignedUrl() + + val presignedUrl = + presignedUrlService.retrieve( + PresignedUrlRetrieveParams.builder().storageUri("storageUri").build() + ) + + presignedUrl.validate() + } } diff --git a/openlayer-java-proguard-test/src/test/kotlin/com/openlayer/api/proguard/ProGuardCompatibilityTest.kt b/openlayer-java-proguard-test/src/test/kotlin/com/openlayer/api/proguard/ProGuardCompatibilityTest.kt index 394091b7..b894f153 100644 --- a/openlayer-java-proguard-test/src/test/kotlin/com/openlayer/api/proguard/ProGuardCompatibilityTest.kt +++ b/openlayer-java-proguard-test/src/test/kotlin/com/openlayer/api/proguard/ProGuardCompatibilityTest.kt @@ -53,6 +53,8 @@ internal class ProGuardCompatibilityTest { assertThat(client.inferencePipelines()).isNotNull() assertThat(client.storage()).isNotNull() assertThat(client.tests()).isNotNull() + assertThat(client.backgroundTasks()).isNotNull() + assertThat(client.governance()).isNotNull() } @Test diff --git a/scripts/mock b/scripts/mock index 4e11791c..45416b90 100755 --- a/scripts/mock +++ b/scripts/mock @@ -16,7 +16,7 @@ elif [ -n "$STAINLESS_OPENAPI_SPEC_URL" ]; then URL="$STAINLESS_OPENAPI_SPEC_URL" else # Embedded OpenAPI spec (base64-encoded, gzipped) - EMBEDDED_SPEC="H4sIAAAAAAAAA+29aXfbSLIo+Ffy8b6+kvuRFLXaUl/ffiov1Xrt7Uly1dyxPFISSJJogwAbCYhm++i3zMf5NP9tfsKciFwBJEBwk2WX6pw6FslcIjMjI2OPb614wiI6CVonrf1ur7vfareCaBC3Tr61vDhKqZfCn2xMg7B10uLZZBIn6f+ETiGdsaTrxeNWuxXRMWudtN6rr1vtVpZAh1GaTvjJzk6uw07rrt3yGfeSYJIGcdQ6aZ1+OCODOCFBlLKEemkQDck0SEckHTGihyWcJbcs6bbarTRIw9yU5PTDWavdumUJF0Pudnutdut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