software.amazon.awssdk.services.codegurusecurity.model.AccountFindingsMetric Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of codegurusecurity Show documentation
Show all versions of codegurusecurity Show documentation
The AWS Java SDK for Code Guru Security module holds the client classes that are used for
communicating with Code Guru Security.
/*
* 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.codegurusecurity.model;
import java.io.Serializable;
import java.time.Instant;
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;
/**
*
* A summary of findings metrics for an account on a specified date.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class AccountFindingsMetric implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField CLOSED_FINDINGS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("closedFindings")
.getter(getter(AccountFindingsMetric::closedFindings)).setter(setter(Builder::closedFindings))
.constructor(FindingMetricsValuePerSeverity::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("closedFindings").build()).build();
private static final SdkField DATE_FIELD = SdkField. builder(MarshallingType.INSTANT).memberName("date")
.getter(getter(AccountFindingsMetric::date)).setter(setter(Builder::date))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("date").build()).build();
private static final SdkField MEAN_TIME_TO_CLOSE_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("meanTimeToClose")
.getter(getter(AccountFindingsMetric::meanTimeToClose)).setter(setter(Builder::meanTimeToClose))
.constructor(FindingMetricsValuePerSeverity::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("meanTimeToClose").build()).build();
private static final SdkField NEW_FINDINGS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("newFindings")
.getter(getter(AccountFindingsMetric::newFindings)).setter(setter(Builder::newFindings))
.constructor(FindingMetricsValuePerSeverity::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("newFindings").build()).build();
private static final SdkField OPEN_FINDINGS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("openFindings")
.getter(getter(AccountFindingsMetric::openFindings)).setter(setter(Builder::openFindings))
.constructor(FindingMetricsValuePerSeverity::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("openFindings").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CLOSED_FINDINGS_FIELD,
DATE_FIELD, MEAN_TIME_TO_CLOSE_FIELD, NEW_FINDINGS_FIELD, OPEN_FINDINGS_FIELD));
private static final long serialVersionUID = 1L;
private final FindingMetricsValuePerSeverity closedFindings;
private final Instant date;
private final FindingMetricsValuePerSeverity meanTimeToClose;
private final FindingMetricsValuePerSeverity newFindings;
private final FindingMetricsValuePerSeverity openFindings;
private AccountFindingsMetric(BuilderImpl builder) {
this.closedFindings = builder.closedFindings;
this.date = builder.date;
this.meanTimeToClose = builder.meanTimeToClose;
this.newFindings = builder.newFindings;
this.openFindings = builder.openFindings;
}
/**
*
* The number of closed findings of each severity on the specified date.
*
*
* @return The number of closed findings of each severity on the specified date.
*/
public final FindingMetricsValuePerSeverity closedFindings() {
return closedFindings;
}
/**
*
* The date from which the findings metrics were retrieved.
*
*
* @return The date from which the findings metrics were retrieved.
*/
public final Instant date() {
return date;
}
/**
*
* The average time in days it takes to close findings of each severity as of a specified date.
*
*
* @return The average time in days it takes to close findings of each severity as of a specified date.
*/
public final FindingMetricsValuePerSeverity meanTimeToClose() {
return meanTimeToClose;
}
/**
*
* The number of new findings of each severity on the specified date.
*
*
* @return The number of new findings of each severity on the specified date.
*/
public final FindingMetricsValuePerSeverity newFindings() {
return newFindings;
}
/**
*
* The number of open findings of each severity as of the specified date.
*
*
* @return The number of open findings of each severity as of the specified date.
*/
public final FindingMetricsValuePerSeverity openFindings() {
return openFindings;
}
@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(closedFindings());
hashCode = 31 * hashCode + Objects.hashCode(date());
hashCode = 31 * hashCode + Objects.hashCode(meanTimeToClose());
hashCode = 31 * hashCode + Objects.hashCode(newFindings());
hashCode = 31 * hashCode + Objects.hashCode(openFindings());
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 AccountFindingsMetric)) {
return false;
}
AccountFindingsMetric other = (AccountFindingsMetric) obj;
return Objects.equals(closedFindings(), other.closedFindings()) && Objects.equals(date(), other.date())
&& Objects.equals(meanTimeToClose(), other.meanTimeToClose())
&& Objects.equals(newFindings(), other.newFindings()) && Objects.equals(openFindings(), other.openFindings());
}
/**
* 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("AccountFindingsMetric").add("ClosedFindings", closedFindings()).add("Date", date())
.add("MeanTimeToClose", meanTimeToClose()).add("NewFindings", newFindings()).add("OpenFindings", openFindings())
.build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "closedFindings":
return Optional.ofNullable(clazz.cast(closedFindings()));
case "date":
return Optional.ofNullable(clazz.cast(date()));
case "meanTimeToClose":
return Optional.ofNullable(clazz.cast(meanTimeToClose()));
case "newFindings":
return Optional.ofNullable(clazz.cast(newFindings()));
case "openFindings":
return Optional.ofNullable(clazz.cast(openFindings()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function