software.amazon.awssdk.services.applicationdiscovery.model.AgentInfo Maven / Gradle / Ivy
Show all versions of applicationdiscovery 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.applicationdiscovery.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
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 java.util.stream.Collectors;
import java.util.stream.Stream;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Information about agents associated with the user’s Amazon Web Services account. Information includes agent IDs, IP
* addresses, media access control (MAC) addresses, agent or collector status, hostname where the agent resides, and
* agent version for each agent.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class AgentInfo implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField AGENT_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("agentId").getter(getter(AgentInfo::agentId)).setter(setter(Builder::agentId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("agentId").build()).build();
private static final SdkField HOST_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("hostName").getter(getter(AgentInfo::hostName)).setter(setter(Builder::hostName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("hostName").build()).build();
private static final SdkField> AGENT_NETWORK_INFO_LIST_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("agentNetworkInfoList")
.getter(getter(AgentInfo::agentNetworkInfoList))
.setter(setter(Builder::agentNetworkInfoList))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("agentNetworkInfoList").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(AgentNetworkInfo::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField CONNECTOR_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("connectorId").getter(getter(AgentInfo::connectorId)).setter(setter(Builder::connectorId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("connectorId").build()).build();
private static final SdkField VERSION_FIELD = SdkField. builder(MarshallingType.STRING).memberName("version")
.getter(getter(AgentInfo::version)).setter(setter(Builder::version))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("version").build()).build();
private static final SdkField HEALTH_FIELD = SdkField. builder(MarshallingType.STRING).memberName("health")
.getter(getter(AgentInfo::healthAsString)).setter(setter(Builder::health))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("health").build()).build();
private static final SdkField LAST_HEALTH_PING_TIME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("lastHealthPingTime").getter(getter(AgentInfo::lastHealthPingTime))
.setter(setter(Builder::lastHealthPingTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("lastHealthPingTime").build())
.build();
private static final SdkField COLLECTION_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("collectionStatus").getter(getter(AgentInfo::collectionStatus)).setter(setter(Builder::collectionStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("collectionStatus").build()).build();
private static final SdkField AGENT_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("agentType").getter(getter(AgentInfo::agentType)).setter(setter(Builder::agentType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("agentType").build()).build();
private static final SdkField REGISTERED_TIME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("registeredTime").getter(getter(AgentInfo::registeredTime)).setter(setter(Builder::registeredTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("registeredTime").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(AGENT_ID_FIELD,
HOST_NAME_FIELD, AGENT_NETWORK_INFO_LIST_FIELD, CONNECTOR_ID_FIELD, VERSION_FIELD, HEALTH_FIELD,
LAST_HEALTH_PING_TIME_FIELD, COLLECTION_STATUS_FIELD, AGENT_TYPE_FIELD, REGISTERED_TIME_FIELD));
private static final long serialVersionUID = 1L;
private final String agentId;
private final String hostName;
private final List agentNetworkInfoList;
private final String connectorId;
private final String version;
private final String health;
private final String lastHealthPingTime;
private final String collectionStatus;
private final String agentType;
private final String registeredTime;
private AgentInfo(BuilderImpl builder) {
this.agentId = builder.agentId;
this.hostName = builder.hostName;
this.agentNetworkInfoList = builder.agentNetworkInfoList;
this.connectorId = builder.connectorId;
this.version = builder.version;
this.health = builder.health;
this.lastHealthPingTime = builder.lastHealthPingTime;
this.collectionStatus = builder.collectionStatus;
this.agentType = builder.agentType;
this.registeredTime = builder.registeredTime;
}
/**
*
* The agent or collector ID.
*
*
* @return The agent or collector ID.
*/
public final String agentId() {
return agentId;
}
/**
*
* The name of the host where the agent or collector resides. The host can be a server or virtual machine.
*
*
* @return The name of the host where the agent or collector resides. The host can be a server or virtual machine.
*/
public final String hostName() {
return hostName;
}
/**
* For responses, this returns true if the service returned a value for the AgentNetworkInfoList property. This DOES
* NOT check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property).
* This is useful because the SDK will never return a null collection or map, but you may need to differentiate
* between the service returning nothing (or null) and the service returning an empty collection or map. For
* requests, this returns true if a value for the property was specified in the request builder, and false if a
* value was not specified.
*/
public final boolean hasAgentNetworkInfoList() {
return agentNetworkInfoList != null && !(agentNetworkInfoList instanceof SdkAutoConstructList);
}
/**
*
* Network details about the host where the agent or collector resides.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasAgentNetworkInfoList} method.
*
*
* @return Network details about the host where the agent or collector resides.
*/
public final List agentNetworkInfoList() {
return agentNetworkInfoList;
}
/**
*
* The ID of the connector.
*
*
* @return The ID of the connector.
*/
public final String connectorId() {
return connectorId;
}
/**
*
* The agent or collector version.
*
*
* @return The agent or collector version.
*/
public final String version() {
return version;
}
/**
*
* The health of the agent.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #health} will
* return {@link AgentStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #healthAsString}.
*
*
* @return The health of the agent.
* @see AgentStatus
*/
public final AgentStatus health() {
return AgentStatus.fromValue(health);
}
/**
*
* The health of the agent.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #health} will
* return {@link AgentStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #healthAsString}.
*
*
* @return The health of the agent.
* @see AgentStatus
*/
public final String healthAsString() {
return health;
}
/**
*
* Time since agent health was reported.
*
*
* @return Time since agent health was reported.
*/
public final String lastHealthPingTime() {
return lastHealthPingTime;
}
/**
*
* Status of the collection process for an agent.
*
*
* @return Status of the collection process for an agent.
*/
public final String collectionStatus() {
return collectionStatus;
}
/**
*
* Type of agent.
*
*
* @return Type of agent.
*/
public final String agentType() {
return agentType;
}
/**
*
* Agent's first registration timestamp in UTC.
*
*
* @return Agent's first registration timestamp in UTC.
*/
public final String registeredTime() {
return registeredTime;
}
@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(agentId());
hashCode = 31 * hashCode + Objects.hashCode(hostName());
hashCode = 31 * hashCode + Objects.hashCode(hasAgentNetworkInfoList() ? agentNetworkInfoList() : null);
hashCode = 31 * hashCode + Objects.hashCode(connectorId());
hashCode = 31 * hashCode + Objects.hashCode(version());
hashCode = 31 * hashCode + Objects.hashCode(healthAsString());
hashCode = 31 * hashCode + Objects.hashCode(lastHealthPingTime());
hashCode = 31 * hashCode + Objects.hashCode(collectionStatus());
hashCode = 31 * hashCode + Objects.hashCode(agentType());
hashCode = 31 * hashCode + Objects.hashCode(registeredTime());
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 AgentInfo)) {
return false;
}
AgentInfo other = (AgentInfo) obj;
return Objects.equals(agentId(), other.agentId()) && Objects.equals(hostName(), other.hostName())
&& hasAgentNetworkInfoList() == other.hasAgentNetworkInfoList()
&& Objects.equals(agentNetworkInfoList(), other.agentNetworkInfoList())
&& Objects.equals(connectorId(), other.connectorId()) && Objects.equals(version(), other.version())
&& Objects.equals(healthAsString(), other.healthAsString())
&& Objects.equals(lastHealthPingTime(), other.lastHealthPingTime())
&& Objects.equals(collectionStatus(), other.collectionStatus()) && Objects.equals(agentType(), other.agentType())
&& Objects.equals(registeredTime(), other.registeredTime());
}
/**
* 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("AgentInfo").add("AgentId", agentId()).add("HostName", hostName())
.add("AgentNetworkInfoList", agentNetworkInfoList() == null ? null : "*** Sensitive Data Redacted ***")
.add("ConnectorId", connectorId()).add("Version", version()).add("Health", healthAsString())
.add("LastHealthPingTime", lastHealthPingTime()).add("CollectionStatus", collectionStatus())
.add("AgentType", agentType()).add("RegisteredTime", registeredTime()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "agentId":
return Optional.ofNullable(clazz.cast(agentId()));
case "hostName":
return Optional.ofNullable(clazz.cast(hostName()));
case "agentNetworkInfoList":
return Optional.ofNullable(clazz.cast(agentNetworkInfoList()));
case "connectorId":
return Optional.ofNullable(clazz.cast(connectorId()));
case "version":
return Optional.ofNullable(clazz.cast(version()));
case "health":
return Optional.ofNullable(clazz.cast(healthAsString()));
case "lastHealthPingTime":
return Optional.ofNullable(clazz.cast(lastHealthPingTime()));
case "collectionStatus":
return Optional.ofNullable(clazz.cast(collectionStatus()));
case "agentType":
return Optional.ofNullable(clazz.cast(agentType()));
case "registeredTime":
return Optional.ofNullable(clazz.cast(registeredTime()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function