software.amazon.awssdk.services.fms.model.SecurityGroupRemediationAction Maven / Gradle / Ivy
Show all versions of fms 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.fms.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
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;
/**
*
* Remediation option for the rule specified in the ViolationTarget
.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class SecurityGroupRemediationAction implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField REMEDIATION_ACTION_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("RemediationActionType").getter(getter(SecurityGroupRemediationAction::remediationActionTypeAsString))
.setter(setter(Builder::remediationActionType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RemediationActionType").build())
.build();
private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Description").getter(getter(SecurityGroupRemediationAction::description))
.setter(setter(Builder::description))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Description").build()).build();
private static final SdkField REMEDIATION_RESULT_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("RemediationResult")
.getter(getter(SecurityGroupRemediationAction::remediationResult)).setter(setter(Builder::remediationResult))
.constructor(SecurityGroupRuleDescription::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RemediationResult").build()).build();
private static final SdkField IS_DEFAULT_ACTION_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("IsDefaultAction").getter(getter(SecurityGroupRemediationAction::isDefaultAction))
.setter(setter(Builder::isDefaultAction))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IsDefaultAction").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(REMEDIATION_ACTION_TYPE_FIELD,
DESCRIPTION_FIELD, REMEDIATION_RESULT_FIELD, IS_DEFAULT_ACTION_FIELD));
private static final Map> SDK_NAME_TO_FIELD = Collections
.unmodifiableMap(new HashMap>() {
{
put("RemediationActionType", REMEDIATION_ACTION_TYPE_FIELD);
put("Description", DESCRIPTION_FIELD);
put("RemediationResult", REMEDIATION_RESULT_FIELD);
put("IsDefaultAction", IS_DEFAULT_ACTION_FIELD);
}
});
private static final long serialVersionUID = 1L;
private final String remediationActionType;
private final String description;
private final SecurityGroupRuleDescription remediationResult;
private final Boolean isDefaultAction;
private SecurityGroupRemediationAction(BuilderImpl builder) {
this.remediationActionType = builder.remediationActionType;
this.description = builder.description;
this.remediationResult = builder.remediationResult;
this.isDefaultAction = builder.isDefaultAction;
}
/**
*
* The remediation action that will be performed.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #remediationActionType} will return {@link RemediationActionType#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #remediationActionTypeAsString}.
*
*
* @return The remediation action that will be performed.
* @see RemediationActionType
*/
public final RemediationActionType remediationActionType() {
return RemediationActionType.fromValue(remediationActionType);
}
/**
*
* The remediation action that will be performed.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #remediationActionType} will return {@link RemediationActionType#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #remediationActionTypeAsString}.
*
*
* @return The remediation action that will be performed.
* @see RemediationActionType
*/
public final String remediationActionTypeAsString() {
return remediationActionType;
}
/**
*
* Brief description of the action that will be performed.
*
*
* @return Brief description of the action that will be performed.
*/
public final String description() {
return description;
}
/**
*
* The final state of the rule specified in the ViolationTarget
after it is remediated.
*
*
* @return The final state of the rule specified in the ViolationTarget
after it is remediated.
*/
public final SecurityGroupRuleDescription remediationResult() {
return remediationResult;
}
/**
*
* Indicates if the current action is the default action.
*
*
* @return Indicates if the current action is the default action.
*/
public final Boolean isDefaultAction() {
return isDefaultAction;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(remediationActionTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(description());
hashCode = 31 * hashCode + Objects.hashCode(remediationResult());
hashCode = 31 * hashCode + Objects.hashCode(isDefaultAction());
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 SecurityGroupRemediationAction)) {
return false;
}
SecurityGroupRemediationAction other = (SecurityGroupRemediationAction) obj;
return Objects.equals(remediationActionTypeAsString(), other.remediationActionTypeAsString())
&& Objects.equals(description(), other.description())
&& Objects.equals(remediationResult(), other.remediationResult())
&& Objects.equals(isDefaultAction(), other.isDefaultAction());
}
/**
* 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("SecurityGroupRemediationAction").add("RemediationActionType", remediationActionTypeAsString())
.add("Description", description()).add("RemediationResult", remediationResult())
.add("IsDefaultAction", isDefaultAction()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "RemediationActionType":
return Optional.ofNullable(clazz.cast(remediationActionTypeAsString()));
case "Description":
return Optional.ofNullable(clazz.cast(description()));
case "RemediationResult":
return Optional.ofNullable(clazz.cast(remediationResult()));
case "IsDefaultAction":
return Optional.ofNullable(clazz.cast(isDefaultAction()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Function