diff --git a/.github/workflows/shared-build-and-deploy.yml b/.github/workflows/shared-build-and-deploy.yml index 43a54dec..22456b4c 100644 --- a/.github/workflows/shared-build-and-deploy.yml +++ b/.github/workflows/shared-build-and-deploy.yml @@ -38,15 +38,15 @@ jobs: publish: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: ref: ${{ inputs.ref }} fetch-depth: 0 - name: Set up maven or jfrog repository - uses: actions/setup-java@v1 + uses: actions/setup-java@v4 with: - java-version: '1.8' + java-version: '8' distribution: 'adopt' server-id: ${{ inputs.server-id }} server-username: SERVER_USERNAME @@ -98,7 +98,7 @@ jobs: json: ${{ secrets.TEST_CREDENTIALS_FILE_STRING }} - name: Publish package - run: mvn clean deploy -P ${{ inputs.profile }} + run: mvn clean deploy -P ${{ inputs.profile }} -DskipTests env: SERVER_USERNAME: ${{ secrets.server-username }} SERVER_PASSWORD: ${{ secrets.server-password }} diff --git a/README.md b/README.md index efc15e19..80db25f7 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ The [Service Account](https://github.com/skyflowapi/skyflow-java/tree/main/src/m The `generateBearerToken(filepath)` function takes the credentials file path for token generation, alternatively, you can also send the entire credentials as string, by using `generateBearerTokenFromCreds(credentials)` -[Example](https://github.com/skyflowapi/skyflow-java/blob/main/samples/src/main/java/com/example/TokenGenerationExample.java +[Example](https://github.com/skyflowapi/skyflow-java/blob/v1/samples/src/main/java/com/example/TokenGenerationExample.java ): ```java @@ -112,7 +112,7 @@ Context-Aware Authorization enables you to embed context values into a Bearer to The service account generated with `context_id` identifier enabled can be used to generate bearer tokens with `context`, which is a `jwt` claim for a skyflow generated bearer token. The token generated from this service account will have a `context_identifier` claim and is valid for 60 minutes and can be used to make API calls to vault services as well as management API(s) based on the permissions of the service account. -[Example](https://github.com/skyflowapi/skyflow-java/blob/main/samples/src/main/java/com/example/BearerTokenWithContextGenerationExample.java): +[Example](https://github.com/skyflowapi/skyflow-java/blob/v1/samples/src/main/java/com/example/BearerTokenWithContextGenerationExample.java): ``` java import com.skyflow.entities.ResponseToken; @@ -157,13 +157,13 @@ public class BearerTokenWithContextGeneration { Note: - You can pass either a service account key credentials file path or a service account key credentials as string to the `setCredentials` method of the BearerTokenBuilder class. - If you pass both a file path and string to the `setCredentials` method, the last method used takes precedence. -- To generate multiple bearer tokens using a thread, see this [example](https://github.com/skyflowapi/skyflow-java/blob/main/samples/src/main/java/com/example/BearerTokenGenerationUsingThreadsExample.java) +- To generate multiple bearer tokens using a thread, see this [example](https://github.com/skyflowapi/skyflow-java/blob/v1/samples/src/main/java/com/example/BearerTokenGenerationUsingThreadsExample.java) ## Service Account Scoped Bearer Token Generation A service account that has multiple roles can generate bearer tokens with access restricted to a specific role by providing the appropriate `roleID`. Generated bearer tokens are valid for 60 minutes and can only perform operations with the permissions associated with the specified role. -[Example](https://github.com/skyflowapi/skyflow-java/blob/main/samples/src/main/java/com/example/ScopedTokenGenerationExample.java): +[Example](https://github.com/skyflowapi/skyflow-java/blob/v1/samples/src/main/java/com/example/ScopedTokenGenerationExample.java): ```java import java.io.File; @@ -197,7 +197,7 @@ Note: Skyflow generates data tokens when sensitive data is inserted into the vault. These data tokens can be digitally signed with the private key of the service account credentials, which adds an additional layer of protection. Signed tokens can be detokenized by passing the signed data token and a bearer token generated from service account credentials. The service account must have appropriate permissions and context to detokenize the signed data tokens. -[Example](https://github.com/skyflowapi/skyflow-java/blob/main/samples/src/main/java/com/example/SignedTokenGenerationExample.java): +[Example](https://github.com/skyflowapi/skyflow-java/blob/v1/samples/src/main/java/com/example/SignedTokenGenerationExample.java): ``` java import com.skyflow.errors.SkyflowException; @@ -352,7 +352,7 @@ InsertOptions insertOptions = new InsertOptions( ); ``` -An [example](https://github.com/skyflowapi/skyflow-java/blob/main/samples/src/main/java/com/example/InsertWithUpsertExample.java) of insert call with upsert support +An [example](https://github.com/skyflowapi/skyflow-java/blob/v1/samples/src/main/java/com/example/InsertWithUpsertExample.java) of insert call with upsert support ```java JSONObject recordsJson = new JSONObject(); JSONArray recordsArrayJson = new JSONArray(); @@ -398,7 +398,7 @@ Sample insert Response } ``` -An [example](https://github.com/skyflowapi/skyflow-java/blob/main/samples/src/main/java/com/example/InsertWithContinueOnErrorExample.java) of Insert call with `continueOnError` support: +An [example](https://github.com/skyflowapi/skyflow-java/blob/v1/samples/src/main/java/com/example/InsertWithContinueOnErrorExample.java) of Insert call with `continueOnError` support: ```java JSONObject records = new JSONObject(); JSONArray recordsArray = new JSONArray(); @@ -494,7 +494,7 @@ InsertBulkOptions insertOptions = new InsertBulkOptions( upsertOptions ); ``` -An [example]() of insert call with upsert support: +An [example](samples/src/main/java/com/example/InsertBulkWithUpsertExample.java) of insert call with upsert support: ```java JSONObject recordsJson = new JSONObject(); @@ -541,7 +541,7 @@ Sample insert Response } ``` -An [example]() of Insert using bulk call: +An [example](samples/src/main/java/com/example/InsertBulkExample.java) of Insert using bulk call: ```java JSONObject records = new JSONObject(); JSONArray recordsArray = new JSONArray(); @@ -622,7 +622,7 @@ recordsJson.put("records", recordsArrayJson); Note: `redaction` defaults to [`RedactionType.PLAIN_TEXT`](#redaction-types). -The following [example](https://github.com/skyflowapi/skyflow-java/blob/main/samples/src/main/java/com/example/DetokenizeExample.java) code makes a detokenize call to reveal the masked value of a token: +The following [example](https://github.com/skyflowapi/skyflow-java/blob/v1/samples/src/main/java/com/example/DetokenizeExample.java) code makes a detokenize call to reveal the masked value of a token: ```java JSONObject recordsJson = new JSONObject(); @@ -771,7 +771,7 @@ There are four accepted values for RedactionType: * `DEFAULT` ### Examples -An [example](https://github.com/skyflowapi/skyflow-java/blob/main/samples/src/main/java/com/example/GetExample.java) call using Skyflow IDs with RedactionType. +An [example](https://github.com/skyflowapi/skyflow-java/blob/v1/samples/src/main/java/com/example/GetExample.java) call using Skyflow IDs with RedactionType. ```java import com.skyflow.entities.RedactionType; @@ -918,7 +918,7 @@ Sample response: ] } ``` -An [example](https://github.com/skyflowapi/skyflow-java/blob/main/samples/src/main/java/com/example/GetExample.java) call using column names and values. +An [example](https://github.com/skyflowapi/skyflow-java/blob/v1/samples/src/main/java/com/example/GetExample.java) call using column names and values. ```java import com.skyflow.entities.RedactionType; @@ -1025,7 +1025,7 @@ There are 4 accepted values in RedactionType: - `REDACTED` - `DEFAULT` -An [example](https://github.com/skyflowapi/skyflow-java/blob/main/samples/src/main/java/com/example/GetByIdExample.java) getById call +An [example](https://github.com/skyflowapi/skyflow-java/blob/v1/samples/src/main/java/com/example/GetByIdExample.java) getById call ```java import com.skyflow.entities.RedactionType; @@ -1118,7 +1118,7 @@ records.put("records", recordsArray); UpdateOptions updateOptions = new UpdateOptions(true); ``` -An [example](https://github.com/skyflowapi/skyflow-java/blob/main/samples/src/main/java/com/example/UpdateExample.java) of update call: +An [example](https://github.com/skyflowapi/skyflow-java/blob/v1/samples/src/main/java/com/example/UpdateExample.java) of update call: ```java JSONObject records = new JSONObject(); JSONArray recordsArray = new JSONArray(); @@ -1255,7 +1255,7 @@ invokeConfig.put("requestBody", requestBodyJson); **pathParams, queryParams, requestHeader, requestBody** are the JSON objects that will be sent through the connection integration url. -An [example](https://github.com/skyflowapi/skyflow-java/blob/main/samples/src/main/java/com/example/InvokeConnectionExample.java) of invokeConnection: +An [example](https://github.com/skyflowapi/skyflow-java/blob/v1/samples/src/main/java/com/example/InvokeConnectionExample.java) of invokeConnection: ```java JSONObject invokeConfig = new JSONObject(); invokeConfig.put("connectionURL", ""); @@ -1305,7 +1305,7 @@ skyflowClient.query(queryInput); ``` See [Query your data](https://docs.skyflow.com/query-data/) and [Execute Query](https://docs.skyflow.com/record/#QueryService_ExecuteQuery) for guidelines and restrictions on supported SQL statements, operators, and keywords. -An [example](https://github.com/skyflowapi/skyflow-java/blob/main/samples/src/main/java/com/example/QueryExample.java) of query call: +An [example](https://github.com/skyflowapi/skyflow-java/blob/v1/samples/src/main/java/com/example/QueryExample.java) of query call: ```java JSONObject queryInput = new JSONObject(); queryInput.put("query", "SELECT * FROM cards WHERE skyflow_id='3ea3861-x107-40w8-la98-106sp08ea83f'"); diff --git a/docs/migrate_to_v2.md b/docs/migrate_to_v2.md index 671210fd..fe996e1b 100644 --- a/docs/migrate_to_v2.md +++ b/docs/migrate_to_v2.md @@ -4,6 +4,19 @@ This guide covers the steps to migrate the Skyflow Java SDK from v1 to v2. --- +## Breaking Changes from V1 to V2 + +| Area | V1 | V2 | +|------|----|----| +| **Client initialization** | `TokenProvider` / `vaultURL` pattern | `Credentials` + `VaultConfig` passed to `Skyflow.builder()` | +| **Vault URL** | Single `vaultURL` string | Split into `vaultId` + `clusterId` | +| **Request/response types** | Raw JSON (`JSONObject`) | Typed objects (e.g. `InsertRequest` / `InsertResponse`) | +| **Error handling** | Basic error message | Restructured with `httpStatus`, `details`, and `requestId` | +| **Logging** | Global log level | Per-instance `logLevel` set via `Skyflow.builder().setLogLevel(LogLevel.INFO)` | +| **Import paths** | `com.skyflow.vault.*` | New module structure across all packages | + +--- + ## Authentication options In V2, multiple authentication options are available. You can now provide credentials in the following ways: @@ -55,7 +68,7 @@ skyflowCredentials.setToken(""); > **Notes:** > - Use only ONE authentication method per credentials object. > - API Key or environment variable are recommended for production. -> - For priority order see [Quickstart — Initialize the client](../README.md#initialize-the-client). +> - For priority order see [Quickstart — Initialize the client](https://github.com/skyflowapi/skyflow-java/blob/main/README.md#initialize-the-client). ---