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

software.amazon.awssdk.services.inspector.model.AssessmentRunAgent Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon Inspector Service module holds the client classes that are used for communicating with Amazon Inspector Service

There is a newer version: 2.29.39
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.inspector.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;

/**
 * 

* Contains information about an Amazon Inspector agent. This data type is used as a response element in the * ListAssessmentRunAgents action. *

*/ @Generated("software.amazon.awssdk:codegen") public final class AssessmentRunAgent implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField AGENT_ID_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("agentId").getter(getter(AssessmentRunAgent::agentId)).setter(setter(Builder::agentId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("agentId").build()).build(); private static final SdkField ASSESSMENT_RUN_ARN_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("assessmentRunArn").getter(getter(AssessmentRunAgent::assessmentRunArn)) .setter(setter(Builder::assessmentRunArn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("assessmentRunArn").build()).build(); private static final SdkField AGENT_HEALTH_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("agentHealth").getter(getter(AssessmentRunAgent::agentHealthAsString)) .setter(setter(Builder::agentHealth)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("agentHealth").build()).build(); private static final SdkField AGENT_HEALTH_CODE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("agentHealthCode").getter(getter(AssessmentRunAgent::agentHealthCodeAsString)) .setter(setter(Builder::agentHealthCode)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("agentHealthCode").build()).build(); private static final SdkField AGENT_HEALTH_DETAILS_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("agentHealthDetails").getter(getter(AssessmentRunAgent::agentHealthDetails)) .setter(setter(Builder::agentHealthDetails)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("agentHealthDetails").build()) .build(); private static final SdkField AUTO_SCALING_GROUP_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("autoScalingGroup").getter(getter(AssessmentRunAgent::autoScalingGroup)) .setter(setter(Builder::autoScalingGroup)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("autoScalingGroup").build()).build(); private static final SdkField> TELEMETRY_METADATA_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("telemetryMetadata") .getter(getter(AssessmentRunAgent::telemetryMetadata)) .setter(setter(Builder::telemetryMetadata)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("telemetryMetadata").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(TelemetryMetadata::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(AGENT_ID_FIELD, ASSESSMENT_RUN_ARN_FIELD, AGENT_HEALTH_FIELD, AGENT_HEALTH_CODE_FIELD, AGENT_HEALTH_DETAILS_FIELD, AUTO_SCALING_GROUP_FIELD, TELEMETRY_METADATA_FIELD)); private static final long serialVersionUID = 1L; private final String agentId; private final String assessmentRunArn; private final String agentHealth; private final String agentHealthCode; private final String agentHealthDetails; private final String autoScalingGroup; private final List telemetryMetadata; private AssessmentRunAgent(BuilderImpl builder) { this.agentId = builder.agentId; this.assessmentRunArn = builder.assessmentRunArn; this.agentHealth = builder.agentHealth; this.agentHealthCode = builder.agentHealthCode; this.agentHealthDetails = builder.agentHealthDetails; this.autoScalingGroup = builder.autoScalingGroup; this.telemetryMetadata = builder.telemetryMetadata; } /** *

* The AWS account of the EC2 instance where the agent is installed. *

* * @return The AWS account of the EC2 instance where the agent is installed. */ public final String agentId() { return agentId; } /** *

* The ARN of the assessment run that is associated with the agent. *

* * @return The ARN of the assessment run that is associated with the agent. */ public final String assessmentRunArn() { return assessmentRunArn; } /** *

* The current health state of the agent. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #agentHealth} will * return {@link AgentHealth#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #agentHealthAsString}. *

* * @return The current health state of the agent. * @see AgentHealth */ public final AgentHealth agentHealth() { return AgentHealth.fromValue(agentHealth); } /** *

* The current health state of the agent. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #agentHealth} will * return {@link AgentHealth#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #agentHealthAsString}. *

* * @return The current health state of the agent. * @see AgentHealth */ public final String agentHealthAsString() { return agentHealth; } /** *

* The detailed health state of the agent. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #agentHealthCode} * will return {@link AgentHealthCode#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available * from {@link #agentHealthCodeAsString}. *

* * @return The detailed health state of the agent. * @see AgentHealthCode */ public final AgentHealthCode agentHealthCode() { return AgentHealthCode.fromValue(agentHealthCode); } /** *

* The detailed health state of the agent. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #agentHealthCode} * will return {@link AgentHealthCode#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available * from {@link #agentHealthCodeAsString}. *

* * @return The detailed health state of the agent. * @see AgentHealthCode */ public final String agentHealthCodeAsString() { return agentHealthCode; } /** *

* The description for the agent health code. *

* * @return The description for the agent health code. */ public final String agentHealthDetails() { return agentHealthDetails; } /** *

* The Auto Scaling group of the EC2 instance that is specified by the agent ID. *

* * @return The Auto Scaling group of the EC2 instance that is specified by the agent ID. */ public final String autoScalingGroup() { return autoScalingGroup; } /** * For responses, this returns true if the service returned a value for the TelemetryMetadata 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 hasTelemetryMetadata() { return telemetryMetadata != null && !(telemetryMetadata instanceof SdkAutoConstructList); } /** *

* The Amazon Inspector application data metrics that are collected by the agent. *

*

* 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 #hasTelemetryMetadata} method. *

* * @return The Amazon Inspector application data metrics that are collected by the agent. */ public final List telemetryMetadata() { return telemetryMetadata; } @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(assessmentRunArn()); hashCode = 31 * hashCode + Objects.hashCode(agentHealthAsString()); hashCode = 31 * hashCode + Objects.hashCode(agentHealthCodeAsString()); hashCode = 31 * hashCode + Objects.hashCode(agentHealthDetails()); hashCode = 31 * hashCode + Objects.hashCode(autoScalingGroup()); hashCode = 31 * hashCode + Objects.hashCode(hasTelemetryMetadata() ? telemetryMetadata() : null); 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 AssessmentRunAgent)) { return false; } AssessmentRunAgent other = (AssessmentRunAgent) obj; return Objects.equals(agentId(), other.agentId()) && Objects.equals(assessmentRunArn(), other.assessmentRunArn()) && Objects.equals(agentHealthAsString(), other.agentHealthAsString()) && Objects.equals(agentHealthCodeAsString(), other.agentHealthCodeAsString()) && Objects.equals(agentHealthDetails(), other.agentHealthDetails()) && Objects.equals(autoScalingGroup(), other.autoScalingGroup()) && hasTelemetryMetadata() == other.hasTelemetryMetadata() && Objects.equals(telemetryMetadata(), other.telemetryMetadata()); } /** * 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("AssessmentRunAgent").add("AgentId", agentId()).add("AssessmentRunArn", assessmentRunArn()) .add("AgentHealth", agentHealthAsString()).add("AgentHealthCode", agentHealthCodeAsString()) .add("AgentHealthDetails", agentHealthDetails()).add("AutoScalingGroup", autoScalingGroup()) .add("TelemetryMetadata", hasTelemetryMetadata() ? telemetryMetadata() : null).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "agentId": return Optional.ofNullable(clazz.cast(agentId())); case "assessmentRunArn": return Optional.ofNullable(clazz.cast(assessmentRunArn())); case "agentHealth": return Optional.ofNullable(clazz.cast(agentHealthAsString())); case "agentHealthCode": return Optional.ofNullable(clazz.cast(agentHealthCodeAsString())); case "agentHealthDetails": return Optional.ofNullable(clazz.cast(agentHealthDetails())); case "autoScalingGroup": return Optional.ofNullable(clazz.cast(autoScalingGroup())); case "telemetryMetadata": return Optional.ofNullable(clazz.cast(telemetryMetadata())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((AssessmentRunAgent) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The AWS account of the EC2 instance where the agent is installed. *

* * @param agentId * The AWS account of the EC2 instance where the agent is installed. * @return Returns a reference to this object so that method calls can be chained together. */ Builder agentId(String agentId); /** *

* The ARN of the assessment run that is associated with the agent. *

* * @param assessmentRunArn * The ARN of the assessment run that is associated with the agent. * @return Returns a reference to this object so that method calls can be chained together. */ Builder assessmentRunArn(String assessmentRunArn); /** *

* The current health state of the agent. *

* * @param agentHealth * The current health state of the agent. * @see AgentHealth * @return Returns a reference to this object so that method calls can be chained together. * @see AgentHealth */ Builder agentHealth(String agentHealth); /** *

* The current health state of the agent. *

* * @param agentHealth * The current health state of the agent. * @see AgentHealth * @return Returns a reference to this object so that method calls can be chained together. * @see AgentHealth */ Builder agentHealth(AgentHealth agentHealth); /** *

* The detailed health state of the agent. *

* * @param agentHealthCode * The detailed health state of the agent. * @see AgentHealthCode * @return Returns a reference to this object so that method calls can be chained together. * @see AgentHealthCode */ Builder agentHealthCode(String agentHealthCode); /** *

* The detailed health state of the agent. *

* * @param agentHealthCode * The detailed health state of the agent. * @see AgentHealthCode * @return Returns a reference to this object so that method calls can be chained together. * @see AgentHealthCode */ Builder agentHealthCode(AgentHealthCode agentHealthCode); /** *

* The description for the agent health code. *

* * @param agentHealthDetails * The description for the agent health code. * @return Returns a reference to this object so that method calls can be chained together. */ Builder agentHealthDetails(String agentHealthDetails); /** *

* The Auto Scaling group of the EC2 instance that is specified by the agent ID. *

* * @param autoScalingGroup * The Auto Scaling group of the EC2 instance that is specified by the agent ID. * @return Returns a reference to this object so that method calls can be chained together. */ Builder autoScalingGroup(String autoScalingGroup); /** *

* The Amazon Inspector application data metrics that are collected by the agent. *

* * @param telemetryMetadata * The Amazon Inspector application data metrics that are collected by the agent. * @return Returns a reference to this object so that method calls can be chained together. */ Builder telemetryMetadata(Collection telemetryMetadata); /** *

* The Amazon Inspector application data metrics that are collected by the agent. *

* * @param telemetryMetadata * The Amazon Inspector application data metrics that are collected by the agent. * @return Returns a reference to this object so that method calls can be chained together. */ Builder telemetryMetadata(TelemetryMetadata... telemetryMetadata); /** *

* The Amazon Inspector application data metrics that are collected by the agent. *

* This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.inspector.model.TelemetryMetadata.Builder} avoiding the need to create * one manually via {@link software.amazon.awssdk.services.inspector.model.TelemetryMetadata#builder()}. * *

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.inspector.model.TelemetryMetadata.Builder#build()} is called * immediately and its result is passed to {@link #telemetryMetadata(List)}. * * @param telemetryMetadata * a consumer that will call methods on * {@link software.amazon.awssdk.services.inspector.model.TelemetryMetadata.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #telemetryMetadata(java.util.Collection) */ Builder telemetryMetadata(Consumer... telemetryMetadata); } static final class BuilderImpl implements Builder { private String agentId; private String assessmentRunArn; private String agentHealth; private String agentHealthCode; private String agentHealthDetails; private String autoScalingGroup; private List telemetryMetadata = DefaultSdkAutoConstructList.getInstance(); private BuilderImpl() { } private BuilderImpl(AssessmentRunAgent model) { agentId(model.agentId); assessmentRunArn(model.assessmentRunArn); agentHealth(model.agentHealth); agentHealthCode(model.agentHealthCode); agentHealthDetails(model.agentHealthDetails); autoScalingGroup(model.autoScalingGroup); telemetryMetadata(model.telemetryMetadata); } public final String getAgentId() { return agentId; } public final void setAgentId(String agentId) { this.agentId = agentId; } @Override public final Builder agentId(String agentId) { this.agentId = agentId; return this; } public final String getAssessmentRunArn() { return assessmentRunArn; } public final void setAssessmentRunArn(String assessmentRunArn) { this.assessmentRunArn = assessmentRunArn; } @Override public final Builder assessmentRunArn(String assessmentRunArn) { this.assessmentRunArn = assessmentRunArn; return this; } public final String getAgentHealth() { return agentHealth; } public final void setAgentHealth(String agentHealth) { this.agentHealth = agentHealth; } @Override public final Builder agentHealth(String agentHealth) { this.agentHealth = agentHealth; return this; } @Override public final Builder agentHealth(AgentHealth agentHealth) { this.agentHealth(agentHealth == null ? null : agentHealth.toString()); return this; } public final String getAgentHealthCode() { return agentHealthCode; } public final void setAgentHealthCode(String agentHealthCode) { this.agentHealthCode = agentHealthCode; } @Override public final Builder agentHealthCode(String agentHealthCode) { this.agentHealthCode = agentHealthCode; return this; } @Override public final Builder agentHealthCode(AgentHealthCode agentHealthCode) { this.agentHealthCode(agentHealthCode == null ? null : agentHealthCode.toString()); return this; } public final String getAgentHealthDetails() { return agentHealthDetails; } public final void setAgentHealthDetails(String agentHealthDetails) { this.agentHealthDetails = agentHealthDetails; } @Override public final Builder agentHealthDetails(String agentHealthDetails) { this.agentHealthDetails = agentHealthDetails; return this; } public final String getAutoScalingGroup() { return autoScalingGroup; } public final void setAutoScalingGroup(String autoScalingGroup) { this.autoScalingGroup = autoScalingGroup; } @Override public final Builder autoScalingGroup(String autoScalingGroup) { this.autoScalingGroup = autoScalingGroup; return this; } public final List getTelemetryMetadata() { List result = TelemetryMetadataListCopier.copyToBuilder(this.telemetryMetadata); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setTelemetryMetadata(Collection telemetryMetadata) { this.telemetryMetadata = TelemetryMetadataListCopier.copyFromBuilder(telemetryMetadata); } @Override public final Builder telemetryMetadata(Collection telemetryMetadata) { this.telemetryMetadata = TelemetryMetadataListCopier.copy(telemetryMetadata); return this; } @Override @SafeVarargs public final Builder telemetryMetadata(TelemetryMetadata... telemetryMetadata) { telemetryMetadata(Arrays.asList(telemetryMetadata)); return this; } @Override @SafeVarargs public final Builder telemetryMetadata(Consumer... telemetryMetadata) { telemetryMetadata(Stream.of(telemetryMetadata).map(c -> TelemetryMetadata.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } @Override public AssessmentRunAgent build() { return new AssessmentRunAgent(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy