Move events to a package
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/017561f1 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/017561f1 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/017561f1 Branch: refs/heads/audit_logging Commit: 017561f102a1ebf27e4681b06621440a6d220b88 Parents: bd9abb8 Author: Daniel Gergely <[email protected]> Authored: Thu Feb 18 16:51:56 2016 +0100 Committer: Toader, Sebastian <[email protected]> Committed: Thu Mar 24 13:06:45 2016 +0100 ---------------------------------------------------------------------- .../request/ActivateUserRequestAuditEvent.java | 85 ------------ .../request/AddBlueprintRequestAuditEvent.java | 75 ---------- .../AddUserToGroupRequestAuditEvent.java | 84 ----------- .../AddViewInstanceRequestAuditEvent.java | 113 --------------- .../request/AdminUserRequestAuditEvent.java | 85 ------------ .../BlueprintExportRequestAuditEvent.java | 62 --------- .../ChangeViewInstanceRequestAuditEvent.java | 109 --------------- .../ClientConfigDownloadRequestAuditEvent.java | 84 ----------- ...ClusterPrivilegeChangeRequestAuditEvent.java | 108 -------------- .../ConfigurationChangeRequestAuditEvent.java | 88 ------------ .../request/CreateGroupRequestAuditEvent.java | 75 ---------- .../request/CreateUserRequestAuditEvent.java | 94 ------------- .../DeleteBlueprintRequestAuditEvent.java | 75 ---------- .../request/DeleteGroupRequestAuditEvent.java | 75 ---------- .../request/DeleteUserRequestAuditEvent.java | 75 ---------- .../DeleteViewInstanceRequestAuditEvent.java | 91 ------------ .../MembershipChangeRequestAuditEvent.java | 93 ------------- .../PrivilegeChangeRequestAuditEvent.java | 94 ------------- .../RemoveUserFromGroupRequestAuditEvent.java | 81 ----------- .../UserPasswordChangeRequestAuditEvent.java | 75 ---------- .../ViewPrivilegeChangeRequestAuditEvent.java | 138 ------------------ .../event/ActivateUserRequestAuditEvent.java | 87 ++++++++++++ .../event/AddBlueprintRequestAuditEvent.java | 77 ++++++++++ .../event/AddUserToGroupRequestAuditEvent.java | 83 +++++++++++ .../event/AddViewInstanceRequestAuditEvent.java | 111 +++++++++++++++ .../event/AdminUserRequestAuditEvent.java | 87 ++++++++++++ .../event/BlueprintExportRequestAuditEvent.java | 64 +++++++++ .../ChangeViewInstanceRequestAuditEvent.java | 111 +++++++++++++++ .../ClientConfigDownloadRequestAuditEvent.java | 86 ++++++++++++ ...ClusterPrivilegeChangeRequestAuditEvent.java | 109 +++++++++++++++ .../ConfigurationChangeRequestAuditEvent.java | 90 ++++++++++++ .../event/CreateGroupRequestAuditEvent.java | 77 ++++++++++ .../event/CreateUserRequestAuditEvent.java | 96 +++++++++++++ .../event/DeleteBlueprintRequestAuditEvent.java | 77 ++++++++++ .../event/DeleteGroupRequestAuditEvent.java | 77 ++++++++++ .../event/DeleteUserRequestAuditEvent.java | 77 ++++++++++ .../DeleteViewInstanceRequestAuditEvent.java | 93 +++++++++++++ .../MembershipChangeRequestAuditEvent.java | 94 +++++++++++++ .../event/PrivilegeChangeRequestAuditEvent.java | 96 +++++++++++++ .../RemoveUserFromGroupRequestAuditEvent.java | 83 +++++++++++ .../UserPasswordChangeRequestAuditEvent.java | 77 ++++++++++ .../ViewPrivilegeChangeRequestAuditEvent.java | 139 +++++++++++++++++++ .../eventcreator/BlueprintEventCreator.java | 5 +- .../BlueprintExportEventCreator.java | 9 +- .../ConfigurationChangeEventCreator.java | 2 +- .../request/eventcreator/GroupEventCreator.java | 10 +- .../eventcreator/MemberEventCreator.java | 7 +- .../eventcreator/PrivilegeEventCreator.java | 7 +- .../ServiceConfigDownloadEventCreator.java | 3 +- .../request/eventcreator/UserEventCreator.java | 11 +- .../eventcreator/ViewInstanceEventCreator.java | 11 +- .../eventcreator/ViewPrivilegeEventCreator.java | 5 +- 52 files changed, 1912 insertions(+), 1908 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/017561f1/ambari-server/src/main/java/org/apache/ambari/server/audit/request/ActivateUserRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/ActivateUserRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/ActivateUserRequestAuditEvent.java deleted file mode 100644 index c80444f..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/ActivateUserRequestAuditEvent.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * 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.request; - -public class ActivateUserRequestAuditEvent extends RequestAuditEvent { - - public static class ActivateUserRequestAuditEventBuilder extends RequestAuditEventBuilder<ActivateUserRequestAuditEvent, ActivateUserRequestAuditEventBuilder> { - - private boolean active; - - 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/017561f1/ambari-server/src/main/java/org/apache/ambari/server/audit/request/AddBlueprintRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/AddBlueprintRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/AddBlueprintRequestAuditEvent.java deleted file mode 100644 index fbf90c8..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/AddBlueprintRequestAuditEvent.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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.request; - -public class AddBlueprintRequestAuditEvent extends RequestAuditEvent { - - public static class AddBlueprintRequestAuditEventBuilder extends RequestAuditEventBuilder<AddBlueprintRequestAuditEvent, AddBlueprintRequestAuditEventBuilder> { - - 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/017561f1/ambari-server/src/main/java/org/apache/ambari/server/audit/request/AddUserToGroupRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/AddUserToGroupRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/AddUserToGroupRequestAuditEvent.java deleted file mode 100644 index 37e33a1..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/AddUserToGroupRequestAuditEvent.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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.request; - -import java.util.List; -import java.util.Map; - -public class AddUserToGroupRequestAuditEvent extends RequestAuditEvent { - - public static class AddUserToGroupRequestAuditEventBuilder extends RequestAuditEventBuilder<AddUserToGroupRequestAuditEvent, AddUserToGroupRequestAuditEventBuilder> { - - private String groupName; - 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/017561f1/ambari-server/src/main/java/org/apache/ambari/server/audit/request/AddViewInstanceRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/AddViewInstanceRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/AddViewInstanceRequestAuditEvent.java deleted file mode 100644 index 9d1b393..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/AddViewInstanceRequestAuditEvent.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * 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.request; - -import java.util.List; - -import org.apache.commons.lang.StringUtils; - -public class AddViewInstanceRequestAuditEvent extends RequestAuditEvent { - - public static class AddViewInstanceRequestAuditEventBuilder extends RequestAuditEventBuilder<AddViewInstanceRequestAuditEvent, AddViewInstanceRequestAuditEventBuilder> { - - private String description; - - private String name; - - private String type; - - private String displayName; - - 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/017561f1/ambari-server/src/main/java/org/apache/ambari/server/audit/request/AdminUserRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/AdminUserRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/AdminUserRequestAuditEvent.java deleted file mode 100644 index 71a73b3..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/AdminUserRequestAuditEvent.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * 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.request; - -public class AdminUserRequestAuditEvent extends RequestAuditEvent { - - public static class AdminUserRequestAuditEventBuilder extends RequestAuditEventBuilder<AdminUserRequestAuditEvent, AdminUserRequestAuditEventBuilder> { - - private boolean 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/017561f1/ambari-server/src/main/java/org/apache/ambari/server/audit/request/BlueprintExportRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/BlueprintExportRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/BlueprintExportRequestAuditEvent.java deleted file mode 100644 index 5b27a0b..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/BlueprintExportRequestAuditEvent.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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.request; - -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/017561f1/ambari-server/src/main/java/org/apache/ambari/server/audit/request/ChangeViewInstanceRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/ChangeViewInstanceRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/ChangeViewInstanceRequestAuditEvent.java deleted file mode 100644 index 8dd31ae..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/ChangeViewInstanceRequestAuditEvent.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for changeitional 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.request; - -public class ChangeViewInstanceRequestAuditEvent extends RequestAuditEvent { - - public static class ChangeViewInstanceRequestAuditEventBuilder extends RequestAuditEventBuilder<ChangeViewInstanceRequestAuditEvent, ChangeViewInstanceRequestAuditEventBuilder> { - - private String description; - - private String name; - - private String type; - - private String displayName; - - 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/017561f1/ambari-server/src/main/java/org/apache/ambari/server/audit/request/ClientConfigDownloadRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/ClientConfigDownloadRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/ClientConfigDownloadRequestAuditEvent.java deleted file mode 100644 index ba744be..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/ClientConfigDownloadRequestAuditEvent.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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.request; - -public class ClientConfigDownloadRequestAuditEvent extends RequestAuditEvent { - - public static class ClientConfigDownloadRequestAuditEventBuilder extends RequestAuditEventBuilder<ClientConfigDownloadRequestAuditEvent, ClientConfigDownloadRequestAuditEventBuilder> { - - private String service; - - 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/017561f1/ambari-server/src/main/java/org/apache/ambari/server/audit/request/ClusterPrivilegeChangeRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/ClusterPrivilegeChangeRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/ClusterPrivilegeChangeRequestAuditEvent.java deleted file mode 100644 index 34b44e3..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/ClusterPrivilegeChangeRequestAuditEvent.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * 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.request; - -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.commons.lang.StringUtils; - -public class ClusterPrivilegeChangeRequestAuditEvent extends RequestAuditEvent { - - public static class ClusterPrivilegeChangeRequestAuditEventBuilder extends RequestAuditEventBuilder<ClusterPrivilegeChangeRequestAuditEvent, ClusterPrivilegeChangeRequestAuditEventBuilder> { - - private Map<String, List<String>> users; - 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/017561f1/ambari-server/src/main/java/org/apache/ambari/server/audit/request/ConfigurationChangeRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/ConfigurationChangeRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/ConfigurationChangeRequestAuditEvent.java deleted file mode 100644 index bb6cc3b..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/ConfigurationChangeRequestAuditEvent.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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.request; - -/** - * Base class for start operation audit events. - */ -public class ConfigurationChangeRequestAuditEvent extends RequestAuditEvent { - - public static class ConfigurationChangeRequestAuditEventBuilder extends RequestAuditEventBuilder<ConfigurationChangeRequestAuditEvent, ConfigurationChangeRequestAuditEventBuilder> { - - private String versionNumber; - - 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/017561f1/ambari-server/src/main/java/org/apache/ambari/server/audit/request/CreateGroupRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/CreateGroupRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/CreateGroupRequestAuditEvent.java deleted file mode 100644 index d1298f3..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/CreateGroupRequestAuditEvent.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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.request; - -public class CreateGroupRequestAuditEvent extends RequestAuditEvent { - - public static class CreateGroupRequestAuditEventBuilder extends RequestAuditEventBuilder<CreateGroupRequestAuditEvent, CreateGroupRequestAuditEventBuilder> { - - private String groupName; - - public CreateGroupRequestAuditEventBuilder() { - super.withOperation("Group create"); - } - - @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/017561f1/ambari-server/src/main/java/org/apache/ambari/server/audit/request/CreateUserRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/CreateUserRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/CreateUserRequestAuditEvent.java deleted file mode 100644 index eb12bae..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/CreateUserRequestAuditEvent.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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.request; - -public class CreateUserRequestAuditEvent extends RequestAuditEvent { - - public static class CreateUserRequestAuditEventBuilder extends RequestAuditEventBuilder<CreateUserRequestAuditEvent, CreateUserRequestAuditEventBuilder> { - - private boolean admin; - - private boolean active; - - private String username; - - public CreateUserRequestAuditEventBuilder() { - super.withOperation("User create"); - } - - @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/017561f1/ambari-server/src/main/java/org/apache/ambari/server/audit/request/DeleteBlueprintRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/DeleteBlueprintRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/DeleteBlueprintRequestAuditEvent.java deleted file mode 100644 index 38911cb..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/DeleteBlueprintRequestAuditEvent.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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.request; - -public class DeleteBlueprintRequestAuditEvent extends RequestAuditEvent { - - public static class DeleteBlueprintRequestAuditEventBuilder extends RequestAuditEventBuilder<DeleteBlueprintRequestAuditEvent, DeleteBlueprintRequestAuditEventBuilder> { - - 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/017561f1/ambari-server/src/main/java/org/apache/ambari/server/audit/request/DeleteGroupRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/DeleteGroupRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/DeleteGroupRequestAuditEvent.java deleted file mode 100644 index 7265def..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/DeleteGroupRequestAuditEvent.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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.request; - -public class DeleteGroupRequestAuditEvent extends RequestAuditEvent { - - public static class DeleteGroupRequestAuditEventBuilder extends RequestAuditEventBuilder<DeleteGroupRequestAuditEvent, DeleteGroupRequestAuditEventBuilder> { - - 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/017561f1/ambari-server/src/main/java/org/apache/ambari/server/audit/request/DeleteUserRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/DeleteUserRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/DeleteUserRequestAuditEvent.java deleted file mode 100644 index 2e67829..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/DeleteUserRequestAuditEvent.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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.request; - -public class DeleteUserRequestAuditEvent extends RequestAuditEvent { - - public static class DeleteUserRequestAuditEventBuilder extends RequestAuditEventBuilder<DeleteUserRequestAuditEvent, DeleteUserRequestAuditEventBuilder> { - - 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/017561f1/ambari-server/src/main/java/org/apache/ambari/server/audit/request/DeleteViewInstanceRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/DeleteViewInstanceRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/DeleteViewInstanceRequestAuditEvent.java deleted file mode 100644 index 20d3234..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/DeleteViewInstanceRequestAuditEvent.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * 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.request; - -public class DeleteViewInstanceRequestAuditEvent extends RequestAuditEvent { - - public static class DeleteViewInstanceRequestAuditEventBuilder extends RequestAuditEventBuilder<DeleteViewInstanceRequestAuditEvent, DeleteViewInstanceRequestAuditEventBuilder> { - - private String name; - - private String type; - - 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/017561f1/ambari-server/src/main/java/org/apache/ambari/server/audit/request/MembershipChangeRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/MembershipChangeRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/MembershipChangeRequestAuditEvent.java deleted file mode 100644 index a407f4b..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/MembershipChangeRequestAuditEvent.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * 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.request; - -import java.util.List; - -import org.apache.commons.lang.StringUtils; - -public class MembershipChangeRequestAuditEvent extends RequestAuditEvent { - - public static class AddUserToGroupRequestAuditEventBuilder extends RequestAuditEventBuilder<MembershipChangeRequestAuditEvent, AddUserToGroupRequestAuditEventBuilder> { - - private List<String> userNameList; - - 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/017561f1/ambari-server/src/main/java/org/apache/ambari/server/audit/request/PrivilegeChangeRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/PrivilegeChangeRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/PrivilegeChangeRequestAuditEvent.java deleted file mode 100644 index ffc75e1..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/PrivilegeChangeRequestAuditEvent.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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.request; - -public class PrivilegeChangeRequestAuditEvent extends RequestAuditEvent { - - public static class PrivilegeChangeRequestAuditEventBuilder extends RequestAuditEventBuilder<PrivilegeChangeRequestAuditEvent, PrivilegeChangeRequestAuditEventBuilder> { - - private String user; - - private String 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/017561f1/ambari-server/src/main/java/org/apache/ambari/server/audit/request/RemoveUserFromGroupRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/RemoveUserFromGroupRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/RemoveUserFromGroupRequestAuditEvent.java deleted file mode 100644 index 0bd977f..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/RemoveUserFromGroupRequestAuditEvent.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.request; - -public class RemoveUserFromGroupRequestAuditEvent extends RequestAuditEvent { - - public static class AddUserToGroupRequestAuditEventBuilder extends RequestAuditEventBuilder<RemoveUserFromGroupRequestAuditEvent, AddUserToGroupRequestAuditEventBuilder> { - - private String groupName; - private String affectedUserName; - - public AddUserToGroupRequestAuditEventBuilder() { - super.withOperation("User removal from group"); - } - - @Override - protected RemoveUserFromGroupRequestAuditEvent newAuditEvent() { - return new RemoveUserFromGroupRequestAuditEvent(this); - } - - /** - * Appends to the event the details of the incoming request. - * @param builder builder for the audit event details. - */ - @Override - protected void buildAuditMessage(StringBuilder builder) { - super.buildAuditMessage(builder); - - builder.append(", Group("); - builder.append(groupName); - builder.append("), Affected username("); - builder.append(affectedUserName); - builder.append(")"); - } - - public AddUserToGroupRequestAuditEventBuilder withGroupName(String groupName) { - this.groupName = groupName; - return this; - } - - public AddUserToGroupRequestAuditEventBuilder withAffectedUserName(String userName) { - this.affectedUserName = userName; - return this; - } - } - - protected RemoveUserFromGroupRequestAuditEvent() { - } - - /** - * {@inheritDoc} - */ - protected RemoveUserFromGroupRequestAuditEvent(AddUserToGroupRequestAuditEventBuilder builder) { - super(builder); - } - - /** - * Returns an builder for {@link RemoveUserFromGroupRequestAuditEvent} - * @return a builder instance - */ - public static AddUserToGroupRequestAuditEventBuilder builder() { - return new AddUserToGroupRequestAuditEventBuilder(); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/017561f1/ambari-server/src/main/java/org/apache/ambari/server/audit/request/UserPasswordChangeRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/UserPasswordChangeRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/UserPasswordChangeRequestAuditEvent.java deleted file mode 100644 index a4a53da..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/UserPasswordChangeRequestAuditEvent.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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.request; - -public class UserPasswordChangeRequestAuditEvent extends RequestAuditEvent { - - public static class UserPasswordChangeRequestAuditEventBuilder extends RequestAuditEventBuilder<UserPasswordChangeRequestAuditEvent, UserPasswordChangeRequestAuditEventBuilder> { - - private String username; - - public UserPasswordChangeRequestAuditEventBuilder() { - super.withOperation("Password change"); - } - - @Override - protected UserPasswordChangeRequestAuditEvent newAuditEvent() { - return new UserPasswordChangeRequestAuditEvent(this); - } - - /** - * Appends to the event the details of the incoming request. - * @param builder builder for the audit event details. - */ - @Override - protected void buildAuditMessage(StringBuilder builder) { - super.buildAuditMessage(builder); - - builder - .append(", Affected username(") - .append(username) - .append(")"); - } - - - public UserPasswordChangeRequestAuditEventBuilder withAffectedUsername(String username) { - this.username = username; - return this; - } - } - - protected UserPasswordChangeRequestAuditEvent() { - } - - /** - * {@inheritDoc} - */ - protected UserPasswordChangeRequestAuditEvent(UserPasswordChangeRequestAuditEventBuilder builder) { - super(builder); - } - - /** - * Returns an builder for {@link UserPasswordChangeRequestAuditEvent} - * @return a builder instance - */ - public static UserPasswordChangeRequestAuditEventBuilder builder() { - return new UserPasswordChangeRequestAuditEventBuilder(); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/017561f1/ambari-server/src/main/java/org/apache/ambari/server/audit/request/ViewPrivilegeChangeRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/ViewPrivilegeChangeRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/ViewPrivilegeChangeRequestAuditEvent.java deleted file mode 100644 index c71df18..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/ViewPrivilegeChangeRequestAuditEvent.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * 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.request; - -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.commons.lang.StringUtils; - -public class ViewPrivilegeChangeRequestAuditEvent extends RequestAuditEvent { - - public static class ViewPrivilegeChangeRequestAuditEventBuilder extends RequestAuditEventBuilder<ViewPrivilegeChangeRequestAuditEvent, ViewPrivilegeChangeRequestAuditEventBuilder> { - - private Map<String, List<String>> users; - private Map<String, List<String>> groups; - - private String name; - - private String type; - - private String version; - - - public ViewPrivilegeChangeRequestAuditEventBuilder() { - super.withOperation("View permission change"); - } - - @Override - protected ViewPrivilegeChangeRequestAuditEvent newAuditEvent() { - return new ViewPrivilegeChangeRequestAuditEvent(this); - } - - /** - * Appends to the event the details of the incoming request. - * @param builder builder for the audit event details. - */ - @Override - protected void buildAuditMessage(StringBuilder builder) { - super.buildAuditMessage(builder); - - builder.append(", Type(") - .append(type) - .append("), Version(") - .append(version) - .append("), Name(") - .append(name) - .append(")"); - - Set<String> roleSet = new HashSet<String>(); - roleSet.addAll(users.keySet()); - roleSet.addAll(groups.keySet()); - - builder.append(", Permissions("); - if(!users.isEmpty() || !groups.isEmpty()) { - builder.append(System.lineSeparator()); - } - - List<String> lines = new LinkedList<String>(); - - for(String role : roleSet) { - lines.add(role + ": "); - if(users.get(role) != null && !users.get(role).isEmpty()) { - lines.add(" Users: " + StringUtils.join(users.get(role), ", ")); - } - if(groups.get(role) != null && !groups.get(role).isEmpty()) { - lines.add(" Groups: " + StringUtils.join(groups.get(role), ", ")); - } - } - - builder.append(StringUtils.join(lines,System.lineSeparator())); - - builder.append(")"); - } - - public ViewPrivilegeChangeRequestAuditEventBuilder withName(String name) { - this.name = name; - return this; - } - - public ViewPrivilegeChangeRequestAuditEventBuilder withType(String type) { - this.type = type; - return this; - } - - public ViewPrivilegeChangeRequestAuditEventBuilder withVersion(String version) { - this.version = version; - return this; - } - - public ViewPrivilegeChangeRequestAuditEventBuilder withUsers(Map<String, List<String>> users) { - this.users = users; - return this; - } - - public ViewPrivilegeChangeRequestAuditEventBuilder withGroups(Map<String, List<String>> groups) { - this.groups = groups; - return this; - } - } - - protected ViewPrivilegeChangeRequestAuditEvent() { - } - - /** - * {@inheritDoc} - */ - protected ViewPrivilegeChangeRequestAuditEvent(ViewPrivilegeChangeRequestAuditEventBuilder builder) { - super(builder); - } - - /** - * Returns an builder for {@link ViewPrivilegeChangeRequestAuditEvent} - * @return a builder instance - */ - public static ViewPrivilegeChangeRequestAuditEventBuilder builder() { - return new ViewPrivilegeChangeRequestAuditEventBuilder(); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/017561f1/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/ActivateUserRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/ActivateUserRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/ActivateUserRequestAuditEvent.java new file mode 100644 index 0000000..4e14671 --- /dev/null +++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/ActivateUserRequestAuditEvent.java @@ -0,0 +1,87 @@ +/* + * 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.request.event; + +import org.apache.ambari.server.audit.request.RequestAuditEvent; + +public class ActivateUserRequestAuditEvent extends RequestAuditEvent { + + public static class ActivateUserRequestAuditEventBuilder extends RequestAuditEventBuilder<ActivateUserRequestAuditEvent, ActivateUserRequestAuditEventBuilder> { + + private boolean active; + + 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/017561f1/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddBlueprintRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddBlueprintRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddBlueprintRequestAuditEvent.java new file mode 100644 index 0000000..afc20da --- /dev/null +++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddBlueprintRequestAuditEvent.java @@ -0,0 +1,77 @@ +/* + * 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.request.event; + +import org.apache.ambari.server.audit.request.RequestAuditEvent; + +public class AddBlueprintRequestAuditEvent extends RequestAuditEvent { + + public static class AddBlueprintRequestAuditEventBuilder extends RequestAuditEventBuilder<AddBlueprintRequestAuditEvent, AddBlueprintRequestAuditEventBuilder> { + + 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/017561f1/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddUserToGroupRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddUserToGroupRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddUserToGroupRequestAuditEvent.java new file mode 100644 index 0000000..0690c30 --- /dev/null +++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/event/AddUserToGroupRequestAuditEvent.java @@ -0,0 +1,83 @@ +/* + * 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.request.event; + +import org.apache.ambari.server.audit.request.RequestAuditEvent; + +public class AddUserToGroupRequestAuditEvent extends RequestAuditEvent { + + public static class AddUserToGroupRequestAuditEventBuilder extends RequestAuditEventBuilder<AddUserToGroupRequestAuditEvent, AddUserToGroupRequestAuditEventBuilder> { + + private String groupName; + 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(); + } + +}
