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

software.amazon.awssdk.services.codegurusecurity.model.AccountFindingsMetric Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Code Guru Security module holds the client classes that are used for communicating with Code Guru Security.

There is a newer version: 2.29.15
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.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 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 getter(Function g) { return obj -> g.apply((AccountFindingsMetric) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The number of closed findings of each severity on the specified date. *

* * @param closedFindings * The number of closed findings of each severity on the specified date. * @return Returns a reference to this object so that method calls can be chained together. */ Builder closedFindings(FindingMetricsValuePerSeverity closedFindings); /** *

* The number of closed findings of each severity on the specified date. *

* This is a convenience method that creates an instance of the {@link FindingMetricsValuePerSeverity.Builder} * avoiding the need to create one manually via {@link FindingMetricsValuePerSeverity#builder()}. * *

* When the {@link Consumer} completes, {@link FindingMetricsValuePerSeverity.Builder#build()} is called * immediately and its result is passed to {@link #closedFindings(FindingMetricsValuePerSeverity)}. * * @param closedFindings * a consumer that will call methods on {@link FindingMetricsValuePerSeverity.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #closedFindings(FindingMetricsValuePerSeverity) */ default Builder closedFindings(Consumer closedFindings) { return closedFindings(FindingMetricsValuePerSeverity.builder().applyMutation(closedFindings).build()); } /** *

* The date from which the findings metrics were retrieved. *

* * @param date * The date from which the findings metrics were retrieved. * @return Returns a reference to this object so that method calls can be chained together. */ Builder date(Instant date); /** *

* The average time in days it takes to close findings of each severity as of a specified date. *

* * @param meanTimeToClose * The average time in days it takes to close findings of each severity as of a specified date. * @return Returns a reference to this object so that method calls can be chained together. */ Builder meanTimeToClose(FindingMetricsValuePerSeverity meanTimeToClose); /** *

* The average time in days it takes to close findings of each severity as of a specified date. *

* This is a convenience method that creates an instance of the {@link FindingMetricsValuePerSeverity.Builder} * avoiding the need to create one manually via {@link FindingMetricsValuePerSeverity#builder()}. * *

* When the {@link Consumer} completes, {@link FindingMetricsValuePerSeverity.Builder#build()} is called * immediately and its result is passed to {@link #meanTimeToClose(FindingMetricsValuePerSeverity)}. * * @param meanTimeToClose * a consumer that will call methods on {@link FindingMetricsValuePerSeverity.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #meanTimeToClose(FindingMetricsValuePerSeverity) */ default Builder meanTimeToClose(Consumer meanTimeToClose) { return meanTimeToClose(FindingMetricsValuePerSeverity.builder().applyMutation(meanTimeToClose).build()); } /** *

* The number of new findings of each severity on the specified date. *

* * @param newFindings * The number of new findings of each severity on the specified date. * @return Returns a reference to this object so that method calls can be chained together. */ Builder newFindings(FindingMetricsValuePerSeverity newFindings); /** *

* The number of new findings of each severity on the specified date. *

* This is a convenience method that creates an instance of the {@link FindingMetricsValuePerSeverity.Builder} * avoiding the need to create one manually via {@link FindingMetricsValuePerSeverity#builder()}. * *

* When the {@link Consumer} completes, {@link FindingMetricsValuePerSeverity.Builder#build()} is called * immediately and its result is passed to {@link #newFindings(FindingMetricsValuePerSeverity)}. * * @param newFindings * a consumer that will call methods on {@link FindingMetricsValuePerSeverity.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #newFindings(FindingMetricsValuePerSeverity) */ default Builder newFindings(Consumer newFindings) { return newFindings(FindingMetricsValuePerSeverity.builder().applyMutation(newFindings).build()); } /** *

* The number of open findings of each severity as of the specified date. *

* * @param openFindings * The number of open findings of each severity as of the specified date. * @return Returns a reference to this object so that method calls can be chained together. */ Builder openFindings(FindingMetricsValuePerSeverity openFindings); /** *

* The number of open findings of each severity as of the specified date. *

* This is a convenience method that creates an instance of the {@link FindingMetricsValuePerSeverity.Builder} * avoiding the need to create one manually via {@link FindingMetricsValuePerSeverity#builder()}. * *

* When the {@link Consumer} completes, {@link FindingMetricsValuePerSeverity.Builder#build()} is called * immediately and its result is passed to {@link #openFindings(FindingMetricsValuePerSeverity)}. * * @param openFindings * a consumer that will call methods on {@link FindingMetricsValuePerSeverity.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #openFindings(FindingMetricsValuePerSeverity) */ default Builder openFindings(Consumer openFindings) { return openFindings(FindingMetricsValuePerSeverity.builder().applyMutation(openFindings).build()); } } static final class BuilderImpl implements Builder { private FindingMetricsValuePerSeverity closedFindings; private Instant date; private FindingMetricsValuePerSeverity meanTimeToClose; private FindingMetricsValuePerSeverity newFindings; private FindingMetricsValuePerSeverity openFindings; private BuilderImpl() { } private BuilderImpl(AccountFindingsMetric model) { closedFindings(model.closedFindings); date(model.date); meanTimeToClose(model.meanTimeToClose); newFindings(model.newFindings); openFindings(model.openFindings); } public final FindingMetricsValuePerSeverity.Builder getClosedFindings() { return closedFindings != null ? closedFindings.toBuilder() : null; } public final void setClosedFindings(FindingMetricsValuePerSeverity.BuilderImpl closedFindings) { this.closedFindings = closedFindings != null ? closedFindings.build() : null; } @Override public final Builder closedFindings(FindingMetricsValuePerSeverity closedFindings) { this.closedFindings = closedFindings; return this; } public final Instant getDate() { return date; } public final void setDate(Instant date) { this.date = date; } @Override public final Builder date(Instant date) { this.date = date; return this; } public final FindingMetricsValuePerSeverity.Builder getMeanTimeToClose() { return meanTimeToClose != null ? meanTimeToClose.toBuilder() : null; } public final void setMeanTimeToClose(FindingMetricsValuePerSeverity.BuilderImpl meanTimeToClose) { this.meanTimeToClose = meanTimeToClose != null ? meanTimeToClose.build() : null; } @Override public final Builder meanTimeToClose(FindingMetricsValuePerSeverity meanTimeToClose) { this.meanTimeToClose = meanTimeToClose; return this; } public final FindingMetricsValuePerSeverity.Builder getNewFindings() { return newFindings != null ? newFindings.toBuilder() : null; } public final void setNewFindings(FindingMetricsValuePerSeverity.BuilderImpl newFindings) { this.newFindings = newFindings != null ? newFindings.build() : null; } @Override public final Builder newFindings(FindingMetricsValuePerSeverity newFindings) { this.newFindings = newFindings; return this; } public final FindingMetricsValuePerSeverity.Builder getOpenFindings() { return openFindings != null ? openFindings.toBuilder() : null; } public final void setOpenFindings(FindingMetricsValuePerSeverity.BuilderImpl openFindings) { this.openFindings = openFindings != null ? openFindings.build() : null; } @Override public final Builder openFindings(FindingMetricsValuePerSeverity openFindings) { this.openFindings = openFindings; return this; } @Override public AccountFindingsMetric build() { return new AccountFindingsMetric(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy