All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.fms.model.SecurityGroupRemediationAction Maven / Gradle / Ivy

Go to download

The AWS Java SDK for FMS module holds the client classes that are used for communicating with FMS.

There is a newer version: 2.29.15
Show newest version
/*
 * 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 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 getter(Function g) { return obj -> g.apply((SecurityGroupRemediationAction) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The remediation action that will be performed. *

* * @param remediationActionType * The remediation action that will be performed. * @see RemediationActionType * @return Returns a reference to this object so that method calls can be chained together. * @see RemediationActionType */ Builder remediationActionType(String remediationActionType); /** *

* The remediation action that will be performed. *

* * @param remediationActionType * The remediation action that will be performed. * @see RemediationActionType * @return Returns a reference to this object so that method calls can be chained together. * @see RemediationActionType */ Builder remediationActionType(RemediationActionType remediationActionType); /** *

* Brief description of the action that will be performed. *

* * @param description * Brief description of the action that will be performed. * @return Returns a reference to this object so that method calls can be chained together. */ Builder description(String description); /** *

* The final state of the rule specified in the ViolationTarget after it is remediated. *

* * @param remediationResult * The final state of the rule specified in the ViolationTarget after it is remediated. * @return Returns a reference to this object so that method calls can be chained together. */ Builder remediationResult(SecurityGroupRuleDescription remediationResult); /** *

* The final state of the rule specified in the ViolationTarget after it is remediated. *

* This is a convenience method that creates an instance of the {@link SecurityGroupRuleDescription.Builder} * avoiding the need to create one manually via {@link SecurityGroupRuleDescription#builder()}. * *

* When the {@link Consumer} completes, {@link SecurityGroupRuleDescription.Builder#build()} is called * immediately and its result is passed to {@link #remediationResult(SecurityGroupRuleDescription)}. * * @param remediationResult * a consumer that will call methods on {@link SecurityGroupRuleDescription.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #remediationResult(SecurityGroupRuleDescription) */ default Builder remediationResult(Consumer remediationResult) { return remediationResult(SecurityGroupRuleDescription.builder().applyMutation(remediationResult).build()); } /** *

* Indicates if the current action is the default action. *

* * @param isDefaultAction * Indicates if the current action is the default action. * @return Returns a reference to this object so that method calls can be chained together. */ Builder isDefaultAction(Boolean isDefaultAction); } static final class BuilderImpl implements Builder { private String remediationActionType; private String description; private SecurityGroupRuleDescription remediationResult; private Boolean isDefaultAction; private BuilderImpl() { } private BuilderImpl(SecurityGroupRemediationAction model) { remediationActionType(model.remediationActionType); description(model.description); remediationResult(model.remediationResult); isDefaultAction(model.isDefaultAction); } public final String getRemediationActionType() { return remediationActionType; } public final void setRemediationActionType(String remediationActionType) { this.remediationActionType = remediationActionType; } @Override public final Builder remediationActionType(String remediationActionType) { this.remediationActionType = remediationActionType; return this; } @Override public final Builder remediationActionType(RemediationActionType remediationActionType) { this.remediationActionType(remediationActionType == null ? null : remediationActionType.toString()); return this; } public final String getDescription() { return description; } public final void setDescription(String description) { this.description = description; } @Override public final Builder description(String description) { this.description = description; return this; } public final SecurityGroupRuleDescription.Builder getRemediationResult() { return remediationResult != null ? remediationResult.toBuilder() : null; } public final void setRemediationResult(SecurityGroupRuleDescription.BuilderImpl remediationResult) { this.remediationResult = remediationResult != null ? remediationResult.build() : null; } @Override public final Builder remediationResult(SecurityGroupRuleDescription remediationResult) { this.remediationResult = remediationResult; return this; } public final Boolean getIsDefaultAction() { return isDefaultAction; } public final void setIsDefaultAction(Boolean isDefaultAction) { this.isDefaultAction = isDefaultAction; } @Override public final Builder isDefaultAction(Boolean isDefaultAction) { this.isDefaultAction = isDefaultAction; return this; } @Override public SecurityGroupRemediationAction build() { return new SecurityGroupRemediationAction(this); } @Override public List> sdkFields() { return SDK_FIELDS; } @Override public Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy