-
Notifications
You must be signed in to change notification settings - Fork 906
[#12297] feat(secret): Add catalog and schema create-time secrets #12420
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
base: main
Are you sure you want to change the base?
Changes from all commits
b946bd2
0ef0553
e0384fd
b557334
abfc6a0
28d1fff
63a9fb2
cf541f8
4b78ba1
08a4387
bf9ecc9
c9da34a
c32ecdb
4c28c10
761d125
fea00d9
796cd50
c136a49
c44237e
2010fc8
300f240
d5e8785
b4dce2a
b55fc93
e24fe73
b5af53d
603b947
e0b681e
78d2bb9
3527020
6422be2
accb66c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,6 +42,8 @@ | |
| import org.apache.gravitino.dto.responses.DropResponse; | ||
| import org.apache.gravitino.dto.responses.EntityListResponse; | ||
| import org.apache.gravitino.dto.responses.SchemaResponse; | ||
| import org.apache.gravitino.dto.secret.SecretBindingDTO; | ||
| import org.apache.gravitino.dto.secret.SecretReferenceDTO; | ||
| import org.apache.gravitino.exceptions.NoSuchCatalogException; | ||
| import org.apache.gravitino.exceptions.NoSuchPolicyException; | ||
| import org.apache.gravitino.exceptions.NoSuchSchemaException; | ||
|
|
@@ -56,6 +58,8 @@ | |
| import org.apache.gravitino.policy.Policy; | ||
| import org.apache.gravitino.policy.SupportsPolicies; | ||
| import org.apache.gravitino.rest.RESTUtils; | ||
| import org.apache.gravitino.secret.SecretBinding; | ||
| import org.apache.gravitino.secret.SecretReference; | ||
| import org.apache.gravitino.tag.SupportsTags; | ||
| import org.apache.gravitino.tag.Tag; | ||
|
|
||
|
|
@@ -167,7 +171,7 @@ public String[] listSchemas(String parentSchema) | |
| } | ||
|
|
||
| /** | ||
| * Create a new schema with specified identifier, comment and metadata. | ||
| * Create a new schema with specified identifier, comment and properties. | ||
| * | ||
| * @param schemaName The name identifier of the schema. | ||
| * @param comment The comment of the schema. | ||
|
|
@@ -179,8 +183,40 @@ public String[] listSchemas(String parentSchema) | |
| @Override | ||
| public Schema createSchema(String schemaName, String comment, Map<String, String> properties) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do u modify the method signature? We should keep backwards compatibility.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you for your review. This issue has been fixed. |
||
| throws NoSuchCatalogException, SchemaAlreadyExistsException { | ||
| return createSchema( | ||
| schemaName, comment, properties, Collections.emptyMap(), Collections.emptyMap()); | ||
| } | ||
|
|
||
| /** | ||
| * Create a new schema with specified identifier, comment, properties, and optional secret maps. | ||
| * | ||
| * @param schemaName The name identifier of the schema. | ||
| * @param comment The comment of the schema. | ||
| * @param properties The properties of the schema. | ||
| * @param secretBindings Optional property key → binding ({@code provider} + {@code plaintext}) | ||
| * for write-through. | ||
| * @param secretReferences Optional property key → secret locator ({@code provider} plus | ||
| * provider-specific attributes). | ||
| * @return The created {@link Schema}. | ||
| * @throws NoSuchCatalogException if the catalog with specified namespace does not exist. | ||
| * @throws SchemaAlreadyExistsException if the schema with specified identifier already exists. | ||
| */ | ||
| @Override | ||
| public Schema createSchema( | ||
| String schemaName, | ||
| String comment, | ||
| Map<String, String> properties, | ||
| Map<String, SecretBinding> secretBindings, | ||
| Map<String, SecretReference> secretReferences) | ||
| throws NoSuchCatalogException, SchemaAlreadyExistsException { | ||
|
|
||
| SchemaCreateRequest req = new SchemaCreateRequest(schemaName, comment, properties); | ||
| SchemaCreateRequest req = | ||
| new SchemaCreateRequest( | ||
| schemaName, | ||
| comment, | ||
| properties, | ||
| SecretBindingDTO.fromSecretBindings(secretBindings), | ||
| SecretReferenceDTO.fromSecretReferences(secretReferences)); | ||
| req.validate(); | ||
|
|
||
| SchemaResponse resp = | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,7 @@ | |
|
|
||
| import com.google.common.base.Preconditions; | ||
| import com.google.common.collect.Sets; | ||
| import java.util.Collections; | ||
| import java.util.List; | ||
| import java.util.Map; | ||
| import java.util.Optional; | ||
|
|
@@ -67,6 +68,8 @@ | |
| import org.apache.gravitino.policy.PolicyChange; | ||
| import org.apache.gravitino.policy.PolicyContent; | ||
| import org.apache.gravitino.policy.PolicyOperations; | ||
| import org.apache.gravitino.secret.SecretBinding; | ||
| import org.apache.gravitino.secret.SecretReference; | ||
| import org.apache.gravitino.tag.Tag; | ||
| import org.apache.gravitino.tag.TagChange; | ||
| import org.apache.gravitino.tag.TagOperations; | ||
|
|
@@ -139,7 +142,29 @@ public Catalog createCatalog( | |
| String comment, | ||
| Map<String, String> properties) | ||
| throws NoSuchMetalakeException, CatalogAlreadyExistsException { | ||
| return getMetalake().createCatalog(catalogName, type, provider, comment, properties); | ||
| return createCatalog( | ||
| catalogName, | ||
| type, | ||
| provider, | ||
| comment, | ||
| properties, | ||
| Collections.emptyMap(), | ||
| Collections.emptyMap()); | ||
| } | ||
|
|
||
| @Override | ||
| public Catalog createCatalog( | ||
| String catalogName, | ||
| Catalog.Type type, | ||
| String provider, | ||
| String comment, | ||
| Map<String, String> properties, | ||
| Map<String, SecretBinding> secretBindings, | ||
| Map<String, SecretReference> secretReferences) | ||
| throws NoSuchMetalakeException, CatalogAlreadyExistsException { | ||
| return getMetalake() | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you for your review. This issue has been fixed. |
||
| .createCatalog( | ||
| catalogName, type, provider, comment, properties, secretBindings, secretReferences); | ||
| } | ||
|
|
||
| @Override | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got. Use 'Creating xxx with secrets is not supported' instead.(Consistent with the original code of the project)