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:20 UTC
[6/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/kerberos/CreateKeyTabKerberosAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/kerberos/CreateKeyTabKerberosAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/kerberos/CreateKeyTabKerberosAuditEvent.java
new file mode 100644
index 0000000..7ac3ef4
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/kerberos/CreateKeyTabKerberosAuditEvent.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.kerberos;
+
+import javax.annotation.concurrent.Immutable;
+
+/**
+ * Audit event for kerberos keytab change
+ */
+@Immutable
+public class CreateKeyTabKerberosAuditEvent extends AbstractKerberosAuditEvent {
+
+ public static class CreateKeyTabKerberosAuditEventBuilder extends AbstractKerberosAuditEventBuilder<CreateKeyTabKerberosAuditEvent, CreateKeyTabKerberosAuditEventBuilder> {
+
+ /**
+ * Path to keytab file
+ */
+ private String keyTabFilePath;
+
+ /**
+ * Host name
+ */
+ private String hostName;
+
+ /**
+ * Principal that belons to the keytab file
+ */
+ private String principal;
+
+ private CreateKeyTabKerberosAuditEventBuilder() {
+ this.withOperation("Keytab file creation");
+ }
+
+ @Override
+ protected void buildAuditMessage(StringBuilder builder) {
+ super.buildAuditMessage(builder);
+
+ builder
+ .append(", Principal(")
+ .append(principal)
+ .append("), Hostname(")
+ .append(hostName)
+ .append("), Keytab file(")
+ .append(keyTabFilePath)
+ .append(")");
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected CreateKeyTabKerberosAuditEvent newAuditEvent() {
+ return new CreateKeyTabKerberosAuditEvent(this);
+ }
+
+ public CreateKeyTabKerberosAuditEventBuilder withKeyTabFilePath(String keyTabFilePath) {
+ this.keyTabFilePath = keyTabFilePath;
+ return this;
+ }
+
+ public CreateKeyTabKerberosAuditEventBuilder withHostName(String hostName) {
+ this.hostName = hostName;
+ return this;
+ }
+
+ public CreateKeyTabKerberosAuditEventBuilder withPrincipal(String principal) {
+ this.principal = principal;
+ return this;
+ }
+
+ public boolean hasPrincipal() {
+ return principal != null;
+ }
+ }
+
+ private CreateKeyTabKerberosAuditEvent() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ private CreateKeyTabKerberosAuditEvent(CreateKeyTabKerberosAuditEventBuilder builder) {
+ super(builder);
+ }
+
+ /**
+ * Returns an builder for {@link CreateKeyTabKerberosAuditEvent}
+ *
+ * @return a builder instance
+ */
+ public static CreateKeyTabKerberosAuditEventBuilder builder() {
+ return new CreateKeyTabKerberosAuditEventBuilder();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/46a34ccd/ambari-server/src/main/java/org/apache/ambari/server/audit/event/kerberos/CreatePrincipalKerberosAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/kerberos/CreatePrincipalKerberosAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/kerberos/CreatePrincipalKerberosAuditEvent.java
new file mode 100644
index 0000000..e3fbbe4
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/kerberos/CreatePrincipalKerberosAuditEvent.java
@@ -0,0 +1,73 @@
+/*
+ * 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.kerberos;
+
+import javax.annotation.concurrent.Immutable;
+
+@Immutable
+public class CreatePrincipalKerberosAuditEvent extends AbstractKerberosAuditEvent {
+
+ public static class CreatePrincipalKerberosAuditEventBuilder extends AbstractKerberosAuditEventBuilder<CreatePrincipalKerberosAuditEvent, CreatePrincipalKerberosAuditEventBuilder> {
+
+ private String principal;
+
+ private CreatePrincipalKerberosAuditEventBuilder() {
+ this.withOperation("Principal creation");
+ }
+
+ @Override
+ protected void buildAuditMessage(StringBuilder builder) {
+ super.buildAuditMessage(builder);
+ builder.append(", Principal(")
+ .append(principal);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected CreatePrincipalKerberosAuditEvent newAuditEvent() {
+ return new CreatePrincipalKerberosAuditEvent(this);
+ }
+
+ public CreatePrincipalKerberosAuditEventBuilder withPrincipal(String principal) {
+ this.principal = principal;
+ return this;
+ }
+ }
+
+ private CreatePrincipalKerberosAuditEvent() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ private CreatePrincipalKerberosAuditEvent(CreatePrincipalKerberosAuditEventBuilder builder) {
+ super(builder);
+ }
+
+ /**
+ * Returns an builder for {@link CreatePrincipalKerberosAuditEvent}
+ *
+ * @return a builder instance
+ */
+ public static CreatePrincipalKerberosAuditEventBuilder builder() {
+ return new CreatePrincipalKerberosAuditEventBuilder();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/46a34ccd/ambari-server/src/main/java/org/apache/ambari/server/audit/event/kerberos/DestroyPrincipalKerberosAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/kerberos/DestroyPrincipalKerberosAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/kerberos/DestroyPrincipalKerberosAuditEvent.java
new file mode 100644
index 0000000..ba56f21
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/kerberos/DestroyPrincipalKerberosAuditEvent.java
@@ -0,0 +1,80 @@
+/*
+ * 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.kerberos;
+
+import javax.annotation.concurrent.Immutable;
+
+/**
+ * Audit event for destroying principal
+ */
+@Immutable
+public class DestroyPrincipalKerberosAuditEvent extends AbstractKerberosAuditEvent {
+
+ public static class DestroyPrincipalKerberosAuditEventBuilder extends AbstractKerberosAuditEventBuilder<DestroyPrincipalKerberosAuditEvent, DestroyPrincipalKerberosAuditEventBuilder> {
+
+ /**
+ * Destroyed principal
+ */
+ private String principal;
+
+ private DestroyPrincipalKerberosAuditEventBuilder() {
+ this.withOperation("Principal removal");
+ }
+
+ @Override
+ protected void buildAuditMessage(StringBuilder builder) {
+ super.buildAuditMessage(builder);
+
+ builder.append(", Principal(")
+ .append(principal);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected DestroyPrincipalKerberosAuditEvent newAuditEvent() {
+ return new DestroyPrincipalKerberosAuditEvent(this);
+ }
+
+ public DestroyPrincipalKerberosAuditEventBuilder withPrincipal(String principal) {
+ this.principal = principal;
+ return this;
+ }
+ }
+
+ private DestroyPrincipalKerberosAuditEvent() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ private DestroyPrincipalKerberosAuditEvent(DestroyPrincipalKerberosAuditEventBuilder builder) {
+ super(builder);
+ }
+
+ /**
+ * Returns an builder for {@link DestroyPrincipalKerberosAuditEvent}
+ *
+ * @return a builder instance
+ */
+ public static DestroyPrincipalKerberosAuditEventBuilder builder() {
+ return new DestroyPrincipalKerberosAuditEventBuilder();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/46a34ccd/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ActivateUserRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ActivateUserRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ActivateUserRequestAuditEvent.java
new file mode 100644
index 0000000..df5726d
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ActivateUserRequestAuditEvent.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 setting a user active or inactive
+ */
+@Immutable
+public class ActivateUserRequestAuditEvent extends RequestAuditEvent {
+
+ public static class ActivateUserRequestAuditEventBuilder extends RequestAuditEventBuilder<ActivateUserRequestAuditEvent, ActivateUserRequestAuditEventBuilder> {
+
+ /**
+ * Active or inactive
+ */
+ private boolean active;
+
+ /**
+ * Name of the user to set active or inactive
+ */
+ private String username;
+
+ public ActivateUserRequestAuditEventBuilder() {
+ super.withOperation("Set user activate");
+ }
+
+ @Override
+ protected ActivateUserRequestAuditEvent newAuditEvent() {
+ return new ActivateUserRequestAuditEvent(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("), ")
+ .append("Active(")
+ .append(active ? "yes" : "no")
+ .append(")");
+ }
+
+ public ActivateUserRequestAuditEventBuilder withActive(boolean active) {
+ this.active = active;
+ return this;
+ }
+
+ public ActivateUserRequestAuditEventBuilder withAffectedUsername(String username) {
+ this.username = username;
+ return this;
+ }
+
+ }
+
+ protected ActivateUserRequestAuditEvent() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected ActivateUserRequestAuditEvent(ActivateUserRequestAuditEventBuilder builder) {
+ super(builder);
+ }
+
+ /**
+ * Returns an builder for {@link ActivateUserRequestAuditEvent}
+ *
+ * @return a builder instance
+ */
+ public static ActivateUserRequestAuditEventBuilder builder() {
+ return new ActivateUserRequestAuditEventBuilder();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/46a34ccd/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddAlertGroupRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddAlertGroupRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddAlertGroupRequestAuditEvent.java
new file mode 100644
index 0000000..cd92ba0
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddAlertGroupRequestAuditEvent.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 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 adding alert group
+ */
+@Immutable
+public class AddAlertGroupRequestAuditEvent extends RequestAuditEvent {
+
+ public static class AddAlertGroupRequestAuditEventBuilder extends RequestAuditEventBuilder<AddAlertGroupRequestAuditEvent, AddAlertGroupRequestAuditEventBuilder> {
+
+ /**
+ * Group name
+ */
+ private String name;
+
+ /**
+ * Definition ids for the group
+ */
+ private List<String> definitionIds;
+
+ /**
+ * Notification ids for the group
+ */
+ private List<String> notificationIds;
+
+ public AddAlertGroupRequestAuditEventBuilder() {
+ super.withOperation("Alert group addition");
+ }
+
+ @Override
+ protected AddAlertGroupRequestAuditEvent newAuditEvent() {
+ return new AddAlertGroupRequestAuditEvent(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 name(")
+ .append(name)
+ .append("), Definition IDs(")
+ .append(StringUtils.join(definitionIds, ", "))
+ .append("), Notification IDs(")
+ .append(StringUtils.join(notificationIds, ", "))
+ .append(")");
+ }
+
+ public AddAlertGroupRequestAuditEventBuilder withName(String name) {
+ this.name = name;
+ return this;
+ }
+
+ public AddAlertGroupRequestAuditEventBuilder withDefinitionIds(List<String> ids) {
+ this.definitionIds = ids;
+ return this;
+ }
+
+ public AddAlertGroupRequestAuditEventBuilder withNotificationIds(List<String> ids) {
+ this.notificationIds = ids;
+ return this;
+ }
+ }
+
+ protected AddAlertGroupRequestAuditEvent() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected AddAlertGroupRequestAuditEvent(AddAlertGroupRequestAuditEventBuilder builder) {
+ super(builder);
+ }
+
+ /**
+ * Returns an builder for {@link AddAlertGroupRequestAuditEvent}
+ *
+ * @return a builder instance
+ */
+ public static AddAlertGroupRequestAuditEventBuilder builder() {
+ return new AddAlertGroupRequestAuditEventBuilder();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/46a34ccd/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddAlertTargetRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddAlertTargetRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddAlertTargetRequestAuditEvent.java
new file mode 100644
index 0000000..1c4a8d5
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddAlertTargetRequestAuditEvent.java
@@ -0,0 +1,167 @@
+/*
+ * 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 adding alert target (= notification)
+ */
+@Immutable
+public class AddAlertTargetRequestAuditEvent extends RequestAuditEvent {
+
+ public static class AddAlertTargetRequestAuditEventBuilder extends RequestAuditEventBuilder<AddAlertTargetRequestAuditEvent, AddAlertTargetRequestAuditEventBuilder> {
+
+ /**
+ * Name of the alert target
+ */
+ private String name;
+
+ /**
+ * Description of the alert target
+ */
+ private String description;
+
+ /**
+ * Type of the alert target
+ */
+ private String notificationType;
+
+ /**
+ * Group list that belongs to the alert target
+ */
+ private List<String> groupIds;
+
+ /**
+ * Email address that should be in the from field
+ */
+ private String emailFrom;
+
+ /**
+ * Eamil recipients
+ */
+ private List<String> emailRecipients;
+
+ /**
+ * Alert states for the alert target
+ */
+ private List<String> alertStates;
+
+ public AddAlertTargetRequestAuditEventBuilder() {
+ super.withOperation("Notification addition");
+ }
+
+ @Override
+ protected AddAlertTargetRequestAuditEvent newAuditEvent() {
+ return new AddAlertTargetRequestAuditEvent(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 name(")
+ .append(name)
+ .append("), Description(")
+ .append(description)
+ .append("), Notification type(")
+ .append(notificationType)
+ .append("), Group IDs(")
+ .append(StringUtils.join(groupIds, ", "));
+
+ if (emailFrom != null) {
+ builder.append("), Email from(")
+ .append(emailFrom);
+ }
+
+ if (emailRecipients != null && !emailRecipients.isEmpty()) {
+ builder.append("), Email to(")
+ .append(StringUtils.join(emailRecipients, ", "));
+ }
+ builder.append("), Alert states(")
+ .append(StringUtils.join(alertStates, ", "))
+ .append(")");
+ }
+
+ public AddAlertTargetRequestAuditEventBuilder withName(String name) {
+ this.name = name;
+ return this;
+ }
+
+ public AddAlertTargetRequestAuditEventBuilder withDescription(String description) {
+ this.description = description;
+ return this;
+ }
+
+ public AddAlertTargetRequestAuditEventBuilder withNotificationType(String notificationType) {
+ this.notificationType = notificationType;
+ return this;
+ }
+
+ public AddAlertTargetRequestAuditEventBuilder withGroupIds(List<String> groupIds) {
+ this.groupIds = groupIds;
+ return this;
+ }
+
+ public AddAlertTargetRequestAuditEventBuilder withEmailFrom(String emailFrom) {
+ this.emailFrom = emailFrom;
+ return this;
+ }
+
+ public AddAlertTargetRequestAuditEventBuilder withEmailRecipients(List<String> emailRecipients) {
+ this.emailRecipients = emailRecipients;
+ return this;
+ }
+
+ public AddAlertTargetRequestAuditEventBuilder withAlertStates(List<String> alertStates) {
+ this.alertStates = alertStates;
+ return this;
+ }
+ }
+
+ protected AddAlertTargetRequestAuditEvent() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected AddAlertTargetRequestAuditEvent(AddAlertTargetRequestAuditEventBuilder builder) {
+ super(builder);
+ }
+
+ /**
+ * Returns an builder for {@link AddAlertTargetRequestAuditEvent}
+ *
+ * @return a builder instance
+ */
+ public static AddAlertTargetRequestAuditEventBuilder builder() {
+ return new AddAlertTargetRequestAuditEventBuilder();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/46a34ccd/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddBlueprintRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddBlueprintRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddBlueprintRequestAuditEvent.java
new file mode 100644
index 0000000..84431ab
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddBlueprintRequestAuditEvent.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 adding blueprint
+ */
+@Immutable
+public class AddBlueprintRequestAuditEvent extends RequestAuditEvent {
+
+ public static class AddBlueprintRequestAuditEventBuilder extends RequestAuditEventBuilder<AddBlueprintRequestAuditEvent, AddBlueprintRequestAuditEventBuilder> {
+
+ /**
+ * Blueprint name
+ */
+ private String blueprintName;
+
+ public AddBlueprintRequestAuditEventBuilder() {
+ super.withOperation("Upload blueprint");
+ }
+
+ @Override
+ protected AddBlueprintRequestAuditEvent newAuditEvent() {
+ return new AddBlueprintRequestAuditEvent(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 AddBlueprintRequestAuditEventBuilder withBlueprintName(String blueprintName) {
+ this.blueprintName = blueprintName;
+ return this;
+ }
+
+ }
+
+ protected AddBlueprintRequestAuditEvent() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected AddBlueprintRequestAuditEvent(AddBlueprintRequestAuditEventBuilder builder) {
+ super(builder);
+ }
+
+ /**
+ * Returns an builder for {@link AddBlueprintRequestAuditEvent}
+ *
+ * @return a builder instance
+ */
+ public static AddBlueprintRequestAuditEventBuilder builder() {
+ return new AddBlueprintRequestAuditEventBuilder();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/46a34ccd/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddComponentToHostRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddComponentToHostRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddComponentToHostRequestAuditEvent.java
new file mode 100644
index 0000000..2c9eedd
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddComponentToHostRequestAuditEvent.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 adding component to a host
+ */
+@Immutable
+public class AddComponentToHostRequestAuditEvent extends RequestAuditEvent {
+
+ public static class AddComponentToHostRequestAuditEventBuilder extends RequestAuditEventBuilder<AddComponentToHostRequestAuditEvent, AddComponentToHostRequestAuditEventBuilder> {
+
+ /**
+ * Host name
+ */
+ private String hostName;
+
+ /**
+ * Component name
+ */
+ private String component;
+
+ public AddComponentToHostRequestAuditEventBuilder() {
+ super.withOperation("Component addition to host");
+ }
+
+ @Override
+ protected AddComponentToHostRequestAuditEvent newAuditEvent() {
+ return new AddComponentToHostRequestAuditEvent(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(", Component(")
+ .append(component)
+ .append(")");
+ }
+
+ public AddComponentToHostRequestAuditEventBuilder withHostName(String hostName) {
+ this.hostName = hostName;
+ return this;
+ }
+
+ public AddComponentToHostRequestAuditEventBuilder withComponent(String component) {
+ this.component = component;
+ return this;
+ }
+ }
+
+ protected AddComponentToHostRequestAuditEvent() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected AddComponentToHostRequestAuditEvent(AddComponentToHostRequestAuditEventBuilder builder) {
+ super(builder);
+ }
+
+ /**
+ * Returns an builder for {@link AddComponentToHostRequestAuditEvent}
+ *
+ * @return a builder instance
+ */
+ public static AddComponentToHostRequestAuditEventBuilder builder() {
+ return new AddComponentToHostRequestAuditEventBuilder();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/46a34ccd/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddCredentialRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddCredentialRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddCredentialRequestAuditEvent.java
new file mode 100644
index 0000000..5d27abf
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddCredentialRequestAuditEvent.java
@@ -0,0 +1,122 @@
+/*
+ * 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 adding credential
+ */
+@Immutable
+public class AddCredentialRequestAuditEvent extends RequestAuditEvent {
+
+ public static class AddCredentialAuditEventBuilder extends RequestAuditEventBuilder<AddCredentialRequestAuditEvent, AddCredentialAuditEventBuilder> {
+
+ /**
+ * Credential type (e.g. temporary)
+ */
+ private String type;
+
+ /**
+ * Cluster name
+ */
+ private String clusterName;
+
+ /**
+ * Principal
+ */
+ private String principal;
+
+ /**
+ * Alias for the credential
+ */
+ private String alias;
+
+ public AddCredentialAuditEventBuilder() {
+ super.withOperation("Credential addition");
+ }
+
+ @Override
+ protected AddCredentialRequestAuditEvent newAuditEvent() {
+ return new AddCredentialRequestAuditEvent(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("), Principal(")
+ .append(principal)
+ .append("), Alias(")
+ .append(alias)
+ .append("), Cluster name(")
+ .append(clusterName)
+ .append(")");
+ }
+
+ public AddCredentialAuditEventBuilder withType(String type) {
+ this.type = type;
+ return this;
+ }
+
+ public AddCredentialAuditEventBuilder withClusterName(String clusterName) {
+ this.clusterName = clusterName;
+ return this;
+ }
+
+ public AddCredentialAuditEventBuilder withPrincipal(String principal) {
+ this.principal = principal;
+ return this;
+ }
+
+ public AddCredentialAuditEventBuilder withAlias(String alias) {
+ this.alias = alias;
+ return this;
+ }
+ }
+
+ protected AddCredentialRequestAuditEvent() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected AddCredentialRequestAuditEvent(AddCredentialAuditEventBuilder builder) {
+ super(builder);
+ }
+
+ /**
+ * Returns an builder for {@link AddCredentialRequestAuditEvent}
+ *
+ * @return a builder instance
+ */
+ public static AddCredentialAuditEventBuilder builder() {
+ return new AddCredentialAuditEventBuilder();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/46a34ccd/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddHostRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddHostRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddHostRequestAuditEvent.java
new file mode 100644
index 0000000..c24175d
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddHostRequestAuditEvent.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 adding host
+ */
+@Immutable
+public class AddHostRequestAuditEvent extends RequestAuditEvent {
+
+ public static class AddHostRequestAuditEventBuilder extends RequestAuditEventBuilder<AddHostRequestAuditEvent, AddHostRequestAuditEventBuilder> {
+
+ /**
+ * Hostname that is added
+ */
+ private String hostName;
+
+ public AddHostRequestAuditEventBuilder() {
+ super.withOperation("Host addition");
+ }
+
+ @Override
+ protected AddHostRequestAuditEvent newAuditEvent() {
+ return new AddHostRequestAuditEvent(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 AddHostRequestAuditEventBuilder withHostName(String hostName) {
+ this.hostName = hostName;
+ return this;
+ }
+ }
+
+ protected AddHostRequestAuditEvent() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected AddHostRequestAuditEvent(AddHostRequestAuditEventBuilder builder) {
+ super(builder);
+ }
+
+ /**
+ * Returns an builder for {@link AddHostRequestAuditEvent}
+ *
+ * @return a builder instance
+ */
+ public static AddHostRequestAuditEventBuilder builder() {
+ return new AddHostRequestAuditEventBuilder();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/46a34ccd/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddRepositoryRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddRepositoryRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddRepositoryRequestAuditEvent.java
new file mode 100644
index 0000000..ed6c1cd
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddRepositoryRequestAuditEvent.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 adding repository
+ */
+@Immutable
+public class AddRepositoryRequestAuditEvent extends RequestAuditEvent {
+
+ public static class AddRepositoryRequestAuditEventBuilder extends RequestAuditEventBuilder<AddRepositoryRequestAuditEvent, AddRepositoryRequestAuditEventBuilder> {
+
+ /**
+ * 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 AddRepositoryRequestAuditEventBuilder() {
+ super.withOperation("Repository addition");
+ }
+
+ @Override
+ protected AddRepositoryRequestAuditEvent newAuditEvent() {
+ return new AddRepositoryRequestAuditEvent(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 AddRepositoryRequestAuditEventBuilder withRepo(String repo) {
+ this.repo = repo;
+ return this;
+ }
+
+ public AddRepositoryRequestAuditEventBuilder withStackName(String stackName) {
+ this.stackName = stackName;
+ return this;
+ }
+
+ public AddRepositoryRequestAuditEventBuilder withOsType(String osType) {
+ this.osType = osType;
+ return this;
+ }
+
+ public AddRepositoryRequestAuditEventBuilder withBaseUrl(String baseUrl) {
+ this.baseUrl = baseUrl;
+ return this;
+ }
+
+ public AddRepositoryRequestAuditEventBuilder withStackVersion(String stackVersion) {
+ this.stackVersion = stackVersion;
+ return this;
+ }
+ }
+
+ protected AddRepositoryRequestAuditEvent() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected AddRepositoryRequestAuditEvent(AddRepositoryRequestAuditEventBuilder builder) {
+ super(builder);
+ }
+
+ /**
+ * Returns an builder for {@link AddRepositoryRequestAuditEvent}
+ *
+ * @return a builder instance
+ */
+ public static AddRepositoryRequestAuditEventBuilder builder() {
+ return new AddRepositoryRequestAuditEventBuilder();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/46a34ccd/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddRepositoryVersionRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddRepositoryVersionRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddRepositoryVersionRequestAuditEvent.java
new file mode 100644
index 0000000..b4d3401
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddRepositoryVersionRequestAuditEvent.java
@@ -0,0 +1,153 @@
+/*
+ * 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 java.util.Map;
+
+import javax.annotation.concurrent.Immutable;
+
+import org.apache.ambari.server.audit.request.RequestAuditEvent;
+
+/**
+ * Audit event for adding repository version
+ */
+@Immutable
+public class AddRepositoryVersionRequestAuditEvent extends RequestAuditEvent {
+
+ public static class AddRepositoryVersionAuditEventBuilder extends RequestAuditEventBuilder<AddRepositoryVersionRequestAuditEvent, AddRepositoryVersionAuditEventBuilder> {
+
+ /**
+ * Stack name
+ */
+ private String stackName;
+
+ /**
+ * Display name
+ */
+ private String displayName;
+
+ /**
+ * Stack version
+ */
+ private String stackVersion;
+
+ /**
+ * Repository version
+ */
+ private String repoVersion;
+
+ /**
+ * Details of the repositories
+ * os type -> list of repositories, where a repository is a key-value map of the properties (repo_id, repo_name, base_url)
+ */
+ private Map<String, List<Map<String, String>>> repos;
+
+ public AddRepositoryVersionAuditEventBuilder() {
+ super.withOperation("Repository version addition");
+ }
+
+ @Override
+ protected AddRepositoryVersionRequestAuditEvent newAuditEvent() {
+ return new AddRepositoryVersionRequestAuditEvent(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("), Display name(")
+ .append(displayName)
+ .append("), Repo version(")
+ .append(repoVersion)
+ .append("), Repositories(");
+
+ if (!repos.isEmpty()) {
+ builder.append(System.lineSeparator());
+ }
+
+ for (Map.Entry<String, List<Map<String, String>>> repo : repos.entrySet()) {
+ builder.append("Operating system: ").append(repo.getKey());
+ builder.append(System.lineSeparator());
+ for (Map<String, String> properties : repo.getValue()) {
+ builder.append(" Repository ID(").append(properties.get("repo_id"));
+ builder.append("), Repository name(").append(properties.get("repo_name"));
+ builder.append("), Base url(").append(properties.get("base_url")).append(")");
+ builder.append(System.lineSeparator());
+ }
+ }
+
+ builder.append(")");
+ }
+
+ public AddRepositoryVersionAuditEventBuilder withStackName(String stackName) {
+ this.stackName = stackName;
+ return this;
+ }
+
+ public AddRepositoryVersionAuditEventBuilder withDisplayName(String displayName) {
+ this.displayName = displayName;
+ return this;
+ }
+
+ public AddRepositoryVersionAuditEventBuilder withStackVersion(String stackVersion) {
+ this.stackVersion = stackVersion;
+ return this;
+ }
+
+ public AddRepositoryVersionAuditEventBuilder withRepoVersion(String repoVersion) {
+ this.repoVersion = repoVersion;
+ return this;
+ }
+
+ public AddRepositoryVersionAuditEventBuilder withRepos(Map<String, List<Map<String, String>>> repos) {
+ this.repos = repos;
+ return this;
+ }
+ }
+
+ protected AddRepositoryVersionRequestAuditEvent() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected AddRepositoryVersionRequestAuditEvent(AddRepositoryVersionAuditEventBuilder builder) {
+ super(builder);
+ }
+
+ /**
+ * Returns an builder for {@link AddRepositoryVersionRequestAuditEvent}
+ *
+ * @return a builder instance
+ */
+ public static AddRepositoryVersionAuditEventBuilder builder() {
+ return new AddRepositoryVersionAuditEventBuilder();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/46a34ccd/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddRequestRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddRequestRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddRequestRequestAuditEvent.java
new file mode 100644
index 0000000..004c24a
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddRequestRequestAuditEvent.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 request
+ */
+@Immutable
+public class AddRequestRequestAuditEvent extends RequestAuditEvent {
+
+ public static class AddRequestAuditEventBuilder extends RequestAuditEventBuilder<AddRequestRequestAuditEvent, AddRequestAuditEventBuilder> {
+
+ /**
+ * Command in the request
+ */
+ private String command;
+
+ /**
+ * Cluster name
+ */
+ private String clusterName;
+
+ public AddRequestAuditEventBuilder() {
+ super.withOperation("Request from server");
+ }
+
+ @Override
+ protected AddRequestRequestAuditEvent newAuditEvent() {
+ return new AddRequestRequestAuditEvent(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(", Command(")
+ .append(command)
+ .append("), Cluster name(")
+ .append(clusterName)
+ .append(")");
+ }
+
+ public AddRequestAuditEventBuilder withClusterName(String clusterName) {
+ this.clusterName = clusterName;
+ return this;
+ }
+
+ public AddRequestAuditEventBuilder withCommand(String command) {
+ this.command = command;
+ return this;
+ }
+ }
+
+ protected AddRequestRequestAuditEvent() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected AddRequestRequestAuditEvent(AddRequestAuditEventBuilder builder) {
+ super(builder);
+ }
+
+ /**
+ * Returns an builder for {@link AddRequestRequestAuditEvent}
+ *
+ * @return a builder instance
+ */
+ public static AddRequestAuditEventBuilder builder() {
+ return new AddRequestAuditEventBuilder();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/46a34ccd/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddUpgradeRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddUpgradeRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddUpgradeRequestAuditEvent.java
new file mode 100644
index 0000000..69b4536
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddUpgradeRequestAuditEvent.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 adding upgrade
+ */
+@Immutable
+public class AddUpgradeRequestAuditEvent extends RequestAuditEvent {
+
+ public static class AddUpgradeRequestAuditEventBuilder extends RequestAuditEventBuilder<AddUpgradeRequestAuditEvent, AddUpgradeRequestAuditEventBuilder> {
+
+ /**
+ * Repository version
+ */
+ private String repositoryVersion;
+
+ /**
+ * Upgrade type (rolling, non-rolling)
+ */
+ private String upgradeType;
+
+ /**
+ * Cluster name
+ */
+ private String clusterName;
+
+
+ public AddUpgradeRequestAuditEventBuilder() {
+ super.withOperation("Upgrade addition");
+ }
+
+ @Override
+ protected AddUpgradeRequestAuditEvent newAuditEvent() {
+ return new AddUpgradeRequestAuditEvent(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(", Repository version(")
+ .append(repositoryVersion)
+ .append("), Upgrade type(")
+ .append(upgradeType)
+ .append("), Cluster name(")
+ .append(clusterName)
+ .append(")");
+ }
+
+ public AddUpgradeRequestAuditEventBuilder withRepositoryVersion(String repositoryVersion) {
+ this.repositoryVersion = repositoryVersion;
+ return this;
+ }
+
+ public AddUpgradeRequestAuditEventBuilder withUpgradeType(String upgradeType) {
+ this.upgradeType = upgradeType;
+ return this;
+ }
+
+ public AddUpgradeRequestAuditEventBuilder withClusterName(String clusterName) {
+ this.clusterName = clusterName;
+ return this;
+ }
+ }
+
+ protected AddUpgradeRequestAuditEvent() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected AddUpgradeRequestAuditEvent(AddUpgradeRequestAuditEventBuilder builder) {
+ super(builder);
+ }
+
+ /**
+ * Returns an builder for {@link AddUpgradeRequestAuditEvent}
+ *
+ * @return a builder instance
+ */
+ public static AddUpgradeRequestAuditEventBuilder builder() {
+ return new AddUpgradeRequestAuditEventBuilder();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/46a34ccd/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddUserToGroupRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddUserToGroupRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddUserToGroupRequestAuditEvent.java
new file mode 100644
index 0000000..33293c0
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddUserToGroupRequestAuditEvent.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 adding a user to a group
+ */
+@Immutable
+public class AddUserToGroupRequestAuditEvent extends RequestAuditEvent {
+
+ public static class AddUserToGroupRequestAuditEventBuilder extends RequestAuditEventBuilder<AddUserToGroupRequestAuditEvent, AddUserToGroupRequestAuditEventBuilder> {
+
+ /**
+ * Group name
+ */
+ private String groupName;
+
+ /**
+ * Name of the user that is put to the group
+ */
+ private String affectedUserName;
+
+ public AddUserToGroupRequestAuditEventBuilder() {
+ super.withOperation("User addition to group");
+ }
+
+ @Override
+ protected AddUserToGroupRequestAuditEvent newAuditEvent() {
+ return new AddUserToGroupRequestAuditEvent(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 AddUserToGroupRequestAuditEvent() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected AddUserToGroupRequestAuditEvent(AddUserToGroupRequestAuditEventBuilder builder) {
+ super(builder);
+ }
+
+ /**
+ * Returns an builder for {@link AddUserToGroupRequestAuditEvent}
+ *
+ * @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/AddViewInstanceRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddViewInstanceRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddViewInstanceRequestAuditEvent.java
new file mode 100644
index 0000000..d9ab59a
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddViewInstanceRequestAuditEvent.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 adding view instance
+ */
+@Immutable
+public class AddViewInstanceRequestAuditEvent extends RequestAuditEvent {
+
+ public static class AddViewInstanceRequestAuditEventBuilder extends RequestAuditEventBuilder<AddViewInstanceRequestAuditEvent, AddViewInstanceRequestAuditEventBuilder> {
+
+ /**
+ * View instance description
+ */
+ private String description;
+
+ /**
+ * View instance name
+ */
+ private String name;
+
+ /**
+ * View instance type (Files, Tez, etc)
+ */
+ private String type;
+
+ /**
+ * Display name for the view instance
+ */
+ private String displayName;
+
+ /**
+ * View instance version
+ */
+ private String version;
+
+ public AddViewInstanceRequestAuditEventBuilder() {
+ super.withOperation("View addition");
+ }
+
+ @Override
+ protected AddViewInstanceRequestAuditEvent newAuditEvent() {
+ return new AddViewInstanceRequestAuditEvent(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("), Display name(")
+ .append(displayName)
+ .append("), Description(")
+ .append(description)
+ .append(")");
+ }
+
+ public AddViewInstanceRequestAuditEventBuilder withDescription(String description) {
+ this.description = description;
+ return this;
+ }
+
+ public AddViewInstanceRequestAuditEventBuilder withName(String name) {
+ this.name = name;
+ return this;
+ }
+
+ public AddViewInstanceRequestAuditEventBuilder withType(String type) {
+ this.type = type;
+ return this;
+ }
+
+ public AddViewInstanceRequestAuditEventBuilder withDisplayName(String displayName) {
+ this.displayName = displayName;
+ return this;
+ }
+
+ public AddViewInstanceRequestAuditEventBuilder withVersion(String version) {
+ this.version = version;
+ return this;
+ }
+ }
+
+ protected AddViewInstanceRequestAuditEvent() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected AddViewInstanceRequestAuditEvent(AddViewInstanceRequestAuditEventBuilder builder) {
+ super(builder);
+ }
+
+ /**
+ * Returns an builder for {@link AddViewInstanceRequestAuditEvent}
+ *
+ * @return a builder instance
+ */
+ public static AddViewInstanceRequestAuditEventBuilder builder() {
+ return new AddViewInstanceRequestAuditEventBuilder();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/46a34ccd/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AdminUserRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AdminUserRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AdminUserRequestAuditEvent.java
new file mode 100644
index 0000000..a43d783
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AdminUserRequestAuditEvent.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 setting or unsetting a user as admin
+ */
+@Immutable
+public class AdminUserRequestAuditEvent extends RequestAuditEvent {
+
+ public static class AdminUserRequestAuditEventBuilder extends RequestAuditEventBuilder<AdminUserRequestAuditEvent, AdminUserRequestAuditEventBuilder> {
+
+ /**
+ * Admin is set or not
+ */
+ private boolean admin;
+
+ /**
+ * Name of the user that is set or unset as admin
+ */
+ private String username;
+
+ public AdminUserRequestAuditEventBuilder() {
+ super.withOperation("Set user admin");
+ }
+
+ @Override
+ protected AdminUserRequestAuditEvent newAuditEvent() {
+ return new AdminUserRequestAuditEvent(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(", Affeted username(")
+ .append(username)
+ .append("), ")
+ .append("Administrator(")
+ .append(admin ? "yes" : "no")
+ .append(")");
+ }
+
+ public AdminUserRequestAuditEventBuilder withAdmin(boolean admin) {
+ this.admin = admin;
+ return this;
+ }
+
+ public AdminUserRequestAuditEventBuilder withAffectedUsername(String username) {
+ this.username = username;
+ return this;
+ }
+
+ }
+
+ protected AdminUserRequestAuditEvent() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected AdminUserRequestAuditEvent(AdminUserRequestAuditEventBuilder builder) {
+ super(builder);
+ }
+
+ /**
+ * Returns an builder for {@link AdminUserRequestAuditEvent}
+ *
+ * @return a builder instance
+ */
+ public static AdminUserRequestAuditEventBuilder builder() {
+ return new AdminUserRequestAuditEventBuilder();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/46a34ccd/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/BlueprintExportRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/BlueprintExportRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/BlueprintExportRequestAuditEvent.java
new file mode 100644
index 0000000..e5ea1bd
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/BlueprintExportRequestAuditEvent.java
@@ -0,0 +1,72 @@
+/*
+ * 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 export
+ */
+@Immutable
+public class BlueprintExportRequestAuditEvent extends RequestAuditEvent {
+
+ public static class BlueprintExportRequestAuditEventBuilder extends RequestAuditEventBuilder<BlueprintExportRequestAuditEvent, BlueprintExportRequestAuditEventBuilder> {
+
+ public BlueprintExportRequestAuditEventBuilder() {
+ super.withOperation("Blueprint export");
+ }
+
+ @Override
+ protected BlueprintExportRequestAuditEvent newAuditEvent() {
+ return new BlueprintExportRequestAuditEvent(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);
+ }
+ }
+
+ protected BlueprintExportRequestAuditEvent() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected BlueprintExportRequestAuditEvent(BlueprintExportRequestAuditEventBuilder builder) {
+ super(builder);
+ }
+
+ /**
+ * Returns an builder for {@link BlueprintExportRequestAuditEvent}
+ *
+ * @return a builder instance
+ */
+ public static BlueprintExportRequestAuditEventBuilder builder() {
+ return new BlueprintExportRequestAuditEventBuilder();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/46a34ccd/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ChangeAlertGroupRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ChangeAlertGroupRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ChangeAlertGroupRequestAuditEvent.java
new file mode 100644
index 0000000..d5a59df
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ChangeAlertGroupRequestAuditEvent.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 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 changing alert group
+ */
+@Immutable
+public class ChangeAlertGroupRequestAuditEvent extends RequestAuditEvent {
+
+ public static class ChangeAlertGroupRequestAuditEventBuilder extends RequestAuditEventBuilder<ChangeAlertGroupRequestAuditEvent, ChangeAlertGroupRequestAuditEventBuilder> {
+
+ /**
+ * Group name
+ */
+ private String name;
+
+ /**
+ * Definition ids
+ */
+ private List<String> definitionIds;
+
+ /**
+ * Notification ids
+ */
+ private List<String> notificationIds;
+
+ public ChangeAlertGroupRequestAuditEventBuilder() {
+ super.withOperation("Alert group change");
+ }
+
+ @Override
+ protected ChangeAlertGroupRequestAuditEvent newAuditEvent() {
+ return new ChangeAlertGroupRequestAuditEvent(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 name(")
+ .append(name)
+ .append("), Definition IDs(")
+ .append(StringUtils.join(definitionIds, ", "))
+ .append("), Notification IDs(")
+ .append(StringUtils.join(notificationIds, ", "))
+ .append(")");
+ }
+
+ public ChangeAlertGroupRequestAuditEventBuilder withName(String name) {
+ this.name = name;
+ return this;
+ }
+
+ public ChangeAlertGroupRequestAuditEventBuilder withDefinitionIds(List<String> ids) {
+ this.definitionIds = ids;
+ return this;
+ }
+
+ public ChangeAlertGroupRequestAuditEventBuilder withNotificationIds(List<String> ids) {
+ this.notificationIds = ids;
+ return this;
+ }
+ }
+
+ protected ChangeAlertGroupRequestAuditEvent() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected ChangeAlertGroupRequestAuditEvent(ChangeAlertGroupRequestAuditEventBuilder builder) {
+ super(builder);
+ }
+
+ /**
+ * Returns an builder for {@link ChangeAlertGroupRequestAuditEvent}
+ *
+ * @return a builder instance
+ */
+ public static ChangeAlertGroupRequestAuditEventBuilder builder() {
+ return new ChangeAlertGroupRequestAuditEventBuilder();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/46a34ccd/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ChangeAlertTargetRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ChangeAlertTargetRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ChangeAlertTargetRequestAuditEvent.java
new file mode 100644
index 0000000..63a45ca
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ChangeAlertTargetRequestAuditEvent.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 java.util.List;
+
+import org.apache.ambari.server.audit.request.RequestAuditEvent;
+import org.apache.commons.lang.StringUtils;
+
+public class ChangeAlertTargetRequestAuditEvent extends RequestAuditEvent {
+
+ public static class ChangeAlertTargetRequestAuditEventBuilder extends RequestAuditEventBuilder<ChangeAlertTargetRequestAuditEvent, ChangeAlertTargetRequestAuditEventBuilder> {
+
+ private String name;
+ private String description;
+ private String notificationType;
+ private List<String> groupIds;
+ private String emailFrom;
+ private List<String> emailRecipients;
+ private List<String> alertStates;
+
+ public ChangeAlertTargetRequestAuditEventBuilder() {
+ super.withOperation("Notification change");
+ }
+
+ @Override
+ protected ChangeAlertTargetRequestAuditEvent newAuditEvent() {
+ return new ChangeAlertTargetRequestAuditEvent(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 name(")
+ .append(name)
+ .append("), Description(")
+ .append(description)
+ .append("), Notification type(")
+ .append(notificationType)
+ .append("), Group IDs(")
+ .append(StringUtils.join(groupIds, ", "));
+
+ if (emailFrom != null) {
+ builder.append("), Email from(")
+ .append(emailFrom);
+ }
+
+ if (emailRecipients != null && !emailRecipients.isEmpty()) {
+ builder.append("), Email to(")
+ .append(StringUtils.join(emailRecipients, ", "));
+ }
+ builder.append("), Alert states(")
+ .append(StringUtils.join(alertStates, ", "))
+ .append(")");
+ }
+
+ public ChangeAlertTargetRequestAuditEventBuilder withName(String name) {
+ this.name = name;
+ return this;
+ }
+
+ public ChangeAlertTargetRequestAuditEventBuilder withDescription(String description) {
+ this.description = description;
+ return this;
+ }
+
+ public ChangeAlertTargetRequestAuditEventBuilder withNotificationType(String notificationType) {
+ this.notificationType = notificationType;
+ return this;
+ }
+
+ public ChangeAlertTargetRequestAuditEventBuilder withGroupIds(List<String> groupIds) {
+ this.groupIds = groupIds;
+ return this;
+ }
+
+ public ChangeAlertTargetRequestAuditEventBuilder withEmailFrom(String emailFrom) {
+ this.emailFrom = emailFrom;
+ return this;
+ }
+
+ public ChangeAlertTargetRequestAuditEventBuilder withEmailRecipients(List<String> emailRecipients) {
+ this.emailRecipients = emailRecipients;
+ return this;
+ }
+
+ public ChangeAlertTargetRequestAuditEventBuilder withAlertStates(List<String> alertStates) {
+ this.alertStates = alertStates;
+ return this;
+ }
+ }
+
+ protected ChangeAlertTargetRequestAuditEvent() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected ChangeAlertTargetRequestAuditEvent(ChangeAlertTargetRequestAuditEventBuilder builder) {
+ super(builder);
+ }
+
+ /**
+ * Returns an builder for {@link ChangeAlertTargetRequestAuditEvent}
+ *
+ * @return a builder instance
+ */
+ public static ChangeAlertTargetRequestAuditEventBuilder builder() {
+ return new ChangeAlertTargetRequestAuditEventBuilder();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/46a34ccd/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ChangeRepositoryVersionRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ChangeRepositoryVersionRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ChangeRepositoryVersionRequestAuditEvent.java
new file mode 100644
index 0000000..74e7267
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ChangeRepositoryVersionRequestAuditEvent.java
@@ -0,0 +1,153 @@
+/*
+ * 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 java.util.Map;
+
+import javax.annotation.concurrent.Immutable;
+
+import org.apache.ambari.server.audit.request.RequestAuditEvent;
+
+/**
+ * Audit event for changing repository version
+ */
+@Immutable
+public class ChangeRepositoryVersionRequestAuditEvent extends RequestAuditEvent {
+
+ public static class ChangeRepositoryVersionAuditEventBuilder extends RequestAuditEventBuilder<ChangeRepositoryVersionRequestAuditEvent, ChangeRepositoryVersionAuditEventBuilder> {
+
+ /**
+ * Stack name
+ */
+ private String stackName;
+
+ /**
+ * Display name
+ */
+ private String displayName;
+
+ /**
+ * Stack version
+ */
+ private String stackVersion;
+
+ /**
+ * Repository version
+ */
+ private String repoVersion;
+
+ /**
+ * Details of the repositories
+ * os type -> list of repositories, where a repository is a key-value map of the properties (repo_id, repo_name, base_url)
+ */
+ private Map<String, List<Map<String, String>>> repos;
+
+ public ChangeRepositoryVersionAuditEventBuilder() {
+ super.withOperation("Repository version change");
+ }
+
+ @Override
+ protected ChangeRepositoryVersionRequestAuditEvent newAuditEvent() {
+ return new ChangeRepositoryVersionRequestAuditEvent(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("), Display name(")
+ .append(displayName)
+ .append("), Repo version(")
+ .append(repoVersion)
+ .append("), Repositories(");
+
+ if (!repos.isEmpty()) {
+ builder.append(System.lineSeparator());
+ }
+
+ for (Map.Entry<String, List<Map<String, String>>> repo : repos.entrySet()) {
+ builder.append("Operating system: ").append(repo.getKey());
+ builder.append(System.lineSeparator());
+ for (Map<String, String> properties : repo.getValue()) {
+ builder.append(" Repository ID(").append(properties.get("repo_id"));
+ builder.append("), Repository name(").append(properties.get("repo_name"));
+ builder.append("), Base url(").append(properties.get("base_url")).append(")");
+ builder.append(System.lineSeparator());
+ }
+ }
+
+ builder.append(")");
+ }
+
+ public ChangeRepositoryVersionAuditEventBuilder withStackName(String stackName) {
+ this.stackName = stackName;
+ return this;
+ }
+
+ public ChangeRepositoryVersionAuditEventBuilder withDisplayName(String displayName) {
+ this.displayName = displayName;
+ return this;
+ }
+
+ public ChangeRepositoryVersionAuditEventBuilder withStackVersion(String stackVersion) {
+ this.stackVersion = stackVersion;
+ return this;
+ }
+
+ public ChangeRepositoryVersionAuditEventBuilder withRepoVersion(String repoVersion) {
+ this.repoVersion = repoVersion;
+ return this;
+ }
+
+ public ChangeRepositoryVersionAuditEventBuilder withRepos(Map<String, List<Map<String, String>>> repos) {
+ this.repos = repos;
+ return this;
+ }
+ }
+
+ protected ChangeRepositoryVersionRequestAuditEvent() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected ChangeRepositoryVersionRequestAuditEvent(ChangeRepositoryVersionAuditEventBuilder builder) {
+ super(builder);
+ }
+
+ /**
+ * Returns an builder for {@link ChangeRepositoryVersionRequestAuditEvent}
+ *
+ * @return a builder instance
+ */
+ public static ChangeRepositoryVersionAuditEventBuilder builder() {
+ return new ChangeRepositoryVersionAuditEventBuilder();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/46a34ccd/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ChangeViewInstanceRequestAuditEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ChangeViewInstanceRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ChangeViewInstanceRequestAuditEvent.java
new file mode 100644
index 0000000..4f719c6
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ChangeViewInstanceRequestAuditEvent.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 change view instance
+ */
+@Immutable
+public class ChangeViewInstanceRequestAuditEvent extends RequestAuditEvent {
+
+ public static class ChangeViewInstanceRequestAuditEventBuilder extends RequestAuditEventBuilder<ChangeViewInstanceRequestAuditEvent, ChangeViewInstanceRequestAuditEventBuilder> {
+
+ /**
+ * Description for the view instance
+ */
+ private String description;
+
+ /**
+ * Name for the view instance
+ */
+ private String name;
+
+ /**
+ * Type for view instance (Files, Tez)
+ */
+ private String type;
+
+ /**
+ * Display name for view instance
+ */
+ private String displayName;
+
+ /**
+ * Version for view instance
+ */
+ private String version;
+
+ public ChangeViewInstanceRequestAuditEventBuilder() {
+ super.withOperation("View change");
+ }
+
+ @Override
+ protected ChangeViewInstanceRequestAuditEvent newAuditEvent() {
+ return new ChangeViewInstanceRequestAuditEvent(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("), Display name(")
+ .append(displayName)
+ .append("), Description(")
+ .append(description)
+ .append(")");
+ }
+
+ public ChangeViewInstanceRequestAuditEventBuilder withDescription(String description) {
+ this.description = description;
+ return this;
+ }
+
+ public ChangeViewInstanceRequestAuditEventBuilder withName(String name) {
+ this.name = name;
+ return this;
+ }
+
+ public ChangeViewInstanceRequestAuditEventBuilder withType(String type) {
+ this.type = type;
+ return this;
+ }
+
+ public ChangeViewInstanceRequestAuditEventBuilder withDisplayName(String displayName) {
+ this.displayName = displayName;
+ return this;
+ }
+
+ public ChangeViewInstanceRequestAuditEventBuilder withVersion(String version) {
+ this.version = version;
+ return this;
+ }
+ }
+
+ protected ChangeViewInstanceRequestAuditEvent() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected ChangeViewInstanceRequestAuditEvent(ChangeViewInstanceRequestAuditEventBuilder builder) {
+ super(builder);
+ }
+
+ /**
+ * Returns an builder for {@link ChangeViewInstanceRequestAuditEvent}
+ *
+ * @return a builder instance
+ */
+ public static ChangeViewInstanceRequestAuditEventBuilder builder() {
+ return new ChangeViewInstanceRequestAuditEventBuilder();
+ }
+
+}