jerryshao commented on code in PR #14907:
URL: https://github.com/apache/gravitino/pull/14907#discussion_r4538222724
##########
core/src/main/java/org/apache/gravitino/listener/api/event/OperationType.java:
##########
@@ -34,6 +34,38 @@ public enum OperationType {
REGISTER_TABLE,
TABLE_EXISTS,
+ // Domain operations
+ /** Domain operation: ListDomains. */
+ LIST_DOMAIN,
+ /** Domain operation: ListDomainsInfo. */
+ LIST_DOMAINS_INFO,
+ /** Domain operation: GetDomain. */
+ GET_DOMAIN,
+ /** Domain operation: CreateDomain. */
+ CREATE_DOMAIN,
+ /** Domain operation: AlterDomain. */
+ ALTER_DOMAIN,
+ /** Domain operation: DeleteDomain. */
+ DELETE_DOMAIN,
+ /** Domain operation: PublishDomain. */
+ PUBLISH_DOMAIN,
+ /** Domain operation: UnpublishDomain. */
+ UNPUBLISH_DOMAIN,
+ /** Domain operation: UpdateDomainBackingTag. */
+ UPDATE_DOMAIN_BACKING_TAG,
+ /** Domain operation: AttachDomain. */
+ ATTACH_DOMAIN,
+ /** Domain operation: DetachDomain. */
+ DETACH_DOMAIN,
+ /** Domain operation: ListSubdomains. */
+ LIST_SUBDOMAIN,
Review Comment:
Fixed in c7fc520e3b. Renamed the enum constant to `LIST_SUBDOMAINS` and
updated the event classes, legacy audit operation, compatibility mapping, and
tests. The related regression tests pass.
##########
core/src/main/java/org/apache/gravitino/GravitinoEnv.java:
##########
@@ -1212,8 +1213,9 @@ private void
initPublicMetadataDispatchers(MetadataOperations metadataOperations
PolicyHookDispatcher policyHookDispatcher = new
PolicyHookDispatcher(internalPolicyDispatcher);
this.policyDispatcher = new PolicyEventDispatcher(eventBus,
policyHookDispatcher);
- // Domain audit events are added separately from lifecycle hooks.
- this.domainDispatcher = new DomainHookDispatcher(internalDomainDispatcher);
+ // Keep events outside lifecycle hooks so hook failures are audited as
well.
+ this.domainDispatcher =
+ new DomainEventDispatcher(eventBus, new
DomainHookDispatcher(internalDomainDispatcher));
Review Comment:
Fixed in c7fc520e3b. Authorization preflight lookups now use
`internalDomainDispatcher()`, so lookup failures no longer suppress the HTTP
audit entry for the actual request. Added regression coverage for both a
missing target domain and a missing requested parent, asserting a PUT failure
audit entry with the request URI and 404 status. Both cases pass.
##########
core/src/main/java/org/apache/gravitino/listener/api/event/domain/AttachDomainEvent.java:
##########
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.gravitino.listener.api.event.domain;
+
+import org.apache.gravitino.annotation.DeveloperApi;
+import org.apache.gravitino.listener.api.event.OperationType;
+import org.apache.gravitino.listener.api.info.DomainInfo;
+import org.apache.gravitino.utils.NameIdentifierUtil;
+
+/** The success event for AttachDomain. */
+@DeveloperApi
+public final class AttachDomainEvent extends DomainEvent {
+ private final String parent;
+ private final DomainInfo domainInfo;
+
+ /**
+ * Creates the event.
+ *
+ * @param user The initiating user.
+ * @param metalake The metalake name.
+ * @param name The domain name addressed by the operation.
+ * @param parent The requested parent name.
+ * @param domainInfo The requested or returned domain snapshot.
+ */
+ public AttachDomainEvent(
+ String user, String metalake, String name, String parent, DomainInfo
domainInfo) {
+ super(user, NameIdentifierUtil.ofDomain(metalake, name));
+ this.parent = parent;
Review Comment:
Fixed in c7fc520e3b. Both `AttachDomainEvent` and `AttachDomainFailureEvent`
now include the requested `parent` in `ownCustomInfo()`. Added formatter
regression coverage using Finance and Risk, asserting that both JSON and text
audit output retain the requested parent for success and failure events. The
tests pass.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]