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/24 13:09:15 UTC
[43/51] [abbrv] ambari git commit: Fix for review comments: package
refactor, javadoc, configuration
http://git-wip-us.apache.org/repos/asf/ambari/blob/565c2ea2/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/565c2ea2/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/565c2ea2/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/565c2ea2/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/565c2ea2/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();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/565c2ea2/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/565c2ea2/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/565c2ea2/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/565c2ea2/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/565c2ea2/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/565c2ea2/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/565c2ea2/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/565c2ea2/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/565c2ea2/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/565c2ea2/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/565c2ea2/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/565c2ea2/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/565c2ea2/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/565c2ea2/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/565c2ea2/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/565c2ea2/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/565c2ea2/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/565c2ea2/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();
+ }
+
+}