
software.amazon.awssdk.services.guardduty.model.Organization 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.guardduty.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;
/**
*
* Contains information about the ISP organization of the remote IP address.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class Organization implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField ASN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Asn")
.getter(getter(Organization::asn)).setter(setter(Builder::asn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("asn").build()).build();
private static final SdkField ASN_ORG_FIELD = SdkField. builder(MarshallingType.STRING).memberName("AsnOrg")
.getter(getter(Organization::asnOrg)).setter(setter(Builder::asnOrg))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("asnOrg").build()).build();
private static final SdkField ISP_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Isp")
.getter(getter(Organization::isp)).setter(setter(Builder::isp))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("isp").build()).build();
private static final SdkField ORG_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Org")
.getter(getter(Organization::org)).setter(setter(Builder::org))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("org").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ASN_FIELD, ASN_ORG_FIELD,
ISP_FIELD, ORG_FIELD));
private static final long serialVersionUID = 1L;
private final String asn;
private final String asnOrg;
private final String isp;
private final String org;
private Organization(BuilderImpl builder) {
this.asn = builder.asn;
this.asnOrg = builder.asnOrg;
this.isp = builder.isp;
this.org = builder.org;
}
/**
*
* The Autonomous System Number (ASN) of the internet provider of the remote IP address.
*
*
* @return The Autonomous System Number (ASN) of the internet provider of the remote IP address.
*/
public final String asn() {
return asn;
}
/**
*
* The organization that registered this ASN.
*
*
* @return The organization that registered this ASN.
*/
public final String asnOrg() {
return asnOrg;
}
/**
*
* The ISP information for the internet provider.
*
*
* @return The ISP information for the internet provider.
*/
public final String isp() {
return isp;
}
/**
*
* The name of the internet provider.
*
*
* @return The name of the internet provider.
*/
public final String org() {
return org;
}
@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(asn());
hashCode = 31 * hashCode + Objects.hashCode(asnOrg());
hashCode = 31 * hashCode + Objects.hashCode(isp());
hashCode = 31 * hashCode + Objects.hashCode(org());
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 Organization)) {
return false;
}
Organization other = (Organization) obj;
return Objects.equals(asn(), other.asn()) && Objects.equals(asnOrg(), other.asnOrg())
&& Objects.equals(isp(), other.isp()) && Objects.equals(org(), other.org());
}
/**
* 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("Organization").add("Asn", asn()).add("AsnOrg", asnOrg()).add("Isp", isp()).add("Org", org())
.build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Asn":
return Optional.ofNullable(clazz.cast(asn()));
case "AsnOrg":
return Optional.ofNullable(clazz.cast(asnOrg()));
case "Isp":
return Optional.ofNullable(clazz.cast(isp()));
case "Org":
return Optional.ofNullable(clazz.cast(org()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function
© 2015 - 2025 Weber Informatics LLC | Privacy Policy