Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
software.amazon.awssdk.services.inspector.model.AssessmentRun 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.inspector.model;
import java.io.Serializable;
import java.time.Instant;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
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 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.traits.MapTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructMap;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* A snapshot of an Amazon Inspector assessment run that contains the findings of the assessment run .
*
*
* Used as the response element in the DescribeAssessmentRuns action.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class AssessmentRun implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("arn")
.getter(getter(AssessmentRun::arn)).setter(setter(Builder::arn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("arn").build()).build();
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("name")
.getter(getter(AssessmentRun::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("name").build()).build();
private static final SdkField ASSESSMENT_TEMPLATE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("assessmentTemplateArn").getter(getter(AssessmentRun::assessmentTemplateArn))
.setter(setter(Builder::assessmentTemplateArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("assessmentTemplateArn").build())
.build();
private static final SdkField STATE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("state")
.getter(getter(AssessmentRun::stateAsString)).setter(setter(Builder::state))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("state").build()).build();
private static final SdkField DURATION_IN_SECONDS_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("durationInSeconds").getter(getter(AssessmentRun::durationInSeconds))
.setter(setter(Builder::durationInSeconds))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("durationInSeconds").build()).build();
private static final SdkField> RULES_PACKAGE_ARNS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("rulesPackageArns")
.getter(getter(AssessmentRun::rulesPackageArns))
.setter(setter(Builder::rulesPackageArns))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("rulesPackageArns").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField> USER_ATTRIBUTES_FOR_FINDINGS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("userAttributesForFindings")
.getter(getter(AssessmentRun::userAttributesForFindings))
.setter(setter(Builder::userAttributesForFindings))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("userAttributesForFindings").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(Attribute::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField CREATED_AT_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("createdAt").getter(getter(AssessmentRun::createdAt)).setter(setter(Builder::createdAt))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("createdAt").build()).build();
private static final SdkField STARTED_AT_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("startedAt").getter(getter(AssessmentRun::startedAt)).setter(setter(Builder::startedAt))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("startedAt").build()).build();
private static final SdkField COMPLETED_AT_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("completedAt").getter(getter(AssessmentRun::completedAt)).setter(setter(Builder::completedAt))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("completedAt").build()).build();
private static final SdkField STATE_CHANGED_AT_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("stateChangedAt").getter(getter(AssessmentRun::stateChangedAt)).setter(setter(Builder::stateChangedAt))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("stateChangedAt").build()).build();
private static final SdkField DATA_COLLECTED_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("dataCollected").getter(getter(AssessmentRun::dataCollected)).setter(setter(Builder::dataCollected))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("dataCollected").build()).build();
private static final SdkField> STATE_CHANGES_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("stateChanges")
.getter(getter(AssessmentRun::stateChanges))
.setter(setter(Builder::stateChanges))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("stateChanges").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(AssessmentRunStateChange::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField> NOTIFICATIONS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("notifications")
.getter(getter(AssessmentRun::notifications))
.setter(setter(Builder::notifications))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("notifications").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(AssessmentRunNotification::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField> FINDING_COUNTS_FIELD = SdkField
.> builder(MarshallingType.MAP)
.memberName("findingCounts")
.getter(getter(AssessmentRun::findingCountsAsStrings))
.setter(setter(Builder::findingCountsWithStrings))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("findingCounts").build(),
MapTrait.builder()
.keyLocationName("key")
.valueLocationName("value")
.valueFieldInfo(
SdkField. builder(MarshallingType.INTEGER)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("value").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ARN_FIELD, NAME_FIELD,
ASSESSMENT_TEMPLATE_ARN_FIELD, STATE_FIELD, DURATION_IN_SECONDS_FIELD, RULES_PACKAGE_ARNS_FIELD,
USER_ATTRIBUTES_FOR_FINDINGS_FIELD, CREATED_AT_FIELD, STARTED_AT_FIELD, COMPLETED_AT_FIELD, STATE_CHANGED_AT_FIELD,
DATA_COLLECTED_FIELD, STATE_CHANGES_FIELD, NOTIFICATIONS_FIELD, FINDING_COUNTS_FIELD));
private static final long serialVersionUID = 1L;
private final String arn;
private final String name;
private final String assessmentTemplateArn;
private final String state;
private final Integer durationInSeconds;
private final List rulesPackageArns;
private final List userAttributesForFindings;
private final Instant createdAt;
private final Instant startedAt;
private final Instant completedAt;
private final Instant stateChangedAt;
private final Boolean dataCollected;
private final List stateChanges;
private final List notifications;
private final Map findingCounts;
private AssessmentRun(BuilderImpl builder) {
this.arn = builder.arn;
this.name = builder.name;
this.assessmentTemplateArn = builder.assessmentTemplateArn;
this.state = builder.state;
this.durationInSeconds = builder.durationInSeconds;
this.rulesPackageArns = builder.rulesPackageArns;
this.userAttributesForFindings = builder.userAttributesForFindings;
this.createdAt = builder.createdAt;
this.startedAt = builder.startedAt;
this.completedAt = builder.completedAt;
this.stateChangedAt = builder.stateChangedAt;
this.dataCollected = builder.dataCollected;
this.stateChanges = builder.stateChanges;
this.notifications = builder.notifications;
this.findingCounts = builder.findingCounts;
}
/**
*
* The ARN of the assessment run.
*
*
* @return The ARN of the assessment run.
*/
public final String arn() {
return arn;
}
/**
*
* The auto-generated name for the assessment run.
*
*
* @return The auto-generated name for the assessment run.
*/
public final String name() {
return name;
}
/**
*
* The ARN of the assessment template that is associated with the assessment run.
*
*
* @return The ARN of the assessment template that is associated with the assessment run.
*/
public final String assessmentTemplateArn() {
return assessmentTemplateArn;
}
/**
*
* The state of the assessment run.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return
* {@link AssessmentRunState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #stateAsString}.
*
*
* @return The state of the assessment run.
* @see AssessmentRunState
*/
public final AssessmentRunState state() {
return AssessmentRunState.fromValue(state);
}
/**
*
* The state of the assessment run.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return
* {@link AssessmentRunState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #stateAsString}.
*
*
* @return The state of the assessment run.
* @see AssessmentRunState
*/
public final String stateAsString() {
return state;
}
/**
*
* The duration of the assessment run.
*
*
* @return The duration of the assessment run.
*/
public final Integer durationInSeconds() {
return durationInSeconds;
}
/**
* For responses, this returns true if the service returned a value for the RulesPackageArns 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 hasRulesPackageArns() {
return rulesPackageArns != null && !(rulesPackageArns instanceof SdkAutoConstructList);
}
/**
*
* The rules packages selected for the assessment run.
*
*
* 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 #hasRulesPackageArns} method.
*
*
* @return The rules packages selected for the assessment run.
*/
public final List rulesPackageArns() {
return rulesPackageArns;
}
/**
* For responses, this returns true if the service returned a value for the UserAttributesForFindings 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 hasUserAttributesForFindings() {
return userAttributesForFindings != null && !(userAttributesForFindings instanceof SdkAutoConstructList);
}
/**
*
* The user-defined attributes that are assigned to every generated finding.
*
*
* 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 #hasUserAttributesForFindings} method.
*
*
* @return The user-defined attributes that are assigned to every generated finding.
*/
public final List userAttributesForFindings() {
return userAttributesForFindings;
}
/**
*
* The time when StartAssessmentRun was called.
*
*
* @return The time when StartAssessmentRun was called.
*/
public final Instant createdAt() {
return createdAt;
}
/**
*
* The time when StartAssessmentRun was called.
*
*
* @return The time when StartAssessmentRun was called.
*/
public final Instant startedAt() {
return startedAt;
}
/**
*
* The assessment run completion time that corresponds to the rules packages evaluation completion time or failure.
*
*
* @return The assessment run completion time that corresponds to the rules packages evaluation completion time or
* failure.
*/
public final Instant completedAt() {
return completedAt;
}
/**
*
* The last time when the assessment run's state changed.
*
*
* @return The last time when the assessment run's state changed.
*/
public final Instant stateChangedAt() {
return stateChangedAt;
}
/**
*
* A Boolean value (true or false) that specifies whether the process of collecting data from the agents is
* completed.
*
*
* @return A Boolean value (true or false) that specifies whether the process of collecting data from the agents is
* completed.
*/
public final Boolean dataCollected() {
return dataCollected;
}
/**
* For responses, this returns true if the service returned a value for the StateChanges 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 hasStateChanges() {
return stateChanges != null && !(stateChanges instanceof SdkAutoConstructList);
}
/**
*
* A list of the assessment run state changes.
*
*
* 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 #hasStateChanges} method.
*
*
* @return A list of the assessment run state changes.
*/
public final List stateChanges() {
return stateChanges;
}
/**
* For responses, this returns true if the service returned a value for the Notifications 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 hasNotifications() {
return notifications != null && !(notifications instanceof SdkAutoConstructList);
}
/**
*
* A list of notifications for the event subscriptions. A notification about a particular generated finding is added
* to this list only once.
*
*
* 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 #hasNotifications} method.
*
*
* @return A list of notifications for the event subscriptions. A notification about a particular generated finding
* is added to this list only once.
*/
public final List notifications() {
return notifications;
}
/**
*
* Provides a total count of generated findings per severity.
*
*
* 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 #hasFindingCounts} method.
*
*
* @return Provides a total count of generated findings per severity.
*/
public final Map findingCounts() {
return AssessmentRunFindingCountsCopier.copyStringToEnum(findingCounts);
}
/**
* For responses, this returns true if the service returned a value for the FindingCounts 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 hasFindingCounts() {
return findingCounts != null && !(findingCounts instanceof SdkAutoConstructMap);
}
/**
*
* Provides a total count of generated findings per severity.
*
*
* 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 #hasFindingCounts} method.
*
*
* @return Provides a total count of generated findings per severity.
*/
public final Map findingCountsAsStrings() {
return findingCounts;
}
@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(arn());
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(assessmentTemplateArn());
hashCode = 31 * hashCode + Objects.hashCode(stateAsString());
hashCode = 31 * hashCode + Objects.hashCode(durationInSeconds());
hashCode = 31 * hashCode + Objects.hashCode(hasRulesPackageArns() ? rulesPackageArns() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasUserAttributesForFindings() ? userAttributesForFindings() : null);
hashCode = 31 * hashCode + Objects.hashCode(createdAt());
hashCode = 31 * hashCode + Objects.hashCode(startedAt());
hashCode = 31 * hashCode + Objects.hashCode(completedAt());
hashCode = 31 * hashCode + Objects.hashCode(stateChangedAt());
hashCode = 31 * hashCode + Objects.hashCode(dataCollected());
hashCode = 31 * hashCode + Objects.hashCode(hasStateChanges() ? stateChanges() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasNotifications() ? notifications() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasFindingCounts() ? findingCountsAsStrings() : 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 AssessmentRun)) {
return false;
}
AssessmentRun other = (AssessmentRun) obj;
return Objects.equals(arn(), other.arn()) && Objects.equals(name(), other.name())
&& Objects.equals(assessmentTemplateArn(), other.assessmentTemplateArn())
&& Objects.equals(stateAsString(), other.stateAsString())
&& Objects.equals(durationInSeconds(), other.durationInSeconds())
&& hasRulesPackageArns() == other.hasRulesPackageArns()
&& Objects.equals(rulesPackageArns(), other.rulesPackageArns())
&& hasUserAttributesForFindings() == other.hasUserAttributesForFindings()
&& Objects.equals(userAttributesForFindings(), other.userAttributesForFindings())
&& Objects.equals(createdAt(), other.createdAt()) && Objects.equals(startedAt(), other.startedAt())
&& Objects.equals(completedAt(), other.completedAt()) && Objects.equals(stateChangedAt(), other.stateChangedAt())
&& Objects.equals(dataCollected(), other.dataCollected()) && hasStateChanges() == other.hasStateChanges()
&& Objects.equals(stateChanges(), other.stateChanges()) && hasNotifications() == other.hasNotifications()
&& Objects.equals(notifications(), other.notifications()) && hasFindingCounts() == other.hasFindingCounts()
&& Objects.equals(findingCountsAsStrings(), other.findingCountsAsStrings());
}
/**
* 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("AssessmentRun").add("Arn", arn()).add("Name", name())
.add("AssessmentTemplateArn", assessmentTemplateArn()).add("State", stateAsString())
.add("DurationInSeconds", durationInSeconds())
.add("RulesPackageArns", hasRulesPackageArns() ? rulesPackageArns() : null)
.add("UserAttributesForFindings", hasUserAttributesForFindings() ? userAttributesForFindings() : null)
.add("CreatedAt", createdAt()).add("StartedAt", startedAt()).add("CompletedAt", completedAt())
.add("StateChangedAt", stateChangedAt()).add("DataCollected", dataCollected())
.add("StateChanges", hasStateChanges() ? stateChanges() : null)
.add("Notifications", hasNotifications() ? notifications() : null)
.add("FindingCounts", hasFindingCounts() ? findingCountsAsStrings() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "arn":
return Optional.ofNullable(clazz.cast(arn()));
case "name":
return Optional.ofNullable(clazz.cast(name()));
case "assessmentTemplateArn":
return Optional.ofNullable(clazz.cast(assessmentTemplateArn()));
case "state":
return Optional.ofNullable(clazz.cast(stateAsString()));
case "durationInSeconds":
return Optional.ofNullable(clazz.cast(durationInSeconds()));
case "rulesPackageArns":
return Optional.ofNullable(clazz.cast(rulesPackageArns()));
case "userAttributesForFindings":
return Optional.ofNullable(clazz.cast(userAttributesForFindings()));
case "createdAt":
return Optional.ofNullable(clazz.cast(createdAt()));
case "startedAt":
return Optional.ofNullable(clazz.cast(startedAt()));
case "completedAt":
return Optional.ofNullable(clazz.cast(completedAt()));
case "stateChangedAt":
return Optional.ofNullable(clazz.cast(stateChangedAt()));
case "dataCollected":
return Optional.ofNullable(clazz.cast(dataCollected()));
case "stateChanges":
return Optional.ofNullable(clazz.cast(stateChanges()));
case "notifications":
return Optional.ofNullable(clazz.cast(notifications()));
case "findingCounts":
return Optional.ofNullable(clazz.cast(findingCountsAsStrings()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function getter(Function g) {
return obj -> g.apply((AssessmentRun) obj);
}
private static BiConsumer setter(BiConsumer s) {
return (obj, val) -> s.accept((Builder) obj, val);
}
public interface Builder extends SdkPojo, CopyableBuilder {
/**
*
* The ARN of the assessment run.
*
*
* @param arn
* The ARN of the assessment run.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder arn(String arn);
/**
*
* The auto-generated name for the assessment run.
*
*
* @param name
* The auto-generated name for the assessment run.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder name(String name);
/**
*
* The ARN of the assessment template that is associated with the assessment run.
*
*
* @param assessmentTemplateArn
* The ARN of the assessment template that is associated with the assessment run.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder assessmentTemplateArn(String assessmentTemplateArn);
/**
*
* The state of the assessment run.
*
*
* @param state
* The state of the assessment run.
* @see AssessmentRunState
* @return Returns a reference to this object so that method calls can be chained together.
* @see AssessmentRunState
*/
Builder state(String state);
/**
*
* The state of the assessment run.
*
*
* @param state
* The state of the assessment run.
* @see AssessmentRunState
* @return Returns a reference to this object so that method calls can be chained together.
* @see AssessmentRunState
*/
Builder state(AssessmentRunState state);
/**
*
* The duration of the assessment run.
*
*
* @param durationInSeconds
* The duration of the assessment run.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder durationInSeconds(Integer durationInSeconds);
/**
*
* The rules packages selected for the assessment run.
*
*
* @param rulesPackageArns
* The rules packages selected for the assessment run.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder rulesPackageArns(Collection rulesPackageArns);
/**
*
* The rules packages selected for the assessment run.
*
*
* @param rulesPackageArns
* The rules packages selected for the assessment run.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder rulesPackageArns(String... rulesPackageArns);
/**
*
* The user-defined attributes that are assigned to every generated finding.
*
*
* @param userAttributesForFindings
* The user-defined attributes that are assigned to every generated finding.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder userAttributesForFindings(Collection userAttributesForFindings);
/**
*
* The user-defined attributes that are assigned to every generated finding.
*
*
* @param userAttributesForFindings
* The user-defined attributes that are assigned to every generated finding.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder userAttributesForFindings(Attribute... userAttributesForFindings);
/**
*
* The user-defined attributes that are assigned to every generated finding.
*
* This is a convenience method that creates an instance of the {@link List.Builder} avoiding the
* need to create one manually via {@link List#builder()}.
*
* When the {@link Consumer} completes, {@link List.Builder#build()} is called immediately and its
* result is passed to {@link #userAttributesForFindings(List)}.
*
* @param userAttributesForFindings
* a consumer that will call methods on {@link List.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #userAttributesForFindings(List)
*/
Builder userAttributesForFindings(Consumer... userAttributesForFindings);
/**
*
* The time when StartAssessmentRun was called.
*
*
* @param createdAt
* The time when StartAssessmentRun was called.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder createdAt(Instant createdAt);
/**
*
* The time when StartAssessmentRun was called.
*
*
* @param startedAt
* The time when StartAssessmentRun was called.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder startedAt(Instant startedAt);
/**
*
* The assessment run completion time that corresponds to the rules packages evaluation completion time or
* failure.
*
*
* @param completedAt
* The assessment run completion time that corresponds to the rules packages evaluation completion time
* or failure.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder completedAt(Instant completedAt);
/**
*
* The last time when the assessment run's state changed.
*
*
* @param stateChangedAt
* The last time when the assessment run's state changed.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder stateChangedAt(Instant stateChangedAt);
/**
*
* A Boolean value (true or false) that specifies whether the process of collecting data from the agents is
* completed.
*
*
* @param dataCollected
* A Boolean value (true or false) that specifies whether the process of collecting data from the agents
* is completed.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder dataCollected(Boolean dataCollected);
/**
*
* A list of the assessment run state changes.
*
*
* @param stateChanges
* A list of the assessment run state changes.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder stateChanges(Collection stateChanges);
/**
*
* A list of the assessment run state changes.
*
*
* @param stateChanges
* A list of the assessment run state changes.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder stateChanges(AssessmentRunStateChange... stateChanges);
/**
*
* A list of the assessment run state changes.
*
* This is a convenience method that creates an instance of the {@link List.Builder}
* avoiding the need to create one manually via {@link List#builder()}.
*
* When the {@link Consumer} completes, {@link List.Builder#build()} is called
* immediately and its result is passed to {@link #stateChanges(List)}.
*
* @param stateChanges
* a consumer that will call methods on {@link List.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #stateChanges(List)
*/
Builder stateChanges(Consumer... stateChanges);
/**
*
* A list of notifications for the event subscriptions. A notification about a particular generated finding is
* added to this list only once.
*
*
* @param notifications
* A list of notifications for the event subscriptions. A notification about a particular generated
* finding is added to this list only once.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder notifications(Collection notifications);
/**
*
* A list of notifications for the event subscriptions. A notification about a particular generated finding is
* added to this list only once.
*
*
* @param notifications
* A list of notifications for the event subscriptions. A notification about a particular generated
* finding is added to this list only once.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder notifications(AssessmentRunNotification... notifications);
/**
*
* A list of notifications for the event subscriptions. A notification about a particular generated finding is
* added to this list only once.
*
* This is a convenience method that creates an instance of the {@link List.Builder}
* avoiding the need to create one manually via {@link List#builder()}.
*
* When the {@link Consumer} completes, {@link List.Builder#build()} is called
* immediately and its result is passed to {@link #notifications(List)}.
*
* @param notifications
* a consumer that will call methods on {@link List.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #notifications(List)
*/
Builder notifications(Consumer... notifications);
/**
*
* Provides a total count of generated findings per severity.
*
*
* @param findingCounts
* Provides a total count of generated findings per severity.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder findingCountsWithStrings(Map findingCounts);
/**
*
* Provides a total count of generated findings per severity.
*
*
* @param findingCounts
* Provides a total count of generated findings per severity.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder findingCounts(Map findingCounts);
}
static final class BuilderImpl implements Builder {
private String arn;
private String name;
private String assessmentTemplateArn;
private String state;
private Integer durationInSeconds;
private List rulesPackageArns = DefaultSdkAutoConstructList.getInstance();
private List userAttributesForFindings = DefaultSdkAutoConstructList.getInstance();
private Instant createdAt;
private Instant startedAt;
private Instant completedAt;
private Instant stateChangedAt;
private Boolean dataCollected;
private List stateChanges = DefaultSdkAutoConstructList.getInstance();
private List notifications = DefaultSdkAutoConstructList.getInstance();
private Map findingCounts = DefaultSdkAutoConstructMap.getInstance();
private BuilderImpl() {
}
private BuilderImpl(AssessmentRun model) {
arn(model.arn);
name(model.name);
assessmentTemplateArn(model.assessmentTemplateArn);
state(model.state);
durationInSeconds(model.durationInSeconds);
rulesPackageArns(model.rulesPackageArns);
userAttributesForFindings(model.userAttributesForFindings);
createdAt(model.createdAt);
startedAt(model.startedAt);
completedAt(model.completedAt);
stateChangedAt(model.stateChangedAt);
dataCollected(model.dataCollected);
stateChanges(model.stateChanges);
notifications(model.notifications);
findingCountsWithStrings(model.findingCounts);
}
public final String getArn() {
return arn;
}
public final void setArn(String arn) {
this.arn = arn;
}
@Override
public final Builder arn(String arn) {
this.arn = arn;
return this;
}
public final String getName() {
return name;
}
public final void setName(String name) {
this.name = name;
}
@Override
public final Builder name(String name) {
this.name = name;
return this;
}
public final String getAssessmentTemplateArn() {
return assessmentTemplateArn;
}
public final void setAssessmentTemplateArn(String assessmentTemplateArn) {
this.assessmentTemplateArn = assessmentTemplateArn;
}
@Override
public final Builder assessmentTemplateArn(String assessmentTemplateArn) {
this.assessmentTemplateArn = assessmentTemplateArn;
return this;
}
public final String getState() {
return state;
}
public final void setState(String state) {
this.state = state;
}
@Override
public final Builder state(String state) {
this.state = state;
return this;
}
@Override
public final Builder state(AssessmentRunState state) {
this.state(state == null ? null : state.toString());
return this;
}
public final Integer getDurationInSeconds() {
return durationInSeconds;
}
public final void setDurationInSeconds(Integer durationInSeconds) {
this.durationInSeconds = durationInSeconds;
}
@Override
public final Builder durationInSeconds(Integer durationInSeconds) {
this.durationInSeconds = durationInSeconds;
return this;
}
public final Collection getRulesPackageArns() {
if (rulesPackageArns instanceof SdkAutoConstructList) {
return null;
}
return rulesPackageArns;
}
public final void setRulesPackageArns(Collection rulesPackageArns) {
this.rulesPackageArns = AssessmentRulesPackageArnListCopier.copy(rulesPackageArns);
}
@Override
public final Builder rulesPackageArns(Collection rulesPackageArns) {
this.rulesPackageArns = AssessmentRulesPackageArnListCopier.copy(rulesPackageArns);
return this;
}
@Override
@SafeVarargs
public final Builder rulesPackageArns(String... rulesPackageArns) {
rulesPackageArns(Arrays.asList(rulesPackageArns));
return this;
}
public final List getUserAttributesForFindings() {
List result = UserAttributeListCopier.copyToBuilder(this.userAttributesForFindings);
if (result instanceof SdkAutoConstructList) {
return null;
}
return result;
}
public final void setUserAttributesForFindings(Collection userAttributesForFindings) {
this.userAttributesForFindings = UserAttributeListCopier.copyFromBuilder(userAttributesForFindings);
}
@Override
public final Builder userAttributesForFindings(Collection userAttributesForFindings) {
this.userAttributesForFindings = UserAttributeListCopier.copy(userAttributesForFindings);
return this;
}
@Override
@SafeVarargs
public final Builder userAttributesForFindings(Attribute... userAttributesForFindings) {
userAttributesForFindings(Arrays.asList(userAttributesForFindings));
return this;
}
@Override
@SafeVarargs
public final Builder userAttributesForFindings(Consumer... userAttributesForFindings) {
userAttributesForFindings(Stream.of(userAttributesForFindings).map(c -> Attribute.builder().applyMutation(c).build())
.collect(Collectors.toList()));
return this;
}
public final Instant getCreatedAt() {
return createdAt;
}
public final void setCreatedAt(Instant createdAt) {
this.createdAt = createdAt;
}
@Override
public final Builder createdAt(Instant createdAt) {
this.createdAt = createdAt;
return this;
}
public final Instant getStartedAt() {
return startedAt;
}
public final void setStartedAt(Instant startedAt) {
this.startedAt = startedAt;
}
@Override
public final Builder startedAt(Instant startedAt) {
this.startedAt = startedAt;
return this;
}
public final Instant getCompletedAt() {
return completedAt;
}
public final void setCompletedAt(Instant completedAt) {
this.completedAt = completedAt;
}
@Override
public final Builder completedAt(Instant completedAt) {
this.completedAt = completedAt;
return this;
}
public final Instant getStateChangedAt() {
return stateChangedAt;
}
public final void setStateChangedAt(Instant stateChangedAt) {
this.stateChangedAt = stateChangedAt;
}
@Override
public final Builder stateChangedAt(Instant stateChangedAt) {
this.stateChangedAt = stateChangedAt;
return this;
}
public final Boolean getDataCollected() {
return dataCollected;
}
public final void setDataCollected(Boolean dataCollected) {
this.dataCollected = dataCollected;
}
@Override
public final Builder dataCollected(Boolean dataCollected) {
this.dataCollected = dataCollected;
return this;
}
public final List getStateChanges() {
List result = AssessmentRunStateChangeListCopier.copyToBuilder(this.stateChanges);
if (result instanceof SdkAutoConstructList) {
return null;
}
return result;
}
public final void setStateChanges(Collection stateChanges) {
this.stateChanges = AssessmentRunStateChangeListCopier.copyFromBuilder(stateChanges);
}
@Override
public final Builder stateChanges(Collection stateChanges) {
this.stateChanges = AssessmentRunStateChangeListCopier.copy(stateChanges);
return this;
}
@Override
@SafeVarargs
public final Builder stateChanges(AssessmentRunStateChange... stateChanges) {
stateChanges(Arrays.asList(stateChanges));
return this;
}
@Override
@SafeVarargs
public final Builder stateChanges(Consumer... stateChanges) {
stateChanges(Stream.of(stateChanges).map(c -> AssessmentRunStateChange.builder().applyMutation(c).build())
.collect(Collectors.toList()));
return this;
}
public final List getNotifications() {
List result = AssessmentRunNotificationListCopier
.copyToBuilder(this.notifications);
if (result instanceof SdkAutoConstructList) {
return null;
}
return result;
}
public final void setNotifications(Collection notifications) {
this.notifications = AssessmentRunNotificationListCopier.copyFromBuilder(notifications);
}
@Override
public final Builder notifications(Collection notifications) {
this.notifications = AssessmentRunNotificationListCopier.copy(notifications);
return this;
}
@Override
@SafeVarargs
public final Builder notifications(AssessmentRunNotification... notifications) {
notifications(Arrays.asList(notifications));
return this;
}
@Override
@SafeVarargs
public final Builder notifications(Consumer... notifications) {
notifications(Stream.of(notifications).map(c -> AssessmentRunNotification.builder().applyMutation(c).build())
.collect(Collectors.toList()));
return this;
}
public final Map getFindingCounts() {
if (findingCounts instanceof SdkAutoConstructMap) {
return null;
}
return findingCounts;
}
public final void setFindingCounts(Map findingCounts) {
this.findingCounts = AssessmentRunFindingCountsCopier.copy(findingCounts);
}
@Override
public final Builder findingCountsWithStrings(Map findingCounts) {
this.findingCounts = AssessmentRunFindingCountsCopier.copy(findingCounts);
return this;
}
@Override
public final Builder findingCounts(Map findingCounts) {
this.findingCounts = AssessmentRunFindingCountsCopier.copyEnumToString(findingCounts);
return this;
}
@Override
public AssessmentRun build() {
return new AssessmentRun(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}