software.amazon.awssdk.services.fms.model.ResourceViolation Maven / Gradle / Ivy
/*
* 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.List;
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;
/**
*
* Violation detail based on resource type.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ResourceViolation implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField AWS_VPC_SECURITY_GROUP_VIOLATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO)
.getter(getter(ResourceViolation::awsVPCSecurityGroupViolation))
.setter(setter(Builder::awsVPCSecurityGroupViolation))
.constructor(AwsVPCSecurityGroupViolation::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AwsVPCSecurityGroupViolation")
.build()).build();
private static final SdkField AWS_EC2_NETWORK_INTERFACE_VIOLATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO)
.getter(getter(ResourceViolation::awsEc2NetworkInterfaceViolation))
.setter(setter(Builder::awsEc2NetworkInterfaceViolation))
.constructor(AwsEc2NetworkInterfaceViolation::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AwsEc2NetworkInterfaceViolation")
.build()).build();
private static final SdkField AWS_EC2_INSTANCE_VIOLATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO)
.getter(getter(ResourceViolation::awsEc2InstanceViolation)).setter(setter(Builder::awsEc2InstanceViolation))
.constructor(AwsEc2InstanceViolation::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AwsEc2InstanceViolation").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(
AWS_VPC_SECURITY_GROUP_VIOLATION_FIELD, AWS_EC2_NETWORK_INTERFACE_VIOLATION_FIELD, AWS_EC2_INSTANCE_VIOLATION_FIELD));
private static final long serialVersionUID = 1L;
private final AwsVPCSecurityGroupViolation awsVPCSecurityGroupViolation;
private final AwsEc2NetworkInterfaceViolation awsEc2NetworkInterfaceViolation;
private final AwsEc2InstanceViolation awsEc2InstanceViolation;
private ResourceViolation(BuilderImpl builder) {
this.awsVPCSecurityGroupViolation = builder.awsVPCSecurityGroupViolation;
this.awsEc2NetworkInterfaceViolation = builder.awsEc2NetworkInterfaceViolation;
this.awsEc2InstanceViolation = builder.awsEc2InstanceViolation;
}
/**
*
* Violation details for security groups.
*
*
* @return Violation details for security groups.
*/
public AwsVPCSecurityGroupViolation awsVPCSecurityGroupViolation() {
return awsVPCSecurityGroupViolation;
}
/**
*
* Violation details for network interface.
*
*
* @return Violation details for network interface.
*/
public AwsEc2NetworkInterfaceViolation awsEc2NetworkInterfaceViolation() {
return awsEc2NetworkInterfaceViolation;
}
/**
*
* Violation details for an EC2 instance.
*
*
* @return Violation details for an EC2 instance.
*/
public AwsEc2InstanceViolation awsEc2InstanceViolation() {
return awsEc2InstanceViolation;
}
@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 int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(awsVPCSecurityGroupViolation());
hashCode = 31 * hashCode + Objects.hashCode(awsEc2NetworkInterfaceViolation());
hashCode = 31 * hashCode + Objects.hashCode(awsEc2InstanceViolation());
return hashCode;
}
@Override
public boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof ResourceViolation)) {
return false;
}
ResourceViolation other = (ResourceViolation) obj;
return Objects.equals(awsVPCSecurityGroupViolation(), other.awsVPCSecurityGroupViolation())
&& Objects.equals(awsEc2NetworkInterfaceViolation(), other.awsEc2NetworkInterfaceViolation())
&& Objects.equals(awsEc2InstanceViolation(), other.awsEc2InstanceViolation());
}
/**
* 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 String toString() {
return ToString.builder("ResourceViolation").add("AwsVPCSecurityGroupViolation", awsVPCSecurityGroupViolation())
.add("AwsEc2NetworkInterfaceViolation", awsEc2NetworkInterfaceViolation())
.add("AwsEc2InstanceViolation", awsEc2InstanceViolation()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "AwsVPCSecurityGroupViolation":
return Optional.ofNullable(clazz.cast(awsVPCSecurityGroupViolation()));
case "AwsEc2NetworkInterfaceViolation":
return Optional.ofNullable(clazz.cast(awsEc2NetworkInterfaceViolation()));
case "AwsEc2InstanceViolation":
return Optional.ofNullable(clazz.cast(awsEc2InstanceViolation()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function
© 2015 - 2025 Weber Informatics LLC | Privacy Policy