├── .genignore ├── .gitattributes ├── .github ├── dependabot.yml ├── pull_request_template.md └── workflows │ ├── docs_publish.yaml │ ├── release_version_check.yaml │ ├── sdk_generation.yaml │ ├── sdk_publish.yaml │ └── test_and_lint.yaml ├── .gitignore ├── .speakeasy ├── gen.lock ├── gen.yaml ├── overlay.yaml ├── workflow.lock └── workflow.yaml ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── RELEASES.md ├── USAGE.md ├── build-extras.gradle ├── build.gradle ├── config └── checkstyle │ └── checkstyle.xml ├── docs ├── models │ ├── errors │ │ ├── BatchServerError.md │ │ ├── ClientError.md │ │ ├── Errors.md │ │ ├── Location.md │ │ ├── ServerError.md │ │ ├── ServerErrorErrors.md │ │ ├── ServerErrorLocation.md │ │ └── UnhealthyServer.md │ ├── operations │ │ ├── CompileQueryWithPartialEvaluationRequest.md │ │ ├── CompileQueryWithPartialEvaluationRequestApplicationJSONRequestBody.md │ │ ├── CompileQueryWithPartialEvaluationResponse.md │ │ ├── ExecuteBatchPolicyWithInputRequest.md │ │ ├── ExecuteBatchPolicyWithInputRequestBody.md │ │ ├── ExecuteBatchPolicyWithInputResponse.md │ │ ├── ExecuteDefaultPolicyWithInputRequest.md │ │ ├── ExecuteDefaultPolicyWithInputResponse.md │ │ ├── ExecutePolicyRequest.md │ │ ├── ExecutePolicyResponse.md │ │ ├── ExecutePolicyWithInputRequest.md │ │ ├── ExecutePolicyWithInputRequestBody.md │ │ ├── ExecutePolicyWithInputResponse.md │ │ ├── HealthRequest.md │ │ └── HealthResponse.md │ └── shared │ │ ├── BatchMixedResults.md │ │ ├── BatchSuccessfulPolicyEvaluation.md │ │ ├── CompileOptions.md │ │ ├── CompileResultJSON.md │ │ ├── CompileResultJSONResult.md │ │ ├── CompileResultMultitarget.md │ │ ├── CompileResultMultitargetQuery.md │ │ ├── CompileResultMultitargetResult.md │ │ ├── CompileResultSQL.md │ │ ├── CompileResultSQLResult.md │ │ ├── CompileResultUCAST.md │ │ ├── CompileResultUCASTResult.md │ │ ├── Errors.md │ │ ├── Explain.md │ │ ├── GzipAcceptEncoding.md │ │ ├── GzipContentEncoding.md │ │ ├── HealthyServer.md │ │ ├── Input.md │ │ ├── Location.md │ │ ├── MaskingRule.md │ │ ├── Mysql.md │ │ ├── One.md │ │ ├── Postgresql.md │ │ ├── Provenance.md │ │ ├── Query.md │ │ ├── Replace.md │ │ ├── Responses.md │ │ ├── Result.md │ │ ├── Revision.md │ │ ├── Security.md │ │ ├── ServerError.md │ │ ├── ServerErrorWithStatusCode.md │ │ ├── Sqlite.md │ │ ├── Sqlserver.md │ │ ├── SuccessfulPolicyResponse.md │ │ ├── SuccessfulPolicyResponseWithStatusCode.md │ │ ├── Support.md │ │ ├── TargetDialects.md │ │ ├── TargetSQLTableMappings.md │ │ ├── Targets.md │ │ └── Ucast.md ├── sdks │ └── opaapiclient │ │ └── README.md └── site │ ├── docs │ ├── index.md │ └── maintenance │ │ ├── add-doc.md │ │ ├── change-managed.md │ │ ├── change-speakeasy.md │ │ ├── custom-spec.md │ │ └── releases.md │ └── mkdocs.yml ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── scripts ├── build_docs.sh ├── check-released-versions.sh ├── check-version-mismatch.sh ├── fix-build-gradle.sh ├── post-generate-hook.sh └── serve_docs.sh ├── settings.gradle ├── src ├── main │ └── java │ │ └── com │ │ └── styra │ │ └── opa │ │ ├── OPAClient.java │ │ ├── OPAException.java │ │ ├── OPAResult.java │ │ ├── openapi │ │ ├── OpaApiClient.java │ │ ├── SDKConfiguration.java │ │ ├── SecuritySource.java │ │ ├── hooks │ │ │ └── SDKHooks.java │ │ ├── models │ │ │ ├── errors │ │ │ │ ├── AuthException.java │ │ │ │ ├── BatchServerError.java │ │ │ │ ├── ClientError.java │ │ │ │ ├── Errors.java │ │ │ │ ├── Location.java │ │ │ │ ├── SDKError.java │ │ │ │ ├── ServerError.java │ │ │ │ ├── ServerErrorErrors.java │ │ │ │ ├── ServerErrorLocation.java │ │ │ │ └── UnhealthyServer.java │ │ │ ├── operations │ │ │ │ ├── CompileQueryWithPartialEvaluationRequest.java │ │ │ │ ├── CompileQueryWithPartialEvaluationRequestApplicationJSONRequestBody.java │ │ │ │ ├── CompileQueryWithPartialEvaluationRequestBuilder.java │ │ │ │ ├── CompileQueryWithPartialEvaluationResponse.java │ │ │ │ ├── ExecuteBatchPolicyWithInputRequest.java │ │ │ │ ├── ExecuteBatchPolicyWithInputRequestBody.java │ │ │ │ ├── ExecuteBatchPolicyWithInputRequestBuilder.java │ │ │ │ ├── ExecuteBatchPolicyWithInputResponse.java │ │ │ │ ├── ExecuteDefaultPolicyWithInputRequest.java │ │ │ │ ├── ExecuteDefaultPolicyWithInputRequestBuilder.java │ │ │ │ ├── ExecuteDefaultPolicyWithInputResponse.java │ │ │ │ ├── ExecutePolicyRequest.java │ │ │ │ ├── ExecutePolicyRequestBuilder.java │ │ │ │ ├── ExecutePolicyResponse.java │ │ │ │ ├── ExecutePolicyWithInputRequest.java │ │ │ │ ├── ExecutePolicyWithInputRequestBody.java │ │ │ │ ├── ExecutePolicyWithInputRequestBuilder.java │ │ │ │ ├── ExecutePolicyWithInputResponse.java │ │ │ │ ├── HealthRequest.java │ │ │ │ ├── HealthRequestBuilder.java │ │ │ │ ├── HealthResponse.java │ │ │ │ └── SDKMethodInterfaces.java │ │ │ └── shared │ │ │ │ ├── BatchMixedResults.java │ │ │ │ ├── BatchSuccessfulPolicyEvaluation.java │ │ │ │ ├── CompileOptions.java │ │ │ │ ├── CompileResultJSON.java │ │ │ │ ├── CompileResultJSONResult.java │ │ │ │ ├── CompileResultMultitarget.java │ │ │ │ ├── CompileResultMultitargetQuery.java │ │ │ │ ├── CompileResultMultitargetResult.java │ │ │ │ ├── CompileResultSQL.java │ │ │ │ ├── CompileResultSQLResult.java │ │ │ │ ├── CompileResultUCAST.java │ │ │ │ ├── CompileResultUCASTResult.java │ │ │ │ ├── Errors.java │ │ │ │ ├── Explain.java │ │ │ │ ├── GzipAcceptEncoding.java │ │ │ │ ├── GzipContentEncoding.java │ │ │ │ ├── HealthyServer.java │ │ │ │ ├── Input.java │ │ │ │ ├── Location.java │ │ │ │ ├── MaskingRule.java │ │ │ │ ├── Mysql.java │ │ │ │ ├── One.java │ │ │ │ ├── Postgresql.java │ │ │ │ ├── Provenance.java │ │ │ │ ├── Query.java │ │ │ │ ├── Replace.java │ │ │ │ ├── Responses.java │ │ │ │ ├── Result.java │ │ │ │ ├── Revision.java │ │ │ │ ├── Security.java │ │ │ │ ├── ServerError.java │ │ │ │ ├── ServerErrorWithStatusCode.java │ │ │ │ ├── Sqlite.java │ │ │ │ ├── Sqlserver.java │ │ │ │ ├── SuccessfulPolicyResponse.java │ │ │ │ ├── SuccessfulPolicyResponseWithStatusCode.java │ │ │ │ ├── Support.java │ │ │ │ ├── TargetDialects.java │ │ │ │ ├── TargetSQLTableMappings.java │ │ │ │ ├── Targets.java │ │ │ │ └── Ucast.java │ │ └── utils │ │ │ ├── BackoffStrategy.java │ │ │ ├── BigDecimalString.java │ │ │ ├── BigIntegerString.java │ │ │ ├── Constants.java │ │ │ ├── Deserializers.java │ │ │ ├── EventStream.java │ │ │ ├── EventStreamLineReader.java │ │ │ ├── EventStreamMessage.java │ │ │ ├── EventStreamReader.java │ │ │ ├── FormMetadata.java │ │ │ ├── HTTPClient.java │ │ │ ├── HTTPRequest.java │ │ │ ├── HasSecurity.java │ │ │ ├── HeaderMetadata.java │ │ │ ├── Helpers.java │ │ │ ├── Hook.java │ │ │ ├── Hooks.java │ │ │ ├── JSON.java │ │ │ ├── LazySingletonValue.java │ │ │ ├── Metadata.java │ │ │ ├── Multipart.java │ │ │ ├── MultipartFormMetadata.java │ │ │ ├── NameValue.java │ │ │ ├── OneOfDeserializer.java │ │ │ ├── Options.java │ │ │ ├── PathParamsMetadata.java │ │ │ ├── QueryEncoding.java │ │ │ ├── QueryParameter.java │ │ │ ├── QueryParameters.java │ │ │ ├── QueryParamsMetadata.java │ │ │ ├── RecordingClient.java │ │ │ ├── RequestBody.java │ │ │ ├── RequestMetadata.java │ │ │ ├── Response.java │ │ │ ├── Retries.java │ │ │ ├── RetryConfig.java │ │ │ ├── Security.java │ │ │ ├── SecurityMetadata.java │ │ │ ├── SerializedBody.java │ │ │ ├── SessionManager.java │ │ │ ├── SpeakeasyHTTPClient.java │ │ │ ├── SpeakeasyMetadata.java │ │ │ ├── TypedObject.java │ │ │ ├── Types.java │ │ │ ├── Utf8UrlEncoder.java │ │ │ └── Utils.java │ │ └── utils │ │ ├── OPAHTTPClient.java │ │ └── OPALatencyMeasuringHTTPClient.java └── test │ ├── java │ └── com │ │ └── styra │ │ └── opa │ │ ├── AlternateSampleObject.java │ │ ├── EOPATest.java │ │ ├── OPATest.java │ │ ├── RecordingHandler.java │ │ └── SampleObject.java │ └── resources │ ├── entrypoint.sh │ ├── eopa.Dockerfile │ ├── nginx.conf │ └── opa.Dockerfile └── testdata └── simple ├── auth.rego ├── condfail.rego ├── policy.rego └── system.rego /.genignore: -------------------------------------------------------------------------------- 1 | LICENSE 2 | src/main/java/com/styra/opa/OPAClient.java 3 | src/main/java/com/styra/opa/OPAException.java 4 | src/main/java/com/styra/opa/utils/OPAHTTPClient.java 5 | src/test/java/com/styra/opa/OPATest.java 6 | testdata/simple/policy.rego 7 | testdata/simple/auth.rego 8 | docs/site/* 9 | docs/site/** 10 | scripts/* 11 | scripts/** 12 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # 2 | # https://help.github.com/articles/dealing-with-line-endings/ 3 | # 4 | # Linux start script should use lf 5 | /gradlew text eol=lf 6 | 7 | # These are Windows script files and should use crlf 8 | *.bat text eol=crlf 9 | 10 | # This allows generated code to be indexed correctly 11 | *.java linguist-generated=false -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: github-actions 4 | directory: / 5 | schedule: 6 | interval: daily 7 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | ### :nut_and_bolt: What code changed, and why? 2 | 3 | ### :+1: Definition of done 4 | 5 | ### :athletic_shoe: How to test 6 | 7 | ### :chains: Related Resources 8 | 9 | -------------------------------------------------------------------------------- /.github/workflows/docs_publish.yaml: -------------------------------------------------------------------------------- 1 | name: "03 - Publish Docs" 2 | "on": 3 | push: 4 | branches: 5 | - main 6 | 7 | jobs: 8 | #publish: 9 | # uses: speakeasy-api/sdk-generation-action/.github/workflows/sdk-publish.yaml@v15 10 | # with: 11 | # create_release: true 12 | # secrets: 13 | # github_access_token: ${{ secrets.GITHUB_TOKEN }} 14 | 15 | docs: 16 | runs-on: ubuntu-latest 17 | steps: 18 | - uses: actions/checkout@v4 19 | - uses: gradle/gradle-build-action@v3 20 | - uses: actions/setup-python@v5 21 | with: 22 | python-version: 3.x 23 | - run: pip install mkdocs 24 | - run: ./scripts/build_docs.sh ./build/docsite 25 | - name: Deploy to GitHub Pages 26 | uses: peaceiris/actions-gh-pages@v4 27 | with: 28 | github_token: ${{ secrets.GITHUB_TOKEN }} 29 | publish_dir: ./build/docsite 30 | -------------------------------------------------------------------------------- /.github/workflows/release_version_check.yaml: -------------------------------------------------------------------------------- 1 | name: "05 - Release Version Check" 2 | 3 | "on": 4 | schedule: 5 | - cron: 0 0 * * * 6 | 7 | jobs: 8 | verscheck: 9 | name: Check Release Versions 10 | runs-on: ubuntu-latest 11 | steps: 12 | - name: Tune GitHub-hosted runner network 13 | uses: smorimoto/tune-github-hosted-runner-network@v1 14 | - uses: actions/checkout@v4 15 | - name: Setup OPA 16 | uses: open-policy-agent/setup-opa@v2 17 | with: 18 | version: latest 19 | - name: Run version-checker script 20 | run: | 21 | ./scripts/check-released-versions.sh 22 | - uses: ravsamhq/notify-slack-action@v2 23 | if: always() && env.SLACK_WEBHOOK_URL != '' 24 | with: 25 | status: ${{ job.status }} 26 | token: ${{ secrets.github_access_token }} 27 | notify_when: "failure" 28 | notification_title: "Maven Central release for opa-java does not match GitHub release version" 29 | message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>, see release docs here: https://styrainc.github.io/opa-java/maintenance/releases/" 30 | footer: "Linked Repo <{repo_url}|{repo}> | <{run_url}|View Run>" 31 | env: 32 | SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} 33 | 34 | -------------------------------------------------------------------------------- /.github/workflows/sdk_generation.yaml: -------------------------------------------------------------------------------- 1 | name: "02 - Generate" 2 | permissions: 3 | checks: write 4 | contents: write 5 | pull-requests: write 6 | statuses: write 7 | "on": 8 | workflow_dispatch: 9 | inputs: 10 | force: 11 | description: Force generation of SDKs 12 | type: boolean 13 | default: false 14 | schedule: 15 | - cron: 0 0 * * 0 16 | jobs: 17 | generate: 18 | runs-on: ubuntu-latest 19 | permissions: 20 | contents: write 21 | pull-requests: write 22 | steps: 23 | - uses: actions/checkout@v4 24 | - uses: gradle/gradle-build-action@v3 25 | - uses: smorimoto/tune-github-hosted-runner-network@v1 26 | - name: Run Generation Workflow 27 | uses: speakeasy-api/sdk-generation-action@v15 28 | with: 29 | speakeasy_version: latest 30 | github_access_token: ${{ secrets.GITHUB_TOKEN }} 31 | mode: pr 32 | force: ${{ github.event.inputs.force }} 33 | speakeasy_api_key: ${{ secrets.SPEAKEASY_API_KEY }} 34 | - name: Change Repo Ownership 35 | run: | 36 | sudo chown -R runner ./repo 37 | - name: Configure git 38 | run: | 39 | git config --global user.name "GitHub Actions" 40 | git config --global user.email "actions@github.com" 41 | 42 | # Note that this step will fail with an error if the SE automation did 43 | # not determine that any changes were needed. I don't think that's a 44 | # problem, but if it turns out to be, we could fix it by checking if the 45 | # ref exists on the remote before we use `gh pr checkout`. 46 | # 47 | # -- CAD 2024-05-01 48 | - name: Checkout PR and Apply Post-Generate Hook 49 | env: 50 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 51 | run: | 52 | cd repo 53 | ref="$(git rev-parse --abbrev-ref HEAD)" 54 | cd .. 55 | gh pr checkout "$ref" 56 | ./scripts/post-generate-hook.sh 57 | if [ 0 -ge "$(git diff | wc -l)" ] ; then 58 | echo "no changes detected after fixup, nothing to commit" 59 | exit 0 60 | fi 61 | msg="post-generation for $ref at $(date)" 62 | git commit -am "$msg" 63 | git push origin "$ref" 64 | - name: Run Tests & Lint 65 | run: ./gradlew test lint checkstyleMain checkstyleTest 66 | -------------------------------------------------------------------------------- /.github/workflows/sdk_publish.yaml: -------------------------------------------------------------------------------- 1 | name: "04 - Publish to Maven Central and GitHub Release" 2 | "on": 3 | workflow_dispatch: 4 | inputs: 5 | force: 6 | description: Force publish 7 | type: boolean 8 | default: false 9 | push: 10 | branches: 11 | - main 12 | paths: 13 | - RELEASES.md 14 | - '*/RELEASES.md' 15 | jobs: 16 | test_and_lint: 17 | runs-on: ubuntu-latest 18 | steps: 19 | - uses: actions/checkout@v4 20 | - uses: gradle/gradle-build-action@v3 21 | - uses: open-policy-agent/setup-opa@v2 22 | - run: ./gradlew test lint checkstyleMain checkstyleTest 23 | - run: ./scripts/check-version-mismatch.sh 24 | 25 | publish: 26 | name: Publish Java SDK 27 | runs-on: ubuntu-latest 28 | steps: 29 | - name: Tune GitHub-hosted runner network 30 | uses: smorimoto/tune-github-hosted-runner-network@v1 31 | - uses: actions/checkout@v4 32 | - name: Set up Java 33 | uses: actions/setup-java@v4 34 | with: 35 | java-version: "11" 36 | distribution: "corretto" 37 | cache: "gradle" 38 | - name: Publish to Sonatype Central 39 | run: |- 40 | pwd 41 | ./gradlew build sonatypeCentralUpload -x autoLintGradle --no-daemon 42 | env: 43 | SONATYPE_USERNAME: ${{ secrets.sonatype_username }} 44 | SONATYPE_PASSWORD: ${{ secrets.sonatype_password }} 45 | SONATYPE_SIGNING_KEY: ${{ secrets.java_gpg_secret_key }} 46 | SIGNING_KEY_PASSPHRASE: ${{ secrets.java_gpg_passphrase }} 47 | - uses: ravsamhq/notify-slack-action@v2 48 | if: always() && env.SLACK_WEBHOOK_URL != '' 49 | with: 50 | status: ${{ job.status }} 51 | token: ${{ secrets.github_access_token }} 52 | notify_when: "failure" 53 | notification_title: "Failed to Publish Maven Central Release" 54 | message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>" 55 | footer: "Linked Repo <{repo_url}|{repo}> | <{run_url}|View Run>" 56 | env: 57 | SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} 58 | 59 | release: 60 | name: Create Github Release 61 | runs-on: ubuntu-latest 62 | steps: 63 | - name: Tune GitHub-hosted runner network 64 | uses: smorimoto/tune-github-hosted-runner-network@v1 65 | - id: release 66 | uses: speakeasy-api/sdk-generation-action@v15 67 | env: 68 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 69 | with: 70 | github_access_token: ${{ secrets.GITHUB_TOKEN }} 71 | action: "release" 72 | speakeasy_api_key: ${{ secrets.speakeasy_api_key }} 73 | speakeasy_server_url: ${{ inputs.speakeasy_server_url }} 74 | - uses: ravsamhq/notify-slack-action@v2 75 | if: always() && env.SLACK_WEBHOOK_URL != '' 76 | with: 77 | status: ${{ job.status }} 78 | token: ${{ secrets.github_access_token }} 79 | notify_when: "failure" 80 | notification_title: "Failed to create Github Release" 81 | message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>" 82 | footer: "Linked Repo <{repo_url}|{repo}> | <{run_url}|View Run>" 83 | env: 84 | SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} 85 | 86 | -------------------------------------------------------------------------------- /.github/workflows/test_and_lint.yaml: -------------------------------------------------------------------------------- 1 | name: "01 - Run unit tests and lint Java code" 2 | on: 3 | pull_request: 4 | 5 | jobs: 6 | test_and_lint: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - uses: actions/checkout@v4 10 | - uses: gradle/gradle-build-action@v3 11 | - run: ./gradlew test lint checkstyleMain checkstyleTest 12 | - name: Publish Test Report 13 | uses: mikepenz/action-junit-report@v5 14 | if: success() || failure() # always run even if the previous step fails 15 | with: 16 | report_paths: '**/build/test-results/test/TEST-*.xml' 17 | - name: Publish Checkstyle report 18 | uses: Juuxel/publish-checkstyle-report@v1 19 | if: ${{ failure() || success() }} 20 | with: 21 | # required: The glob paths to report XML files as a multiline string 22 | # The format below works for the Gradle Checkstyle plugin with default configurations 23 | reports: | 24 | build/reports/checkstyle/*.xml 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .speakeasy/temp/ 2 | .speakeasy/reports 3 | # Ignore Gradle project-specific cache directory 4 | .gradle 5 | # Ignore Gradle build output directory 6 | build 7 | bin/ 8 | # Ignore IDE-specific configs 9 | .project 10 | .settings/ 11 | .DS_Store 12 | .env 13 | -------------------------------------------------------------------------------- /.speakeasy/gen.yaml: -------------------------------------------------------------------------------- 1 | configVersion: 2.0.0 2 | generation: 3 | sdkClassName: OpaApiClient 4 | maintainOpenAPIOrder: true 5 | usageSnippets: 6 | optionalPropertyRendering: withExample 7 | useClassNamesForArrayFields: true 8 | fixes: 9 | nameResolutionDec2023: true 10 | nameResolutionFeb2025: false 11 | parameterOrderingFeb2024: true 12 | requestResponseComponentNamesFeb2024: true 13 | securityFeb2025: false 14 | auth: 15 | oAuth2ClientCredentialsEnabled: false 16 | oAuth2PasswordEnabled: false 17 | java: 18 | version: 2.1.1 19 | additionalDependencies: 20 | - testImplementation:org.junit.jupiter:junit-jupiter-api:5.8.2 21 | - runtimeOnly:org.junit.jupiter:junit-jupiter-engine:5.8.2 22 | - testImplementation:org.testcontainers:testcontainers-bom:1.20.1 23 | - testImplementation:org.testcontainers:testcontainers:1.20.1 24 | - testImplementation:org.testcontainers:junit-jupiter:1.20.1 25 | - implementation:com.fasterxml.jackson.core:jackson-annotations:2.17.0 26 | - api:com.fasterxml.jackson.core:jackson-core:2.17.0 27 | - implementation:org.apache.httpcomponents:httpcore:4.4.16 28 | - api:com.fasterxml.jackson.core:jackson-databind:2.17.0 29 | additionalPlugins: 30 | - id("java") 31 | - id("checkstyle") 32 | artifactID: openapi 33 | clientServerStatusCodesAsErrors: true 34 | companyEmail: devrel@styra.com 35 | companyName: Styra 36 | companyURL: www.styra.com 37 | defaultErrorName: SDKError 38 | flattenGlobalSecurity: false 39 | githubURL: github.com/styrainc/opa-java 40 | groupID: com.styra.opa 41 | imports: 42 | option: openapi 43 | paths: 44 | callbacks: models/callbacks 45 | errors: models/errors 46 | operations: models/operations 47 | shared: models/shared 48 | webhooks: models/webhooks 49 | inputModelSuffix: input 50 | license: 51 | name: The Apache License, Version 2.0 52 | shortName: apache2 53 | url: http://www.apache.org/licenses/LICENSE-2.0.txt 54 | maxMethodParams: 4 55 | outputModelSuffix: output 56 | projectName: api 57 | templateVersion: v2 58 | -------------------------------------------------------------------------------- /.speakeasy/overlay.yaml: -------------------------------------------------------------------------------- 1 | overlay: 1.0.0 2 | info: 3 | title: Overlay to fix the Speakeasy path encoding 4 | version: 0.0.1 5 | actions: 6 | - target: "$.components.parameters.policyPath" 7 | description: | 8 | Support path encoding 9 | https://www.speakeasy.com/docs/languages/java/param-encoding#allowreserved. 10 | Fix https://github.com/StyraInc/opa-java/issues/77 11 | update: 12 | x-speakeasy-param-encoding-override: allowReserved -------------------------------------------------------------------------------- /.speakeasy/workflow.lock: -------------------------------------------------------------------------------- 1 | speakeasyVersion: 1.538.0 2 | sources: 3 | openapi: 4 | sourceNamespace: openapi 5 | sourceRevisionDigest: sha256:6b2c2d3da56f81b9871521b2ae47e55246248cf0b473436988b1b1911b8129af 6 | sourceBlobDigest: sha256:d91719dc8def1c66ba7871a3c70d1ffe77d1cbeb5fd9547d8c4c811f7f4f6363 7 | tags: 8 | - latest 9 | - speakeasy-sdk-regen-1745519178 10 | - 0.2.0 11 | targets: 12 | opa: 13 | source: openapi 14 | sourceNamespace: openapi 15 | sourceRevisionDigest: sha256:6b2c2d3da56f81b9871521b2ae47e55246248cf0b473436988b1b1911b8129af 16 | sourceBlobDigest: sha256:d91719dc8def1c66ba7871a3c70d1ffe77d1cbeb5fd9547d8c4c811f7f4f6363 17 | codeSamplesNamespace: openapi-java-code-samples 18 | codeSamplesRevisionDigest: sha256:eabb303ad900c49114a9534e1da21932144866b6ba4c13877df50d235272c9b2 19 | workflow: 20 | workflowVersion: 1.0.0 21 | speakeasyVersion: latest 22 | sources: 23 | openapi: 24 | inputs: 25 | - location: https://raw.githubusercontent.com/StyraInc/enterprise-opa/main/openapi/openapi.yaml 26 | overlays: 27 | - location: .speakeasy/overlay.yaml 28 | registry: 29 | location: registry.speakeasyapi.dev/styra/styra/openapi 30 | targets: 31 | opa: 32 | target: java 33 | source: openapi 34 | publish: 35 | java: 36 | ossrhUsername: $OSSRH_USERNAME 37 | ossrhPassword: $OSSRH_PASSWORD 38 | gpgSecretKey: $JAVA_GPG_SECRET_KEY 39 | gpgPassPhrase: $JAVA_GPG_PASSPHRASE 40 | codeSamples: 41 | registry: 42 | location: registry.speakeasyapi.dev/styra/styra/openapi-java-code-samples 43 | labelOverride: 44 | fixedValue: Java (SDK) 45 | blocking: false 46 | -------------------------------------------------------------------------------- /.speakeasy/workflow.yaml: -------------------------------------------------------------------------------- 1 | workflowVersion: 1.0.0 2 | speakeasyVersion: latest 3 | sources: 4 | openapi: 5 | inputs: 6 | - location: https://raw.githubusercontent.com/StyraInc/enterprise-opa/main/openapi/openapi.yaml 7 | overlays: 8 | - location: .speakeasy/overlay.yaml 9 | registry: 10 | location: registry.speakeasyapi.dev/styra/styra/openapi 11 | targets: 12 | opa: 13 | target: java 14 | source: openapi 15 | publish: 16 | java: 17 | ossrhUsername: $OSSRH_USERNAME 18 | ossrhPassword: $OSSRH_PASSWORD 19 | gpgSecretKey: $JAVA_GPG_SECRET_KEY 20 | gpgPassPhrase: $JAVA_GPG_PASSPHRASE 21 | codeSamples: 22 | registry: 23 | location: registry.speakeasyapi.dev/styra/styra/openapi-java-code-samples 24 | labelOverride: 25 | fixedValue: Java (SDK) 26 | blocking: false 27 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # OPA Java SDK Changelog 2 | 3 | ## v1.6.0 4 | 5 | * Fixed omission of jackson-databind dependency type change to `api`, which was supposed to go out with 1.5.3. 6 | 7 | ## v1.5.3 8 | 9 | * Marked jackson-databind as an `api` dependency in addition to jackson-core. 10 | * Fixed a bug where `OPALatencyMeasuringHTTPClient` would report results in ns rather than ms. 11 | 12 | ## v1.5.2 13 | 14 | * Fixed a bug where instantiating `OPALatencyMeasuringHTTPClient` with the default constructor could result in a null pointer exception while formatting messages. 15 | 16 | ## v1.5.1 17 | 18 | * Regenerated low-level API with Speakeasy 1.351.2 19 | * Release `OPALatencyMeasuringHTTPClient` 20 | 21 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to This Repository 2 | 3 | Thank you for your interest in contributing to this repository. Please note that this repository contains generated code. As such, we do not accept direct changes or pull requests. Instead, we encourage you to follow the guidelines below to report issues and suggest improvements. 4 | 5 | ## How to Report Issues 6 | 7 | If you encounter any bugs or have suggestions for improvements, please open an issue on GitHub. When reporting an issue, please provide as much detail as possible to help us reproduce the problem. This includes: 8 | 9 | - A clear and descriptive title 10 | - Steps to reproduce the issue 11 | - Expected and actual behavior 12 | - Any relevant logs, screenshots, or error messages 13 | - Information about your environment (e.g., operating system, software versions) 14 | - For example can be collected using the `npx envinfo` command from your terminal if you have Node.js installed 15 | 16 | ## Issue Triage and Upstream Fixes 17 | 18 | We will review and triage issues as quickly as possible. Our goal is to address bugs and incorporate improvements in the upstream source code. Fixes will be included in the next generation of the generated code. 19 | 20 | ## Contact 21 | 22 | If you have any questions or need further assistance, please feel free to reach out by opening an issue. 23 | 24 | Thank you for your understanding and cooperation! 25 | 26 | The Maintainers 27 | -------------------------------------------------------------------------------- /USAGE.md: -------------------------------------------------------------------------------- 1 | 2 | ```java 3 | package hello.world; 4 | 5 | import com.styra.opa.openapi.OpaApiClient; 6 | import com.styra.opa.openapi.models.errors.ClientError; 7 | import com.styra.opa.openapi.models.errors.ServerError; 8 | import com.styra.opa.openapi.models.operations.ExecuteDefaultPolicyWithInputResponse; 9 | import com.styra.opa.openapi.models.shared.Input; 10 | import java.lang.Exception; 11 | 12 | public class Application { 13 | 14 | public static void main(String[] args) throws ClientError, ServerError, Exception { 15 | 16 | OpaApiClient sdk = OpaApiClient.builder() 17 | .build(); 18 | 19 | ExecuteDefaultPolicyWithInputResponse res = sdk.executeDefaultPolicyWithInput() 20 | .input(Input.of(4963.69)) 21 | .call(); 22 | 23 | if (res.result().isPresent()) { 24 | // handle response 25 | } 26 | } 27 | } 28 | ``` 29 | 30 | ```java 31 | package hello.world; 32 | 33 | import com.styra.opa.openapi.OpaApiClient; 34 | import com.styra.opa.openapi.models.errors.ClientError; 35 | import com.styra.opa.openapi.models.errors.ServerError; 36 | import com.styra.opa.openapi.models.operations.*; 37 | import com.styra.opa.openapi.models.shared.Input; 38 | import java.lang.Exception; 39 | 40 | public class Application { 41 | 42 | public static void main(String[] args) throws ClientError, ServerError, Exception { 43 | 44 | OpaApiClient sdk = OpaApiClient.builder() 45 | .build(); 46 | 47 | ExecutePolicyWithInputRequest req = ExecutePolicyWithInputRequest.builder() 48 | .path("app/rbac") 49 | .requestBody(ExecutePolicyWithInputRequestBody.builder() 50 | .input(Input.of(true)) 51 | .build()) 52 | .build(); 53 | 54 | ExecutePolicyWithInputResponse res = sdk.executePolicyWithInput() 55 | .request(req) 56 | .call(); 57 | 58 | if (res.successfulPolicyResponse().isPresent()) { 59 | // handle response 60 | } 61 | } 62 | } 63 | ``` 64 | 65 | ```java 66 | package hello.world; 67 | 68 | import com.styra.opa.openapi.OpaApiClient; 69 | import com.styra.opa.openapi.models.errors.BatchServerError; 70 | import com.styra.opa.openapi.models.errors.ClientError; 71 | import com.styra.opa.openapi.models.operations.*; 72 | import com.styra.opa.openapi.models.shared.Input; 73 | import java.lang.Exception; 74 | import java.util.Map; 75 | 76 | public class Application { 77 | 78 | public static void main(String[] args) throws ClientError, BatchServerError, Exception { 79 | 80 | OpaApiClient sdk = OpaApiClient.builder() 81 | .build(); 82 | 83 | ExecuteBatchPolicyWithInputRequest req = ExecuteBatchPolicyWithInputRequest.builder() 84 | .path("app/rbac") 85 | .requestBody(ExecuteBatchPolicyWithInputRequestBody.builder() 86 | .inputs(Map.ofEntries( 87 | Map.entry("key", Input.of(6919.52)))) 88 | .build()) 89 | .build(); 90 | 91 | ExecuteBatchPolicyWithInputResponse res = sdk.executeBatchPolicyWithInput() 92 | .request(req) 93 | .call(); 94 | 95 | if (res.batchSuccessfulPolicyEvaluation().isPresent()) { 96 | // handle response 97 | } 98 | } 99 | } 100 | ``` 101 | -------------------------------------------------------------------------------- /build-extras.gradle: -------------------------------------------------------------------------------- 1 | // This file 2 | // * is referred to in an `apply from` command in `build.gradle` 3 | // * can be used to customise `build.gradle` 4 | // * is generated once and not overwritten in SDK generation updates 5 | 6 | sourcesJar { 7 | archiveBaseName = "opa" 8 | } 9 | 10 | javadocJar { 11 | archiveBaseName = "opa" 12 | } 13 | 14 | tasks.withType(Javadoc) { 15 | // NOTE: depending on weather or not fix-build-gradle has been run yet, we 16 | // may not have the nebula.lint plugin installed. If it isn't present, we 17 | // need the build to still pass to keep the automation happy. 18 | if (project.hasProperty('autoLintGradle')) { 19 | autoLintGradle.enabled = false 20 | } 21 | failOnError false 22 | } 23 | 24 | // https://discuss.gradle.org/t/how-to-exclude-checkstyle-task-from-build-task/6692/5 25 | // 26 | // This prevents Checkstyle from running on ./gradlew build, but keeps it 27 | // working for ./gradlew lint. 28 | checkstyle { 29 | sourceSets = [] 30 | } 31 | 32 | // Exclude files generated by Speakeasy from linting. 33 | tasks.withType(Checkstyle) { 34 | configFile = file("${project.rootDir}/config/checkstyle/checkstyle.xml") 35 | exclude 'com/styra/opa/openapi/**/*.java' 36 | exclude 'com/styra/opa/openapi/*.java' 37 | } 38 | 39 | task lint { 40 | dependsOn checkstyleTest 41 | dependsOn checkstyleMain 42 | if (project.hasProperty('autoLintGradle')) { 43 | autoLintGradle.enabled = true 44 | gradleLint { 45 | criticalRules=['all-dependency'] 46 | reportFormat = 'text' 47 | excludedRules = [ 48 | // Enabling recommended-versions causes Gradle to complain about 49 | // testcontainers, but applying the suggested fix (removing the version 50 | // numbers from all but one of the testImplementation lines) causes 51 | // gradle to fail in a more obscure way that I don't understand. 52 | "recommended-versions" 53 | ] 54 | } 55 | } 56 | } 57 | 58 | test { 59 | useJUnitPlatform() 60 | testLogging { 61 | // uncomment for more verbose output during development 62 | //events "passed", "skipped", "failed", "standard_out", "standard_error" 63 | } 64 | } 65 | 66 | gradle.projectsEvaluated { 67 | tasks.withType(JavaCompile) { 68 | options.compilerArgs << "-Xlint:unchecked" 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /docs/models/errors/BatchServerError.md: -------------------------------------------------------------------------------- 1 | # BatchServerError 2 | 3 | Server Error. All requests returned a 500 error. 4 | 5 | 6 | 7 | ## Fields 8 | 9 | | Field | Type | Required | Description | 10 | | --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | 11 | | `batchDecisionId` | *Optional\* | :heavy_minus_sign: | N/A | 12 | | `responses` | Map\ | :heavy_minus_sign: | N/A | -------------------------------------------------------------------------------- /docs/models/errors/ClientError.md: -------------------------------------------------------------------------------- 1 | # ClientError 2 | 3 | Bad Request 4 | 5 | 6 | ## Fields 7 | 8 | | Field | Type | Required | Description | 9 | | ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | 10 | | `code` | *String* | :heavy_check_mark: | N/A | 11 | | `message` | *String* | :heavy_check_mark: | N/A | 12 | | `errors` | List\<[Errors](../../models/errors/Errors.md)> | :heavy_minus_sign: | N/A | -------------------------------------------------------------------------------- /docs/models/errors/Errors.md: -------------------------------------------------------------------------------- 1 | # Errors 2 | 3 | 4 | ## Fields 5 | 6 | | Field | Type | Required | Description | 7 | | ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | 8 | | `code` | *String* | :heavy_check_mark: | N/A | 9 | | `message` | *String* | :heavy_check_mark: | N/A | 10 | | `location` | [Optional\](../../models/errors/Location.md) | :heavy_minus_sign: | N/A | -------------------------------------------------------------------------------- /docs/models/errors/Location.md: -------------------------------------------------------------------------------- 1 | # Location 2 | 3 | 4 | ## Fields 5 | 6 | | Field | Type | Required | Description | 7 | | ------------------ | ------------------ | ------------------ | ------------------ | 8 | | `file` | *String* | :heavy_check_mark: | N/A | 9 | | `row` | *long* | :heavy_check_mark: | N/A | 10 | | `col` | *long* | :heavy_check_mark: | N/A | -------------------------------------------------------------------------------- /docs/models/errors/ServerError.md: -------------------------------------------------------------------------------- 1 | # ServerError 2 | 3 | Server Error 4 | 5 | 6 | ## Fields 7 | 8 | | Field | Type | Required | Description | Example | 9 | | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | 10 | | `code` | *String* | :heavy_check_mark: | N/A | | 11 | | `message` | *String* | :heavy_check_mark: | N/A | | 12 | | `errors` | List\<[ServerErrorErrors](../../models/errors/ServerErrorErrors.md)> | :heavy_minus_sign: | N/A | | 13 | | `decisionId` | *Optional\* | :heavy_minus_sign: | N/A | b84cf736-213c-4932-a8e4-bb5c648f1b4d | -------------------------------------------------------------------------------- /docs/models/errors/ServerErrorErrors.md: -------------------------------------------------------------------------------- 1 | # ServerErrorErrors 2 | 3 | 4 | ## Fields 5 | 6 | | Field | Type | Required | Description | 7 | | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | 8 | | `code` | *String* | :heavy_check_mark: | N/A | 9 | | `message` | *String* | :heavy_check_mark: | N/A | 10 | | `location` | [Optional\](../../models/errors/ServerErrorLocation.md) | :heavy_minus_sign: | N/A | -------------------------------------------------------------------------------- /docs/models/errors/ServerErrorLocation.md: -------------------------------------------------------------------------------- 1 | # ServerErrorLocation 2 | 3 | 4 | ## Fields 5 | 6 | | Field | Type | Required | Description | 7 | | ------------------ | ------------------ | ------------------ | ------------------ | 8 | | `file` | *String* | :heavy_check_mark: | N/A | 9 | | `row` | *long* | :heavy_check_mark: | N/A | 10 | | `col` | *long* | :heavy_check_mark: | N/A | -------------------------------------------------------------------------------- /docs/models/errors/UnhealthyServer.md: -------------------------------------------------------------------------------- 1 | # UnhealthyServer 2 | 3 | OPA service is not healthy. If the bundles option is specified this can mean any of the configured bundles have not yet been activated. If the plugins option is specified then at least one plugin is in a non-OK state. 4 | 5 | 6 | ## Fields 7 | 8 | | Field | Type | Required | Description | 9 | | ------------------- | ------------------- | ------------------- | ------------------- | 10 | | `code` | *String* | :heavy_check_mark: | N/A | 11 | | `error` | *Optional\* | :heavy_minus_sign: | N/A | 12 | | `message` | *Optional\* | :heavy_minus_sign: | N/A | -------------------------------------------------------------------------------- /docs/models/operations/CompileQueryWithPartialEvaluationRequestApplicationJSONRequestBody.md: -------------------------------------------------------------------------------- 1 | # CompileQueryWithPartialEvaluationRequestApplicationJSONRequestBody 2 | 3 | The query, input, and other settings for partial evaluation. 4 | 5 | 6 | ## Fields 7 | 8 | | Field | Type | Required | Description | 9 | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | 10 | | `options` | [Optional\](../../models/shared/CompileOptions.md) | :heavy_minus_sign: | Additional options to use during partial evaluation. Only the disableInlining option is currently supported in OPA. Enterprise OPA may support additional options. | 11 | | `unknowns` | List\<*String*> | :heavy_minus_sign: | The terms to treat as unknown during partial evaluation. | 12 | | `input` | [Optional\](../../models/shared/Input.md) | :heavy_minus_sign: | Arbitrary JSON used within your policies by accessing `input` | -------------------------------------------------------------------------------- /docs/models/operations/ExecuteBatchPolicyWithInputRequestBody.md: -------------------------------------------------------------------------------- 1 | # ExecuteBatchPolicyWithInputRequestBody 2 | 3 | The batch of inputs 4 | 5 | 6 | ## Fields 7 | 8 | | Field | Type | Required | Description | 9 | | --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | 10 | | `inputs` | Map\ | :heavy_check_mark: | N/A | -------------------------------------------------------------------------------- /docs/models/operations/ExecutePolicyWithInputRequestBody.md: -------------------------------------------------------------------------------- 1 | # ExecutePolicyWithInputRequestBody 2 | 3 | The input document 4 | 5 | 6 | ## Fields 7 | 8 | | Field | Type | Required | Description | 9 | | ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | 10 | | `input` | [Input](../../models/shared/Input.md) | :heavy_check_mark: | Arbitrary JSON used within your policies by accessing `input` | -------------------------------------------------------------------------------- /docs/models/shared/BatchMixedResults.md: -------------------------------------------------------------------------------- 1 | # BatchMixedResults 2 | 3 | Mixed success and failures. 4 | 5 | 6 | ## Fields 7 | 8 | | Field | Type | Required | Description | 9 | | -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | 10 | | `batchDecisionId` | *Optional\* | :heavy_minus_sign: | N/A | 11 | | `metrics` | Map\ | :heavy_minus_sign: | If query metrics are enabled, this field contains query performance metrics collected during the parse, compile, and evaluation steps. | 12 | | `responses` | Map\ | :heavy_minus_sign: | N/A | -------------------------------------------------------------------------------- /docs/models/shared/BatchSuccessfulPolicyEvaluation.md: -------------------------------------------------------------------------------- 1 | # BatchSuccessfulPolicyEvaluation 2 | 3 | All batched policy executions succeeded. 4 | The server also returns 200 if the path refers to an undefined document. In this case, responses will be empty. 5 | 6 | 7 | 8 | ## Fields 9 | 10 | | Field | Type | Required | Description | Example | 11 | | -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | 12 | | `batchDecisionId` | *Optional\* | :heavy_minus_sign: | N/A | 1bef6b7d-cd13-4890-bfe1-fd2e8de32189 | 13 | | `metrics` | Map\ | :heavy_minus_sign: | If query metrics are enabled, this field contains query performance metrics collected during the parse, compile, and evaluation steps. | | 14 | | `responses` | Map\ | :heavy_minus_sign: | N/A | | -------------------------------------------------------------------------------- /docs/models/shared/CompileOptions.md: -------------------------------------------------------------------------------- 1 | # CompileOptions 2 | 3 | Additional options to use during partial evaluation. Only the disableInlining option is currently supported in OPA. Enterprise OPA may support additional options. 4 | 5 | 6 | ## Fields 7 | 8 | | Field | Type | Required | Description | 9 | | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | 10 | | `disableInlining` | List\<*String*> | :heavy_minus_sign: | A list of paths to exclude from partial evaluation inlining. | 11 | | `targetDialects` | List\<[TargetDialects](../../models/shared/TargetDialects.md)> | :heavy_minus_sign: | The output targets for partial evaluation. Different targets will have different constraints. | 12 | | `targetSQLTableMappings` | [Optional\](../../models/shared/TargetSQLTableMappings.md) | :heavy_minus_sign: | N/A | 13 | | `maskRule` | *Optional\* | :heavy_minus_sign: | The Rego rule to evaluate for generating column masks. | 14 | | `additionalProperties` | Map\ | :heavy_minus_sign: | N/A | -------------------------------------------------------------------------------- /docs/models/shared/CompileResultJSON.md: -------------------------------------------------------------------------------- 1 | # CompileResultJSON 2 | 3 | The partially evaluated result of the query. Result will be empty if the query is never true. 4 | 5 | 6 | ## Fields 7 | 8 | | Field | Type | Required | Description | 9 | | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | 10 | | `result` | [Optional\](../../models/shared/CompileResultJSONResult.md) | :heavy_minus_sign: | The partially evaluated result of the query. | -------------------------------------------------------------------------------- /docs/models/shared/CompileResultJSONResult.md: -------------------------------------------------------------------------------- 1 | # CompileResultJSONResult 2 | 3 | The partially evaluated result of the query. 4 | 5 | 6 | ## Fields 7 | 8 | | Field | Type | Required | Description | 9 | | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | 10 | | `query` | [Optional\](../../models/shared/Query.md) | :heavy_minus_sign: | N/A | 11 | | `support` | [Optional\](../../models/shared/Support.md) | :heavy_minus_sign: | N/A | 12 | | `additionalProperties` | Map\ | :heavy_minus_sign: | N/A | -------------------------------------------------------------------------------- /docs/models/shared/CompileResultMultitarget.md: -------------------------------------------------------------------------------- 1 | # CompileResultMultitarget 2 | 3 | The partially evaluated result of the query, for each target dialect. Result will be empty if the query is never true. 4 | 5 | 6 | ## Fields 7 | 8 | | Field | Type | Required | Description | 9 | | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | 10 | | `result` | [Optional\](../../models/shared/CompileResultMultitargetResult.md) | :heavy_minus_sign: | The partially evaluated result of the query in each target dialect. | -------------------------------------------------------------------------------- /docs/models/shared/CompileResultMultitargetQuery.md: -------------------------------------------------------------------------------- 1 | # CompileResultMultitargetQuery 2 | 3 | UCAST JSON object describing the conditions under which the query is true. 4 | 5 | 6 | ## Fields 7 | 8 | | Field | Type | Required | Description | 9 | | ----------- | ----------- | ----------- | ----------- | -------------------------------------------------------------------------------- /docs/models/shared/CompileResultMultitargetResult.md: -------------------------------------------------------------------------------- 1 | # CompileResultMultitargetResult 2 | 3 | The partially evaluated result of the query in each target dialect. 4 | 5 | 6 | ## Fields 7 | 8 | | Field | Type | Required | Description | 9 | | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | 10 | | `targets` | [Optional\](../../models/shared/Targets.md) | :heavy_minus_sign: | N/A | 11 | | `additionalProperties` | Map\ | :heavy_minus_sign: | N/A | -------------------------------------------------------------------------------- /docs/models/shared/CompileResultSQL.md: -------------------------------------------------------------------------------- 1 | # CompileResultSQL 2 | 3 | The partially evaluated result of the query, in SQL format. Result will be empty if the query is never true. 4 | 5 | 6 | ## Fields 7 | 8 | | Field | Type | Required | Description | 9 | | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | 10 | | `result` | [Optional\](../../models/shared/CompileResultSQLResult.md) | :heavy_minus_sign: | The partially evaluated result of the query as SQL. | -------------------------------------------------------------------------------- /docs/models/shared/CompileResultSQLResult.md: -------------------------------------------------------------------------------- 1 | # CompileResultSQLResult 2 | 3 | The partially evaluated result of the query as SQL. 4 | 5 | 6 | ## Fields 7 | 8 | | Field | Type | Required | Description | 9 | | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | 10 | | `query` | *Optional\* | :heavy_minus_sign: | String representing the SQL equivalent of the conditions under which the query is true. | 11 | | `masks` | Map\> | :heavy_minus_sign: | Column masking functions, where the key is the column name, and the value describes which masking function to use. | 12 | | `additionalProperties` | Map\ | :heavy_minus_sign: | N/A | -------------------------------------------------------------------------------- /docs/models/shared/CompileResultUCAST.md: -------------------------------------------------------------------------------- 1 | # CompileResultUCAST 2 | 3 | The partially evaluated result of the query, in UCAST format. Result will be empty if the query is never true. 4 | 5 | 6 | ## Fields 7 | 8 | | Field | Type | Required | Description | 9 | | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | 10 | | `result` | [Optional\](../../models/shared/CompileResultUCASTResult.md) | :heavy_minus_sign: | The partially evaluated result of the query as UCAST. | -------------------------------------------------------------------------------- /docs/models/shared/CompileResultUCASTResult.md: -------------------------------------------------------------------------------- 1 | # CompileResultUCASTResult 2 | 3 | The partially evaluated result of the query as UCAST. 4 | 5 | 6 | ## Fields 7 | 8 | | Field | Type | Required | Description | 9 | | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | 10 | | `query` | Map\ | :heavy_minus_sign: | UCAST JSON object describing the conditions under which the query is true. | 11 | | `masks` | Map\> | :heavy_minus_sign: | Column masking rules, where the key is the column name, and the value describes which masking function to use. | 12 | | `additionalProperties` | Map\ | :heavy_minus_sign: | N/A | -------------------------------------------------------------------------------- /docs/models/shared/Errors.md: -------------------------------------------------------------------------------- 1 | # Errors 2 | 3 | 4 | ## Fields 5 | 6 | | Field | Type | Required | Description | 7 | | ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | 8 | | `code` | *String* | :heavy_check_mark: | N/A | 9 | | `message` | *String* | :heavy_check_mark: | N/A | 10 | | `location` | [Optional\](../../models/shared/Location.md) | :heavy_minus_sign: | N/A | -------------------------------------------------------------------------------- /docs/models/shared/Explain.md: -------------------------------------------------------------------------------- 1 | # Explain 2 | 3 | 4 | ## Values 5 | 6 | | Name | Value | 7 | | ------- | ------- | 8 | | `NOTES` | notes | 9 | | `FAILS` | fails | 10 | | `FULL` | full | 11 | | `DEBUG` | debug | -------------------------------------------------------------------------------- /docs/models/shared/GzipAcceptEncoding.md: -------------------------------------------------------------------------------- 1 | # GzipAcceptEncoding 2 | 3 | 4 | ## Values 5 | 6 | | Name | Value | 7 | | ------ | ------ | 8 | | `GZIP` | gzip | -------------------------------------------------------------------------------- /docs/models/shared/GzipContentEncoding.md: -------------------------------------------------------------------------------- 1 | # GzipContentEncoding 2 | 3 | 4 | ## Values 5 | 6 | | Name | Value | 7 | | ------ | ------ | 8 | | `GZIP` | gzip | -------------------------------------------------------------------------------- /docs/models/shared/HealthyServer.md: -------------------------------------------------------------------------------- 1 | # HealthyServer 2 | 3 | OPA service is healthy. If the bundles option is specified then all configured bundles have been activated. If the plugins option is specified then all plugins are in an OK state. 4 | 5 | 6 | ## Fields 7 | 8 | | Field | Type | Required | Description | 9 | | ----------- | ----------- | ----------- | ----------- | -------------------------------------------------------------------------------- /docs/models/shared/Input.md: -------------------------------------------------------------------------------- 1 | # Input 2 | 3 | Arbitrary JSON used within your policies by accessing `input` 4 | 5 | -------------------------------------------------------------------------------- /docs/models/shared/Location.md: -------------------------------------------------------------------------------- 1 | # Location 2 | 3 | 4 | ## Fields 5 | 6 | | Field | Type | Required | Description | 7 | | ------------------ | ------------------ | ------------------ | ------------------ | 8 | | `file` | *String* | :heavy_check_mark: | N/A | 9 | | `row` | *long* | :heavy_check_mark: | N/A | 10 | | `col` | *long* | :heavy_check_mark: | N/A | -------------------------------------------------------------------------------- /docs/models/shared/MaskingRule.md: -------------------------------------------------------------------------------- 1 | # MaskingRule 2 | 3 | -------------------------------------------------------------------------------- /docs/models/shared/Mysql.md: -------------------------------------------------------------------------------- 1 | # Mysql 2 | 3 | 4 | ## Fields 5 | 6 | | Field | Type | Required | Description | 7 | | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | 8 | | `query` | *Optional\* | :heavy_minus_sign: | String representing the SQL equivalent of the conditions under which the query is true. | 9 | | `masks` | Map\> | :heavy_minus_sign: | Column masking rules, where the first two nested keys represent the table name and the column name, and the value describes which masking function to use. | -------------------------------------------------------------------------------- /docs/models/shared/One.md: -------------------------------------------------------------------------------- 1 | # One 2 | 3 | 4 | ## Fields 5 | 6 | | Field | Type | Required | Description | 7 | | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | 8 | | `replace` | [Optional\](../../models/shared/Replace.md) | :heavy_minus_sign: | N/A | -------------------------------------------------------------------------------- /docs/models/shared/Postgresql.md: -------------------------------------------------------------------------------- 1 | # Postgresql 2 | 3 | 4 | ## Fields 5 | 6 | | Field | Type | Required | Description | 7 | | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | 8 | | `query` | *Optional\* | :heavy_minus_sign: | String representing the SQL equivalent of the conditions under which the query is true | 9 | | `masks` | Map\> | :heavy_minus_sign: | Column masking rules, where the first two nested keys represent the table name and the column name, and the value describes which masking function to use. | -------------------------------------------------------------------------------- /docs/models/shared/Provenance.md: -------------------------------------------------------------------------------- 1 | # Provenance 2 | 3 | Provenance information can be requested on individual API calls and are returned inline with the API response. To obtain provenance information on an API call, specify the `provenance=true` query parameter when executing the API call. 4 | 5 | 6 | ## Fields 7 | 8 | | Field | Type | Required | Description | 9 | | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | 10 | | `version` | *Optional\* | :heavy_minus_sign: | N/A | 11 | | `buildCommit` | *Optional\* | :heavy_minus_sign: | N/A | 12 | | `buildTimestamp` | [OffsetDateTime](https://docs.oracle.com/javase/8/docs/api/java/time/OffsetDateTime.html) | :heavy_minus_sign: | N/A | 13 | | `buildHost` | *Optional\* | :heavy_minus_sign: | N/A | 14 | | `bundles` | Map\ | :heavy_minus_sign: | N/A | -------------------------------------------------------------------------------- /docs/models/shared/Query.md: -------------------------------------------------------------------------------- 1 | # Query 2 | 3 | 4 | ## Fields 5 | 6 | | Field | Type | Required | Description | 7 | | ----------- | ----------- | ----------- | ----------- | -------------------------------------------------------------------------------- /docs/models/shared/Replace.md: -------------------------------------------------------------------------------- 1 | # Replace 2 | 3 | -------------------------------------------------------------------------------- /docs/models/shared/Responses.md: -------------------------------------------------------------------------------- 1 | # Responses 2 | 3 | -------------------------------------------------------------------------------- /docs/models/shared/Result.md: -------------------------------------------------------------------------------- 1 | # Result 2 | 3 | The base or virtual document referred to by the URL path. If the path is undefined, this key will be omitted. 4 | 5 | -------------------------------------------------------------------------------- /docs/models/shared/Revision.md: -------------------------------------------------------------------------------- 1 | # Revision 2 | 3 | 4 | ## Fields 5 | 6 | | Field | Type | Required | Description | 7 | | ------------------ | ------------------ | ------------------ | ------------------ | 8 | | `revision` | *String* | :heavy_check_mark: | N/A | -------------------------------------------------------------------------------- /docs/models/shared/Security.md: -------------------------------------------------------------------------------- 1 | # Security 2 | 3 | 4 | ## Fields 5 | 6 | | Field | Type | Required | Description | 7 | | ------------------- | ------------------- | ------------------- | ------------------- | 8 | | `bearerAuth` | *Optional\* | :heavy_minus_sign: | N/A | -------------------------------------------------------------------------------- /docs/models/shared/ServerError.md: -------------------------------------------------------------------------------- 1 | # ServerError 2 | 3 | 4 | ## Fields 5 | 6 | | Field | Type | Required | Description | Example | 7 | | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | 8 | | `code` | *String* | :heavy_check_mark: | N/A | | 9 | | `message` | *String* | :heavy_check_mark: | N/A | | 10 | | `errors` | List\<[ServerErrorErrors](../../models/errors/ServerErrorErrors.md)> | :heavy_minus_sign: | N/A | | 11 | | `decisionId` | *Optional\* | :heavy_minus_sign: | N/A | b84cf736-213c-4932-a8e4-bb5c648f1b4d | -------------------------------------------------------------------------------- /docs/models/shared/ServerErrorWithStatusCode.md: -------------------------------------------------------------------------------- 1 | # ServerErrorWithStatusCode 2 | 3 | 4 | ## Fields 5 | 6 | | Field | Type | Required | Description | Example | 7 | | ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | 8 | | `httpStatusCode` | *String* | :heavy_check_mark: | N/A | 200 | 9 | | `code` | *String* | :heavy_check_mark: | N/A | | 10 | | `message` | *String* | :heavy_check_mark: | N/A | | 11 | | `errors` | List\<[Errors](../../models/shared/Errors.md)> | :heavy_minus_sign: | N/A | | 12 | | `decisionId` | *Optional\* | :heavy_minus_sign: | N/A | b84cf736-213c-4932-a8e4-bb5c648f1b4d | -------------------------------------------------------------------------------- /docs/models/shared/Sqlite.md: -------------------------------------------------------------------------------- 1 | # Sqlite 2 | 3 | 4 | ## Fields 5 | 6 | | Field | Type | Required | Description | 7 | | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | 8 | | `query` | *Optional\* | :heavy_minus_sign: | String representing the SQL equivalent of the conditions under which the query is true | 9 | | `masks` | Map\> | :heavy_minus_sign: | Column masking rules, where the first two nested keys represent the table name and the column name, and the value describes which masking function to use. | -------------------------------------------------------------------------------- /docs/models/shared/Sqlserver.md: -------------------------------------------------------------------------------- 1 | # Sqlserver 2 | 3 | 4 | ## Fields 5 | 6 | | Field | Type | Required | Description | 7 | | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | 8 | | `query` | *Optional\* | :heavy_minus_sign: | String representing the SQL equivalent of the conditions under which the query is true. | 9 | | `masks` | Map\> | :heavy_minus_sign: | Column masking rules, where the first two nested keys represent the table name and the column name, and the value describes which masking function to use. | -------------------------------------------------------------------------------- /docs/models/shared/Support.md: -------------------------------------------------------------------------------- 1 | # Support 2 | 3 | 4 | ## Fields 5 | 6 | | Field | Type | Required | Description | 7 | | ----------- | ----------- | ----------- | ----------- | -------------------------------------------------------------------------------- /docs/models/shared/TargetDialects.md: -------------------------------------------------------------------------------- 1 | # TargetDialects 2 | 3 | 4 | ## Values 5 | 6 | | Name | Value | 7 | | --------------------- | --------------------- | 8 | | `UCAST_PLUS_ALL` | ucast+all | 9 | | `UCAST_PLUS_MINIMAL` | ucast+minimal | 10 | | `UCAST_PLUS_PRISMA` | ucast+prisma | 11 | | `UCAST_PLUS_LINQ` | ucast+linq | 12 | | `SQL_PLUS_SQLSERVER` | sql+sqlserver | 13 | | `SQL_PLUS_MYSQL` | sql+mysql | 14 | | `SQL_PLUS_POSTGRESQL` | sql+postgresql | 15 | | `SQL_PLUS_SQLITE` | sql+sqlite | -------------------------------------------------------------------------------- /docs/models/shared/TargetSQLTableMappings.md: -------------------------------------------------------------------------------- 1 | # TargetSQLTableMappings 2 | 3 | 4 | ## Fields 5 | 6 | | Field | Type | Required | Description | 7 | | ---------------------- | ---------------------- | ---------------------- | ---------------------- | 8 | | `sqlserver` | Map\ | :heavy_minus_sign: | N/A | 9 | | `mysql` | Map\ | :heavy_minus_sign: | N/A | 10 | | `postgresql` | Map\ | :heavy_minus_sign: | N/A | 11 | | `sqlite` | Map\ | :heavy_minus_sign: | N/A | -------------------------------------------------------------------------------- /docs/models/shared/Targets.md: -------------------------------------------------------------------------------- 1 | # Targets 2 | 3 | 4 | ## Fields 5 | 6 | | Field | Type | Required | Description | 7 | | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | 8 | | `ucast` | [Optional\](../../models/shared/Ucast.md) | :heavy_minus_sign: | N/A | 9 | | `sqlserver` | [Optional\](../../models/shared/Sqlserver.md) | :heavy_minus_sign: | N/A | 10 | | `mysql` | [Optional\](../../models/shared/Mysql.md) | :heavy_minus_sign: | N/A | 11 | | `postgresql` | [Optional\](../../models/shared/Postgresql.md) | :heavy_minus_sign: | N/A | 12 | | `sqlite` | [Optional\](../../models/shared/Sqlite.md) | :heavy_minus_sign: | N/A | -------------------------------------------------------------------------------- /docs/models/shared/Ucast.md: -------------------------------------------------------------------------------- 1 | # Ucast 2 | 3 | 4 | ## Fields 5 | 6 | | Field | Type | Required | Description | 7 | | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | 8 | | `query` | [Optional\](../../models/shared/CompileResultMultitargetQuery.md) | :heavy_minus_sign: | UCAST JSON object describing the conditions under which the query is true. | 9 | | `masks` | Map\> | :heavy_minus_sign: | Column masking rules, where the first two nested keys represent the entity name and the property name, and the value describes which masking function to use. | -------------------------------------------------------------------------------- /docs/site/docs/index.md: -------------------------------------------------------------------------------- 1 | # OPA-Java SDK Developer Documentation Site 2 | 3 | This site is meant to assist developers of the [opa-java](https://github.com/StyraInc/opa-java/) project itself. Looking for docs on how to use it? Consider the [JavaDoc](./javadoc) or [SDK docs](https://docs.styra.com/sdk). 4 | 5 | This site contains the developer documentation for [opa-java](https://github.com/StyraInc/opa-java/), a Java SDK for the [Open Policy Agent](https://www.openpolicyagent.org/) [REST API](https://www.openpolicyagent.org/docs/latest/rest-api/). "Low level" wrappers around the REST API methods are generated using [Speakeasy](https://www.speakeasyapi.dev/). A higher level human-written API is also provided, which is intended to simplify the most common tasks for OPA API consumers. The Speakeasy-generated API can be found in the [`com.styra.opa.openapi`](https://styrainc.github.io/opa-java/javadoc/com/styra/opa/openapi/package-summary.html) package, while the higher level API is located in [`com.styra.opa`](https://styrainc.github.io/opa-java/javadoc/com/styra/opa/package-summary.html). 6 | 7 | ## Documentation Index 8 | 9 | - [Add a Documentation Page](maintenance/add-doc.md) 10 | - [Modify Styra-Managed Code](maintenance/change-managed.md) 11 | - [Regenerate Speakeasy-Managed Code](maintenance/change-speakeasy.md) 12 | - [Release](maintenance/releases.md) 13 | - [Using a Custom OpenAPI Spec](https://www.rfc-editor.org/rfc/rfc3986#section-3) 14 | 15 | ## Other Helpful Links 16 | 17 | * [StyraInc/opa-java GitHub repository](https://github.com/StyraInc/opa-java) 18 | * [opa-java JavaDoc](https://styrainc.github.io/opa-java/javadoc/) 19 | * [Speakeasy generated "models" documentation](./models/) 20 | * [Speakeasy generated "SDKs" documentation](./sdks/) 21 | * [OpenAPI Spec for the OPA REST API](https://github.com/StyraInc/enterprise-opa/tree/main/openapi) 22 | 23 | -------------------------------------------------------------------------------- /docs/site/docs/maintenance/add-doc.md: -------------------------------------------------------------------------------- 1 | # Add a Documentation Page 2 | 3 | Documentation for `opa-java` is managed using [MkDocs](https://www.mkdocs.org/). You can build the docs into a folder `out` using the command [`./scripts/build_docs.sh`](https://github.com/StyraInc/opa-java/blob/main/scripts/build_docs.sh), or you can serve an ephemeral, local version of the docs using [`./scripts/serve_docs.sh`](https://github.com/StyraInc/opa-java/blob/main/scripts/serve_docs.sh). 4 | 5 | ## Appropriate Content for Docs 6 | 7 | The docs site for `opa-java` is primarily for maintenance information about the project. Information about how to use specific APIs belongs in the JavaDoc, and can be created or modified by changing comments in the Java code. Higher-level user-facing documentation belongs on the [Styra documentation site](https://docs.styra.com/sdk). 8 | 9 | Generally speaking, the MkDocs site should only contain information that would be of interest to someone contributing to the `opa-java` repo. 10 | 11 | ## Adding a Document 12 | 13 | 1. Add your document to [`docs/site/docs/`](https://github.com/StyraInc/opa-java/tree/main/docs/site/docs). 14 | 2. Update [`docs/site/mkdocs.yml`](https://github.com/StyraInc/opa-java/blob/main/docs/site/mkdocs.yml) so that your document will be presented in the navigation bar. 15 | 3. Update [`docs/site/docs/index.md`](https://github.com/StyraInc/opa-java/blob/main/docs/site/docs/index.md) to include a link to your new document. 16 | 3. Use `scripts/build_doc.sh` or `scripts/serve_docs.sh` to ensure your docs changes render as you intended. 17 | 4. Create a PR with your changes. Your changes will automatically be published by the [docs publishing workflow](https://github.com/StyraInc/opa-java/blob/main/.github/workflows/docs_publish.yaml). 18 | 19 | -------------------------------------------------------------------------------- /docs/site/docs/maintenance/change-managed.md: -------------------------------------------------------------------------------- 1 | # Modify Styra-Managed Code 2 | 3 | Because the `opa-java` repository is largely managed by Speakeasy's code generation tooling, there are a few additional restrictions that should be kept in mind when changing the Styra-managed "porcelain" API code. 4 | 5 | Since Speakeasy is configured to create the generated Java code in the package `com.styra.opa.openapi`, you should avoid including any human-written code in this package. To avoid having your code accidentally overwritten, you should add any new files you create to [`.genignore`](https://github.com/StyraInc/opa-java/blob/main/.genignore). 6 | 7 | If you need to modify the `build.gradle` file, you should be aware it is automatically re-generated on a regular basis as it is managed by Speakeasy's tooling. `opa-java` also has additional tools in place to handle needed changes to this file, see [*Regenerate Speakeasy-Manged Code*](./change-speakeasy.md) for more information. 8 | -------------------------------------------------------------------------------- /docs/site/docs/maintenance/custom-spec.md: -------------------------------------------------------------------------------- 1 | # Using a Custom OpenAPI Spec 2 | 3 | !!! note 4 | 5 | **This procedure should only be used during development.** The OpenAPI spec in the StyraInc/enterprise-opa repository is the point of truth for how the SDKs should be generated. You should never merge code into `main` which was not generated using the upstream one. Any permenant changes to the OpenAPI spec must go through a PR on the upstream. 6 | 7 | During development, you may wish to customize the OpenAPI spec used to generate the SDK. Here is how you can do so: 8 | 9 | 1. Download the existing [spec](https://github.com/StyraInc/enterprise-opa/tree/main/openapi) to a local file, noting the path you saved it at. 10 | 2. Make any needed modifications to the OpenAPI spec. 11 | 3. Modify `.speakeasy/workflow.yaml` to change `sources.openapi.inputs[0].location` to point to your local file. It is not necessary to provide a URI scheme for local files. 12 | 4. Follow the steps described in [Regenerate Speakeasy-Managed Code](maintenance/change-speakeasy.md) to regenerate the SDK. 13 | 14 | -------------------------------------------------------------------------------- /docs/site/docs/maintenance/releases.md: -------------------------------------------------------------------------------- 1 | # Releases 2 | 3 | !!! note 4 | 5 | There are manual steps required before releases will appear on Maven Central, scroll down for more information. 6 | 7 | !!! warning 8 | 9 | Before performing a release, be sure to check that the version number in `.speakeasy/gen.yaml` matches the one in `RELEASES.md`, otherwise the GitHub and Maven Central release may have inconsistent version numbers. You can do this by running `./scripts/check-version-mismatch.sh` 10 | 11 | Releases normally happen when the Speakeasy automation in the [SDK generation workflow](https://github.com/StyraInc/opa-java/blob/main/.github/workflows/sdk_generation.yaml) detects that a dependency needs updated, or the code generation changes. It should automatically create a PR (for example, [#40](https://github.com/StyraInc/opa-java/pull/40)) which updates the [`RELEASES.md`](https://github.com/StyraInc/opa-java/blob/main/RELEASES.md) file. This workflow runs nightly. 12 | 13 | You can force the creation of one of these PRs by running the workflow manually and checking "Force generation of SDKs" option. In this situation, the PR is created even if nothing has changed. This can be useful if you need to force a release for some reason or another. 14 | 15 | If any changes were introduced beyond those automatically generated, you should also checkout the PR locally and update the `RELEASES.md` file to document those changes. For an example, see [87f45e6](https://github.com/StyraInc/opa-java/pull/44/commits/87f45e6161ee9c0d38cc3093b7d8483be6c19fa5). 16 | 17 | Once merging the PR, the [SDK publishing workflow](https://github.com/StyraInc/opa-java/blob/main/.github/workflows/sdk_publish.yaml) should automatically detect the change to the `RELEASES.md` file and publish a release to the [GitHub releases](https://github.com/StyraInc/opa-java/releases) and to [Maven Central](https://central.sonatype.com/artifact/com.styra/opa). 18 | 19 | Once all of the above are done, **you must manually log in to the [OSSRH portal](https://s01.oss.sonatype.org/) to complete additional steps before the release will be visible on Maven Central**. These additional steps can be found in Maven Central's documentation [here](https://central.sonatype.org/publish/release). In summary, you must find the release under "staging repositories", "close" the corresponding repository, and then "release" it after it has been successfully closed. Once the release is finished, you can drop the staging release. 20 | 21 | -------------------------------------------------------------------------------- /docs/site/mkdocs.yml: -------------------------------------------------------------------------------- 1 | site_name: OPA-Java SDK Documentation 2 | site_url: "https://styrainc.github.io/opa-java/" 3 | markdown_extensions: 4 | - admonition 5 | nav: 6 | - 'Home': "index.md" 7 | - 'GitHub': "https://github.com/StyraInc/opa-java" 8 | - 'Other Styra OPA SDKs': "https://docs.styra.com/sdk" 9 | - 'Javadoc': "javadoc" 10 | - 'Maintenance': 11 | - "Add a Documentation Page": "maintenance/add-doc.md" 12 | - "Modify Styra-Managed Code": "maintenance/change-managed.md" 13 | - "Regenerate Speakeasy-Managed Code": "maintenance/change-speakeasy.md" 14 | - "Release": "maintenance/releases.md" 15 | - "Using a Custom OpenAPI Spec": "maintenance/custom-spec.md" 16 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | groupId=com.styra 2 | artifactId=opa 3 | version=2.1.1 -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StyraInc/opa-java/a91cb4f199a6485e16c03d23156fb843b69f1b8a/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%"=="" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%"=="" set DIRNAME=. 29 | @rem This is normally unused 30 | set APP_BASE_NAME=%~n0 31 | set APP_HOME=%DIRNAME% 32 | 33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 35 | 36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 38 | 39 | @rem Find java.exe 40 | if defined JAVA_HOME goto findJavaFromJavaHome 41 | 42 | set JAVA_EXE=java.exe 43 | %JAVA_EXE% -version >NUL 2>&1 44 | if %ERRORLEVEL% equ 0 goto execute 45 | 46 | echo. 47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 48 | echo. 49 | echo Please set the JAVA_HOME variable in your environment to match the 50 | echo location of your Java installation. 51 | 52 | goto fail 53 | 54 | :findJavaFromJavaHome 55 | set JAVA_HOME=%JAVA_HOME:"=% 56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 57 | 58 | if exist "%JAVA_EXE%" goto execute 59 | 60 | echo. 61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 62 | echo. 63 | echo Please set the JAVA_HOME variable in your environment to match the 64 | echo location of your Java installation. 65 | 66 | goto fail 67 | 68 | :execute 69 | @rem Setup the command line 70 | 71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 72 | 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if %ERRORLEVEL% equ 0 goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | set EXIT_CODE=%ERRORLEVEL% 85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 87 | exit /b %EXIT_CODE% 88 | 89 | :mainEnd 90 | if "%OS%"=="Windows_NT" endlocal 91 | 92 | :omega 93 | -------------------------------------------------------------------------------- /scripts/build_docs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # This script builds the static documentation site. You need to have Gradle and 4 | # MkDocs set up and working on your system to run it. 5 | 6 | set -x 7 | set -e 8 | set -u 9 | cd "$(dirname "$0")/.." 10 | 11 | if [ $# -ne 1 ] ; then 12 | echo "usage: $0 OUTPUT_DIR" 1>&2 13 | exit 1 14 | fi 15 | 16 | OUTPUT_DIR="$1" 17 | if [ ! -d "$OUTPUT_DIR" ] ; then 18 | mkdir -p "$OUTPUT_DIR" 19 | fi 20 | OUTPUT_DIR="$(realpath "$OUTPUT_DIR")" 21 | 22 | TEMP="$(mktemp -d)" 23 | trap "rm -rf '$TEMP'" EXIT 24 | 25 | ./gradlew build javadoc -x test -x autoLintGradle -x lint 26 | 27 | cp -R ./docs/site/* "$TEMP" 28 | cp -R ./docs/models "$TEMP/docs/" 29 | cp -R ./docs/sdks "$TEMP/docs/" 30 | mkdir "$TEMP/javadoc" 31 | cp -R ./build/docs/javadoc/* "$TEMP/javadoc" 32 | 33 | cd "$TEMP" 34 | 35 | printf '# Index of Models Documentation\n\nThese documents are auto-generated by Speakeasy.\n\n' > docs/models/index.md 36 | find ./docs/models/ -type f -iname "*.md" | grep -v 'index.md$' | while read -r f ; do 37 | # extract the title frome each markdown file 38 | t="$(awk '/^[#]/ {$1=""; print($0); exit}' < "$f" | sed 's/^ //g')" 39 | 40 | # generate an appropriate link based on the file path 41 | l="$(echo "$f" | sed 's#^./docs/models/#./#g')" 42 | 43 | # append the link to the index file 44 | printf '* [%s](%s)\n' "$t" "$l" >> docs/models/index.md 45 | done 46 | 47 | printf '# Index of SDKs Documentation\n\nThese documents are auto-generated by Speakeasy.\n\n' > docs/sdks/index.md 48 | find ./docs/sdks/ -type f -iname "*.md" | grep -v 'index.md$' | while read -r f ; do 49 | # extract the title frome each markdown file 50 | t="$(awk '/^[#]/ {$1=""; print($0); exit}' < "$f" | sed 's/^ //g')" 51 | 52 | # generate an appropriate link based on the file path 53 | l="$(echo "$f" | sed 's#^./docs/sdks/#./#g')" 54 | 55 | # append the link to the index file 56 | printf '* [%s](%s)\n' "$t" "$l" >> docs/sdks/index.md 57 | done 58 | 59 | mkdocs build -d "$OUTPUT_DIR" 60 | cp -R javadoc "$OUTPUT_DIR" 61 | 62 | -------------------------------------------------------------------------------- /scripts/check-released-versions.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # This script checks weather or not the latest GitHub release matches the 4 | # latest Maven Central release version. If the latest release was in the last 5 | # 24 hours, then it will always exit 0. If the releases don't match, it will 6 | # exit 1 and print a pertinent error message. 7 | 8 | set -e 9 | set -u 10 | set -x 11 | 12 | # https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28#list-releases 13 | GITHUB_REPO="styrainc/opa-java" 14 | GITHUB_API_URL="https://api.github.com/repos/$GITHUB_REPO/releases" 15 | 16 | # https://central.sonatype.org/search/rest-api-guide/ 17 | # 18 | # Note that there is further filtering done using opa eval later when 19 | # MAVEN_RELEASE is calculated. 20 | MAVEN_URL='https://search.maven.org/solrsearch/select?q=g:com.styra&rows=20&wt=json' 21 | 22 | # If the release is less than this many seconds old, ignore it. 23 | # 86400s == 1 day. 24 | IGNORE_WINDOW=86400 25 | 26 | # Notice the tr -d v to strip the leading v from the release tag. 27 | GH_RESPONSE="$(curl -LSs "$GITHUB_API_URL")" 28 | RELEASE_TAG="$(printf '%s' "$GH_RESPONSE" | opa eval -f pretty -I 'input[0].tag_name' | tr -d '"' | tr -d 'v')" 29 | RELEASE_TS="$(printf '%s' "$GH_RESPONSE" | opa eval -f pretty -I 'input[0].published_at' | tr -d '"')" 30 | RELEASE_AGE="$(printf '{"ts": "%s"}' "$RELEASE_TS" | opa eval -f pretty -I 'ceil((time.now_ns() - time.parse_rfc3339_ns(input.ts))*0.000000001)')" 31 | 32 | printf "DEBUG: RELEASE_TAG='%s' RELEASE_TS='%s' RELEASE_AGE=%ds\n" "$RELEASE_TAG" "$RELEASE_TS" "$RELEASE_AGE" 1>&2 33 | 34 | if [ "$RELEASE_AGE" -lt "$IGNORE_WINDOW" ] ; then 35 | printf "DEBUG: release is too new (%ds < %ds), skipping version check\n" "$RELEASE_AGE" "$IGNORE_WINDOW" 1>&2 36 | exit 0 37 | fi 38 | 39 | MAVEN_RESPONSE="$(curl -LSs "$MAVEN_URL")" 40 | MAVEN_RELEASE="$(printf '%s' "$MAVEN_RESPONSE" | opa eval -f pretty -I '[d | d := input.response.docs[_]; d.a == "opa"][0].latestVersion' | tr -d '"')" 41 | 42 | if [ "$MAVEN_RELEASE" != "$RELEASE_TAG" ] ; then 43 | echo "latest Maven release '$MAVEN_RELEASE' does not match latest GitHub release tag '$RELEASE_TAG'" 44 | exit 1 45 | fi 46 | 47 | echo "latest Maven release '$MAVEN_RELEASE' matches latest GitHub release tag '$RELEASE_TAG'" 48 | exit 0 49 | -------------------------------------------------------------------------------- /scripts/check-version-mismatch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # This script checks that the version numbers reported in RELEASES.md and in 4 | # .speakeasy/gen.yaml match. 5 | 6 | set -e 7 | set -u 8 | # set -x 9 | 10 | GEN_YAML_VERSION="$(opa eval -f raw -I 'input.java.version' < .speakeasy/gen.yaml)" 11 | 12 | RELEASES_MD_VERSION="$(awk '/^### Generated/ {s=1} s==1 && /java v[0-9]/ {s=0; print}' < RELEASES.md | tail -n1 | cut -d'[' -f 2 | cut -d']' -f 1 | cut -d' ' -f2 | tr -d 'v')" 13 | 14 | BUILD_GRADLE_VERSION="$(awk '$1 == "version"' < build.gradle | cut -d'"' -f2 | tail -n 1)" 15 | 16 | SDK_VERSION="$(awk '$3 == "sdkVersion"' < src/main/java/com/styra/opa/openapi/SDKConfiguration.java | cut -d'"' -f2)" 17 | 18 | ALL_VERSIONS="$(printf '%s\n%s\n%s\n%s\n' "$GEN_YAML_VERSION" "$RELEASES_MD_VERSION" "$BUILD_GRADLE_VERSION" "$SDK_VERSION")" 19 | 20 | if [ "$(echo "$ALL_VERSIONS" | sort | uniq | wc -l)" -gt 1 ] ; then 21 | echo "ERROR: version mismatch detected! This may result in incorrect GitHub and/or Maven version numbers during release." 1>&2 22 | echo ".speakeasy/gen.yaml: $GEN_YAML_VERSION" 1>&2 23 | echo "RELEASES.md: $RELEASES_MD_VERSION" 1>&2 24 | echo "build.gradle: $BUILD_GRADLE_VERSION" 1>&2 25 | echo "src/main/java/com/styra/opa/openapi/SDKConfiguration.java: $SDK_VERSION" 1>&2 26 | exit 1 27 | fi 28 | 29 | exit 0 30 | -------------------------------------------------------------------------------- /scripts/post-generate-hook.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # This script is called by sdk_generation.yaml after Speakeasy's generation is 4 | # complete, but before adding the "post generation fixup" commit. Any additional 5 | # steps that need 6 | 7 | cd "$(dirname "$0")/.." 8 | set -e 9 | set -u 10 | set -x 11 | 12 | ./scripts/fix-build-gradle.sh 13 | -------------------------------------------------------------------------------- /scripts/serve_docs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # This script can be used to serve the MkDocs site locally. You need to have 4 | # Gradle working (to build the javadoc component), Python (to serve the docs 5 | # locally), and mkdocs (to generate the rest of the site) all set up before 6 | # you run this script. 7 | 8 | set -x 9 | set -e 10 | set -u 11 | cd "$(dirname "$0")/.." 12 | 13 | TEMP="$(mktemp -d)" 14 | trap "rm -rf '$TEMP'" EXIT 15 | 16 | ./scripts/build_docs.sh "$TEMP" 17 | cd "$TEMP" 18 | 19 | python3 -m http.server 20 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | * 4 | * The settings file is used to specify which projects to include in your build. 5 | * 6 | * Detailed information about configuring a multi-project build in Gradle can be found 7 | * in the user manual at https://docs.gradle.org/7.5.1/userguide/multi_project_builds.html 8 | */ 9 | 10 | rootProject.name = 'opa' 11 | -------------------------------------------------------------------------------- /src/main/java/com/styra/opa/OPAException.java: -------------------------------------------------------------------------------- 1 | package com.styra.opa; 2 | 3 | // TODO: select an appropriate name and move this into the SDK 4 | // 5 | // This generic exception should be used as a parent type for any other custom 6 | // exceptions thrown by the high level API. 7 | public class OPAException extends Exception { 8 | 9 | public OPAException(Throwable cause) { 10 | super(cause); 11 | } 12 | 13 | public OPAException(String message) { 14 | super(message); 15 | } 16 | 17 | public OPAException(String message, Throwable cause) { 18 | super(message, cause); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/styra/opa/openapi/SDKConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. 3 | */ 4 | package com.styra.opa.openapi; 5 | 6 | import com.styra.opa.openapi.hooks.SDKHooks; 7 | import com.styra.opa.openapi.utils.HTTPClient; 8 | import com.styra.opa.openapi.utils.Hook.SdkInitData; 9 | import com.styra.opa.openapi.utils.Hooks; 10 | import com.styra.opa.openapi.utils.RetryConfig; 11 | import java.lang.String; 12 | import java.util.Optional; 13 | 14 | class SDKConfiguration { 15 | public SecuritySource securitySource; 16 | 17 | public Optional securitySource() { 18 | return Optional.ofNullable(securitySource); 19 | } 20 | 21 | public HTTPClient defaultClient; 22 | 23 | public String serverUrl; 24 | 25 | public String resolvedServerUrl() { 26 | return serverUrl; 27 | } 28 | public int serverIdx = 0; 29 | private static final String LANGUAGE = "java"; 30 | public static final String OPENAPI_DOC_VERSION = "0.2.0"; 31 | public static final String SDK_VERSION = "2.1.1"; 32 | public static final String GEN_VERSION = "2.591.1"; 33 | private static final String BASE_PACKAGE = "com.styra.opa.openapi"; 34 | public static final String USER_AGENT = 35 | String.format("speakeasy-sdk/%s %s %s %s %s", 36 | LANGUAGE, SDK_VERSION, GEN_VERSION, OPENAPI_DOC_VERSION, BASE_PACKAGE); 37 | 38 | private Hooks _hooks = createHooks(); 39 | 40 | private static Hooks createHooks() { 41 | Hooks hooks = new Hooks(); 42 | return hooks; 43 | } 44 | 45 | public Hooks hooks() { 46 | return _hooks; 47 | } 48 | 49 | public void setHooks(Hooks hooks) { 50 | this._hooks = hooks; 51 | } 52 | 53 | /** 54 | * Initializes state (for example hooks). 55 | **/ 56 | public void initialize() { 57 | SDKHooks.initialize(_hooks); 58 | // apply the sdk init hook immediately 59 | SdkInitData data = _hooks.sdkInit(new SdkInitData(resolvedServerUrl(), defaultClient)); 60 | this.serverUrl = data.baseUrl(); 61 | this.defaultClient = data.client(); 62 | } 63 | 64 | 65 | 66 | public Optional retryConfig = Optional.empty(); 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/com/styra/opa/openapi/SecuritySource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. 3 | */ 4 | package com.styra.opa.openapi; 5 | 6 | import com.styra.opa.openapi.utils.HasSecurity; 7 | 8 | public interface SecuritySource { 9 | 10 | HasSecurity getSecurity(); 11 | 12 | public static SecuritySource of(HasSecurity security) { 13 | return new DefaultSecuritySource(security); 14 | } 15 | 16 | public static class DefaultSecuritySource implements SecuritySource { 17 | private HasSecurity security; 18 | 19 | public DefaultSecuritySource(HasSecurity security) { 20 | this.security = security; 21 | } 22 | 23 | public HasSecurity getSecurity() { 24 | return security; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/styra/opa/openapi/hooks/SDKHooks.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. 3 | */ 4 | 5 | package com.styra.opa.openapi.hooks; 6 | 7 | // 8 | // This file is written once by speakeasy code generation and 9 | // thereafter will not be overwritten by speakeasy updates. As a 10 | // consequence any customization of this class will be preserved. 11 | // 12 | 13 | public final class SDKHooks { 14 | 15 | private SDKHooks() { 16 | // prevent instantiation 17 | } 18 | 19 | public static final void initialize(com.styra.opa.openapi.utils.Hooks hooks) { 20 | // register hooks here 21 | 22 | // for more information see 23 | // https://www.speakeasyapi.dev/docs/additional-features/sdk-hooks 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/styra/opa/openapi/models/errors/AuthException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. 3 | */ 4 | package com.styra.opa.openapi.models.errors; 5 | 6 | import java.util.Optional; 7 | 8 | /** 9 | * An exception associated with Authentication or Authorization. 10 | */ 11 | @SuppressWarnings("serial") 12 | public class AuthException extends RuntimeException { 13 | 14 | private final Optional statusCode; 15 | 16 | private AuthException(Optional statusCode, String message) { 17 | super(message); 18 | this.statusCode = statusCode; 19 | } 20 | 21 | public AuthException(int statusCode, String message) { 22 | this(Optional.of(statusCode), message); 23 | } 24 | 25 | public AuthException(String message) { 26 | this(Optional.empty(), message); 27 | } 28 | 29 | public Optional statusCode() { 30 | return statusCode; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/styra/opa/openapi/models/errors/Location.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. 3 | */ 4 | package com.styra.opa.openapi.models.errors; 5 | 6 | import com.fasterxml.jackson.annotation.JsonCreator; 7 | import com.fasterxml.jackson.annotation.JsonIgnore; 8 | import com.fasterxml.jackson.annotation.JsonProperty; 9 | import com.styra.opa.openapi.utils.Utils; 10 | import java.lang.Long; 11 | import java.lang.Override; 12 | import java.lang.String; 13 | import java.util.Objects; 14 | 15 | public class Location { 16 | 17 | @JsonProperty("file") 18 | private String file; 19 | 20 | @JsonProperty("row") 21 | private long row; 22 | 23 | @JsonProperty("col") 24 | private long col; 25 | 26 | @JsonCreator 27 | public Location( 28 | @JsonProperty("file") String file, 29 | @JsonProperty("row") long row, 30 | @JsonProperty("col") long col) { 31 | Utils.checkNotNull(file, "file"); 32 | Utils.checkNotNull(row, "row"); 33 | Utils.checkNotNull(col, "col"); 34 | this.file = file; 35 | this.row = row; 36 | this.col = col; 37 | } 38 | 39 | @JsonIgnore 40 | public String file() { 41 | return file; 42 | } 43 | 44 | @JsonIgnore 45 | public long row() { 46 | return row; 47 | } 48 | 49 | @JsonIgnore 50 | public long col() { 51 | return col; 52 | } 53 | 54 | public final static Builder builder() { 55 | return new Builder(); 56 | } 57 | 58 | public Location withFile(String file) { 59 | Utils.checkNotNull(file, "file"); 60 | this.file = file; 61 | return this; 62 | } 63 | 64 | public Location withRow(long row) { 65 | Utils.checkNotNull(row, "row"); 66 | this.row = row; 67 | return this; 68 | } 69 | 70 | public Location withCol(long col) { 71 | Utils.checkNotNull(col, "col"); 72 | this.col = col; 73 | return this; 74 | } 75 | 76 | 77 | @Override 78 | public boolean equals(java.lang.Object o) { 79 | if (this == o) { 80 | return true; 81 | } 82 | if (o == null || getClass() != o.getClass()) { 83 | return false; 84 | } 85 | Location other = (Location) o; 86 | return 87 | Objects.deepEquals(this.file, other.file) && 88 | Objects.deepEquals(this.row, other.row) && 89 | Objects.deepEquals(this.col, other.col); 90 | } 91 | 92 | @Override 93 | public int hashCode() { 94 | return Objects.hash( 95 | file, 96 | row, 97 | col); 98 | } 99 | 100 | @Override 101 | public String toString() { 102 | return Utils.toString(Location.class, 103 | "file", file, 104 | "row", row, 105 | "col", col); 106 | } 107 | 108 | public final static class Builder { 109 | 110 | private String file; 111 | 112 | private Long row; 113 | 114 | private Long col; 115 | 116 | private Builder() { 117 | // force use of static builder() method 118 | } 119 | 120 | public Builder file(String file) { 121 | Utils.checkNotNull(file, "file"); 122 | this.file = file; 123 | return this; 124 | } 125 | 126 | public Builder row(long row) { 127 | Utils.checkNotNull(row, "row"); 128 | this.row = row; 129 | return this; 130 | } 131 | 132 | public Builder col(long col) { 133 | Utils.checkNotNull(col, "col"); 134 | this.col = col; 135 | return this; 136 | } 137 | 138 | public Location build() { 139 | return new Location( 140 | file, 141 | row, 142 | col); 143 | } 144 | } 145 | } 146 | -------------------------------------------------------------------------------- /src/main/java/com/styra/opa/openapi/models/errors/SDKError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. 3 | */ 4 | package com.styra.opa.openapi.models.errors; 5 | 6 | import java.net.http.HttpResponse; 7 | import java.io.InputStream; 8 | import com.styra.opa.openapi.utils.Utils; 9 | 10 | /** 11 | * Thrown by a service call when an error response occurs. Contains details about the response. 12 | */ 13 | @SuppressWarnings("serial") 14 | public class SDKError extends Exception { 15 | 16 | private final HttpResponse rawResponse; 17 | private final int code; 18 | private final String message; 19 | private final byte[] body; 20 | 21 | public SDKError( 22 | HttpResponse rawResponse, 23 | int code, 24 | String message, 25 | byte[] body) { 26 | Utils.checkNotNull(rawResponse, "rawResponse"); 27 | Utils.checkNotNull(message, "message"); 28 | Utils.checkNotNull(body, "body"); 29 | this.rawResponse = rawResponse; 30 | this.code = code; 31 | this.message = message; 32 | this.body = body; 33 | } 34 | 35 | @Override 36 | public boolean equals(java.lang.Object o) { 37 | if (this == o) { 38 | return true; 39 | } 40 | if (o == null || getClass() != o.getClass()) { 41 | return false; 42 | } 43 | SDKError other = (SDKError) o; 44 | return 45 | java.util.Objects.deepEquals(this.rawResponse, other.rawResponse) && 46 | java.util.Objects.deepEquals(this.code, other.code) && 47 | java.util.Objects.deepEquals(this.message, other.message) && 48 | java.util.Objects.deepEquals(this.body, other.body); 49 | } 50 | 51 | @Override 52 | public int hashCode() { 53 | return java.util.Objects.hash( 54 | rawResponse, 55 | code, 56 | message, 57 | body); 58 | } 59 | 60 | @Override 61 | public String toString() { 62 | return Utils.toString(SDKError.class, 63 | "rawResponse", rawResponse, 64 | "code", code, 65 | "message", message, 66 | "body", body); 67 | } 68 | 69 | public HttpResponse rawResponse() { 70 | return this.rawResponse; 71 | } 72 | 73 | public int code() { 74 | return this.code; 75 | } 76 | 77 | public String message() { 78 | return this.message; 79 | } 80 | 81 | public byte[] body() { 82 | return this.body; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /src/main/java/com/styra/opa/openapi/models/operations/CompileQueryWithPartialEvaluationRequestBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. 3 | */ 4 | package com.styra.opa.openapi.models.operations; 5 | 6 | import com.styra.opa.openapi.utils.Utils; 7 | import java.lang.Exception; 8 | 9 | public class CompileQueryWithPartialEvaluationRequestBuilder { 10 | 11 | private CompileQueryWithPartialEvaluationRequest request; 12 | private final SDKMethodInterfaces.MethodCallCompileQueryWithPartialEvaluation sdk; 13 | 14 | public CompileQueryWithPartialEvaluationRequestBuilder(SDKMethodInterfaces.MethodCallCompileQueryWithPartialEvaluation sdk) { 15 | this.sdk = sdk; 16 | } 17 | 18 | public CompileQueryWithPartialEvaluationRequestBuilder request(CompileQueryWithPartialEvaluationRequest request) { 19 | Utils.checkNotNull(request, "request"); 20 | this.request = request; 21 | return this; 22 | } 23 | 24 | public CompileQueryWithPartialEvaluationResponse call() throws Exception { 25 | 26 | return sdk.compileQueryWithPartialEvaluation( 27 | request); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/styra/opa/openapi/models/operations/ExecuteBatchPolicyWithInputRequestBody.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. 3 | */ 4 | package com.styra.opa.openapi.models.operations; 5 | 6 | import com.fasterxml.jackson.annotation.JsonCreator; 7 | import com.fasterxml.jackson.annotation.JsonIgnore; 8 | import com.fasterxml.jackson.annotation.JsonProperty; 9 | import com.styra.opa.openapi.models.shared.Input; 10 | import com.styra.opa.openapi.utils.Utils; 11 | import java.lang.Override; 12 | import java.lang.String; 13 | import java.util.Map; 14 | import java.util.Objects; 15 | 16 | /** 17 | * ExecuteBatchPolicyWithInputRequestBody 18 | * 19 | *

The batch of inputs 20 | */ 21 | public class ExecuteBatchPolicyWithInputRequestBody { 22 | 23 | @JsonProperty("inputs") 24 | private Map inputs; 25 | 26 | @JsonCreator 27 | public ExecuteBatchPolicyWithInputRequestBody( 28 | @JsonProperty("inputs") Map inputs) { 29 | inputs = Utils.emptyMapIfNull(inputs); 30 | this.inputs = inputs; 31 | } 32 | 33 | @JsonIgnore 34 | public Map inputs() { 35 | return inputs; 36 | } 37 | 38 | public final static Builder builder() { 39 | return new Builder(); 40 | } 41 | 42 | public ExecuteBatchPolicyWithInputRequestBody withInputs(Map inputs) { 43 | Utils.checkNotNull(inputs, "inputs"); 44 | this.inputs = inputs; 45 | return this; 46 | } 47 | 48 | 49 | @Override 50 | public boolean equals(java.lang.Object o) { 51 | if (this == o) { 52 | return true; 53 | } 54 | if (o == null || getClass() != o.getClass()) { 55 | return false; 56 | } 57 | ExecuteBatchPolicyWithInputRequestBody other = (ExecuteBatchPolicyWithInputRequestBody) o; 58 | return 59 | Objects.deepEquals(this.inputs, other.inputs); 60 | } 61 | 62 | @Override 63 | public int hashCode() { 64 | return Objects.hash( 65 | inputs); 66 | } 67 | 68 | @Override 69 | public String toString() { 70 | return Utils.toString(ExecuteBatchPolicyWithInputRequestBody.class, 71 | "inputs", inputs); 72 | } 73 | 74 | public final static class Builder { 75 | 76 | private Map inputs; 77 | 78 | private Builder() { 79 | // force use of static builder() method 80 | } 81 | 82 | public Builder inputs(Map inputs) { 83 | Utils.checkNotNull(inputs, "inputs"); 84 | this.inputs = inputs; 85 | return this; 86 | } 87 | 88 | public ExecuteBatchPolicyWithInputRequestBody build() { 89 | return new ExecuteBatchPolicyWithInputRequestBody( 90 | inputs); 91 | } 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /src/main/java/com/styra/opa/openapi/models/operations/ExecuteBatchPolicyWithInputRequestBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. 3 | */ 4 | package com.styra.opa.openapi.models.operations; 5 | 6 | import com.styra.opa.openapi.utils.Utils; 7 | import java.lang.Exception; 8 | 9 | public class ExecuteBatchPolicyWithInputRequestBuilder { 10 | 11 | private ExecuteBatchPolicyWithInputRequest request; 12 | private final SDKMethodInterfaces.MethodCallExecuteBatchPolicyWithInput sdk; 13 | 14 | public ExecuteBatchPolicyWithInputRequestBuilder(SDKMethodInterfaces.MethodCallExecuteBatchPolicyWithInput sdk) { 15 | this.sdk = sdk; 16 | } 17 | 18 | public ExecuteBatchPolicyWithInputRequestBuilder request(ExecuteBatchPolicyWithInputRequest request) { 19 | Utils.checkNotNull(request, "request"); 20 | this.request = request; 21 | return this; 22 | } 23 | 24 | public ExecuteBatchPolicyWithInputResponse call() throws Exception { 25 | 26 | return sdk.executeBatchPolicyWithInput( 27 | request); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/styra/opa/openapi/models/operations/ExecuteDefaultPolicyWithInputRequestBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. 3 | */ 4 | package com.styra.opa.openapi.models.operations; 5 | 6 | import com.styra.opa.openapi.models.shared.GzipAcceptEncoding; 7 | import com.styra.opa.openapi.models.shared.Input; 8 | import com.styra.opa.openapi.utils.Utils; 9 | import java.lang.Boolean; 10 | import java.lang.Exception; 11 | import java.util.Optional; 12 | 13 | public class ExecuteDefaultPolicyWithInputRequestBuilder { 14 | 15 | private Optional pretty = Optional.empty(); 16 | private Optional acceptEncoding = Optional.empty(); 17 | private Input input; 18 | private final SDKMethodInterfaces.MethodCallExecuteDefaultPolicyWithInput sdk; 19 | 20 | public ExecuteDefaultPolicyWithInputRequestBuilder(SDKMethodInterfaces.MethodCallExecuteDefaultPolicyWithInput sdk) { 21 | this.sdk = sdk; 22 | } 23 | 24 | public ExecuteDefaultPolicyWithInputRequestBuilder pretty(boolean pretty) { 25 | Utils.checkNotNull(pretty, "pretty"); 26 | this.pretty = Optional.of(pretty); 27 | return this; 28 | } 29 | 30 | public ExecuteDefaultPolicyWithInputRequestBuilder pretty(Optional pretty) { 31 | Utils.checkNotNull(pretty, "pretty"); 32 | this.pretty = pretty; 33 | return this; 34 | } 35 | 36 | public ExecuteDefaultPolicyWithInputRequestBuilder acceptEncoding(GzipAcceptEncoding acceptEncoding) { 37 | Utils.checkNotNull(acceptEncoding, "acceptEncoding"); 38 | this.acceptEncoding = Optional.of(acceptEncoding); 39 | return this; 40 | } 41 | 42 | public ExecuteDefaultPolicyWithInputRequestBuilder acceptEncoding(Optional acceptEncoding) { 43 | Utils.checkNotNull(acceptEncoding, "acceptEncoding"); 44 | this.acceptEncoding = acceptEncoding; 45 | return this; 46 | } 47 | 48 | public ExecuteDefaultPolicyWithInputRequestBuilder input(Input input) { 49 | Utils.checkNotNull(input, "input"); 50 | this.input = input; 51 | return this; 52 | } 53 | 54 | public ExecuteDefaultPolicyWithInputResponse call() throws Exception { 55 | 56 | return sdk.executeDefaultPolicyWithInput( 57 | pretty, 58 | acceptEncoding, 59 | input); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/com/styra/opa/openapi/models/operations/ExecutePolicyRequestBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. 3 | */ 4 | package com.styra.opa.openapi.models.operations; 5 | 6 | import com.styra.opa.openapi.utils.Utils; 7 | import java.lang.Exception; 8 | 9 | public class ExecutePolicyRequestBuilder { 10 | 11 | private ExecutePolicyRequest request; 12 | private final SDKMethodInterfaces.MethodCallExecutePolicy sdk; 13 | 14 | public ExecutePolicyRequestBuilder(SDKMethodInterfaces.MethodCallExecutePolicy sdk) { 15 | this.sdk = sdk; 16 | } 17 | 18 | public ExecutePolicyRequestBuilder request(ExecutePolicyRequest request) { 19 | Utils.checkNotNull(request, "request"); 20 | this.request = request; 21 | return this; 22 | } 23 | 24 | public ExecutePolicyResponse call() throws Exception { 25 | 26 | return sdk.executePolicy( 27 | request); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/styra/opa/openapi/models/operations/ExecutePolicyWithInputRequestBody.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. 3 | */ 4 | package com.styra.opa.openapi.models.operations; 5 | 6 | import com.fasterxml.jackson.annotation.JsonCreator; 7 | import com.fasterxml.jackson.annotation.JsonIgnore; 8 | import com.fasterxml.jackson.annotation.JsonProperty; 9 | import com.styra.opa.openapi.models.shared.Input; 10 | import com.styra.opa.openapi.utils.Utils; 11 | import java.lang.Override; 12 | import java.lang.String; 13 | import java.util.Objects; 14 | 15 | /** 16 | * ExecutePolicyWithInputRequestBody 17 | * 18 | *

The input document 19 | */ 20 | public class ExecutePolicyWithInputRequestBody { 21 | 22 | /** 23 | * Arbitrary JSON used within your policies by accessing `input` 24 | */ 25 | @JsonProperty("input") 26 | private Input input; 27 | 28 | @JsonCreator 29 | public ExecutePolicyWithInputRequestBody( 30 | @JsonProperty("input") Input input) { 31 | Utils.checkNotNull(input, "input"); 32 | this.input = input; 33 | } 34 | 35 | /** 36 | * Arbitrary JSON used within your policies by accessing `input` 37 | */ 38 | @JsonIgnore 39 | public Input input() { 40 | return input; 41 | } 42 | 43 | public final static Builder builder() { 44 | return new Builder(); 45 | } 46 | 47 | /** 48 | * Arbitrary JSON used within your policies by accessing `input` 49 | */ 50 | public ExecutePolicyWithInputRequestBody withInput(Input input) { 51 | Utils.checkNotNull(input, "input"); 52 | this.input = input; 53 | return this; 54 | } 55 | 56 | 57 | @Override 58 | public boolean equals(java.lang.Object o) { 59 | if (this == o) { 60 | return true; 61 | } 62 | if (o == null || getClass() != o.getClass()) { 63 | return false; 64 | } 65 | ExecutePolicyWithInputRequestBody other = (ExecutePolicyWithInputRequestBody) o; 66 | return 67 | Objects.deepEquals(this.input, other.input); 68 | } 69 | 70 | @Override 71 | public int hashCode() { 72 | return Objects.hash( 73 | input); 74 | } 75 | 76 | @Override 77 | public String toString() { 78 | return Utils.toString(ExecutePolicyWithInputRequestBody.class, 79 | "input", input); 80 | } 81 | 82 | public final static class Builder { 83 | 84 | private Input input; 85 | 86 | private Builder() { 87 | // force use of static builder() method 88 | } 89 | 90 | /** 91 | * Arbitrary JSON used within your policies by accessing `input` 92 | */ 93 | public Builder input(Input input) { 94 | Utils.checkNotNull(input, "input"); 95 | this.input = input; 96 | return this; 97 | } 98 | 99 | public ExecutePolicyWithInputRequestBody build() { 100 | return new ExecutePolicyWithInputRequestBody( 101 | input); 102 | } 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /src/main/java/com/styra/opa/openapi/models/operations/ExecutePolicyWithInputRequestBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. 3 | */ 4 | package com.styra.opa.openapi.models.operations; 5 | 6 | import com.styra.opa.openapi.utils.Utils; 7 | import java.lang.Exception; 8 | 9 | public class ExecutePolicyWithInputRequestBuilder { 10 | 11 | private ExecutePolicyWithInputRequest request; 12 | private final SDKMethodInterfaces.MethodCallExecutePolicyWithInput sdk; 13 | 14 | public ExecutePolicyWithInputRequestBuilder(SDKMethodInterfaces.MethodCallExecutePolicyWithInput sdk) { 15 | this.sdk = sdk; 16 | } 17 | 18 | public ExecutePolicyWithInputRequestBuilder request(ExecutePolicyWithInputRequest request) { 19 | Utils.checkNotNull(request, "request"); 20 | this.request = request; 21 | return this; 22 | } 23 | 24 | public ExecutePolicyWithInputResponse call() throws Exception { 25 | 26 | return sdk.executePolicyWithInput( 27 | request); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/styra/opa/openapi/models/operations/HealthRequestBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. 3 | */ 4 | package com.styra.opa.openapi.models.operations; 5 | 6 | import com.fasterxml.jackson.core.type.TypeReference; 7 | import com.styra.opa.openapi.utils.LazySingletonValue; 8 | import com.styra.opa.openapi.utils.Utils; 9 | import java.lang.Boolean; 10 | import java.lang.Exception; 11 | import java.lang.String; 12 | import java.util.List; 13 | import java.util.Optional; 14 | 15 | public class HealthRequestBuilder { 16 | 17 | private Optional bundles = Utils.readDefaultOrConstValue( 18 | "bundles", 19 | "false", 20 | new TypeReference>() {}); 21 | private Optional plugins = Utils.readDefaultOrConstValue( 22 | "plugins", 23 | "false", 24 | new TypeReference>() {}); 25 | private Optional> excludePlugin = Optional.empty(); 26 | private final SDKMethodInterfaces.MethodCallHealth sdk; 27 | 28 | public HealthRequestBuilder(SDKMethodInterfaces.MethodCallHealth sdk) { 29 | this.sdk = sdk; 30 | } 31 | 32 | public HealthRequestBuilder bundles(boolean bundles) { 33 | Utils.checkNotNull(bundles, "bundles"); 34 | this.bundles = Optional.of(bundles); 35 | return this; 36 | } 37 | 38 | public HealthRequestBuilder bundles(Optional bundles) { 39 | Utils.checkNotNull(bundles, "bundles"); 40 | this.bundles = bundles; 41 | return this; 42 | } 43 | 44 | public HealthRequestBuilder plugins(boolean plugins) { 45 | Utils.checkNotNull(plugins, "plugins"); 46 | this.plugins = Optional.of(plugins); 47 | return this; 48 | } 49 | 50 | public HealthRequestBuilder plugins(Optional plugins) { 51 | Utils.checkNotNull(plugins, "plugins"); 52 | this.plugins = plugins; 53 | return this; 54 | } 55 | 56 | public HealthRequestBuilder excludePlugin(List excludePlugin) { 57 | Utils.checkNotNull(excludePlugin, "excludePlugin"); 58 | this.excludePlugin = Optional.of(excludePlugin); 59 | return this; 60 | } 61 | 62 | public HealthRequestBuilder excludePlugin(Optional> excludePlugin) { 63 | Utils.checkNotNull(excludePlugin, "excludePlugin"); 64 | this.excludePlugin = excludePlugin; 65 | return this; 66 | } 67 | 68 | public HealthResponse call() throws Exception { 69 | if (bundles == null) { 70 | bundles = _SINGLETON_VALUE_Bundles.value(); 71 | } 72 | if (plugins == null) { 73 | plugins = _SINGLETON_VALUE_Plugins.value(); 74 | } 75 | return sdk.health( 76 | bundles, 77 | plugins, 78 | excludePlugin); 79 | } 80 | 81 | private static final LazySingletonValue> _SINGLETON_VALUE_Bundles = 82 | new LazySingletonValue<>( 83 | "bundles", 84 | "false", 85 | new TypeReference>() {}); 86 | 87 | private static final LazySingletonValue> _SINGLETON_VALUE_Plugins = 88 | new LazySingletonValue<>( 89 | "plugins", 90 | "false", 91 | new TypeReference>() {}); 92 | } 93 | -------------------------------------------------------------------------------- /src/main/java/com/styra/opa/openapi/models/operations/SDKMethodInterfaces.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. 3 | */ 4 | package com.styra.opa.openapi.models.operations; 5 | 6 | import com.styra.opa.openapi.models.shared.GzipAcceptEncoding; 7 | import com.styra.opa.openapi.models.shared.Input; 8 | import java.lang.Boolean; 9 | import java.lang.Exception; 10 | import java.lang.String; 11 | import java.util.List; 12 | import java.util.Optional; 13 | 14 | public class SDKMethodInterfaces { 15 | 16 | public interface MethodCallExecuteDefaultPolicyWithInput { 17 | ExecuteDefaultPolicyWithInputResponse executeDefaultPolicyWithInput( 18 | Optional pretty, 19 | Optional acceptEncoding, 20 | Input input) throws Exception; 21 | } 22 | 23 | public interface MethodCallExecutePolicy { 24 | ExecutePolicyResponse executePolicy( 25 | ExecutePolicyRequest request) throws Exception; 26 | } 27 | 28 | public interface MethodCallExecutePolicyWithInput { 29 | ExecutePolicyWithInputResponse executePolicyWithInput( 30 | ExecutePolicyWithInputRequest request) throws Exception; 31 | } 32 | 33 | public interface MethodCallExecuteBatchPolicyWithInput { 34 | ExecuteBatchPolicyWithInputResponse executeBatchPolicyWithInput( 35 | ExecuteBatchPolicyWithInputRequest request) throws Exception; 36 | } 37 | 38 | public interface MethodCallCompileQueryWithPartialEvaluation { 39 | CompileQueryWithPartialEvaluationResponse compileQueryWithPartialEvaluation( 40 | CompileQueryWithPartialEvaluationRequest request) throws Exception; 41 | } 42 | 43 | public interface MethodCallHealth { 44 | HealthResponse health( 45 | Optional bundles, 46 | Optional plugins, 47 | Optional> excludePlugin) throws Exception; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/styra/opa/openapi/models/shared/CompileResultMultitargetQuery.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. 3 | */ 4 | package com.styra.opa.openapi.models.shared; 5 | 6 | import com.fasterxml.jackson.annotation.JsonCreator; 7 | import com.styra.opa.openapi.utils.Utils; 8 | import java.lang.Override; 9 | import java.lang.String; 10 | import java.util.Objects; 11 | 12 | /** 13 | * CompileResultMultitargetQuery 14 | * 15 | *

UCAST JSON object describing the conditions under which the query is true. 16 | */ 17 | public class CompileResultMultitargetQuery { 18 | 19 | @JsonCreator 20 | public CompileResultMultitargetQuery() { 21 | 22 | 23 | } 24 | 25 | public final static Builder builder() { 26 | return new Builder(); 27 | } 28 | 29 | 30 | @Override 31 | public boolean equals(java.lang.Object o) { 32 | if (this == o) { 33 | return true; 34 | } 35 | if (o == null || getClass() != o.getClass()) { 36 | return false; 37 | } 38 | return true; 39 | } 40 | 41 | @Override 42 | public int hashCode() { 43 | return Objects.hash( 44 | ); 45 | } 46 | 47 | @Override 48 | public String toString() { 49 | return Utils.toString(CompileResultMultitargetQuery.class); 50 | } 51 | 52 | public final static class Builder { 53 | 54 | private Builder() { 55 | // force use of static builder() method 56 | } 57 | 58 | public CompileResultMultitargetQuery build() { 59 | return new CompileResultMultitargetQuery( 60 | ); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/styra/opa/openapi/models/shared/Explain.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. 3 | */ 4 | package com.styra.opa.openapi.models.shared; 5 | 6 | import com.fasterxml.jackson.annotation.JsonValue; 7 | import java.lang.String; 8 | import java.util.Objects; 9 | import java.util.Optional; 10 | 11 | public enum Explain { 12 | NOTES("notes"), 13 | FAILS("fails"), 14 | FULL("full"), 15 | DEBUG("debug"); 16 | 17 | @JsonValue 18 | private final String value; 19 | 20 | private Explain(String value) { 21 | this.value = value; 22 | } 23 | 24 | public String value() { 25 | return value; 26 | } 27 | 28 | public static Optional fromValue(String value) { 29 | for (Explain o: Explain.values()) { 30 | if (Objects.deepEquals(o.value, value)) { 31 | return Optional.of(o); 32 | } 33 | } 34 | return Optional.empty(); 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /src/main/java/com/styra/opa/openapi/models/shared/GzipAcceptEncoding.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. 3 | */ 4 | package com.styra.opa.openapi.models.shared; 5 | 6 | import com.fasterxml.jackson.annotation.JsonValue; 7 | import java.lang.String; 8 | import java.util.Objects; 9 | import java.util.Optional; 10 | 11 | public enum GzipAcceptEncoding { 12 | GZIP("gzip"); 13 | 14 | @JsonValue 15 | private final String value; 16 | 17 | private GzipAcceptEncoding(String value) { 18 | this.value = value; 19 | } 20 | 21 | public String value() { 22 | return value; 23 | } 24 | 25 | public static Optional fromValue(String value) { 26 | for (GzipAcceptEncoding o: GzipAcceptEncoding.values()) { 27 | if (Objects.deepEquals(o.value, value)) { 28 | return Optional.of(o); 29 | } 30 | } 31 | return Optional.empty(); 32 | } 33 | } 34 | 35 | -------------------------------------------------------------------------------- /src/main/java/com/styra/opa/openapi/models/shared/GzipContentEncoding.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. 3 | */ 4 | package com.styra.opa.openapi.models.shared; 5 | 6 | import com.fasterxml.jackson.annotation.JsonValue; 7 | import java.lang.String; 8 | import java.util.Objects; 9 | import java.util.Optional; 10 | 11 | public enum GzipContentEncoding { 12 | GZIP("gzip"); 13 | 14 | @JsonValue 15 | private final String value; 16 | 17 | private GzipContentEncoding(String value) { 18 | this.value = value; 19 | } 20 | 21 | public String value() { 22 | return value; 23 | } 24 | 25 | public static Optional fromValue(String value) { 26 | for (GzipContentEncoding o: GzipContentEncoding.values()) { 27 | if (Objects.deepEquals(o.value, value)) { 28 | return Optional.of(o); 29 | } 30 | } 31 | return Optional.empty(); 32 | } 33 | } 34 | 35 | -------------------------------------------------------------------------------- /src/main/java/com/styra/opa/openapi/models/shared/HealthyServer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. 3 | */ 4 | package com.styra.opa.openapi.models.shared; 5 | 6 | import com.fasterxml.jackson.annotation.JsonCreator; 7 | import com.styra.opa.openapi.utils.Utils; 8 | import java.lang.Override; 9 | import java.lang.String; 10 | import java.util.Objects; 11 | 12 | /** 13 | * HealthyServer 14 | * 15 | *

OPA service is healthy. If the bundles option is specified then all configured bundles have been activated. If the plugins option is specified then all plugins are in an OK state. 16 | */ 17 | public class HealthyServer { 18 | 19 | @JsonCreator 20 | public HealthyServer() { 21 | 22 | 23 | } 24 | 25 | public final static Builder builder() { 26 | return new Builder(); 27 | } 28 | 29 | 30 | @Override 31 | public boolean equals(java.lang.Object o) { 32 | if (this == o) { 33 | return true; 34 | } 35 | if (o == null || getClass() != o.getClass()) { 36 | return false; 37 | } 38 | return true; 39 | } 40 | 41 | @Override 42 | public int hashCode() { 43 | return Objects.hash( 44 | ); 45 | } 46 | 47 | @Override 48 | public String toString() { 49 | return Utils.toString(HealthyServer.class); 50 | } 51 | 52 | public final static class Builder { 53 | 54 | private Builder() { 55 | // force use of static builder() method 56 | } 57 | 58 | public HealthyServer build() { 59 | return new HealthyServer( 60 | ); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/styra/opa/openapi/models/shared/MaskingRule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. 3 | */ 4 | package com.styra.opa.openapi.models.shared; 5 | 6 | import com.fasterxml.jackson.annotation.JsonValue; 7 | import com.fasterxml.jackson.core.type.TypeReference; 8 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 9 | import com.styra.opa.openapi.utils.OneOfDeserializer; 10 | import com.styra.opa.openapi.utils.TypedObject; 11 | import com.styra.opa.openapi.utils.Utils.JsonShape; 12 | import com.styra.opa.openapi.utils.Utils.TypeReferenceWithShape; 13 | import com.styra.opa.openapi.utils.Utils; 14 | import java.lang.Override; 15 | import java.lang.String; 16 | import java.lang.SuppressWarnings; 17 | import java.util.Objects; 18 | 19 | @JsonDeserialize(using = MaskingRule._Deserializer.class) 20 | public class MaskingRule { 21 | 22 | @JsonValue 23 | private TypedObject value; 24 | 25 | private MaskingRule(TypedObject value) { 26 | this.value = value; 27 | } 28 | 29 | public static MaskingRule of(One value) { 30 | Utils.checkNotNull(value, "value"); 31 | return new MaskingRule(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); 32 | } 33 | 34 | /** 35 | * Returns an instance of one of these types: 36 | *

    37 | *
  • {@code com.styra.opa.openapi.models.shared.One}
  • 38 | *
39 | * 40 | *

Use {@code instanceof} to determine what type is returned. For example: 41 | * 42 | *

43 |      * if (obj.value() instanceof String) {
44 |      *     String answer = (String) obj.value();
45 |      *     System.out.println("answer=" + answer);
46 |      * }
47 |      * 
48 | * 49 | * @return value of oneOf type 50 | **/ 51 | public java.lang.Object value() { 52 | return value.value(); 53 | } 54 | 55 | @Override 56 | public boolean equals(java.lang.Object o) { 57 | if (this == o) { 58 | return true; 59 | } 60 | if (o == null || getClass() != o.getClass()) { 61 | return false; 62 | } 63 | MaskingRule other = (MaskingRule) o; 64 | return Objects.deepEquals(this.value.value(), other.value.value()); 65 | } 66 | 67 | @Override 68 | public int hashCode() { 69 | return Objects.hash(value.value()); 70 | } 71 | 72 | @SuppressWarnings("serial") 73 | public static final class _Deserializer extends OneOfDeserializer { 74 | 75 | public _Deserializer() { 76 | super(MaskingRule.class, false, 77 | TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); 78 | } 79 | } 80 | 81 | @Override 82 | public String toString() { 83 | return Utils.toString(MaskingRule.class, 84 | "value", value); 85 | } 86 | 87 | } 88 | 89 | -------------------------------------------------------------------------------- /src/main/java/com/styra/opa/openapi/models/shared/One.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. 3 | */ 4 | package com.styra.opa.openapi.models.shared; 5 | 6 | import com.fasterxml.jackson.annotation.JsonCreator; 7 | import com.fasterxml.jackson.annotation.JsonIgnore; 8 | import com.fasterxml.jackson.annotation.JsonInclude.Include; 9 | import com.fasterxml.jackson.annotation.JsonInclude; 10 | import com.fasterxml.jackson.annotation.JsonProperty; 11 | import com.styra.opa.openapi.utils.Utils; 12 | import java.lang.Override; 13 | import java.lang.String; 14 | import java.lang.SuppressWarnings; 15 | import java.util.Objects; 16 | import java.util.Optional; 17 | 18 | public class One { 19 | 20 | @JsonInclude(Include.NON_ABSENT) 21 | @JsonProperty("replace") 22 | private Optional replace; 23 | 24 | @JsonCreator 25 | public One( 26 | @JsonProperty("replace") Optional replace) { 27 | Utils.checkNotNull(replace, "replace"); 28 | this.replace = replace; 29 | } 30 | 31 | public One() { 32 | this(Optional.empty()); 33 | } 34 | 35 | @SuppressWarnings("unchecked") 36 | @JsonIgnore 37 | public Optional replace() { 38 | return (Optional) replace; 39 | } 40 | 41 | public final static Builder builder() { 42 | return new Builder(); 43 | } 44 | 45 | public One withReplace(Replace replace) { 46 | Utils.checkNotNull(replace, "replace"); 47 | this.replace = Optional.ofNullable(replace); 48 | return this; 49 | } 50 | 51 | public One withReplace(Optional replace) { 52 | Utils.checkNotNull(replace, "replace"); 53 | this.replace = replace; 54 | return this; 55 | } 56 | 57 | 58 | @Override 59 | public boolean equals(java.lang.Object o) { 60 | if (this == o) { 61 | return true; 62 | } 63 | if (o == null || getClass() != o.getClass()) { 64 | return false; 65 | } 66 | One other = (One) o; 67 | return 68 | Objects.deepEquals(this.replace, other.replace); 69 | } 70 | 71 | @Override 72 | public int hashCode() { 73 | return Objects.hash( 74 | replace); 75 | } 76 | 77 | @Override 78 | public String toString() { 79 | return Utils.toString(One.class, 80 | "replace", replace); 81 | } 82 | 83 | public final static class Builder { 84 | 85 | private Optional replace = Optional.empty(); 86 | 87 | private Builder() { 88 | // force use of static builder() method 89 | } 90 | 91 | public Builder replace(Replace replace) { 92 | Utils.checkNotNull(replace, "replace"); 93 | this.replace = Optional.ofNullable(replace); 94 | return this; 95 | } 96 | 97 | public Builder replace(Optional replace) { 98 | Utils.checkNotNull(replace, "replace"); 99 | this.replace = replace; 100 | return this; 101 | } 102 | 103 | public One build() { 104 | return new One( 105 | replace); 106 | } 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /src/main/java/com/styra/opa/openapi/models/shared/Query.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. 3 | */ 4 | package com.styra.opa.openapi.models.shared; 5 | 6 | import com.fasterxml.jackson.annotation.JsonCreator; 7 | import com.styra.opa.openapi.utils.Utils; 8 | import java.lang.Override; 9 | import java.lang.String; 10 | import java.util.Objects; 11 | 12 | public class Query { 13 | 14 | @JsonCreator 15 | public Query() { 16 | 17 | 18 | } 19 | 20 | public final static Builder builder() { 21 | return new Builder(); 22 | } 23 | 24 | 25 | @Override 26 | public boolean equals(java.lang.Object o) { 27 | if (this == o) { 28 | return true; 29 | } 30 | if (o == null || getClass() != o.getClass()) { 31 | return false; 32 | } 33 | return true; 34 | } 35 | 36 | @Override 37 | public int hashCode() { 38 | return Objects.hash( 39 | ); 40 | } 41 | 42 | @Override 43 | public String toString() { 44 | return Utils.toString(Query.class); 45 | } 46 | 47 | public final static class Builder { 48 | 49 | private Builder() { 50 | // force use of static builder() method 51 | } 52 | 53 | public Query build() { 54 | return new Query( 55 | ); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/com/styra/opa/openapi/models/shared/Responses.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. 3 | */ 4 | package com.styra.opa.openapi.models.shared; 5 | 6 | import com.fasterxml.jackson.annotation.JsonSubTypes.Type; 7 | import com.fasterxml.jackson.annotation.JsonSubTypes; 8 | import com.fasterxml.jackson.annotation.JsonTypeInfo.As; 9 | import com.fasterxml.jackson.annotation.JsonTypeInfo.Id; 10 | import com.fasterxml.jackson.annotation.JsonTypeInfo; 11 | import java.lang.String; 12 | 13 | @JsonTypeInfo(use = Id.NAME, property = "http_status_code", include = As.EXISTING_PROPERTY, visible = true) 14 | @JsonSubTypes({ 15 | @Type(value = SuccessfulPolicyResponseWithStatusCode.class, name="200"), 16 | @Type(value = ServerErrorWithStatusCode.class, name="500")}) 17 | public interface Responses { 18 | 19 | String httpStatusCode(); 20 | 21 | } 22 | 23 | -------------------------------------------------------------------------------- /src/main/java/com/styra/opa/openapi/models/shared/Revision.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. 3 | */ 4 | package com.styra.opa.openapi.models.shared; 5 | 6 | import com.fasterxml.jackson.annotation.JsonCreator; 7 | import com.fasterxml.jackson.annotation.JsonIgnore; 8 | import com.fasterxml.jackson.annotation.JsonProperty; 9 | import com.styra.opa.openapi.utils.Utils; 10 | import java.lang.Override; 11 | import java.lang.String; 12 | import java.util.Objects; 13 | 14 | public class Revision { 15 | 16 | @JsonProperty("revision") 17 | private String revision; 18 | 19 | @JsonCreator 20 | public Revision( 21 | @JsonProperty("revision") String revision) { 22 | Utils.checkNotNull(revision, "revision"); 23 | this.revision = revision; 24 | } 25 | 26 | @JsonIgnore 27 | public String revision() { 28 | return revision; 29 | } 30 | 31 | public final static Builder builder() { 32 | return new Builder(); 33 | } 34 | 35 | public Revision withRevision(String revision) { 36 | Utils.checkNotNull(revision, "revision"); 37 | this.revision = revision; 38 | return this; 39 | } 40 | 41 | 42 | @Override 43 | public boolean equals(java.lang.Object o) { 44 | if (this == o) { 45 | return true; 46 | } 47 | if (o == null || getClass() != o.getClass()) { 48 | return false; 49 | } 50 | Revision other = (Revision) o; 51 | return 52 | Objects.deepEquals(this.revision, other.revision); 53 | } 54 | 55 | @Override 56 | public int hashCode() { 57 | return Objects.hash( 58 | revision); 59 | } 60 | 61 | @Override 62 | public String toString() { 63 | return Utils.toString(Revision.class, 64 | "revision", revision); 65 | } 66 | 67 | public final static class Builder { 68 | 69 | private String revision; 70 | 71 | private Builder() { 72 | // force use of static builder() method 73 | } 74 | 75 | public Builder revision(String revision) { 76 | Utils.checkNotNull(revision, "revision"); 77 | this.revision = revision; 78 | return this; 79 | } 80 | 81 | public Revision build() { 82 | return new Revision( 83 | revision); 84 | } 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /src/main/java/com/styra/opa/openapi/models/shared/Security.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. 3 | */ 4 | package com.styra.opa.openapi.models.shared; 5 | 6 | import com.fasterxml.jackson.annotation.JsonCreator; 7 | import com.fasterxml.jackson.annotation.JsonIgnore; 8 | import com.styra.opa.openapi.utils.HasSecurity; 9 | import com.styra.opa.openapi.utils.SpeakeasyMetadata; 10 | import com.styra.opa.openapi.utils.Utils; 11 | import java.lang.Override; 12 | import java.lang.String; 13 | import java.util.Objects; 14 | import java.util.Optional; 15 | 16 | public class Security implements HasSecurity { 17 | 18 | @SpeakeasyMetadata("security:scheme=true,type=http,subtype=bearer,name=Authorization") 19 | private Optional bearerAuth; 20 | 21 | @JsonCreator 22 | public Security( 23 | Optional bearerAuth) { 24 | Utils.checkNotNull(bearerAuth, "bearerAuth"); 25 | this.bearerAuth = bearerAuth; 26 | } 27 | 28 | public Security() { 29 | this(Optional.empty()); 30 | } 31 | 32 | @JsonIgnore 33 | public Optional bearerAuth() { 34 | return bearerAuth; 35 | } 36 | 37 | public final static Builder builder() { 38 | return new Builder(); 39 | } 40 | 41 | public Security withBearerAuth(String bearerAuth) { 42 | Utils.checkNotNull(bearerAuth, "bearerAuth"); 43 | this.bearerAuth = Optional.ofNullable(bearerAuth); 44 | return this; 45 | } 46 | 47 | public Security withBearerAuth(Optional bearerAuth) { 48 | Utils.checkNotNull(bearerAuth, "bearerAuth"); 49 | this.bearerAuth = bearerAuth; 50 | return this; 51 | } 52 | 53 | 54 | @Override 55 | public boolean equals(java.lang.Object o) { 56 | if (this == o) { 57 | return true; 58 | } 59 | if (o == null || getClass() != o.getClass()) { 60 | return false; 61 | } 62 | Security other = (Security) o; 63 | return 64 | Objects.deepEquals(this.bearerAuth, other.bearerAuth); 65 | } 66 | 67 | @Override 68 | public int hashCode() { 69 | return Objects.hash( 70 | bearerAuth); 71 | } 72 | 73 | @Override 74 | public String toString() { 75 | return Utils.toString(Security.class, 76 | "bearerAuth", bearerAuth); 77 | } 78 | 79 | public final static class Builder { 80 | 81 | private Optional bearerAuth = Optional.empty(); 82 | 83 | private Builder() { 84 | // force use of static builder() method 85 | } 86 | 87 | public Builder bearerAuth(String bearerAuth) { 88 | Utils.checkNotNull(bearerAuth, "bearerAuth"); 89 | this.bearerAuth = Optional.ofNullable(bearerAuth); 90 | return this; 91 | } 92 | 93 | public Builder bearerAuth(Optional bearerAuth) { 94 | Utils.checkNotNull(bearerAuth, "bearerAuth"); 95 | this.bearerAuth = bearerAuth; 96 | return this; 97 | } 98 | 99 | public Security build() { 100 | return new Security( 101 | bearerAuth); 102 | } 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /src/main/java/com/styra/opa/openapi/models/shared/Support.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. 3 | */ 4 | package com.styra.opa.openapi.models.shared; 5 | 6 | import com.fasterxml.jackson.annotation.JsonCreator; 7 | import com.styra.opa.openapi.utils.Utils; 8 | import java.lang.Override; 9 | import java.lang.String; 10 | import java.util.Objects; 11 | 12 | public class Support { 13 | 14 | @JsonCreator 15 | public Support() { 16 | 17 | 18 | } 19 | 20 | public final static Builder builder() { 21 | return new Builder(); 22 | } 23 | 24 | 25 | @Override 26 | public boolean equals(java.lang.Object o) { 27 | if (this == o) { 28 | return true; 29 | } 30 | if (o == null || getClass() != o.getClass()) { 31 | return false; 32 | } 33 | return true; 34 | } 35 | 36 | @Override 37 | public int hashCode() { 38 | return Objects.hash( 39 | ); 40 | } 41 | 42 | @Override 43 | public String toString() { 44 | return Utils.toString(Support.class); 45 | } 46 | 47 | public final static class Builder { 48 | 49 | private Builder() { 50 | // force use of static builder() method 51 | } 52 | 53 | public Support build() { 54 | return new Support( 55 | ); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/com/styra/opa/openapi/models/shared/TargetDialects.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. 3 | */ 4 | package com.styra.opa.openapi.models.shared; 5 | 6 | import com.fasterxml.jackson.annotation.JsonValue; 7 | import java.lang.String; 8 | import java.util.Objects; 9 | import java.util.Optional; 10 | 11 | public enum TargetDialects { 12 | UCAST_PLUS_ALL("ucast+all"), 13 | UCAST_PLUS_MINIMAL("ucast+minimal"), 14 | UCAST_PLUS_PRISMA("ucast+prisma"), 15 | UCAST_PLUS_LINQ("ucast+linq"), 16 | SQL_PLUS_SQLSERVER("sql+sqlserver"), 17 | SQL_PLUS_MYSQL("sql+mysql"), 18 | SQL_PLUS_POSTGRESQL("sql+postgresql"), 19 | SQL_PLUS_SQLITE("sql+sqlite"); 20 | 21 | @JsonValue 22 | private final String value; 23 | 24 | private TargetDialects(String value) { 25 | this.value = value; 26 | } 27 | 28 | public String value() { 29 | return value; 30 | } 31 | 32 | public static Optional fromValue(String value) { 33 | for (TargetDialects o: TargetDialects.values()) { 34 | if (Objects.deepEquals(o.value, value)) { 35 | return Optional.of(o); 36 | } 37 | } 38 | return Optional.empty(); 39 | } 40 | } 41 | 42 | -------------------------------------------------------------------------------- /src/main/java/com/styra/opa/openapi/utils/BigDecimalString.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. 3 | */ 4 | package com.styra.opa.openapi.utils; 5 | 6 | import java.io.IOException; 7 | import java.math.BigDecimal; 8 | import java.util.Objects; 9 | 10 | import com.fasterxml.jackson.core.JacksonException; 11 | import com.fasterxml.jackson.core.JsonGenerator; 12 | import com.fasterxml.jackson.core.JsonParser; 13 | import com.fasterxml.jackson.core.JsonProcessingException; 14 | import com.fasterxml.jackson.databind.DeserializationContext; 15 | import com.fasterxml.jackson.databind.SerializerProvider; 16 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 17 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 18 | import com.fasterxml.jackson.databind.deser.std.StdDeserializer; 19 | import com.fasterxml.jackson.databind.ser.std.StdSerializer; 20 | 21 | // Internal API only 22 | 23 | // Note that Jackson 2.16.1 does not support @JsonValue and @JsonFormat combined so we must use 24 | // a custom serializer/deserializer 25 | 26 | @JsonSerialize(using = BigDecimalString.Serializer.class) 27 | @JsonDeserialize(using = BigDecimalString.Deserializer.class) 28 | public class BigDecimalString { 29 | 30 | private final BigDecimal value; 31 | 32 | public BigDecimalString(BigDecimal value) { 33 | this.value = value; 34 | } 35 | 36 | public BigDecimalString(String value) { 37 | this(new BigDecimal(value)); 38 | } 39 | 40 | public BigDecimal value() { 41 | return value; 42 | } 43 | 44 | @Override 45 | public String toString() { 46 | return value.toString(); 47 | } 48 | 49 | @Override 50 | public int hashCode() { 51 | return Objects.hash(value); 52 | } 53 | 54 | @Override 55 | public boolean equals(Object obj) { 56 | if (this == obj) 57 | return true; 58 | if (obj == null) 59 | return false; 60 | if (getClass() != obj.getClass()) 61 | return false; 62 | BigDecimalString other = (BigDecimalString) obj; 63 | return Objects.equals(value, other.value); 64 | } 65 | 66 | @SuppressWarnings("serial") 67 | public static final class Serializer extends StdSerializer { 68 | 69 | protected Serializer() { 70 | super(BigDecimalString.class); 71 | } 72 | 73 | @Override 74 | public void serialize(BigDecimalString value, JsonGenerator g, SerializerProvider provider) 75 | throws IOException, JsonProcessingException { 76 | g.writeString(value.value.toString()); 77 | } 78 | } 79 | 80 | @SuppressWarnings("serial") 81 | public static final class Deserializer extends StdDeserializer { 82 | 83 | protected Deserializer() { 84 | super(BigDecimalString.class); 85 | } 86 | 87 | @Override 88 | public BigDecimalString deserialize(JsonParser p, DeserializationContext ctxt) 89 | throws IOException, JacksonException { 90 | String s = p.readValueAs(String.class); 91 | return new BigDecimalString(new BigDecimal(s)); 92 | } 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /src/main/java/com/styra/opa/openapi/utils/BigIntegerString.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. 3 | */ 4 | package com.styra.opa.openapi.utils; 5 | 6 | import java.io.IOException; 7 | import java.math.BigInteger; 8 | import java.util.Objects; 9 | 10 | import com.fasterxml.jackson.core.JacksonException; 11 | import com.fasterxml.jackson.core.JsonGenerator; 12 | import com.fasterxml.jackson.core.JsonParser; 13 | import com.fasterxml.jackson.core.JsonProcessingException; 14 | import com.fasterxml.jackson.databind.DeserializationContext; 15 | import com.fasterxml.jackson.databind.SerializerProvider; 16 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 17 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 18 | import com.fasterxml.jackson.databind.deser.std.StdDeserializer; 19 | import com.fasterxml.jackson.databind.ser.std.StdSerializer; 20 | 21 | // Internal API only 22 | 23 | // Note that Jackson 2.16.1 does not support @JsonValue and @JsonFormat combined so we must use 24 | // a custom serializer/deserializer 25 | 26 | @JsonSerialize(using = BigIntegerString.Serializer.class) 27 | @JsonDeserialize(using = BigIntegerString.Deserializer.class) 28 | public class BigIntegerString { 29 | 30 | private final BigInteger value; 31 | 32 | public BigIntegerString(BigInteger value) { 33 | this.value = value; 34 | } 35 | 36 | public BigIntegerString(String value) { 37 | this(new BigInteger(value)); 38 | } 39 | 40 | public BigInteger value() { 41 | return value; 42 | } 43 | 44 | @Override 45 | public String toString() { 46 | return value.toString(); 47 | } 48 | 49 | @Override 50 | public int hashCode() { 51 | return Objects.hash(value); 52 | } 53 | 54 | @Override 55 | public boolean equals(Object obj) { 56 | if (this == obj) 57 | return true; 58 | if (obj == null) 59 | return false; 60 | if (getClass() != obj.getClass()) 61 | return false; 62 | BigIntegerString other = (BigIntegerString) obj; 63 | return Objects.equals(value, other.value); 64 | } 65 | 66 | @SuppressWarnings("serial") 67 | public static final class Serializer extends StdSerializer { 68 | 69 | protected Serializer() { 70 | super(BigIntegerString.class); 71 | } 72 | 73 | @Override 74 | public void serialize(BigIntegerString value, JsonGenerator g, SerializerProvider provider) 75 | throws IOException, JsonProcessingException { 76 | g.writeString(value.value.toString()); 77 | } 78 | } 79 | 80 | @SuppressWarnings("serial") 81 | public static final class Deserializer extends StdDeserializer { 82 | 83 | protected Deserializer() { 84 | super(BigIntegerString.class); 85 | } 86 | 87 | @Override 88 | public BigIntegerString deserialize(JsonParser p, DeserializationContext ctxt) 89 | throws IOException, JacksonException { 90 | String s = p.readValueAs(String.class); 91 | return new BigIntegerString(new BigInteger(s)); 92 | } 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /src/main/java/com/styra/opa/openapi/utils/Constants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. 3 | */ 4 | package com.styra.opa.openapi.utils; 5 | 6 | public final class Constants { 7 | 8 | public static final boolean HAS_CLIENT_CREDENTIALS_BASIC = false; 9 | 10 | } -------------------------------------------------------------------------------- /src/main/java/com/styra/opa/openapi/utils/EventStreamLineReader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. 3 | */ 4 | package com.styra.opa.openapi.utils; 5 | 6 | import java.io.IOException; 7 | import java.io.Reader; 8 | 9 | /** 10 | * Converts CR-LF, LF, CR to LF 11 | */ 12 | public class EventStreamLineReader extends Reader { 13 | 14 | private final Reader reader; 15 | private int lastCh = -1; // not LF nor CR 16 | 17 | public EventStreamLineReader(Reader reader) { 18 | this.reader = reader; 19 | } 20 | 21 | @Override 22 | public int read() throws IOException { 23 | if (lastCh == -1) { 24 | // load first character of stream 25 | lastCh = reader.read(); 26 | if (lastCh == -1 || lastCh == '\n') { 27 | // force reload of buffered last ch 28 | int v = lastCh; 29 | lastCh = -1; 30 | return v; 31 | } 32 | } 33 | int ch = reader.read(); 34 | if (ch == -1) { 35 | if (lastCh == '\r') { 36 | lastCh = -1; 37 | return '\n'; 38 | } else { 39 | int v = lastCh; 40 | lastCh = -1; 41 | return v; 42 | } 43 | } else if (lastCh == '\n') { 44 | lastCh = ch; 45 | return '\n'; 46 | } else if (lastCh == '\r' && ch == '\n') { 47 | // force reload of buffered last ch 48 | lastCh = -1; 49 | return '\n'; 50 | } else if (lastCh == '\r') { 51 | lastCh = ch; 52 | return '\n'; 53 | } else { 54 | int v = lastCh; 55 | lastCh = ch; 56 | return v; 57 | } 58 | } 59 | 60 | @Override 61 | public int read(char[] cbuf, int off, int len) throws IOException { 62 | throw new UnsupportedOperationException(); 63 | } 64 | 65 | @Override 66 | public void close() throws IOException { 67 | reader.close(); 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /src/main/java/com/styra/opa/openapi/utils/EventStreamMessage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. 3 | */ 4 | package com.styra.opa.openapi.utils; 5 | 6 | import java.util.Optional; 7 | 8 | public class EventStreamMessage { 9 | 10 | private final Optional event; 11 | private final Optional id; 12 | private final Optional retryMs; 13 | private final String data; 14 | 15 | public EventStreamMessage(Optional event, Optional id, Optional retryMs, String data) { 16 | if (data == null) { 17 | throw new IllegalArgumentException("data cannot be null"); 18 | } 19 | this.event = event; 20 | this.id = id; 21 | this.retryMs = retryMs; 22 | this.data = data; 23 | } 24 | 25 | public Optional event() { 26 | return event; 27 | } 28 | 29 | public Optional id() { 30 | return id; 31 | } 32 | 33 | public Optional retryMs() { 34 | return retryMs; 35 | } 36 | 37 | public String data() { 38 | return data; 39 | } 40 | 41 | public boolean isEmpty() { 42 | return !event.isPresent() && !id().isPresent() && !retryMs().isPresent() && data.isEmpty(); 43 | } 44 | 45 | @Override 46 | public String toString() { 47 | StringBuilder b = new StringBuilder(); 48 | event.ifPresent(value -> b.append("event: " + value + "\n")); 49 | id.ifPresent(value -> b.append("id: " + value + "\n")); 50 | retryMs.ifPresent(value -> b.append("retry: " + value + "\n")); 51 | if (!data.isEmpty()) { 52 | b.append("data: " + data); 53 | } 54 | return b.toString(); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/com/styra/opa/openapi/utils/FormMetadata.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. 3 | */ 4 | package com.styra.opa.openapi.utils; 5 | 6 | import java.lang.reflect.Field; 7 | 8 | class FormMetadata { 9 | 10 | String style = "form"; 11 | boolean explode = true; 12 | boolean json; 13 | String name; 14 | 15 | private FormMetadata() { 16 | } 17 | 18 | // form:name=propName,style=spaceDelimited,explode=true 19 | static FormMetadata parse(Field field) throws IllegalArgumentException, IllegalAccessException { 20 | return Metadata.parse("form", new FormMetadata(), field); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/styra/opa/openapi/utils/HTTPClient.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. 3 | */ 4 | package com.styra.opa.openapi.utils; 5 | 6 | import java.io.IOException; 7 | import java.io.InputStream; 8 | import java.net.URISyntaxException; 9 | import java.net.http.HttpResponse; 10 | import java.net.http.HttpRequest; 11 | 12 | public interface HTTPClient { 13 | 14 | /** 15 | * Sends an HTTP request and returns the response. 16 | * 17 | *

Note that {@link HttpRequest} is immutable. To modify the request you can use 18 | * {@link HttpRequest#newBuilder(HttpRequest, BiPredicate)} with 19 | * JDK 16 and later (which will copy the request for modification in a builder). 20 | * If that method is not available then use {@link Helpers#copy} (which also returns 21 | * a builder). 22 | * 23 | * @param request HTTP request 24 | * @return HTTP response 25 | * @throws IOException 26 | * @throws InterruptedException 27 | * @throws URISyntaxException 28 | */ 29 | HttpResponse send(HttpRequest request) 30 | throws IOException, InterruptedException, URISyntaxException; 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/styra/opa/openapi/utils/HasSecurity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. 3 | */ 4 | package com.styra.opa.openapi.utils; 5 | 6 | /** 7 | * Implemented by classes that have security annotations on fields. 8 | **/ 9 | public interface HasSecurity { 10 | } -------------------------------------------------------------------------------- /src/main/java/com/styra/opa/openapi/utils/HeaderMetadata.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. 3 | */ 4 | package com.styra.opa.openapi.utils; 5 | 6 | import java.lang.reflect.Field; 7 | 8 | class HeaderMetadata { 9 | 10 | String style = "simple"; 11 | boolean explode; 12 | String name; 13 | 14 | private HeaderMetadata() { 15 | } 16 | 17 | // headerParam:style=simple,explode=false,name=apiID 18 | static HeaderMetadata parse(Field field) throws IllegalArgumentException, IllegalAccessException { 19 | return Metadata.parse("header", new HeaderMetadata(), field); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/styra/opa/openapi/utils/JSON.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. 3 | */ 4 | package com.styra.opa.openapi.utils; 5 | 6 | import org.openapitools.jackson.nullable.JsonNullableModule; 7 | 8 | import com.fasterxml.jackson.databind.DeserializationFeature; 9 | import com.fasterxml.jackson.databind.SerializationFeature; 10 | import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; 11 | import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; 12 | import com.fasterxml.jackson.databind.ObjectMapper; 13 | 14 | public class JSON { 15 | public static ObjectMapper getMapper() { 16 | return new ObjectMapper() 17 | .registerModule(new JavaTimeModule()) 18 | .registerModule(new Jdk8Module()) 19 | .registerModule(new JsonNullableModule()) 20 | .registerModule(Deserializers.STRICT_DESERIALIZERS) 21 | .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) 22 | .configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false) 23 | .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) 24 | .enable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES); 25 | } 26 | } -------------------------------------------------------------------------------- /src/main/java/com/styra/opa/openapi/utils/LazySingletonValue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. 3 | */ 4 | package com.styra.opa.openapi.utils; 5 | 6 | import com.fasterxml.jackson.core.type.TypeReference; 7 | 8 | public final class LazySingletonValue { 9 | 10 | private static final Object NOT_SET = new Object(); 11 | 12 | private final String name; 13 | private final String json; 14 | private final TypeReference typeReference; 15 | private Object value = NOT_SET; 16 | 17 | public LazySingletonValue(String name, String json, TypeReference typeReference) { 18 | this.name = name; 19 | this.json = json; 20 | this.typeReference = typeReference; 21 | } 22 | 23 | @SuppressWarnings("unchecked") 24 | public T value() { 25 | if (value == NOT_SET) { 26 | value = Utils.readDefaultOrConstValue(name, json, typeReference); 27 | } 28 | return (T) value; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/styra/opa/openapi/utils/Metadata.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. 3 | */ 4 | package com.styra.opa.openapi.utils; 5 | 6 | import java.lang.reflect.Field; 7 | import java.util.HashMap; 8 | import java.util.Map; 9 | 10 | final class Metadata { 11 | 12 | private Metadata() { 13 | // prevent instantiation 14 | } 15 | 16 | static T parse(String name, T metadata, Field field) 17 | throws IllegalArgumentException, IllegalAccessException { 18 | SpeakeasyMetadata md = field.getAnnotation(SpeakeasyMetadata.class); 19 | if (md == null) { 20 | return null; 21 | } 22 | 23 | String mdValue = md.value(); 24 | 25 | if (mdValue == null || mdValue.isBlank()) { 26 | return null; 27 | } 28 | 29 | String[] groups = mdValue.split(" "); 30 | 31 | boolean handled = false; 32 | 33 | for (String group : groups) { 34 | String[] parts = group.split(":"); 35 | if (parts.length != 2) { 36 | return null; 37 | } 38 | 39 | if (!parts[0].equals(name)) { 40 | continue; 41 | } 42 | 43 | Map values = new HashMap<>(); 44 | 45 | String[] pairs = parts[1].split(","); 46 | for (String pair : pairs) { 47 | String[] keyVal = pair.split("="); 48 | String key = keyVal[0]; 49 | 50 | String val = ""; 51 | if (keyVal.length > 1) { 52 | val = keyVal[1]; 53 | } 54 | 55 | values.put(key, val); 56 | } 57 | 58 | Field[] fields = metadata.getClass().getDeclaredFields(); 59 | 60 | for (Field f : fields) { 61 | f.setAccessible(true); 62 | if (values.containsKey(f.getName())) { 63 | String val = values.get(f.getName()); 64 | 65 | if (f.getType().equals(boolean.class) || f.getType().equals(Boolean.class)) { 66 | f.set(metadata, val.equals("true") || val.isBlank()); 67 | } else { 68 | f.set(metadata, val); 69 | } 70 | } 71 | } 72 | 73 | handled = true; 74 | } 75 | 76 | if (!handled) { 77 | return null; 78 | } 79 | 80 | return (T) metadata; 81 | } 82 | } -------------------------------------------------------------------------------- /src/main/java/com/styra/opa/openapi/utils/MultipartFormMetadata.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. 3 | */ 4 | package com.styra.opa.openapi.utils; 5 | 6 | import java.lang.reflect.Field; 7 | 8 | class MultipartFormMetadata { 9 | 10 | boolean file; 11 | boolean content; 12 | boolean json; 13 | String name; 14 | 15 | private MultipartFormMetadata() { 16 | } 17 | 18 | // multipartForm:name=file 19 | static MultipartFormMetadata parse(Field field) throws IllegalArgumentException, IllegalAccessException { 20 | return Metadata.parse("multipartForm", new MultipartFormMetadata(), field); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/styra/opa/openapi/utils/NameValue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. 3 | */ 4 | package com.styra.opa.openapi.utils; 5 | 6 | final class NameValue { 7 | private final String name; 8 | private final String value; 9 | 10 | NameValue(String name, String value) { 11 | this.name = name; 12 | this.value = value; 13 | } 14 | 15 | String name() { 16 | return name; 17 | } 18 | 19 | String value() { 20 | return value; 21 | } 22 | } -------------------------------------------------------------------------------- /src/main/java/com/styra/opa/openapi/utils/Options.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. 3 | */ 4 | package com.styra.opa.openapi.utils; 5 | 6 | import java.util.Optional; 7 | import java.util.List; 8 | 9 | public class Options { 10 | 11 | public enum Option { 12 | RETRY_CONFIG; 13 | } 14 | 15 | private Optional retryConfig = Optional.empty(); 16 | 17 | private Options(Optional retryConfig) { 18 | Utils.checkNotNull(retryConfig, "retryConfig"); 19 | this.retryConfig = retryConfig; 20 | } 21 | 22 | public Optional retryConfig() { 23 | return retryConfig; 24 | } 25 | 26 | public final void validate(List