Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for dbutils.secrets #132

Merged
merged 15 commits into from
Aug 16, 2023
2 changes: 1 addition & 1 deletion .codegen/_openapi_sha
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1e3533f94335f0e6c5d9262bc1fea95b3ddcb0e1
b799a600ccf37b0776d99c315614f0d0f0f0ce54
3 changes: 2 additions & 1 deletion .codegen/workspace.java.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ import com.databricks.sdk.core.DatabricksConfig;
defined in an outer scope (https://github.com/golang/go/issues/17454). */ -}}
import com.databricks.sdk.mixin.ClustersExt;
import com.databricks.sdk.mixin.DbfsExt;
import com.databricks.sdk.mixin.SecretsExt;
{{range .Services}}{{if not .IsAccounts}}
import com.databricks.sdk.service.{{.Package.Name}}.{{.PascalName}}API;
import com.databricks.sdk.service.{{.Package.Name}}.{{.PascalName}}Service;
{{end}}{{end}}
import com.databricks.sdk.support.Generated;

{{- define "api" -}}
{{- $mixins := dict "ClustersAPI" "ClustersExt" "DbfsAPI" "DbfsExt" -}}
{{- $mixins := dict "ClustersAPI" "ClustersExt" "DbfsAPI" "DbfsExt" "SecretsAPI" "SecretsExt" -}}
{{- $genApi := concat .PascalName "API" -}}
{{- getOrDefault $mixins $genApi $genApi -}}
{{- end -}}
Expand Down
21 changes: 18 additions & 3 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/AccountsSto
databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/AccountsUpdateMetastore.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/AccountsUpdateMetastoreAssignment.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/AccountsUpdateStorageCredential.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/ArtifactAllowlistInfo.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/ArtifactAllowlistsAPI.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/ArtifactAllowlistsImpl.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/ArtifactAllowlistsService.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/ArtifactMatcher.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/ArtifactType.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/AwsIamRole.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/AzureManagedIdentity.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/AzureServicePrincipal.java linguist-generated=true
Expand Down Expand Up @@ -104,12 +110,12 @@ databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/DeltaRuntim
databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/Dependency.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/DisableRequest.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/DisableSchemaName.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/EffectiveAutoMaintenanceFlag.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/EffectiveAutoMaintenanceFlagInheritedFromType.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/EffectivePermissionsList.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/EffectivePredictiveOptimizationFlag.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/EffectivePredictiveOptimizationFlagInheritedFromType.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/EffectivePrivilege.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/EffectivePrivilegeAssignment.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/EnableAutoMaintenance.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/EnablePredictiveOptimization.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/EnableRequest.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/EnableSchemaName.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/EncryptionDetails.java linguist-generated=true
Expand All @@ -133,6 +139,7 @@ databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/FunctionsSe
databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/GetAccountMetastoreAssignmentRequest.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/GetAccountMetastoreRequest.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/GetAccountStorageCredentialRequest.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/GetArtifactAllowlistRequest.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/GetCatalogRequest.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/GetConnectionRequest.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/GetEffectiveRequest.java linguist-generated=true
Expand Down Expand Up @@ -169,6 +176,7 @@ databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/ListTablesR
databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/ListTablesResponse.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/ListVolumesRequest.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/ListVolumesResponseContent.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/MatchType.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/MetastoreAssignment.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/MetastoreInfo.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/MetastoreInfoDeltaSharingScope.java linguist-generated=true
Expand All @@ -191,6 +199,7 @@ databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/SchemasServ
databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/SecurableOptionsMap.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/SecurablePropertiesMap.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/SecurableType.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/SetArtifactAllowlist.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/SseEncryptionDetails.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/SseEncryptionDetailsAlgorithm.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/catalog/StorageCredentialInfo.java linguist-generated=true
Expand Down Expand Up @@ -724,6 +733,8 @@ databricks-sdk-java/src/main/java/com/databricks/sdk/service/ml/DeleteModelTagRe
databricks-sdk-java/src/main/java/com/databricks/sdk/service/ml/DeleteModelVersionRequest.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/ml/DeleteModelVersionTagRequest.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/ml/DeleteRun.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/ml/DeleteRuns.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/ml/DeleteRunsResponse.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/ml/DeleteTag.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/ml/DeleteTransitionRequestRequest.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/ml/DeleteTransitionRequestStage.java linguist-generated=true
Expand Down Expand Up @@ -812,6 +823,8 @@ databricks-sdk-java/src/main/java/com/databricks/sdk/service/ml/RenameModelReque
databricks-sdk-java/src/main/java/com/databricks/sdk/service/ml/RenameModelResponse.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/ml/RestoreExperiment.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/ml/RestoreRun.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/ml/RestoreRuns.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/ml/RestoreRunsResponse.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/ml/Run.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/ml/RunData.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/ml/RunInfo.java linguist-generated=true
Expand Down Expand Up @@ -1378,6 +1391,8 @@ databricks-sdk-java/src/main/java/com/databricks/sdk/service/workspace/GetRepoPe
databricks-sdk-java/src/main/java/com/databricks/sdk/service/workspace/GetRepoPermissionLevelsResponse.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/workspace/GetRepoPermissionsRequest.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/workspace/GetRepoRequest.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/workspace/GetSecretRequest.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/workspace/GetSecretResponse.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/workspace/GetStatusRequest.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/workspace/GetWorkspaceObjectPermissionLevelsRequest.java linguist-generated=true
databricks-sdk-java/src/main/java/com/databricks/sdk/service/workspace/GetWorkspaceObjectPermissionLevelsResponse.java linguist-generated=true
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.databricks.sdk.mixin;

import com.databricks.sdk.core.ApiClient;
import com.databricks.sdk.service.workspace.*;
import java.util.Base64;

/** Remote equivalent of secrets util. */
public class SecretsExt extends SecretsAPI {

public SecretsExt(ApiClient apiClient) {
super(apiClient);
}

public SecretsExt(SecretsService mock) {
super(mock);
}

/** Gets the bytes representation of a secret value for the specified scope and key. */
public byte[] getBytes(String scope, String key) {
GetSecretResponse response = this.getSecret(scope, key);
return Base64.getDecoder().decode(response.getValue());
}

/** Gets the string representation of a secret value for the specified secrets scope and key. */
public String get(String scope, String key) {
byte[] val = this.getBytes(scope, key);
return new String(val);
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading