software.amazon.awssdk.services.fsx.model.WindowsAuditLogCreateConfiguration Maven / Gradle / Ivy
Show all versions of fsx Show documentation
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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 software.amazon.awssdk.services.fsx.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* The Windows file access auditing configuration used when creating or updating an Amazon FSx for Windows File Server
* file system.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class WindowsAuditLogCreateConfiguration implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField FILE_ACCESS_AUDIT_LOG_LEVEL_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("FileAccessAuditLogLevel")
.getter(getter(WindowsAuditLogCreateConfiguration::fileAccessAuditLogLevelAsString))
.setter(setter(Builder::fileAccessAuditLogLevel))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FileAccessAuditLogLevel").build())
.build();
private static final SdkField FILE_SHARE_ACCESS_AUDIT_LOG_LEVEL_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("FileShareAccessAuditLogLevel")
.getter(getter(WindowsAuditLogCreateConfiguration::fileShareAccessAuditLogLevelAsString))
.setter(setter(Builder::fileShareAccessAuditLogLevel))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FileShareAccessAuditLogLevel")
.build()).build();
private static final SdkField AUDIT_LOG_DESTINATION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AuditLogDestination").getter(getter(WindowsAuditLogCreateConfiguration::auditLogDestination))
.setter(setter(Builder::auditLogDestination))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AuditLogDestination").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(
FILE_ACCESS_AUDIT_LOG_LEVEL_FIELD, FILE_SHARE_ACCESS_AUDIT_LOG_LEVEL_FIELD, AUDIT_LOG_DESTINATION_FIELD));
private static final long serialVersionUID = 1L;
private final String fileAccessAuditLogLevel;
private final String fileShareAccessAuditLogLevel;
private final String auditLogDestination;
private WindowsAuditLogCreateConfiguration(BuilderImpl builder) {
this.fileAccessAuditLogLevel = builder.fileAccessAuditLogLevel;
this.fileShareAccessAuditLogLevel = builder.fileShareAccessAuditLogLevel;
this.auditLogDestination = builder.auditLogDestination;
}
/**
*
* Sets which attempt type is logged by Amazon FSx for file and folder accesses.
*
*
* -
*
* SUCCESS_ONLY
- only successful attempts to access files or folders are logged.
*
*
* -
*
* FAILURE_ONLY
- only failed attempts to access files or folders are logged.
*
*
* -
*
* SUCCESS_AND_FAILURE
- both successful attempts and failed attempts to access files or folders are
* logged.
*
*
* -
*
* DISABLED
- access auditing of files and folders is turned off.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #fileAccessAuditLogLevel} will return {@link WindowsAccessAuditLogLevel#UNKNOWN_TO_SDK_VERSION}. The raw
* value returned by the service is available from {@link #fileAccessAuditLogLevelAsString}.
*
*
* @return Sets which attempt type is logged by Amazon FSx for file and folder accesses.
*
* -
*
* SUCCESS_ONLY
- only successful attempts to access files or folders are logged.
*
*
* -
*
* FAILURE_ONLY
- only failed attempts to access files or folders are logged.
*
*
* -
*
* SUCCESS_AND_FAILURE
- both successful attempts and failed attempts to access files or
* folders are logged.
*
*
* -
*
* DISABLED
- access auditing of files and folders is turned off.
*
*
* @see WindowsAccessAuditLogLevel
*/
public final WindowsAccessAuditLogLevel fileAccessAuditLogLevel() {
return WindowsAccessAuditLogLevel.fromValue(fileAccessAuditLogLevel);
}
/**
*
* Sets which attempt type is logged by Amazon FSx for file and folder accesses.
*
*
* -
*
* SUCCESS_ONLY
- only successful attempts to access files or folders are logged.
*
*
* -
*
* FAILURE_ONLY
- only failed attempts to access files or folders are logged.
*
*
* -
*
* SUCCESS_AND_FAILURE
- both successful attempts and failed attempts to access files or folders are
* logged.
*
*
* -
*
* DISABLED
- access auditing of files and folders is turned off.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #fileAccessAuditLogLevel} will return {@link WindowsAccessAuditLogLevel#UNKNOWN_TO_SDK_VERSION}. The raw
* value returned by the service is available from {@link #fileAccessAuditLogLevelAsString}.
*
*
* @return Sets which attempt type is logged by Amazon FSx for file and folder accesses.
*
* -
*
* SUCCESS_ONLY
- only successful attempts to access files or folders are logged.
*
*
* -
*
* FAILURE_ONLY
- only failed attempts to access files or folders are logged.
*
*
* -
*
* SUCCESS_AND_FAILURE
- both successful attempts and failed attempts to access files or
* folders are logged.
*
*
* -
*
* DISABLED
- access auditing of files and folders is turned off.
*
*
* @see WindowsAccessAuditLogLevel
*/
public final String fileAccessAuditLogLevelAsString() {
return fileAccessAuditLogLevel;
}
/**
*
* Sets which attempt type is logged by Amazon FSx for file share accesses.
*
*
* -
*
* SUCCESS_ONLY
- only successful attempts to access file shares are logged.
*
*
* -
*
* FAILURE_ONLY
- only failed attempts to access file shares are logged.
*
*
* -
*
* SUCCESS_AND_FAILURE
- both successful attempts and failed attempts to access file shares are logged.
*
*
* -
*
* DISABLED
- access auditing of file shares is turned off.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #fileShareAccessAuditLogLevel} will return {@link WindowsAccessAuditLogLevel#UNKNOWN_TO_SDK_VERSION}. The
* raw value returned by the service is available from {@link #fileShareAccessAuditLogLevelAsString}.
*
*
* @return Sets which attempt type is logged by Amazon FSx for file share accesses.
*
* -
*
* SUCCESS_ONLY
- only successful attempts to access file shares are logged.
*
*
* -
*
* FAILURE_ONLY
- only failed attempts to access file shares are logged.
*
*
* -
*
* SUCCESS_AND_FAILURE
- both successful attempts and failed attempts to access file shares are
* logged.
*
*
* -
*
* DISABLED
- access auditing of file shares is turned off.
*
*
* @see WindowsAccessAuditLogLevel
*/
public final WindowsAccessAuditLogLevel fileShareAccessAuditLogLevel() {
return WindowsAccessAuditLogLevel.fromValue(fileShareAccessAuditLogLevel);
}
/**
*
* Sets which attempt type is logged by Amazon FSx for file share accesses.
*
*
* -
*
* SUCCESS_ONLY
- only successful attempts to access file shares are logged.
*
*
* -
*
* FAILURE_ONLY
- only failed attempts to access file shares are logged.
*
*
* -
*
* SUCCESS_AND_FAILURE
- both successful attempts and failed attempts to access file shares are logged.
*
*
* -
*
* DISABLED
- access auditing of file shares is turned off.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #fileShareAccessAuditLogLevel} will return {@link WindowsAccessAuditLogLevel#UNKNOWN_TO_SDK_VERSION}. The
* raw value returned by the service is available from {@link #fileShareAccessAuditLogLevelAsString}.
*
*
* @return Sets which attempt type is logged by Amazon FSx for file share accesses.
*
* -
*
* SUCCESS_ONLY
- only successful attempts to access file shares are logged.
*
*
* -
*
* FAILURE_ONLY
- only failed attempts to access file shares are logged.
*
*
* -
*
* SUCCESS_AND_FAILURE
- both successful attempts and failed attempts to access file shares are
* logged.
*
*
* -
*
* DISABLED
- access auditing of file shares is turned off.
*
*
* @see WindowsAccessAuditLogLevel
*/
public final String fileShareAccessAuditLogLevelAsString() {
return fileShareAccessAuditLogLevel;
}
/**
*
* The Amazon Resource Name (ARN) that specifies the destination of the audit logs.
*
*
* The destination can be any Amazon CloudWatch Logs log group ARN or Amazon Kinesis Data Firehose delivery stream
* ARN, with the following requirements:
*
*
* -
*
* The destination ARN that you provide (either CloudWatch Logs log group or Kinesis Data Firehose delivery stream)
* must be in the same Amazon Web Services partition, Amazon Web Services Region, and Amazon Web Services account as
* your Amazon FSx file system.
*
*
* -
*
* The name of the Amazon CloudWatch Logs log group must begin with the /aws/fsx
prefix. The name of
* the Amazon Kinesis Data Firehose delivery stream must begin with the aws-fsx
prefix.
*
*
* -
*
* If you do not provide a destination in AuditLogDestination
, Amazon FSx will create and use a log
* stream in the CloudWatch Logs /aws/fsx/windows
log group.
*
*
* -
*
* If AuditLogDestination
is provided and the resource does not exist, the request will fail with a
* BadRequest
error.
*
*
* -
*
* If FileAccessAuditLogLevel
and FileShareAccessAuditLogLevel
are both set to
* DISABLED
, you cannot specify a destination in AuditLogDestination
.
*
*
*
*
* @return The Amazon Resource Name (ARN) that specifies the destination of the audit logs.
*
* The destination can be any Amazon CloudWatch Logs log group ARN or Amazon Kinesis Data Firehose delivery
* stream ARN, with the following requirements:
*
*
* -
*
* The destination ARN that you provide (either CloudWatch Logs log group or Kinesis Data Firehose delivery
* stream) must be in the same Amazon Web Services partition, Amazon Web Services Region, and Amazon Web
* Services account as your Amazon FSx file system.
*
*
* -
*
* The name of the Amazon CloudWatch Logs log group must begin with the /aws/fsx
prefix. The
* name of the Amazon Kinesis Data Firehose delivery stream must begin with the aws-fsx
prefix.
*
*
* -
*
* If you do not provide a destination in AuditLogDestination
, Amazon FSx will create and use a
* log stream in the CloudWatch Logs /aws/fsx/windows
log group.
*
*
* -
*
* If AuditLogDestination
is provided and the resource does not exist, the request will fail
* with a BadRequest
error.
*
*
* -
*
* If FileAccessAuditLogLevel
and FileShareAccessAuditLogLevel
are both set to
* DISABLED
, you cannot specify a destination in AuditLogDestination
.
*
*
*/
public final String auditLogDestination() {
return auditLogDestination;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(fileAccessAuditLogLevelAsString());
hashCode = 31 * hashCode + Objects.hashCode(fileShareAccessAuditLogLevelAsString());
hashCode = 31 * hashCode + Objects.hashCode(auditLogDestination());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof WindowsAuditLogCreateConfiguration)) {
return false;
}
WindowsAuditLogCreateConfiguration other = (WindowsAuditLogCreateConfiguration) obj;
return Objects.equals(fileAccessAuditLogLevelAsString(), other.fileAccessAuditLogLevelAsString())
&& Objects.equals(fileShareAccessAuditLogLevelAsString(), other.fileShareAccessAuditLogLevelAsString())
&& Objects.equals(auditLogDestination(), other.auditLogDestination());
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*/
@Override
public final String toString() {
return ToString.builder("WindowsAuditLogCreateConfiguration")
.add("FileAccessAuditLogLevel", fileAccessAuditLogLevelAsString())
.add("FileShareAccessAuditLogLevel", fileShareAccessAuditLogLevelAsString())
.add("AuditLogDestination", auditLogDestination()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "FileAccessAuditLogLevel":
return Optional.ofNullable(clazz.cast(fileAccessAuditLogLevelAsString()));
case "FileShareAccessAuditLogLevel":
return Optional.ofNullable(clazz.cast(fileShareAccessAuditLogLevelAsString()));
case "AuditLogDestination":
return Optional.ofNullable(clazz.cast(auditLogDestination()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function