You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by st...@apache.org on 2016/03/30 21:51:19 UTC
[5/7] ambari git commit: AMBARI-15241. Basic Operational Audit
Logging. (Daniel Gergely via stoader)
http://git-wip-us.apache.org/repos/asf/ambari/blob/46a34ccd/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ClientConfigDownloadRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ClientConfigDownloadRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ClientConfigDownloadRequestAuditEvent.java
new file mode 100644
index 0000000..fd4071a
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ClientConfigDownloadRequestAuditEvent.java
@@ -0,0 +1,100 @@
+/*
+ * 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.ambari.server.audit.event.request;
+
+import javax.annotation.concurrent.Immutable;
+
+import org.apache.ambari.server.audit.request.RequestAuditEvent;
+
+/**
+ * Audit event for downloading client config for a component
+ */
+@Immutable
+public class ClientConfigDownloadRequestAuditEvent extends RequestAuditEvent {
+
+ public static class ClientConfigDownloadRequestAuditEventBuilder extends RequestAuditEventBuilder<ClientConfigDownloadRequestAuditEvent, ClientConfigDownloadRequestAuditEventBuilder> {
+
+ /**
+ * Service name
+ */
+ private String service;
+
+ /**
+ * Component name
+ */
+ private String component;
+
+ public ClientConfigDownloadRequestAuditEventBuilder() {
+ super.withOperation("Client config download");
+ }
+
+ @Override
+ protected ClientConfigDownloadRequestAuditEvent newAuditEvent() {
+ return new ClientConfigDownloadRequestAuditEvent(this);
+ }
+
+ /**
+ * Appends to the event the details of the incoming request.
+ *
+ * @param builder builder for the audit event details.
+ */
+ @Override
+ protected void buildAuditMessage(StringBuilder builder) {
+ super.buildAuditMessage(builder);
+
+ builder.append(", Service(")
+ .append(service)
+ .append("), Component(")
+ .append(component)
+ .append(")");
+
+ }
+
+ public ClientConfigDownloadRequestAuditEventBuilder withService(String service) {
+ this.service = service;
+ return this;
+ }
+
+ public ClientConfigDownloadRequestAuditEventBuilder withComponent(String component) {
+ this.component = component;
+ return this;
+ }
+
+ }
+
+ protected ClientConfigDownloadRequestAuditEvent() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected ClientConfigDownloadRequestAuditEvent(ClientConfigDownloadRequestAuditEventBuilder builder) {
+ super(builder);
+ }
+
+ /**
+ * Returns an builder for {@link ClientConfigDownloadRequestAuditEvent}
+ *
+ * @return a builder instance
+ */
+ public static ClientConfigDownloadRequestAuditEventBuilder builder() {
+ return new ClientConfigDownloadRequestAuditEventBuilder();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/46a34ccd/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ClusterNameChangeRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ClusterNameChangeRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ClusterNameChangeRequestAuditEvent.java
new file mode 100644
index 0000000..c4ad139
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ClusterNameChangeRequestAuditEvent.java
@@ -0,0 +1,91 @@
+/*
+ * 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.ambari.server.audit.event.request;
+
+import org.apache.ambari.server.audit.request.RequestAuditEvent;
+
+/**
+ * Base class for start operation audit events.
+ */
+public class ClusterNameChangeRequestAuditEvent extends RequestAuditEvent {
+
+ public static class ClusterNameChangeRequestAuditEventBuilder extends RequestAuditEventBuilder<ClusterNameChangeRequestAuditEvent, ClusterNameChangeRequestAuditEventBuilder> {
+
+ private String oldName;
+
+ private String newName;
+
+ public ClusterNameChangeRequestAuditEventBuilder() {
+ super.withOperation("Cluster name change");
+ }
+
+ @Override
+ protected ClusterNameChangeRequestAuditEvent newAuditEvent() {
+ return new ClusterNameChangeRequestAuditEvent(this);
+ }
+
+ /**
+ * Appends to the event the details of the incoming request.
+ *
+ * @param builder builder for the audit event details.
+ */
+ @Override
+ protected void buildAuditMessage(StringBuilder builder) {
+ super.buildAuditMessage(builder);
+
+ builder
+ .append(", Old name(")
+ .append(oldName)
+ .append("), New name(")
+ .append(newName)
+ .append(")");
+ }
+
+ public ClusterNameChangeRequestAuditEventBuilder withOldName(String oldName) {
+ this.oldName = oldName;
+ return this;
+ }
+
+ public ClusterNameChangeRequestAuditEventBuilder withNewName(String newName) {
+ this.newName = newName;
+ return this;
+ }
+
+ }
+
+ protected ClusterNameChangeRequestAuditEvent() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected ClusterNameChangeRequestAuditEvent(ClusterNameChangeRequestAuditEventBuilder builder) {
+ super(builder);
+ }
+
+ /**
+ * Returns an builder for {@link ClusterNameChangeRequestAuditEvent}
+ *
+ * @return a builder instance
+ */
+ public static ClusterNameChangeRequestAuditEventBuilder builder() {
+ return new ClusterNameChangeRequestAuditEventBuilder();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/46a34ccd/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ClusterPrivilegeChangeRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ClusterPrivilegeChangeRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ClusterPrivilegeChangeRequestAuditEvent.java
new file mode 100644
index 0000000..cc59038
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ClusterPrivilegeChangeRequestAuditEvent.java
@@ -0,0 +1,126 @@
+/*
+ * 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.ambari.server.audit.event.request;
+
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.annotation.concurrent.Immutable;
+
+import org.apache.ambari.server.audit.request.RequestAuditEvent;
+import org.apache.commons.lang.StringUtils;
+
+/**
+ * Audit event for changing cluster privilege
+ */
+@Immutable
+public class ClusterPrivilegeChangeRequestAuditEvent extends RequestAuditEvent {
+
+ public static class ClusterPrivilegeChangeRequestAuditEventBuilder extends RequestAuditEventBuilder<ClusterPrivilegeChangeRequestAuditEvent, ClusterPrivilegeChangeRequestAuditEventBuilder> {
+
+ /**
+ * Roles for users
+ * username -> list of roles
+ */
+ private Map<String, List<String>> users;
+
+ /**
+ * Roles for groups
+ * groupname -> list fo roles
+ */
+ private Map<String, List<String>> groups;
+
+ public ClusterPrivilegeChangeRequestAuditEventBuilder() {
+ super.withOperation("Role change");
+ }
+
+ @Override
+ protected ClusterPrivilegeChangeRequestAuditEvent newAuditEvent() {
+ return new ClusterPrivilegeChangeRequestAuditEvent(this);
+ }
+
+ /**
+ * Appends to the event the details of the incoming request.
+ *
+ * @param builder builder for the audit event details.
+ */
+ @Override
+ protected void buildAuditMessage(StringBuilder builder) {
+ super.buildAuditMessage(builder);
+
+ Set<String> roleSet = new HashSet<String>();
+ roleSet.addAll(users.keySet());
+ roleSet.addAll(groups.keySet());
+
+ builder.append(", Roles(");
+ if (!users.isEmpty() || !groups.isEmpty()) {
+ builder.append(System.lineSeparator());
+ }
+
+ List<String> lines = new LinkedList<String>();
+
+ for (String role : roleSet) {
+ lines.add(role + ": ");
+ if (users.get(role) != null && !users.get(role).isEmpty()) {
+ lines.add(" Users: " + StringUtils.join(users.get(role), ", "));
+ }
+ if (groups.get(role) != null && !groups.get(role).isEmpty()) {
+ lines.add(" Groups: " + StringUtils.join(groups.get(role), ", "));
+ }
+ }
+
+ builder.append(StringUtils.join(lines, System.lineSeparator()));
+
+ builder.append(")");
+ }
+
+ public ClusterPrivilegeChangeRequestAuditEventBuilder withUsers(Map<String, List<String>> users) {
+ this.users = users;
+ return this;
+ }
+
+ public ClusterPrivilegeChangeRequestAuditEventBuilder withGroups(Map<String, List<String>> groups) {
+ this.groups = groups;
+ return this;
+ }
+ }
+
+ protected ClusterPrivilegeChangeRequestAuditEvent() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected ClusterPrivilegeChangeRequestAuditEvent(ClusterPrivilegeChangeRequestAuditEventBuilder builder) {
+ super(builder);
+ }
+
+ /**
+ * Returns an builder for {@link ClusterPrivilegeChangeRequestAuditEvent}
+ *
+ * @return a builder instance
+ */
+ public static ClusterPrivilegeChangeRequestAuditEventBuilder builder() {
+ return new ClusterPrivilegeChangeRequestAuditEventBuilder();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/46a34ccd/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ConfigurationChangeRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ConfigurationChangeRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ConfigurationChangeRequestAuditEvent.java
new file mode 100644
index 0000000..d24c623
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ConfigurationChangeRequestAuditEvent.java
@@ -0,0 +1,101 @@
+/*
+ * 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.ambari.server.audit.event.request;
+
+import javax.annotation.concurrent.Immutable;
+
+import org.apache.ambari.server.audit.request.RequestAuditEvent;
+
+/**
+ * Audit event for configuration change
+ */
+@Immutable
+public class ConfigurationChangeRequestAuditEvent extends RequestAuditEvent {
+
+ public static class ConfigurationChangeRequestAuditEventBuilder extends RequestAuditEventBuilder<ConfigurationChangeRequestAuditEvent, ConfigurationChangeRequestAuditEventBuilder> {
+
+ /**
+ * Version number of the new version
+ */
+ private String versionNumber;
+
+ /**
+ * Version note for the new version
+ */
+ private String versionNote;
+
+ public ConfigurationChangeRequestAuditEventBuilder() {
+ super.withOperation("Configuration change");
+ }
+
+ @Override
+ protected ConfigurationChangeRequestAuditEvent newAuditEvent() {
+ return new ConfigurationChangeRequestAuditEvent(this);
+ }
+
+ /**
+ * Appends to the event the details of the incoming request.
+ *
+ * @param builder builder for the audit event details.
+ */
+ @Override
+ protected void buildAuditMessage(StringBuilder builder) {
+ super.buildAuditMessage(builder);
+
+ builder
+ .append(", VersionNumber(V")
+ .append(versionNumber)
+ .append("), ")
+ .append("VersionNote(")
+ .append(versionNote)
+ .append(")");
+ }
+
+ public ConfigurationChangeRequestAuditEventBuilder withVersionNumber(String versionNumber) {
+ this.versionNumber = versionNumber;
+ return this;
+ }
+
+ public ConfigurationChangeRequestAuditEventBuilder withVersionNote(String versionNote) {
+ this.versionNote = versionNote;
+ return this;
+ }
+
+ }
+
+ protected ConfigurationChangeRequestAuditEvent() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected ConfigurationChangeRequestAuditEvent(ConfigurationChangeRequestAuditEventBuilder builder) {
+ super(builder);
+ }
+
+ /**
+ * Returns an builder for {@link ConfigurationChangeRequestAuditEvent}
+ *
+ * @return a builder instance
+ */
+ public static ConfigurationChangeRequestAuditEventBuilder builder() {
+ return new ConfigurationChangeRequestAuditEventBuilder();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/46a34ccd/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/CreateGroupRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/CreateGroupRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/CreateGroupRequestAuditEvent.java
new file mode 100644
index 0000000..5b4558c
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/CreateGroupRequestAuditEvent.java
@@ -0,0 +1,88 @@
+/*
+ * 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.ambari.server.audit.event.request;
+
+import javax.annotation.concurrent.Immutable;
+
+import org.apache.ambari.server.audit.request.RequestAuditEvent;
+
+/**
+ * Audit event for creating a group
+ */
+@Immutable
+public class CreateGroupRequestAuditEvent extends RequestAuditEvent {
+
+ public static class CreateGroupRequestAuditEventBuilder extends RequestAuditEventBuilder<CreateGroupRequestAuditEvent, CreateGroupRequestAuditEventBuilder> {
+
+ /**
+ * NAme of the created group
+ */
+ private String groupName;
+
+ public CreateGroupRequestAuditEventBuilder() {
+ super.withOperation("Group creation");
+ }
+
+ @Override
+ protected CreateGroupRequestAuditEvent newAuditEvent() {
+ return new CreateGroupRequestAuditEvent(this);
+ }
+
+ /**
+ * Appends to the event the details of the incoming request.
+ *
+ * @param builder builder for the audit event details.
+ */
+ @Override
+ protected void buildAuditMessage(StringBuilder builder) {
+ super.buildAuditMessage(builder);
+
+ builder
+ .append(", Group(")
+ .append(groupName)
+ .append(")");
+ }
+
+ public CreateGroupRequestAuditEventBuilder withGroupName(String groupName) {
+ this.groupName = groupName;
+ return this;
+ }
+
+ }
+
+ protected CreateGroupRequestAuditEvent() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected CreateGroupRequestAuditEvent(CreateGroupRequestAuditEventBuilder builder) {
+ super(builder);
+ }
+
+ /**
+ * Returns an builder for {@link CreateGroupRequestAuditEvent}
+ *
+ * @return a builder instance
+ */
+ public static CreateGroupRequestAuditEventBuilder builder() {
+ return new CreateGroupRequestAuditEventBuilder();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/46a34ccd/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/CreateUserRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/CreateUserRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/CreateUserRequestAuditEvent.java
new file mode 100644
index 0000000..95a5825
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/CreateUserRequestAuditEvent.java
@@ -0,0 +1,113 @@
+/*
+ * 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.ambari.server.audit.event.request;
+
+import javax.annotation.concurrent.Immutable;
+
+import org.apache.ambari.server.audit.request.RequestAuditEvent;
+
+/**
+ * Audit event for creating a user
+ */
+@Immutable
+public class CreateUserRequestAuditEvent extends RequestAuditEvent {
+
+ public static class CreateUserRequestAuditEventBuilder extends RequestAuditEventBuilder<CreateUserRequestAuditEvent, CreateUserRequestAuditEventBuilder> {
+
+ /**
+ * Is the user admin
+ */
+ private boolean admin;
+
+ /**
+ * Is the user active
+ */
+ private boolean active;
+
+ /**
+ * Username
+ */
+ private String username;
+
+ public CreateUserRequestAuditEventBuilder() {
+ super.withOperation("User creation");
+ }
+
+ @Override
+ protected CreateUserRequestAuditEvent newAuditEvent() {
+ return new CreateUserRequestAuditEvent(this);
+ }
+
+ /**
+ * Appends to the event the details of the incoming request.
+ *
+ * @param builder builder for the audit event details.
+ */
+ @Override
+ protected void buildAuditMessage(StringBuilder builder) {
+ super.buildAuditMessage(builder);
+
+ builder
+ .append(", Created Username(")
+ .append(username)
+ .append("), Active(")
+ .append(active ? "yes" : "no")
+ .append("), ")
+ .append("Administrator(")
+ .append(admin ? "yes" : "no")
+ .append(")");
+ }
+
+ public CreateUserRequestAuditEventBuilder withAdmin(boolean admin) {
+ this.admin = admin;
+ return this;
+ }
+
+ public CreateUserRequestAuditEventBuilder withActive(boolean active) {
+ this.active = active;
+ return this;
+ }
+
+ public CreateUserRequestAuditEventBuilder withCreatedUsername(String username) {
+ this.username = username;
+ return this;
+ }
+
+ }
+
+ protected CreateUserRequestAuditEvent() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected CreateUserRequestAuditEvent(CreateUserRequestAuditEventBuilder builder) {
+ super(builder);
+ }
+
+ /**
+ * Returns an builder for {@link CreateUserRequestAuditEvent}
+ *
+ * @return a builder instance
+ */
+ public static CreateUserRequestAuditEventBuilder builder() {
+ return new CreateUserRequestAuditEventBuilder();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/46a34ccd/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteAlertGroupRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteAlertGroupRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteAlertGroupRequestAuditEvent.java
new file mode 100644
index 0000000..d78886b
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteAlertGroupRequestAuditEvent.java
@@ -0,0 +1,86 @@
+/*
+ * 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.ambari.server.audit.event.request;
+
+import javax.annotation.concurrent.Immutable;
+
+import org.apache.ambari.server.audit.request.RequestAuditEvent;
+
+/***
+ * Audit event for alert group deletion
+ */
+@Immutable
+public class DeleteAlertGroupRequestAuditEvent extends RequestAuditEvent {
+
+ public static class DeleteAlertGroupRequestAuditEventBuilder extends RequestAuditEventBuilder<DeleteAlertGroupRequestAuditEvent, DeleteAlertGroupRequestAuditEventBuilder> {
+
+ /**
+ * Alert group id
+ */
+ private String id;
+
+ public DeleteAlertGroupRequestAuditEventBuilder() {
+ super.withOperation("Alert group removal");
+ }
+
+ @Override
+ protected DeleteAlertGroupRequestAuditEvent newAuditEvent() {
+ return new DeleteAlertGroupRequestAuditEvent(this);
+ }
+
+ /**
+ * Appends to the event the details of the incoming request.
+ *
+ * @param builder builder for the audit event details.
+ */
+ @Override
+ protected void buildAuditMessage(StringBuilder builder) {
+ super.buildAuditMessage(builder);
+
+ builder.append(", Alert group ID(")
+ .append(id)
+ .append(")");
+ }
+
+ public DeleteAlertGroupRequestAuditEventBuilder withId(String id) {
+ this.id = id;
+ return this;
+ }
+ }
+
+ protected DeleteAlertGroupRequestAuditEvent() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected DeleteAlertGroupRequestAuditEvent(DeleteAlertGroupRequestAuditEventBuilder builder) {
+ super(builder);
+ }
+
+ /**
+ * Returns an builder for {@link DeleteAlertGroupRequestAuditEvent}
+ *
+ * @return a builder instance
+ */
+ public static DeleteAlertGroupRequestAuditEventBuilder builder() {
+ return new DeleteAlertGroupRequestAuditEventBuilder();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/46a34ccd/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteAlertTargetRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteAlertTargetRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteAlertTargetRequestAuditEvent.java
new file mode 100644
index 0000000..098cdc7
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteAlertTargetRequestAuditEvent.java
@@ -0,0 +1,86 @@
+/*
+ * 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.ambari.server.audit.event.request;
+
+import javax.annotation.concurrent.Immutable;
+
+import org.apache.ambari.server.audit.request.RequestAuditEvent;
+
+/**
+ * Audit event for deleting alert target (=notification)
+ */
+@Immutable
+public class DeleteAlertTargetRequestAuditEvent extends RequestAuditEvent {
+
+ public static class DeleteAlertTargetRequestAuditEventBuilder extends RequestAuditEventBuilder<DeleteAlertTargetRequestAuditEvent, DeleteAlertTargetRequestAuditEventBuilder> {
+
+ /**
+ * Alert target id
+ */
+ private String id;
+
+ public DeleteAlertTargetRequestAuditEventBuilder() {
+ super.withOperation("Notification removal");
+ }
+
+ @Override
+ protected DeleteAlertTargetRequestAuditEvent newAuditEvent() {
+ return new DeleteAlertTargetRequestAuditEvent(this);
+ }
+
+ /**
+ * Appends to the event the details of the incoming request.
+ *
+ * @param builder builder for the audit event details.
+ */
+ @Override
+ protected void buildAuditMessage(StringBuilder builder) {
+ super.buildAuditMessage(builder);
+
+ builder.append(", Notification ID(")
+ .append(id)
+ .append(")");
+ }
+
+ public DeleteAlertTargetRequestAuditEventBuilder withId(String id) {
+ this.id = id;
+ return this;
+ }
+ }
+
+ protected DeleteAlertTargetRequestAuditEvent() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected DeleteAlertTargetRequestAuditEvent(DeleteAlertTargetRequestAuditEventBuilder builder) {
+ super(builder);
+ }
+
+ /**
+ * Returns an builder for {@link DeleteAlertTargetRequestAuditEvent}
+ *
+ * @return a builder instance
+ */
+ public static DeleteAlertTargetRequestAuditEventBuilder builder() {
+ return new DeleteAlertTargetRequestAuditEventBuilder();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/46a34ccd/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteBlueprintRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteBlueprintRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteBlueprintRequestAuditEvent.java
new file mode 100644
index 0000000..203f684
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteBlueprintRequestAuditEvent.java
@@ -0,0 +1,88 @@
+/*
+ * 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.ambari.server.audit.event.request;
+
+import javax.annotation.concurrent.Immutable;
+
+import org.apache.ambari.server.audit.request.RequestAuditEvent;
+
+/**
+ * Audit event for blueprint deletion
+ */
+@Immutable
+public class DeleteBlueprintRequestAuditEvent extends RequestAuditEvent {
+
+ public static class DeleteBlueprintRequestAuditEventBuilder extends RequestAuditEventBuilder<DeleteBlueprintRequestAuditEvent, DeleteBlueprintRequestAuditEventBuilder> {
+
+ /**
+ * Name of the deleted blueprint
+ */
+ private String blueprintName;
+
+ public DeleteBlueprintRequestAuditEventBuilder() {
+ super.withOperation("Delete blueprint");
+ }
+
+ @Override
+ protected DeleteBlueprintRequestAuditEvent newAuditEvent() {
+ return new DeleteBlueprintRequestAuditEvent(this);
+ }
+
+ /**
+ * Appends to the event the details of the incoming request.
+ *
+ * @param builder builder for the audit event details.
+ */
+ @Override
+ protected void buildAuditMessage(StringBuilder builder) {
+ super.buildAuditMessage(builder);
+
+ builder
+ .append(", Blueprint name(")
+ .append(blueprintName)
+ .append(")");
+ }
+
+ public DeleteBlueprintRequestAuditEventBuilder withBlueprintName(String blueprintName) {
+ this.blueprintName = blueprintName;
+ return this;
+ }
+
+ }
+
+ protected DeleteBlueprintRequestAuditEvent() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected DeleteBlueprintRequestAuditEvent(DeleteBlueprintRequestAuditEventBuilder builder) {
+ super(builder);
+ }
+
+ /**
+ * Returns an builder for {@link DeleteBlueprintRequestAuditEvent}
+ *
+ * @return a builder instance
+ */
+ public static DeleteBlueprintRequestAuditEventBuilder builder() {
+ return new DeleteBlueprintRequestAuditEventBuilder();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/46a34ccd/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteGroupRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteGroupRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteGroupRequestAuditEvent.java
new file mode 100644
index 0000000..b348508
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteGroupRequestAuditEvent.java
@@ -0,0 +1,88 @@
+/*
+ * 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.ambari.server.audit.event.request;
+
+import javax.annotation.concurrent.Immutable;
+
+import org.apache.ambari.server.audit.request.RequestAuditEvent;
+
+/**
+ * Audit event for group deletion
+ */
+@Immutable
+public class DeleteGroupRequestAuditEvent extends RequestAuditEvent {
+
+ public static class DeleteGroupRequestAuditEventBuilder extends RequestAuditEventBuilder<DeleteGroupRequestAuditEvent, DeleteGroupRequestAuditEventBuilder> {
+
+ /**
+ * Name of the deleted group
+ */
+ private String groupName;
+
+ public DeleteGroupRequestAuditEventBuilder() {
+ super.withOperation("Group delete");
+ }
+
+ @Override
+ protected DeleteGroupRequestAuditEvent newAuditEvent() {
+ return new DeleteGroupRequestAuditEvent(this);
+ }
+
+ /**
+ * Appends to the event the details of the incoming request.
+ *
+ * @param builder builder for the audit event details.
+ */
+ @Override
+ protected void buildAuditMessage(StringBuilder builder) {
+ super.buildAuditMessage(builder);
+
+ builder
+ .append(", Group(")
+ .append(groupName)
+ .append(")");
+ }
+
+ public DeleteGroupRequestAuditEventBuilder withGroupName(String groupName) {
+ this.groupName = groupName;
+ return this;
+ }
+
+ }
+
+ protected DeleteGroupRequestAuditEvent() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected DeleteGroupRequestAuditEvent(DeleteGroupRequestAuditEventBuilder builder) {
+ super(builder);
+ }
+
+ /**
+ * Returns an builder for {@link DeleteGroupRequestAuditEvent}
+ *
+ * @return a builder instance
+ */
+ public static DeleteGroupRequestAuditEventBuilder builder() {
+ return new DeleteGroupRequestAuditEventBuilder();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/46a34ccd/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteHostRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteHostRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteHostRequestAuditEvent.java
new file mode 100644
index 0000000..27769ff
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteHostRequestAuditEvent.java
@@ -0,0 +1,88 @@
+/*
+ * 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.ambari.server.audit.event.request;
+
+import javax.annotation.concurrent.Immutable;
+
+import org.apache.ambari.server.audit.request.RequestAuditEvent;
+
+/**
+ * Audit event for deleting a host
+ */
+@Immutable
+public class DeleteHostRequestAuditEvent extends RequestAuditEvent {
+
+ public static class DeleteHostRequestAuditEventBuilder extends RequestAuditEventBuilder<DeleteHostRequestAuditEvent, DeleteHostRequestAuditEventBuilder> {
+
+ /**
+ * Name of the deleted host
+ */
+ private String hostName;
+
+ public DeleteHostRequestAuditEventBuilder() {
+ super.withOperation("Host deletion");
+ }
+
+ @Override
+ protected DeleteHostRequestAuditEvent newAuditEvent() {
+ return new DeleteHostRequestAuditEvent(this);
+ }
+
+ /**
+ * Appends to the event the details of the incoming request.
+ *
+ * @param builder builder for the audit event details.
+ */
+ @Override
+ protected void buildAuditMessage(StringBuilder builder) {
+ super.buildAuditMessage(builder);
+
+ builder
+ .append(", Hostname(")
+ .append(hostName)
+ .append(")");
+ }
+
+ public DeleteHostRequestAuditEventBuilder withHostName(String groupName) {
+ this.hostName = groupName;
+ return this;
+ }
+
+ }
+
+ protected DeleteHostRequestAuditEvent() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected DeleteHostRequestAuditEvent(DeleteHostRequestAuditEventBuilder builder) {
+ super(builder);
+ }
+
+ /**
+ * Returns an builder for {@link DeleteHostRequestAuditEvent}
+ *
+ * @return a builder instance
+ */
+ public static DeleteHostRequestAuditEventBuilder builder() {
+ return new DeleteHostRequestAuditEventBuilder();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/46a34ccd/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteRepositoryVersionRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteRepositoryVersionRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteRepositoryVersionRequestAuditEvent.java
new file mode 100644
index 0000000..4937087
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteRepositoryVersionRequestAuditEvent.java
@@ -0,0 +1,110 @@
+/*
+ * 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.ambari.server.audit.event.request;
+
+import javax.annotation.concurrent.Immutable;
+
+import org.apache.ambari.server.audit.request.RequestAuditEvent;
+
+/**
+ * Audit event for deleting a repository version
+ */
+@Immutable
+public class DeleteRepositoryVersionRequestAuditEvent extends RequestAuditEvent {
+
+ public static class DeleteRepositoryVersionAuditEventBuilder extends RequestAuditEventBuilder<DeleteRepositoryVersionRequestAuditEvent, DeleteRepositoryVersionAuditEventBuilder> {
+
+ /**
+ * Stack name
+ */
+ private String stackName;
+
+ /**
+ * Stack version
+ */
+ private String stackVersion;
+
+ /**
+ * Repository version
+ */
+ private String repoVersion;
+
+ public DeleteRepositoryVersionAuditEventBuilder() {
+ super.withOperation("Repository version removal");
+ }
+
+ @Override
+ protected DeleteRepositoryVersionRequestAuditEvent newAuditEvent() {
+ return new DeleteRepositoryVersionRequestAuditEvent(this);
+ }
+
+ /**
+ * Appends to the event the details of the incoming request.
+ *
+ * @param builder builder for the audit event details.
+ */
+ @Override
+ protected void buildAuditMessage(StringBuilder builder) {
+ super.buildAuditMessage(builder);
+
+ builder.append(", Stack(")
+ .append(stackName)
+ .append("), Stack version(")
+ .append(stackVersion)
+ .append("), Repo version ID(")
+ .append(repoVersion)
+ .append(")");
+ }
+
+ public DeleteRepositoryVersionAuditEventBuilder withStackName(String stackName) {
+ this.stackName = stackName;
+ return this;
+ }
+
+ public DeleteRepositoryVersionAuditEventBuilder withStackVersion(String stackVersion) {
+ this.stackVersion = stackVersion;
+ return this;
+ }
+
+ public DeleteRepositoryVersionAuditEventBuilder withRepoVersion(String repoVersion) {
+ this.repoVersion = repoVersion;
+ return this;
+ }
+ }
+
+ protected DeleteRepositoryVersionRequestAuditEvent() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected DeleteRepositoryVersionRequestAuditEvent(DeleteRepositoryVersionAuditEventBuilder builder) {
+ super(builder);
+ }
+
+ /**
+ * Returns an builder for {@link DeleteRepositoryVersionRequestAuditEvent}
+ *
+ * @return a builder instance
+ */
+ public static DeleteRepositoryVersionAuditEventBuilder builder() {
+ return new DeleteRepositoryVersionAuditEventBuilder();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/46a34ccd/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteServiceRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteServiceRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteServiceRequestAuditEvent.java
new file mode 100644
index 0000000..14ec72e
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteServiceRequestAuditEvent.java
@@ -0,0 +1,88 @@
+/*
+ * 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.ambari.server.audit.event.request;
+
+import javax.annotation.concurrent.Immutable;
+
+import org.apache.ambari.server.audit.request.RequestAuditEvent;
+
+/**
+ * Audit event for service deletion
+ */
+@Immutable
+public class DeleteServiceRequestAuditEvent extends RequestAuditEvent {
+
+ public static class DeleteServiceRequestAuditEventBuilder extends RequestAuditEventBuilder<DeleteServiceRequestAuditEvent, DeleteServiceRequestAuditEventBuilder> {
+
+ /**
+ * Name of the deleted service
+ */
+ private String serviceName;
+
+ public DeleteServiceRequestAuditEventBuilder() {
+ super.withOperation("Service deletion");
+ }
+
+ @Override
+ protected DeleteServiceRequestAuditEvent newAuditEvent() {
+ return new DeleteServiceRequestAuditEvent(this);
+ }
+
+ /**
+ * Appends to the event the details of the incoming request.
+ *
+ * @param builder builder for the audit event details.
+ */
+ @Override
+ protected void buildAuditMessage(StringBuilder builder) {
+ super.buildAuditMessage(builder);
+
+ builder
+ .append(", Service(")
+ .append(serviceName)
+ .append(")");
+ }
+
+ public DeleteServiceRequestAuditEventBuilder withService(String service) {
+ this.serviceName = service;
+ return this;
+ }
+
+ }
+
+ protected DeleteServiceRequestAuditEvent() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected DeleteServiceRequestAuditEvent(DeleteServiceRequestAuditEventBuilder builder) {
+ super(builder);
+ }
+
+ /**
+ * Returns an builder for {@link DeleteServiceRequestAuditEvent}
+ *
+ * @return a builder instance
+ */
+ public static DeleteServiceRequestAuditEventBuilder builder() {
+ return new DeleteServiceRequestAuditEventBuilder();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/46a34ccd/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteUserRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteUserRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteUserRequestAuditEvent.java
new file mode 100644
index 0000000..1415518
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteUserRequestAuditEvent.java
@@ -0,0 +1,88 @@
+/*
+ * 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.ambari.server.audit.event.request;
+
+import javax.annotation.concurrent.Immutable;
+
+import org.apache.ambari.server.audit.request.RequestAuditEvent;
+
+/**
+ * Audit event for deleting a user
+ */
+@Immutable
+public class DeleteUserRequestAuditEvent extends RequestAuditEvent {
+
+ public static class DeleteUserRequestAuditEventBuilder extends RequestAuditEventBuilder<DeleteUserRequestAuditEvent, DeleteUserRequestAuditEventBuilder> {
+
+ /**
+ * Name of the deleted user
+ */
+ private String username;
+
+ public DeleteUserRequestAuditEventBuilder() {
+ super.withOperation("User delete");
+ }
+
+ @Override
+ protected DeleteUserRequestAuditEvent newAuditEvent() {
+ return new DeleteUserRequestAuditEvent(this);
+ }
+
+ /**
+ * Appends to the event the details of the incoming request.
+ *
+ * @param builder builder for the audit event details.
+ */
+ @Override
+ protected void buildAuditMessage(StringBuilder builder) {
+ super.buildAuditMessage(builder);
+
+ builder
+ .append(", Deleted Username(")
+ .append(username)
+ .append(")");
+ }
+
+ public DeleteUserRequestAuditEventBuilder withDeletedUsername(String username) {
+ this.username = username;
+ return this;
+ }
+
+ }
+
+ protected DeleteUserRequestAuditEvent() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected DeleteUserRequestAuditEvent(DeleteUserRequestAuditEventBuilder builder) {
+ super(builder);
+ }
+
+ /**
+ * Returns an builder for {@link DeleteUserRequestAuditEvent}
+ *
+ * @return a builder instance
+ */
+ public static DeleteUserRequestAuditEventBuilder builder() {
+ return new DeleteUserRequestAuditEventBuilder();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/46a34ccd/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteViewInstanceRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteViewInstanceRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteViewInstanceRequestAuditEvent.java
new file mode 100644
index 0000000..d3173ec
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/DeleteViewInstanceRequestAuditEvent.java
@@ -0,0 +1,110 @@
+/*
+ * 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.ambari.server.audit.event.request;
+
+import javax.annotation.concurrent.Immutable;
+
+import org.apache.ambari.server.audit.request.RequestAuditEvent;
+
+/**
+ * Audit event for deleting a view instance
+ */
+@Immutable
+public class DeleteViewInstanceRequestAuditEvent extends RequestAuditEvent {
+
+ public static class DeleteViewInstanceRequestAuditEventBuilder extends RequestAuditEventBuilder<DeleteViewInstanceRequestAuditEvent, DeleteViewInstanceRequestAuditEventBuilder> {
+
+ /**
+ * View instance name
+ */
+ private String name;
+
+ /**
+ * View instance type (Files, Tez, etc...)
+ */
+ private String type;
+
+ /**
+ * View instance version
+ */
+ private String version;
+
+ public DeleteViewInstanceRequestAuditEventBuilder() {
+ super.withOperation("View deletion");
+ }
+
+ @Override
+ protected DeleteViewInstanceRequestAuditEvent newAuditEvent() {
+ return new DeleteViewInstanceRequestAuditEvent(this);
+ }
+
+ /**
+ * Appends to the event the details of the incoming request.
+ *
+ * @param builder builder for the audit event details.
+ */
+ @Override
+ protected void buildAuditMessage(StringBuilder builder) {
+ super.buildAuditMessage(builder);
+
+ builder.append(", Type(")
+ .append(type)
+ .append("), Version(")
+ .append(version)
+ .append("), Name(")
+ .append(name)
+ .append(")");
+ }
+
+ public DeleteViewInstanceRequestAuditEventBuilder withName(String name) {
+ this.name = name;
+ return this;
+ }
+
+ public DeleteViewInstanceRequestAuditEventBuilder withType(String type) {
+ this.type = type;
+ return this;
+ }
+
+ public DeleteViewInstanceRequestAuditEventBuilder withVersion(String version) {
+ this.version = version;
+ return this;
+ }
+ }
+
+ protected DeleteViewInstanceRequestAuditEvent() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected DeleteViewInstanceRequestAuditEvent(DeleteViewInstanceRequestAuditEventBuilder builder) {
+ super(builder);
+ }
+
+ /**
+ * Returns an builder for {@link DeleteViewInstanceRequestAuditEvent}
+ *
+ * @return a builder instance
+ */
+ public static DeleteViewInstanceRequestAuditEventBuilder builder() {
+ return new DeleteViewInstanceRequestAuditEventBuilder();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/46a34ccd/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/MembershipChangeRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/MembershipChangeRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/MembershipChangeRequestAuditEvent.java
new file mode 100644
index 0000000..040934e
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/MembershipChangeRequestAuditEvent.java
@@ -0,0 +1,108 @@
+/*
+ * 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.ambari.server.audit.event.request;
+
+import java.util.List;
+
+import javax.annotation.concurrent.Immutable;
+
+import org.apache.ambari.server.audit.request.RequestAuditEvent;
+import org.apache.commons.lang.StringUtils;
+
+/**
+ * Audit event for group membership change
+ */
+@Immutable
+public class MembershipChangeRequestAuditEvent extends RequestAuditEvent {
+
+ public static class AddUserToGroupRequestAuditEventBuilder extends RequestAuditEventBuilder<MembershipChangeRequestAuditEvent, AddUserToGroupRequestAuditEventBuilder> {
+
+ /**
+ * New list of users
+ */
+ private List<String> userNameList;
+
+ /**
+ * Group name
+ */
+ private String groupName;
+
+ public AddUserToGroupRequestAuditEventBuilder() {
+ super.withOperation("Membership change");
+ }
+
+ @Override
+ protected MembershipChangeRequestAuditEvent newAuditEvent() {
+ return new MembershipChangeRequestAuditEvent(this);
+ }
+
+ /**
+ * Appends to the event the details of the incoming request.
+ *
+ * @param builder builder for the audit event details.
+ */
+ @Override
+ protected void buildAuditMessage(StringBuilder builder) {
+ super.buildAuditMessage(builder);
+
+ builder.append(", Group(")
+ .append(groupName)
+ .append("), Members(");
+
+ if (userNameList.isEmpty()) {
+ builder.append("<empty>");
+ }
+
+ StringUtils.join(userNameList, ", ");
+
+ builder.append(")");
+ }
+
+ public AddUserToGroupRequestAuditEventBuilder withUserNameList(List<String> users) {
+ this.userNameList = users;
+ return this;
+ }
+
+ public AddUserToGroupRequestAuditEventBuilder withGroupName(String groupName) {
+ this.groupName = groupName;
+ return this;
+ }
+
+ }
+
+ protected MembershipChangeRequestAuditEvent() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected MembershipChangeRequestAuditEvent(AddUserToGroupRequestAuditEventBuilder builder) {
+ super(builder);
+ }
+
+ /**
+ * Returns an builder for {@link MembershipChangeRequestAuditEvent}
+ *
+ * @return a builder instance
+ */
+ public static AddUserToGroupRequestAuditEventBuilder builder() {
+ return new AddUserToGroupRequestAuditEventBuilder();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/46a34ccd/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/PrivilegeChangeRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/PrivilegeChangeRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/PrivilegeChangeRequestAuditEvent.java
new file mode 100644
index 0000000..b6c9002
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/PrivilegeChangeRequestAuditEvent.java
@@ -0,0 +1,113 @@
+/*
+ * 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.ambari.server.audit.event.request;
+
+import javax.annotation.concurrent.Immutable;
+
+import org.apache.ambari.server.audit.request.RequestAuditEvent;
+
+/**
+ * Audit event for privilege change
+ */
+@Immutable
+public class PrivilegeChangeRequestAuditEvent extends RequestAuditEvent {
+
+ public static class PrivilegeChangeRequestAuditEventBuilder extends RequestAuditEventBuilder<PrivilegeChangeRequestAuditEvent, PrivilegeChangeRequestAuditEventBuilder> {
+
+ /**
+ * User name (this or group is set)
+ */
+ private String user;
+
+ /**
+ * Group name (this or user is set)
+ */
+ private String group;
+
+ /**
+ * Role for the user or group
+ */
+ private String role;
+
+ public PrivilegeChangeRequestAuditEventBuilder() {
+ super.withOperation("Role change");
+ }
+
+ @Override
+ protected PrivilegeChangeRequestAuditEvent newAuditEvent() {
+ return new PrivilegeChangeRequestAuditEvent(this);
+ }
+
+ /**
+ * Appends to the event the details of the incoming request.
+ *
+ * @param builder builder for the audit event details.
+ */
+ @Override
+ protected void buildAuditMessage(StringBuilder builder) {
+ super.buildAuditMessage(builder);
+
+ builder.append(", Role(")
+ .append(role)
+ .append(")");
+
+ if (user != null) {
+ builder.append(", User(").append(user).append(")");
+ }
+ if (group != null) {
+ builder.append(", Group(").append(group).append(")");
+ }
+ }
+
+ public PrivilegeChangeRequestAuditEventBuilder withUser(String user) {
+ this.user = user;
+ return this;
+ }
+
+ public PrivilegeChangeRequestAuditEventBuilder withGroup(String group) {
+ this.group = group;
+ return this;
+ }
+
+ public PrivilegeChangeRequestAuditEventBuilder withRole(String role) {
+ this.role = role;
+ return this;
+ }
+ }
+
+ protected PrivilegeChangeRequestAuditEvent() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected PrivilegeChangeRequestAuditEvent(PrivilegeChangeRequestAuditEventBuilder builder) {
+ super(builder);
+ }
+
+ /**
+ * Returns an builder for {@link PrivilegeChangeRequestAuditEvent}
+ *
+ * @return a builder instance
+ */
+ public static PrivilegeChangeRequestAuditEventBuilder builder() {
+ return new PrivilegeChangeRequestAuditEventBuilder();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/46a34ccd/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/RemoveUserFromGroupRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/RemoveUserFromGroupRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/RemoveUserFromGroupRequestAuditEvent.java
new file mode 100644
index 0000000..b1169ad
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/RemoveUserFromGroupRequestAuditEvent.java
@@ -0,0 +1,98 @@
+/*
+ * 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.ambari.server.audit.event.request;
+
+import javax.annotation.concurrent.Immutable;
+
+import org.apache.ambari.server.audit.request.RequestAuditEvent;
+
+/**
+ * Audit event for removing a user from a group
+ */
+@Immutable
+public class RemoveUserFromGroupRequestAuditEvent extends RequestAuditEvent {
+
+ public static class AddUserToGroupRequestAuditEventBuilder extends RequestAuditEventBuilder<RemoveUserFromGroupRequestAuditEvent, AddUserToGroupRequestAuditEventBuilder> {
+
+ /**
+ * Group name to remove from
+ */
+ private String groupName;
+
+ /**
+ * Name of the user that is removed
+ */
+ private String affectedUserName;
+
+ public AddUserToGroupRequestAuditEventBuilder() {
+ super.withOperation("User removal from group");
+ }
+
+ @Override
+ protected RemoveUserFromGroupRequestAuditEvent newAuditEvent() {
+ return new RemoveUserFromGroupRequestAuditEvent(this);
+ }
+
+ /**
+ * Appends to the event the details of the incoming request.
+ *
+ * @param builder builder for the audit event details.
+ */
+ @Override
+ protected void buildAuditMessage(StringBuilder builder) {
+ super.buildAuditMessage(builder);
+
+ builder.append(", Group(");
+ builder.append(groupName);
+ builder.append("), Affected username(");
+ builder.append(affectedUserName);
+ builder.append(")");
+ }
+
+ public AddUserToGroupRequestAuditEventBuilder withGroupName(String groupName) {
+ this.groupName = groupName;
+ return this;
+ }
+
+ public AddUserToGroupRequestAuditEventBuilder withAffectedUserName(String userName) {
+ this.affectedUserName = userName;
+ return this;
+ }
+ }
+
+ protected RemoveUserFromGroupRequestAuditEvent() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected RemoveUserFromGroupRequestAuditEvent(AddUserToGroupRequestAuditEventBuilder builder) {
+ super(builder);
+ }
+
+ /**
+ * Returns an builder for {@link RemoveUserFromGroupRequestAuditEvent}
+ *
+ * @return a builder instance
+ */
+ public static AddUserToGroupRequestAuditEventBuilder builder() {
+ return new AddUserToGroupRequestAuditEventBuilder();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/46a34ccd/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/StartOperationRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/StartOperationRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/StartOperationRequestAuditEvent.java
new file mode 100644
index 0000000..66e37b8
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/StartOperationRequestAuditEvent.java
@@ -0,0 +1,126 @@
+/*
+ * 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.ambari.server.audit.event.request;
+
+
+import javax.annotation.concurrent.Immutable;
+
+import org.apache.ambari.server.audit.event.AbstractUserAuditEvent;
+
+/**
+ * Start operation request was accepted.
+ */
+@Immutable
+public class StartOperationRequestAuditEvent extends AbstractUserAuditEvent {
+
+ public static class StartOperationAuditEventBuilder
+ extends AbstractUserAuditEventBuilder<StartOperationRequestAuditEvent, StartOperationAuditEventBuilder> {
+
+ /**
+ * Request id
+ */
+ private String requestId;
+
+ /**
+ * Reason of failure, if it is set, then the request is considered as failed
+ */
+ private String reasonOfFailure;
+
+ /**
+ * Description of the request
+ */
+ private String operation;
+
+ private StartOperationAuditEventBuilder() {
+ }
+
+ /**
+ * Appends to the audit event the identifier of the
+ * operation through whcih the operation progress can be tracked.
+ *
+ * @param builder builder for the audit event details.
+ */
+ @Override
+ protected void buildAuditMessage(StringBuilder builder) {
+ super.buildAuditMessage(builder);
+
+ builder
+ .append(", Operation(")
+ .append(operation)
+ .append("), RequestId(")
+ .append(requestId)
+ .append("), Status(")
+ .append(reasonOfFailure == null ? "Successfully queued" : "Failed to queue");
+
+ if (reasonOfFailure != null) {
+ builder.append("), Reason(")
+ .append(reasonOfFailure);
+ }
+ builder.append(")");
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected StartOperationRequestAuditEvent newAuditEvent() {
+ return new StartOperationRequestAuditEvent(this);
+ }
+
+ /**
+ * Sets the identifier of the operation through which the operation progress can be tracked.
+ *
+ * @param requestId the identifier of the operation through which the operation progress can be tracked.
+ * @return this builder
+ */
+ public StartOperationAuditEventBuilder withRequestId(String requestId) {
+ this.requestId = requestId;
+ return this;
+ }
+
+ public StartOperationAuditEventBuilder withReasonOfFailure(String reasonOfFailure) {
+ this.reasonOfFailure = reasonOfFailure;
+ return this;
+ }
+
+ public StartOperationAuditEventBuilder withOperation(String operation) {
+ this.operation = operation;
+ return this;
+ }
+ }
+
+ private StartOperationRequestAuditEvent() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ private StartOperationRequestAuditEvent(StartOperationAuditEventBuilder builder) {
+ super(builder);
+ }
+
+ /**
+ * Returns an builder for {@link StartOperationRequestAuditEvent}
+ *
+ * @return a builder instance
+ */
+ public static StartOperationAuditEventBuilder builder() {
+ return new StartOperationAuditEventBuilder();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/46a34ccd/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/UpdateRepositoryRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/UpdateRepositoryRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/UpdateRepositoryRequestAuditEvent.java
new file mode 100644
index 0000000..ea3a0de
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/UpdateRepositoryRequestAuditEvent.java
@@ -0,0 +1,134 @@
+/*
+ * 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.ambari.server.audit.event.request;
+
+import javax.annotation.concurrent.Immutable;
+
+import org.apache.ambari.server.audit.request.RequestAuditEvent;
+
+/**
+ * Audit event for updating repository
+ */
+@Immutable
+public class UpdateRepositoryRequestAuditEvent extends RequestAuditEvent {
+
+ public static class UpdateRepositoryRequestAuditEventBuilder extends RequestAuditEventBuilder<UpdateRepositoryRequestAuditEvent, UpdateRepositoryRequestAuditEventBuilder> {
+
+ /**
+ * Repository name
+ */
+ private String repo;
+
+ /**
+ * Stack name
+ */
+ private String stackName;
+
+ /**
+ * Operating system type
+ */
+ private String osType;
+
+ /**
+ * Base url for the repository
+ */
+ private String baseUrl;
+
+ /**
+ * Stack version
+ */
+ private String stackVersion;
+
+ public UpdateRepositoryRequestAuditEventBuilder() {
+ super.withOperation("Repository update");
+ }
+
+ @Override
+ protected UpdateRepositoryRequestAuditEvent newAuditEvent() {
+ return new UpdateRepositoryRequestAuditEvent(this);
+ }
+
+ /**
+ * Appends to the event the details of the incoming request.
+ *
+ * @param builder builder for the audit event details.
+ */
+ @Override
+ protected void buildAuditMessage(StringBuilder builder) {
+ super.buildAuditMessage(builder);
+
+ builder.append(", Stack(")
+ .append(stackName)
+ .append("), Stack version(")
+ .append(stackVersion)
+ .append("), OS(")
+ .append(osType)
+ .append("), Repo id(")
+ .append(repo)
+ .append("), Base URL(")
+ .append(baseUrl)
+ .append(")");
+ }
+
+ public UpdateRepositoryRequestAuditEventBuilder withRepo(String repo) {
+ this.repo = repo;
+ return this;
+ }
+
+ public UpdateRepositoryRequestAuditEventBuilder withStackName(String stackName) {
+ this.stackName = stackName;
+ return this;
+ }
+
+ public UpdateRepositoryRequestAuditEventBuilder withOsType(String osType) {
+ this.osType = osType;
+ return this;
+ }
+
+ public UpdateRepositoryRequestAuditEventBuilder withBaseUrl(String baseUrl) {
+ this.baseUrl = baseUrl;
+ return this;
+ }
+
+ public UpdateRepositoryRequestAuditEventBuilder withStackVersion(String stackVersion) {
+ this.stackVersion = stackVersion;
+ return this;
+ }
+ }
+
+ protected UpdateRepositoryRequestAuditEvent() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected UpdateRepositoryRequestAuditEvent(UpdateRepositoryRequestAuditEventBuilder builder) {
+ super(builder);
+ }
+
+ /**
+ * Returns an builder for {@link UpdateRepositoryRequestAuditEvent}
+ *
+ * @return a builder instance
+ */
+ public static UpdateRepositoryRequestAuditEventBuilder builder() {
+ return new UpdateRepositoryRequestAuditEventBuilder();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/46a34ccd/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/UpdateUpgradeItemRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/UpdateUpgradeItemRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/UpdateUpgradeItemRequestAuditEvent.java
new file mode 100644
index 0000000..3475f0a
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/UpdateUpgradeItemRequestAuditEvent.java
@@ -0,0 +1,111 @@
+/*
+ * 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.ambari.server.audit.event.request;
+
+import javax.annotation.concurrent.Immutable;
+
+import org.apache.ambari.server.audit.request.RequestAuditEvent;
+
+/**
+ * Audit event for updating an upgrade item
+ */
+@Immutable
+public class UpdateUpgradeItemRequestAuditEvent extends RequestAuditEvent {
+
+ public static class UpdateUpgradeItemRequestAuditEventBuilder extends RequestAuditEventBuilder<UpdateUpgradeItemRequestAuditEvent, UpdateUpgradeItemRequestAuditEventBuilder> {
+
+ /**
+ * Stage id
+ */
+ private String stageId;
+
+ /**
+ * Status
+ */
+ private String status;
+
+ /**
+ * Request id
+ */
+ private String requestId;
+
+
+ public UpdateUpgradeItemRequestAuditEventBuilder() {
+ super.withOperation("Action confirmation by the user");
+ }
+
+ @Override
+ protected UpdateUpgradeItemRequestAuditEvent newAuditEvent() {
+ return new UpdateUpgradeItemRequestAuditEvent(this);
+ }
+
+ /**
+ * Appends to the event the details of the incoming request.
+ *
+ * @param builder builder for the audit event details.
+ */
+ @Override
+ protected void buildAuditMessage(StringBuilder builder) {
+ super.buildAuditMessage(builder);
+
+ builder.append(", Stage id(")
+ .append(stageId)
+ .append("), Status(")
+ .append(status)
+ .append("), Request id(")
+ .append(requestId)
+ .append(")");
+ }
+
+ public UpdateUpgradeItemRequestAuditEventBuilder withStageId(String stageId) {
+ this.stageId = stageId;
+ return this;
+ }
+
+ public UpdateUpgradeItemRequestAuditEventBuilder withStatus(String status) {
+ this.status = status;
+ return this;
+ }
+
+ public UpdateUpgradeItemRequestAuditEventBuilder withRequestId(String requestId) {
+ this.requestId = requestId;
+ return this;
+ }
+ }
+
+ protected UpdateUpgradeItemRequestAuditEvent() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected UpdateUpgradeItemRequestAuditEvent(UpdateUpgradeItemRequestAuditEventBuilder builder) {
+ super(builder);
+ }
+
+ /**
+ * Returns an builder for {@link UpdateUpgradeItemRequestAuditEvent}
+ *
+ * @return a builder instance
+ */
+ public static UpdateUpgradeItemRequestAuditEventBuilder builder() {
+ return new UpdateUpgradeItemRequestAuditEventBuilder();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/46a34ccd/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/UserPasswordChangeRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/UserPasswordChangeRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/UserPasswordChangeRequestAuditEvent.java
new file mode 100644
index 0000000..64a5aa1
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/UserPasswordChangeRequestAuditEvent.java
@@ -0,0 +1,88 @@
+/*
+ * 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.ambari.server.audit.event.request;
+
+import javax.annotation.concurrent.Immutable;
+
+import org.apache.ambari.server.audit.request.RequestAuditEvent;
+
+/**
+ * Audit event for changing user password
+ */
+@Immutable
+public class UserPasswordChangeRequestAuditEvent extends RequestAuditEvent {
+
+ public static class UserPasswordChangeRequestAuditEventBuilder extends RequestAuditEventBuilder<UserPasswordChangeRequestAuditEvent, UserPasswordChangeRequestAuditEventBuilder> {
+
+ /**
+ * Name of the user whose password is changed
+ */
+ private String username;
+
+ public UserPasswordChangeRequestAuditEventBuilder() {
+ super.withOperation("Password change");
+ }
+
+ @Override
+ protected UserPasswordChangeRequestAuditEvent newAuditEvent() {
+ return new UserPasswordChangeRequestAuditEvent(this);
+ }
+
+ /**
+ * Appends to the event the details of the incoming request.
+ *
+ * @param builder builder for the audit event details.
+ */
+ @Override
+ protected void buildAuditMessage(StringBuilder builder) {
+ super.buildAuditMessage(builder);
+
+ builder
+ .append(", Affected username(")
+ .append(username)
+ .append(")");
+ }
+
+
+ public UserPasswordChangeRequestAuditEventBuilder withAffectedUsername(String username) {
+ this.username = username;
+ return this;
+ }
+ }
+
+ protected UserPasswordChangeRequestAuditEvent() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected UserPasswordChangeRequestAuditEvent(UserPasswordChangeRequestAuditEventBuilder builder) {
+ super(builder);
+ }
+
+ /**
+ * Returns an builder for {@link UserPasswordChangeRequestAuditEvent}
+ *
+ * @return a builder instance
+ */
+ public static UserPasswordChangeRequestAuditEventBuilder builder() {
+ return new UserPasswordChangeRequestAuditEventBuilder();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/46a34ccd/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ViewPrivilegeChangeRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ViewPrivilegeChangeRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ViewPrivilegeChangeRequestAuditEvent.java
new file mode 100644
index 0000000..c06eb7e
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ViewPrivilegeChangeRequestAuditEvent.java
@@ -0,0 +1,163 @@
+/*
+ * 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.ambari.server.audit.event.request;
+
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.annotation.concurrent.Immutable;
+
+import org.apache.ambari.server.audit.request.RequestAuditEvent;
+import org.apache.commons.lang.StringUtils;
+
+/**
+ * Audit event for changing view privilege
+ */
+@Immutable
+public class ViewPrivilegeChangeRequestAuditEvent extends RequestAuditEvent {
+
+ public static class ViewPrivilegeChangeRequestAuditEventBuilder extends RequestAuditEventBuilder<ViewPrivilegeChangeRequestAuditEvent, ViewPrivilegeChangeRequestAuditEventBuilder> {
+
+ /**
+ * Users with their roles
+ */
+ private Map<String, List<String>> users;
+
+ /**
+ * Groups with their roles
+ */
+ private Map<String, List<String>> groups;
+
+ /**
+ * View name
+ */
+ private String name;
+
+ /**
+ * View type (Files, Tez, etc...)
+ */
+ private String type;
+
+ /**
+ * View version
+ */
+ private String version;
+
+
+ public ViewPrivilegeChangeRequestAuditEventBuilder() {
+ super.withOperation("View permission change");
+ }
+
+ @Override
+ protected ViewPrivilegeChangeRequestAuditEvent newAuditEvent() {
+ return new ViewPrivilegeChangeRequestAuditEvent(this);
+ }
+
+ /**
+ * Appends to the event the details of the incoming request.
+ *
+ * @param builder builder for the audit event details.
+ */
+ @Override
+ protected void buildAuditMessage(StringBuilder builder) {
+ super.buildAuditMessage(builder);
+
+ builder.append(", Type(")
+ .append(type)
+ .append("), Version(")
+ .append(version)
+ .append("), Name(")
+ .append(name)
+ .append(")");
+
+ Set<String> roleSet = new HashSet<String>();
+ roleSet.addAll(users.keySet());
+ roleSet.addAll(groups.keySet());
+
+ builder.append(", Permissions(");
+ if (!users.isEmpty() || !groups.isEmpty()) {
+ builder.append(System.lineSeparator());
+ }
+
+ List<String> lines = new LinkedList<String>();
+
+ for (String role : roleSet) {
+ lines.add(role + ": ");
+ if (users.get(role) != null && !users.get(role).isEmpty()) {
+ lines.add(" Users: " + StringUtils.join(users.get(role), ", "));
+ }
+ if (groups.get(role) != null && !groups.get(role).isEmpty()) {
+ lines.add(" Groups: " + StringUtils.join(groups.get(role), ", "));
+ }
+ }
+
+ builder.append(StringUtils.join(lines, System.lineSeparator()));
+
+ builder.append(")");
+ }
+
+ public ViewPrivilegeChangeRequestAuditEventBuilder withName(String name) {
+ this.name = name;
+ return this;
+ }
+
+ public ViewPrivilegeChangeRequestAuditEventBuilder withType(String type) {
+ this.type = type;
+ return this;
+ }
+
+ public ViewPrivilegeChangeRequestAuditEventBuilder withVersion(String version) {
+ this.version = version;
+ return this;
+ }
+
+ public ViewPrivilegeChangeRequestAuditEventBuilder withUsers(Map<String, List<String>> users) {
+ this.users = users;
+ return this;
+ }
+
+ public ViewPrivilegeChangeRequestAuditEventBuilder withGroups(Map<String, List<String>> groups) {
+ this.groups = groups;
+ return this;
+ }
+ }
+
+ protected ViewPrivilegeChangeRequestAuditEvent() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected ViewPrivilegeChangeRequestAuditEvent(ViewPrivilegeChangeRequestAuditEventBuilder builder) {
+ super(builder);
+ }
+
+ /**
+ * Returns an builder for {@link ViewPrivilegeChangeRequestAuditEvent}
+ *
+ * @return a builder instance
+ */
+ public static ViewPrivilegeChangeRequestAuditEventBuilder builder() {
+ return new ViewPrivilegeChangeRequestAuditEventBuilder();
+ }
+
+}