http://git-wip-us.apache.org/repos/asf/ambari/blob/565c2ea2/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/RequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/RequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/RequestAuditEvent.java deleted file mode 100644 index 0bb9b25..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/RequestAuditEvent.java +++ /dev/null @@ -1,145 +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.event.request; - -import org.apache.ambari.server.api.services.Request; -import org.apache.ambari.server.api.services.ResultStatus; -import org.apache.ambari.server.audit.event.AbstractUserAuditEvent; - -/** - * Base class for start operation audit events. - */ -public class RequestAuditEvent extends AbstractUserAuditEvent { - - public static class RequestAuditEventBuilder<T extends RequestAuditEvent, TBuilder extends RequestAuditEventBuilder<T, TBuilder>> extends AbstractUserAuditEventBuilder<T, TBuilder> { - - private Request.Type requestType; - - private ResultStatus resultStatus; - - private String url; - - private String operation; - - @Override - protected T newAuditEvent() { - return (T) new RequestAuditEvent(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); - if (operation != null) { - builder - .append(", Operation(") - .append(operation) - .append(")"); - } - builder - .append(", RequestType(") - .append(requestType) - .append("), ") - .append("url(") - .append(url) - .append("), ResultStatus(") - .append(resultStatus.getStatusCode()) - .append(" ") - .append(resultStatus.getStatus()) - .append(")"); - - if (resultStatus.isErrorState()) { - builder.append(", Reason(") - .append(resultStatus.getMessage()) - .append(")"); - } - } - - /** - * Sets the request type to be added to the audit event. - * - * @param requestType request type to be added to the audit event. - * @return this builder - */ - public TBuilder withRequestType(Request.Type requestType) { - this.requestType = requestType; - - return (TBuilder) this; - } - - /** - * Sets the url to be added to the audit event. - * - * @param url url to be added to the audit event. - * @return this builder - */ - public TBuilder withUrl(String url) { - this.url = url; - - return (TBuilder) this; - } - - /** - * Sets the result status to be added to the audit event. - * - * @param resultStatus result status to be added to the audit event. - * @return this builder - */ - public TBuilder withResultStatus(ResultStatus resultStatus) { - this.resultStatus = resultStatus; - - return (TBuilder) this; - } - - /** - * Sets the operation to be added to the audit event. - * - * @param operation operation to be added to the audit event. - * @return this builder - */ - public TBuilder withOperation(String operation) { - this.operation = operation; - - return (TBuilder) this; - } - } - - protected RequestAuditEvent() { - } - - /** - * {@inheritDoc} - */ - protected RequestAuditEvent(RequestAuditEventBuilder<?, ?> builder) { - super(builder); - } - - /** - * Returns an builder for {@link RequestAuditEvent} - * - * @return a builder instance - */ - public static RequestAuditEventBuilder<?, ?> builder() { - return new RequestAuditEventBuilder(); - } - -}
http://git-wip-us.apache.org/repos/asf/ambari/blob/565c2ea2/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/RequestAuditEventCreator.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/RequestAuditEventCreator.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/RequestAuditEventCreator.java deleted file mode 100644 index e642541..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/RequestAuditEventCreator.java +++ /dev/null @@ -1,59 +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 - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * 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.Set; - -import org.apache.ambari.server.api.services.Request; -import org.apache.ambari.server.api.services.Result; -import org.apache.ambari.server.api.services.ResultStatus; -import org.apache.ambari.server.audit.event.AuditEvent; -import org.apache.ambari.server.controller.spi.Resource; - -/** - * This interface must be implemented by the plugins for the request audit logger - * in order to make custom {@link AuditEvent}s based on {@link org.apache.ambari.server.api.services.Request.Type}s - * and {@link org.apache.ambari.server.controller.spi.Resource.Type} - */ -public interface RequestAuditEventCreator { - - /** - * @return the set of {@link org.apache.ambari.server.api.services.Request.Type}s that are handled by this creator - */ - Set<Request.Type> getRequestTypes(); - - /** - * @return the {@link org.apache.ambari.server.controller.spi.Resource.Type}s that is handled by this creator - */ - Set<Resource.Type> getResourceTypes(); - - /** - * @return the {@link ResultStatus}es that is handled by this creator - */ - Set<ResultStatus.STATUS> getResultStatuses(); - - /** - * Creates and {@link AuditEvent} - * @param request HTTP request object - * @param result HTTP result object - * @return an {@link AuditEvent} - */ - AuditEvent createAuditEvent(Request request, Result result); - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/565c2ea2/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/RequestAuditLogger.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/RequestAuditLogger.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/RequestAuditLogger.java deleted file mode 100644 index a5003e0..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/RequestAuditLogger.java +++ /dev/null @@ -1,36 +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 - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * 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.api.services.Request; -import org.apache.ambari.server.api.services.Result; - -/** - * Audit logger interface for logging requests - */ -public interface RequestAuditLogger { - - /** - * Logs an audit event based on the http request and result - * @param request - * @param result - */ - void log(Request request, Result result); - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/565c2ea2/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/RequestAuditLoggerImpl.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/RequestAuditLoggerImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/RequestAuditLoggerImpl.java deleted file mode 100644 index 0c9edea..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/RequestAuditLoggerImpl.java +++ /dev/null @@ -1,146 +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 - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * 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.Set; - -import org.apache.ambari.server.api.services.Request; -import org.apache.ambari.server.api.services.Result; -import org.apache.ambari.server.api.services.ResultStatus; -import org.apache.ambari.server.audit.AuditLogger; -import org.apache.ambari.server.audit.event.AuditEvent; -import org.apache.ambari.server.controller.spi.Resource; - -import com.google.inject.Inject; -import com.google.inject.Singleton; - -/** - * The purpose of this class is to create audit log entries for the HTTP requests - */ -@Singleton -public class RequestAuditLoggerImpl implements RequestAuditLogger { - - /** - * Priorities for searching the proper creator - */ - private static final int REQUEST_TYPE_PRIORITY = 1; - private static final int RESULT_STATUS_PRIORITY = 2; - private static final int RESOURCE_TYPE_PRIORITY = 4; - - /** - * Container for the {@link RequestAuditEventCreator} - */ - private Set<RequestAuditEventCreator> creators; - - /** - * Audit logger that receives {@link AuditEvent}s and does the actual logging - */ - private AuditLogger auditLogger; - - /** - * Injecting dependencies through the constructor - * @param auditLogger Audit Logger - * @param creatorSet Set of plugins that are registered for requests - */ - @Inject - public RequestAuditLoggerImpl(AuditLogger auditLogger, Set<RequestAuditEventCreator> creatorSet) { - this.auditLogger = auditLogger; - this.creators = creatorSet; - } - - /** - * Finds the proper creator, then creates and logs and {@link AuditEvent} - * @param request - * @param result - */ - @Override - public void log(Request request, Result result) { - Resource.Type resourceType = request.getResource().getResourceDefinition().getType(); - Request.Type requestType = request.getRequestType(); - ResultStatus resultStatus = result.getStatus(); - - RequestAuditEventCreator creator = selectCreator(resourceType, resultStatus, requestType); - if (creator != null) { - AuditEvent ae = creator.createAuditEvent(request, result); - if (ae != null) { - auditLogger.log(ae); - } - } - } - - /** - * Select the proper creator. Priority order: resourceType > resultStatus > requestType - * The most matching creator is returned - * If there is no creator found, then null is returned. - * @param resourceType - * @param requestType - * @param resultStatus - * @return - */ - private RequestAuditEventCreator selectCreator(Resource.Type resourceType, ResultStatus resultStatus, Request.Type requestType) { - - RequestAuditEventCreator selected = null; - Integer priority = -1; - - for (RequestAuditEventCreator creator : creators) { - Integer creatorPriority = getPriority(creator, resourceType, resultStatus, requestType); - if (creatorPriority != null && priority < creatorPriority) { - priority = creatorPriority; - selected = creator; - } - } - return selected; - } - - /** - * Calculates the creator priority for the actual resouce type, result status and request type - * @param creator - * @param resourceType - * @param resultStatus - * @param requestType - * @return - */ - private Integer getPriority(RequestAuditEventCreator creator, Resource.Type resourceType, ResultStatus resultStatus, Request.Type requestType) { - Integer priority = 0; - - if (isIncompatible(creator, resourceType, resultStatus, requestType)) { - return null; - } - - priority += creator.getRequestTypes() != null && creator.getRequestTypes().contains(requestType) ? REQUEST_TYPE_PRIORITY : 0; - priority += creator.getResultStatuses() != null && creator.getResultStatuses().contains(resultStatus.getStatus()) ? RESULT_STATUS_PRIORITY : 0; - priority += creator.getResourceTypes() != null && creator.getResourceTypes().contains(resourceType) ? RESOURCE_TYPE_PRIORITY : 0; - return priority; - } - - /** - * Checks if the creator is a possible candidate for creating audit log event for the request - * @param creator - * @param resourceType - * @param resultStatus - * @param requestType - * @return - */ - private boolean isIncompatible(RequestAuditEventCreator creator, Resource.Type resourceType, ResultStatus resultStatus, Request.Type requestType) { - return creator.getRequestTypes() != null && !creator.getRequestTypes().contains(requestType) || - creator.getResultStatuses() != null && !creator.getResultStatuses().contains(resultStatus.getStatus()) || - creator.getResourceTypes() != null && !creator.getResourceTypes().contains(resourceType); - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/565c2ea2/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/StartOperationRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/StartOperationRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/StartOperationRequestAuditEvent.java new file mode 100644 index 0000000..66e37b8 --- /dev/null +++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/StartOperationRequestAuditEvent.java @@ -0,0 +1,126 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.server.audit.event.request; + + +import javax.annotation.concurrent.Immutable; + +import org.apache.ambari.server.audit.event.AbstractUserAuditEvent; + +/** + * Start operation request was accepted. + */ +@Immutable +public class StartOperationRequestAuditEvent extends AbstractUserAuditEvent { + + public static class StartOperationAuditEventBuilder + extends AbstractUserAuditEventBuilder<StartOperationRequestAuditEvent, StartOperationAuditEventBuilder> { + + /** + * Request id + */ + private String requestId; + + /** + * Reason of failure, if it is set, then the request is considered as failed + */ + private String reasonOfFailure; + + /** + * Description of the request + */ + private String operation; + + private StartOperationAuditEventBuilder() { + } + + /** + * Appends to the audit event the identifier of the + * operation through whcih the operation progress can be tracked. + * + * @param builder builder for the audit event details. + */ + @Override + protected void buildAuditMessage(StringBuilder builder) { + super.buildAuditMessage(builder); + + builder + .append(", Operation(") + .append(operation) + .append("), RequestId(") + .append(requestId) + .append("), Status(") + .append(reasonOfFailure == null ? "Successfully queued" : "Failed to queue"); + + if (reasonOfFailure != null) { + builder.append("), Reason(") + .append(reasonOfFailure); + } + builder.append(")"); + } + + /** + * {@inheritDoc} + */ + @Override + protected StartOperationRequestAuditEvent newAuditEvent() { + return new StartOperationRequestAuditEvent(this); + } + + /** + * Sets the identifier of the operation through which the operation progress can be tracked. + * + * @param requestId the identifier of the operation through which the operation progress can be tracked. + * @return this builder + */ + public StartOperationAuditEventBuilder withRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public StartOperationAuditEventBuilder withReasonOfFailure(String reasonOfFailure) { + this.reasonOfFailure = reasonOfFailure; + return this; + } + + public StartOperationAuditEventBuilder withOperation(String operation) { + this.operation = operation; + return this; + } + } + + private StartOperationRequestAuditEvent() { + } + + /** + * {@inheritDoc} + */ + private StartOperationRequestAuditEvent(StartOperationAuditEventBuilder builder) { + super(builder); + } + + /** + * Returns an builder for {@link StartOperationRequestAuditEvent} + * + * @return a builder instance + */ + public static StartOperationAuditEventBuilder builder() { + return new StartOperationAuditEventBuilder(); + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/565c2ea2/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/UpdateRepositoryRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/UpdateRepositoryRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/UpdateRepositoryRequestAuditEvent.java new file mode 100644 index 0000000..ea3a0de --- /dev/null +++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/UpdateRepositoryRequestAuditEvent.java @@ -0,0 +1,134 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.server.audit.event.request; + +import javax.annotation.concurrent.Immutable; + +import org.apache.ambari.server.audit.request.RequestAuditEvent; + +/** + * Audit event for updating repository + */ +@Immutable +public class UpdateRepositoryRequestAuditEvent extends RequestAuditEvent { + + public static class UpdateRepositoryRequestAuditEventBuilder extends RequestAuditEventBuilder<UpdateRepositoryRequestAuditEvent, UpdateRepositoryRequestAuditEventBuilder> { + + /** + * Repository name + */ + private String repo; + + /** + * Stack name + */ + private String stackName; + + /** + * Operating system type + */ + private String osType; + + /** + * Base url for the repository + */ + private String baseUrl; + + /** + * Stack version + */ + private String stackVersion; + + public UpdateRepositoryRequestAuditEventBuilder() { + super.withOperation("Repository update"); + } + + @Override + protected UpdateRepositoryRequestAuditEvent newAuditEvent() { + return new UpdateRepositoryRequestAuditEvent(this); + } + + /** + * Appends to the event the details of the incoming request. + * + * @param builder builder for the audit event details. + */ + @Override + protected void buildAuditMessage(StringBuilder builder) { + super.buildAuditMessage(builder); + + builder.append(", Stack(") + .append(stackName) + .append("), Stack version(") + .append(stackVersion) + .append("), OS(") + .append(osType) + .append("), Repo id(") + .append(repo) + .append("), Base URL(") + .append(baseUrl) + .append(")"); + } + + public UpdateRepositoryRequestAuditEventBuilder withRepo(String repo) { + this.repo = repo; + return this; + } + + public UpdateRepositoryRequestAuditEventBuilder withStackName(String stackName) { + this.stackName = stackName; + return this; + } + + public UpdateRepositoryRequestAuditEventBuilder withOsType(String osType) { + this.osType = osType; + return this; + } + + public UpdateRepositoryRequestAuditEventBuilder withBaseUrl(String baseUrl) { + this.baseUrl = baseUrl; + return this; + } + + public UpdateRepositoryRequestAuditEventBuilder withStackVersion(String stackVersion) { + this.stackVersion = stackVersion; + return this; + } + } + + protected UpdateRepositoryRequestAuditEvent() { + } + + /** + * {@inheritDoc} + */ + protected UpdateRepositoryRequestAuditEvent(UpdateRepositoryRequestAuditEventBuilder builder) { + super(builder); + } + + /** + * Returns an builder for {@link UpdateRepositoryRequestAuditEvent} + * + * @return a builder instance + */ + public static UpdateRepositoryRequestAuditEventBuilder builder() { + return new UpdateRepositoryRequestAuditEventBuilder(); + } + +} http://git-wip-us.apache.org/repos/asf/ambari/blob/565c2ea2/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/UpdateUpgradeItemRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/UpdateUpgradeItemRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/UpdateUpgradeItemRequestAuditEvent.java new file mode 100644 index 0000000..3475f0a --- /dev/null +++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/UpdateUpgradeItemRequestAuditEvent.java @@ -0,0 +1,111 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.server.audit.event.request; + +import javax.annotation.concurrent.Immutable; + +import org.apache.ambari.server.audit.request.RequestAuditEvent; + +/** + * Audit event for updating an upgrade item + */ +@Immutable +public class UpdateUpgradeItemRequestAuditEvent extends RequestAuditEvent { + + public static class UpdateUpgradeItemRequestAuditEventBuilder extends RequestAuditEventBuilder<UpdateUpgradeItemRequestAuditEvent, UpdateUpgradeItemRequestAuditEventBuilder> { + + /** + * Stage id + */ + private String stageId; + + /** + * Status + */ + private String status; + + /** + * Request id + */ + private String requestId; + + + public UpdateUpgradeItemRequestAuditEventBuilder() { + super.withOperation("Action confirmation by the user"); + } + + @Override + protected UpdateUpgradeItemRequestAuditEvent newAuditEvent() { + return new UpdateUpgradeItemRequestAuditEvent(this); + } + + /** + * Appends to the event the details of the incoming request. + * + * @param builder builder for the audit event details. + */ + @Override + protected void buildAuditMessage(StringBuilder builder) { + super.buildAuditMessage(builder); + + builder.append(", Stage id(") + .append(stageId) + .append("), Status(") + .append(status) + .append("), Request id(") + .append(requestId) + .append(")"); + } + + public UpdateUpgradeItemRequestAuditEventBuilder withStageId(String stageId) { + this.stageId = stageId; + return this; + } + + public UpdateUpgradeItemRequestAuditEventBuilder withStatus(String status) { + this.status = status; + return this; + } + + public UpdateUpgradeItemRequestAuditEventBuilder withRequestId(String requestId) { + this.requestId = requestId; + return this; + } + } + + protected UpdateUpgradeItemRequestAuditEvent() { + } + + /** + * {@inheritDoc} + */ + protected UpdateUpgradeItemRequestAuditEvent(UpdateUpgradeItemRequestAuditEventBuilder builder) { + super(builder); + } + + /** + * Returns an builder for {@link UpdateUpgradeItemRequestAuditEvent} + * + * @return a builder instance + */ + public static UpdateUpgradeItemRequestAuditEventBuilder builder() { + return new UpdateUpgradeItemRequestAuditEventBuilder(); + } + +} http://git-wip-us.apache.org/repos/asf/ambari/blob/565c2ea2/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/UserPasswordChangeRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/UserPasswordChangeRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/UserPasswordChangeRequestAuditEvent.java new file mode 100644 index 0000000..64a5aa1 --- /dev/null +++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/UserPasswordChangeRequestAuditEvent.java @@ -0,0 +1,88 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.server.audit.event.request; + +import javax.annotation.concurrent.Immutable; + +import org.apache.ambari.server.audit.request.RequestAuditEvent; + +/** + * Audit event for changing user password + */ +@Immutable +public class UserPasswordChangeRequestAuditEvent extends RequestAuditEvent { + + public static class UserPasswordChangeRequestAuditEventBuilder extends RequestAuditEventBuilder<UserPasswordChangeRequestAuditEvent, UserPasswordChangeRequestAuditEventBuilder> { + + /** + * Name of the user whose password is changed + */ + private String username; + + public UserPasswordChangeRequestAuditEventBuilder() { + super.withOperation("Password change"); + } + + @Override + protected UserPasswordChangeRequestAuditEvent newAuditEvent() { + return new UserPasswordChangeRequestAuditEvent(this); + } + + /** + * Appends to the event the details of the incoming request. + * + * @param builder builder for the audit event details. + */ + @Override + protected void buildAuditMessage(StringBuilder builder) { + super.buildAuditMessage(builder); + + builder + .append(", Affected username(") + .append(username) + .append(")"); + } + + + public UserPasswordChangeRequestAuditEventBuilder withAffectedUsername(String username) { + this.username = username; + return this; + } + } + + protected UserPasswordChangeRequestAuditEvent() { + } + + /** + * {@inheritDoc} + */ + protected UserPasswordChangeRequestAuditEvent(UserPasswordChangeRequestAuditEventBuilder builder) { + super(builder); + } + + /** + * Returns an builder for {@link UserPasswordChangeRequestAuditEvent} + * + * @return a builder instance + */ + public static UserPasswordChangeRequestAuditEventBuilder builder() { + return new UserPasswordChangeRequestAuditEventBuilder(); + } + +} http://git-wip-us.apache.org/repos/asf/ambari/blob/565c2ea2/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ViewPrivilegeChangeRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ViewPrivilegeChangeRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ViewPrivilegeChangeRequestAuditEvent.java new file mode 100644 index 0000000..c06eb7e --- /dev/null +++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ViewPrivilegeChangeRequestAuditEvent.java @@ -0,0 +1,163 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.server.audit.event.request; + +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.annotation.concurrent.Immutable; + +import org.apache.ambari.server.audit.request.RequestAuditEvent; +import org.apache.commons.lang.StringUtils; + +/** + * Audit event for changing view privilege + */ +@Immutable +public class ViewPrivilegeChangeRequestAuditEvent extends RequestAuditEvent { + + public static class ViewPrivilegeChangeRequestAuditEventBuilder extends RequestAuditEventBuilder<ViewPrivilegeChangeRequestAuditEvent, ViewPrivilegeChangeRequestAuditEventBuilder> { + + /** + * Users with their roles + */ + private Map<String, List<String>> users; + + /** + * Groups with their roles + */ + private Map<String, List<String>> groups; + + /** + * View name + */ + private String name; + + /** + * View type (Files, Tez, etc...) + */ + private String type; + + /** + * View version + */ + private String version; + + + public ViewPrivilegeChangeRequestAuditEventBuilder() { + super.withOperation("View permission change"); + } + + @Override + protected ViewPrivilegeChangeRequestAuditEvent newAuditEvent() { + return new ViewPrivilegeChangeRequestAuditEvent(this); + } + + /** + * Appends to the event the details of the incoming request. + * + * @param builder builder for the audit event details. + */ + @Override + protected void buildAuditMessage(StringBuilder builder) { + super.buildAuditMessage(builder); + + builder.append(", Type(") + .append(type) + .append("), Version(") + .append(version) + .append("), Name(") + .append(name) + .append(")"); + + Set<String> roleSet = new HashSet<String>(); + roleSet.addAll(users.keySet()); + roleSet.addAll(groups.keySet()); + + builder.append(", Permissions("); + if (!users.isEmpty() || !groups.isEmpty()) { + builder.append(System.lineSeparator()); + } + + List<String> lines = new LinkedList<String>(); + + for (String role : roleSet) { + lines.add(role + ": "); + if (users.get(role) != null && !users.get(role).isEmpty()) { + lines.add(" Users: " + StringUtils.join(users.get(role), ", ")); + } + if (groups.get(role) != null && !groups.get(role).isEmpty()) { + lines.add(" Groups: " + StringUtils.join(groups.get(role), ", ")); + } + } + + builder.append(StringUtils.join(lines, System.lineSeparator())); + + builder.append(")"); + } + + public ViewPrivilegeChangeRequestAuditEventBuilder withName(String name) { + this.name = name; + return this; + } + + public ViewPrivilegeChangeRequestAuditEventBuilder withType(String type) { + this.type = type; + return this; + } + + public ViewPrivilegeChangeRequestAuditEventBuilder withVersion(String version) { + this.version = version; + return this; + } + + public ViewPrivilegeChangeRequestAuditEventBuilder withUsers(Map<String, List<String>> users) { + this.users = users; + return this; + } + + public ViewPrivilegeChangeRequestAuditEventBuilder withGroups(Map<String, List<String>> groups) { + this.groups = groups; + return this; + } + } + + protected ViewPrivilegeChangeRequestAuditEvent() { + } + + /** + * {@inheritDoc} + */ + protected ViewPrivilegeChangeRequestAuditEvent(ViewPrivilegeChangeRequestAuditEventBuilder builder) { + super(builder); + } + + /** + * Returns an builder for {@link ViewPrivilegeChangeRequestAuditEvent} + * + * @return a builder instance + */ + public static ViewPrivilegeChangeRequestAuditEventBuilder builder() { + return new ViewPrivilegeChangeRequestAuditEventBuilder(); + } + +} http://git-wip-us.apache.org/repos/asf/ambari/blob/565c2ea2/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/ActivateUserRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/ActivateUserRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/ActivateUserRequestAuditEvent.java deleted file mode 100644 index 937291c..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/ActivateUserRequestAuditEvent.java +++ /dev/null @@ -1,89 +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.event.request.event; - -import org.apache.ambari.server.audit.event.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/565c2ea2/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/AddAlertGroupRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/AddAlertGroupRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/AddAlertGroupRequestAuditEvent.java deleted file mode 100644 index 51e8045..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/AddAlertGroupRequestAuditEvent.java +++ /dev/null @@ -1,98 +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.event.request.event; - -import java.util.List; - -import org.apache.ambari.server.audit.event.request.RequestAuditEvent; -import org.apache.commons.lang.StringUtils; - -public class AddAlertGroupRequestAuditEvent extends RequestAuditEvent { - - public static class AddAlertGroupRequestAuditEventBuilder extends RequestAuditEventBuilder<AddAlertGroupRequestAuditEvent, AddAlertGroupRequestAuditEventBuilder> { - - private String name; - - private List<String> definitionIds; - - private List<String> notificationIds; - - public AddAlertGroupRequestAuditEventBuilder() { - super.withOperation("Alert group addition"); - } - - @Override - protected AddAlertGroupRequestAuditEvent newAuditEvent() { - return new AddAlertGroupRequestAuditEvent(this); - } - - /** - * Appends to the event the details of the incoming request. - * - * @param builder builder for the audit event details. - */ - @Override - protected void buildAuditMessage(StringBuilder builder) { - super.buildAuditMessage(builder); - - builder.append(", Alert group name(") - .append(name) - .append("), Definition IDs(") - .append(StringUtils.join(definitionIds, ", ")) - .append("), Notification IDs(") - .append(StringUtils.join(notificationIds, ", ")) - .append(")"); - } - - public AddAlertGroupRequestAuditEventBuilder withName(String name) { - this.name = name; - return this; - } - - public AddAlertGroupRequestAuditEventBuilder withDefinitionIds(List<String> ids) { - this.definitionIds = ids; - return this; - } - - public AddAlertGroupRequestAuditEventBuilder withNotificationIds(List<String> ids) { - this.notificationIds = ids; - return this; - } - } - - protected AddAlertGroupRequestAuditEvent() { - } - - /** - * {@inheritDoc} - */ - protected AddAlertGroupRequestAuditEvent(AddAlertGroupRequestAuditEventBuilder builder) { - super(builder); - } - - /** - * Returns an builder for {@link AddAlertGroupRequestAuditEvent} - * - * @return a builder instance - */ - public static AddAlertGroupRequestAuditEventBuilder builder() { - return new AddAlertGroupRequestAuditEventBuilder(); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/565c2ea2/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/AddAlertTargetRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/AddAlertTargetRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/AddAlertTargetRequestAuditEvent.java deleted file mode 100644 index fc5ccc5..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/AddAlertTargetRequestAuditEvent.java +++ /dev/null @@ -1,134 +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.event.request.event; - -import java.util.List; - -import org.apache.ambari.server.audit.event.request.RequestAuditEvent; -import org.apache.commons.lang.StringUtils; - -public class AddAlertTargetRequestAuditEvent extends RequestAuditEvent { - - public static class AddAlertTargetRequestAuditEventBuilder extends RequestAuditEventBuilder<AddAlertTargetRequestAuditEvent, AddAlertTargetRequestAuditEventBuilder> { - - 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 AddAlertTargetRequestAuditEventBuilder() { - super.withOperation("Notification addition"); - } - - @Override - protected AddAlertTargetRequestAuditEvent newAuditEvent() { - return new AddAlertTargetRequestAuditEvent(this); - } - - /** - * Appends to the event the details of the incoming request. - * - * @param builder builder for the audit event details. - */ - @Override - protected void buildAuditMessage(StringBuilder builder) { - super.buildAuditMessage(builder); - - builder.append(", Notification name(") - .append(name) - .append("), Description(") - .append(description) - .append("), Notification type(") - .append(notificationType) - .append("), Group IDs(") - .append(StringUtils.join(groupIds, ", ")); - - if (emailFrom != null) { - builder.append("), Email from(") - .append(emailFrom); - } - - if (emailRecipients != null && !emailRecipients.isEmpty()) { - builder.append("), Email to(") - .append(StringUtils.join(emailRecipients, ", ")); - } - builder.append("), Alert states(") - .append(StringUtils.join(alertStates, ", ")) - .append(")"); - } - - public AddAlertTargetRequestAuditEventBuilder withName(String name) { - this.name = name; - return this; - } - - public AddAlertTargetRequestAuditEventBuilder withDescription(String description) { - this.description = description; - return this; - } - - public AddAlertTargetRequestAuditEventBuilder withNotificationType(String notificationType) { - this.notificationType = notificationType; - return this; - } - - public AddAlertTargetRequestAuditEventBuilder withGroupIds(List<String> groupIds) { - this.groupIds = groupIds; - return this; - } - - public AddAlertTargetRequestAuditEventBuilder withEmailFrom(String emailFrom) { - this.emailFrom = emailFrom; - return this; - } - - public AddAlertTargetRequestAuditEventBuilder withEmailRecipients(List<String> emailRecipients) { - this.emailRecipients = emailRecipients; - return this; - } - - public AddAlertTargetRequestAuditEventBuilder withAlertStates(List<String> alertStates) { - this.alertStates = alertStates; - return this; - } - } - - protected AddAlertTargetRequestAuditEvent() { - } - - /** - * {@inheritDoc} - */ - protected AddAlertTargetRequestAuditEvent(AddAlertTargetRequestAuditEventBuilder builder) { - super(builder); - } - - /** - * Returns an builder for {@link AddAlertTargetRequestAuditEvent} - * - * @return a builder instance - */ - public static AddAlertTargetRequestAuditEventBuilder builder() { - return new AddAlertTargetRequestAuditEventBuilder(); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/565c2ea2/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/AddBlueprintRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/AddBlueprintRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/AddBlueprintRequestAuditEvent.java deleted file mode 100644 index 2e0cce4..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/AddBlueprintRequestAuditEvent.java +++ /dev/null @@ -1,79 +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.event.request.event; - -import org.apache.ambari.server.audit.event.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/565c2ea2/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/AddComponentToHostRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/AddComponentToHostRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/AddComponentToHostRequestAuditEvent.java deleted file mode 100644 index ad6233a..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/AddComponentToHostRequestAuditEvent.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.event.request.event; - -import org.apache.ambari.server.audit.event.request.RequestAuditEvent; - -public class AddComponentToHostRequestAuditEvent extends RequestAuditEvent { - - public static class AddComponentToHostRequestAuditEventBuilder extends RequestAuditEventBuilder<AddComponentToHostRequestAuditEvent, AddComponentToHostRequestAuditEventBuilder> { - - private String hostName; - private String component; - - public AddComponentToHostRequestAuditEventBuilder() { - super.withOperation("Component addition to host"); - } - - @Override - protected AddComponentToHostRequestAuditEvent newAuditEvent() { - return new AddComponentToHostRequestAuditEvent(this); - } - - /** - * Appends to the event the details of the incoming request. - * - * @param builder builder for the audit event details. - */ - @Override - protected void buildAuditMessage(StringBuilder builder) { - super.buildAuditMessage(builder); - - builder.append(", Hostname(") - .append(hostName) - .append(", Component(") - .append(component) - .append(")"); - } - - public AddComponentToHostRequestAuditEventBuilder withHostName(String hostName) { - this.hostName = hostName; - return this; - } - - public AddComponentToHostRequestAuditEventBuilder withComponent(String component) { - this.component = component; - return this; - } - } - - protected AddComponentToHostRequestAuditEvent() { - } - - /** - * {@inheritDoc} - */ - protected AddComponentToHostRequestAuditEvent(AddComponentToHostRequestAuditEventBuilder builder) { - super(builder); - } - - /** - * Returns an builder for {@link AddComponentToHostRequestAuditEvent} - * - * @return a builder instance - */ - public static AddComponentToHostRequestAuditEventBuilder builder() { - return new AddComponentToHostRequestAuditEventBuilder(); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/565c2ea2/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/AddCredentialRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/AddCredentialRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/AddCredentialRequestAuditEvent.java deleted file mode 100644 index 2804820..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/AddCredentialRequestAuditEvent.java +++ /dev/null @@ -1,104 +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.event.request.event; - -import org.apache.ambari.server.audit.event.request.RequestAuditEvent; - -public class AddCredentialRequestAuditEvent extends RequestAuditEvent { - - public static class AddCredentialAuditEventBuilder extends RequestAuditEventBuilder<AddCredentialRequestAuditEvent, AddCredentialAuditEventBuilder> { - - private String type; - - private String clusterName; - - private String principal; - - private String alias; - - public AddCredentialAuditEventBuilder() { - super.withOperation("Credential addition"); - } - - @Override - protected AddCredentialRequestAuditEvent newAuditEvent() { - return new AddCredentialRequestAuditEvent(this); - } - - /** - * Appends to the event the details of the incoming request. - * - * @param builder builder for the audit event details. - */ - @Override - protected void buildAuditMessage(StringBuilder builder) { - super.buildAuditMessage(builder); - - builder.append(", Type(") - .append(type) - .append("), Principal(") - .append(principal) - .append("), Alias(") - .append(alias) - .append("), Cluster name(") - .append(clusterName) - .append(")"); - } - - public AddCredentialAuditEventBuilder withType(String type) { - this.type = type; - return this; - } - - public AddCredentialAuditEventBuilder withClusterName(String clusterName) { - this.clusterName = clusterName; - return this; - } - - public AddCredentialAuditEventBuilder withPrincipal(String principal) { - this.principal = principal; - return this; - } - - public AddCredentialAuditEventBuilder withAlias(String alias) { - this.alias = alias; - return this; - } - } - - protected AddCredentialRequestAuditEvent() { - } - - /** - * {@inheritDoc} - */ - protected AddCredentialRequestAuditEvent(AddCredentialAuditEventBuilder builder) { - super(builder); - } - - /** - * Returns an builder for {@link AddCredentialRequestAuditEvent} - * - * @return a builder instance - */ - public static AddCredentialAuditEventBuilder builder() { - return new AddCredentialAuditEventBuilder(); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/565c2ea2/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/AddHostRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/AddHostRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/AddHostRequestAuditEvent.java deleted file mode 100644 index 8d7206e..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/AddHostRequestAuditEvent.java +++ /dev/null @@ -1,77 +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.event.request.event; - -import org.apache.ambari.server.audit.event.request.RequestAuditEvent; - -public class AddHostRequestAuditEvent extends RequestAuditEvent { - - public static class AddHostRequestAuditEventBuilder extends RequestAuditEventBuilder<AddHostRequestAuditEvent, AddHostRequestAuditEventBuilder> { - - private String hostName; - - public AddHostRequestAuditEventBuilder() { - super.withOperation("Host addition"); - } - - @Override - protected AddHostRequestAuditEvent newAuditEvent() { - return new AddHostRequestAuditEvent(this); - } - - /** - * Appends to the event the details of the incoming request. - * - * @param builder builder for the audit event details. - */ - @Override - protected void buildAuditMessage(StringBuilder builder) { - super.buildAuditMessage(builder); - - builder.append(", Hostname(") - .append(hostName) - .append(")"); - } - - public AddHostRequestAuditEventBuilder withHostName(String hostName) { - this.hostName = hostName; - return this; - } - } - - protected AddHostRequestAuditEvent() { - } - - /** - * {@inheritDoc} - */ - protected AddHostRequestAuditEvent(AddHostRequestAuditEventBuilder builder) { - super(builder); - } - - /** - * Returns an builder for {@link AddHostRequestAuditEvent} - * - * @return a builder instance - */ - public static AddHostRequestAuditEventBuilder builder() { - return new AddHostRequestAuditEventBuilder(); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/565c2ea2/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/AddRepositoryRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/AddRepositoryRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/AddRepositoryRequestAuditEvent.java deleted file mode 100644 index 2635b44..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/AddRepositoryRequestAuditEvent.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.event.request.event; - -import org.apache.ambari.server.audit.event.request.RequestAuditEvent; - -public class AddRepositoryRequestAuditEvent extends RequestAuditEvent { - - public static class AddRepositoryRequestAuditEventBuilder extends RequestAuditEventBuilder<AddRepositoryRequestAuditEvent, AddRepositoryRequestAuditEventBuilder> { - - private String repo; - - private String stackName; - - private String osType; - - private String baseUrl; - - private String stackVersion; - - public AddRepositoryRequestAuditEventBuilder() { - super.withOperation("Repository addition"); - } - - @Override - protected AddRepositoryRequestAuditEvent newAuditEvent() { - return new AddRepositoryRequestAuditEvent(this); - } - - /** - * Appends to the event the details of the incoming request. - * - * @param builder builder for the audit event details. - */ - @Override - protected void buildAuditMessage(StringBuilder builder) { - super.buildAuditMessage(builder); - - builder.append(", Stack(") - .append(stackName) - .append("), Stack version(") - .append(stackVersion) - .append("), OS(") - .append(osType) - .append("), Repo id(") - .append(repo) - .append("), Base URL(") - .append(baseUrl) - .append(")"); - } - - public AddRepositoryRequestAuditEventBuilder withRepo(String repo) { - this.repo = repo; - return this; - } - - public AddRepositoryRequestAuditEventBuilder withStackName(String stackName) { - this.stackName = stackName; - return this; - } - - public AddRepositoryRequestAuditEventBuilder withOsType(String osType) { - this.osType = osType; - return this; - } - - public AddRepositoryRequestAuditEventBuilder withBaseUrl(String baseUrl) { - this.baseUrl = baseUrl; - return this; - } - - public AddRepositoryRequestAuditEventBuilder withStackVersion(String stackVersion) { - this.stackVersion = stackVersion; - return this; - } - } - - protected AddRepositoryRequestAuditEvent() { - } - - /** - * {@inheritDoc} - */ - protected AddRepositoryRequestAuditEvent(AddRepositoryRequestAuditEventBuilder builder) { - super(builder); - } - - /** - * Returns an builder for {@link AddRepositoryRequestAuditEvent} - * - * @return a builder instance - */ - public static AddRepositoryRequestAuditEventBuilder builder() { - return new AddRepositoryRequestAuditEventBuilder(); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/565c2ea2/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/AddRepositoryVersionRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/AddRepositoryVersionRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/AddRepositoryVersionRequestAuditEvent.java deleted file mode 100644 index 0d95636..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/AddRepositoryVersionRequestAuditEvent.java +++ /dev/null @@ -1,131 +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.event.request.event; - -import java.util.List; -import java.util.Map; - -import org.apache.ambari.server.audit.event.request.RequestAuditEvent; - -public class AddRepositoryVersionRequestAuditEvent extends RequestAuditEvent { - - public static class AddRepositoryVersionAuditEventBuilder extends RequestAuditEventBuilder<AddRepositoryVersionRequestAuditEvent, AddRepositoryVersionAuditEventBuilder> { - - private String stackName; - - private String displayName; - - private String stackVersion; - - private String repoVersion; - - private Map<String, List<Map<String, String>>> repos; - - public AddRepositoryVersionAuditEventBuilder() { - super.withOperation("Repository version addition"); - } - - @Override - protected AddRepositoryVersionRequestAuditEvent newAuditEvent() { - return new AddRepositoryVersionRequestAuditEvent(this); - } - - /** - * Appends to the event the details of the incoming request. - * - * @param builder builder for the audit event details. - */ - @Override - protected void buildAuditMessage(StringBuilder builder) { - super.buildAuditMessage(builder); - - builder.append(", Stack(") - .append(stackName) - .append("), Stack version(") - .append(stackVersion) - .append("), Display name(") - .append(displayName) - .append("), Repo version(") - .append(repoVersion) - .append("), Repositories("); - - if (!repos.isEmpty()) { - builder.append(System.lineSeparator()); - } - - for (Map.Entry<String, List<Map<String, String>>> repo : repos.entrySet()) { - builder.append("Operating system: ").append(repo.getKey()); - builder.append(System.lineSeparator()); - for (Map<String, String> properties : repo.getValue()) { - builder.append(" Repository ID(").append(properties.get("repo_id")); - builder.append("), Repository name(").append(properties.get("repo_name")); - builder.append("), Base url(").append(properties.get("base_url")).append(")"); - builder.append(System.lineSeparator()); - } - } - - builder.append(")"); - } - - public AddRepositoryVersionAuditEventBuilder withStackName(String stackName) { - this.stackName = stackName; - return this; - } - - public AddRepositoryVersionAuditEventBuilder withDisplayName(String displayName) { - this.displayName = displayName; - return this; - } - - public AddRepositoryVersionAuditEventBuilder withStackVersion(String stackVersion) { - this.stackVersion = stackVersion; - return this; - } - - public AddRepositoryVersionAuditEventBuilder withRepoVersion(String repoVersion) { - this.repoVersion = repoVersion; - return this; - } - - public AddRepositoryVersionAuditEventBuilder withRepos(Map<String, List<Map<String, String>>> repos) { - this.repos = repos; - return this; - } - } - - protected AddRepositoryVersionRequestAuditEvent() { - } - - /** - * {@inheritDoc} - */ - protected AddRepositoryVersionRequestAuditEvent(AddRepositoryVersionAuditEventBuilder builder) { - super(builder); - } - - /** - * Returns an builder for {@link AddRepositoryVersionRequestAuditEvent} - * - * @return a builder instance - */ - public static AddRepositoryVersionAuditEventBuilder builder() { - return new AddRepositoryVersionAuditEventBuilder(); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/565c2ea2/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/AddRequestRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/AddRequestRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/AddRequestRequestAuditEvent.java deleted file mode 100644 index 3095d09..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/AddRequestRequestAuditEvent.java +++ /dev/null @@ -1,86 +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.event.request.event; - -import org.apache.ambari.server.audit.event.request.RequestAuditEvent; - -public class AddRequestRequestAuditEvent extends RequestAuditEvent { - - public static class AddRequestAuditEventBuilder extends RequestAuditEventBuilder<AddRequestRequestAuditEvent, AddRequestAuditEventBuilder> { - - private String command; - - private String clusterName; - - public AddRequestAuditEventBuilder() { - super.withOperation("Request from server"); - } - - @Override - protected AddRequestRequestAuditEvent newAuditEvent() { - return new AddRequestRequestAuditEvent(this); - } - - /** - * Appends to the event the details of the incoming request. - * - * @param builder builder for the audit event details. - */ - @Override - protected void buildAuditMessage(StringBuilder builder) { - super.buildAuditMessage(builder); - - builder.append("), Command(") - .append(command) - .append("), Cluster name(") - .append(clusterName) - .append(")"); - } - - public AddRequestAuditEventBuilder withClusterName(String clusterName) { - this.clusterName = clusterName; - return this; - } - - public AddRequestAuditEventBuilder withCommand(String command) { - this.command = command; - return this; - } - } - - protected AddRequestRequestAuditEvent() { - } - - /** - * {@inheritDoc} - */ - protected AddRequestRequestAuditEvent(AddRequestAuditEventBuilder builder) { - super(builder); - } - - /** - * Returns an builder for {@link AddRequestRequestAuditEvent} - * - * @return a builder instance - */ - public static AddRequestAuditEventBuilder builder() { - return new AddRequestAuditEventBuilder(); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/565c2ea2/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/AddUpgradeRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/AddUpgradeRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/AddUpgradeRequestAuditEvent.java deleted file mode 100644 index 0fc1b06..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/AddUpgradeRequestAuditEvent.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.event.request.event; - -import org.apache.ambari.server.audit.event.request.RequestAuditEvent; - -public class AddUpgradeRequestAuditEvent extends RequestAuditEvent { - - public static class AddUpgradeRequestAuditEventBuilder extends RequestAuditEventBuilder<AddUpgradeRequestAuditEvent, AddUpgradeRequestAuditEventBuilder> { - - private String repositoryVersion; - private String upgradeType; - private String clusterName; - - - public AddUpgradeRequestAuditEventBuilder() { - super.withOperation("Upgrade addition"); - } - - @Override - protected AddUpgradeRequestAuditEvent newAuditEvent() { - return new AddUpgradeRequestAuditEvent(this); - } - - /** - * Appends to the event the details of the incoming request. - * - * @param builder builder for the audit event details. - */ - @Override - protected void buildAuditMessage(StringBuilder builder) { - super.buildAuditMessage(builder); - - builder.append(", Repository version(") - .append(repositoryVersion) - .append("), Upgrade type(") - .append(upgradeType) - .append("), Cluster name(") - .append(clusterName) - .append(")"); - } - - public AddUpgradeRequestAuditEventBuilder withRepositoryVersion(String repositoryVersion) { - this.repositoryVersion = repositoryVersion; - return this; - } - - public AddUpgradeRequestAuditEventBuilder withUpgradeType(String upgradeType) { - this.upgradeType = upgradeType; - return this; - } - - public AddUpgradeRequestAuditEventBuilder withClusterName(String clusterName) { - this.clusterName = clusterName; - return this; - } - } - - protected AddUpgradeRequestAuditEvent() { - } - - /** - * {@inheritDoc} - */ - protected AddUpgradeRequestAuditEvent(AddUpgradeRequestAuditEventBuilder builder) { - super(builder); - } - - /** - * Returns an builder for {@link AddUpgradeRequestAuditEvent} - * - * @return a builder instance - */ - public static AddUpgradeRequestAuditEventBuilder builder() { - return new AddUpgradeRequestAuditEventBuilder(); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/565c2ea2/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/AddUserToGroupRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/AddUserToGroupRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/AddUserToGroupRequestAuditEvent.java deleted file mode 100644 index 1e18268..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/AddUserToGroupRequestAuditEvent.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.event.request.event; - -import org.apache.ambari.server.audit.event.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(); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/565c2ea2/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/AddViewInstanceRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/AddViewInstanceRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/AddViewInstanceRequestAuditEvent.java deleted file mode 100644 index 6326338..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/event/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.event.request.event; - -import org.apache.ambari.server.audit.event.request.RequestAuditEvent; - -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(); - } - -}