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

software.amazon.awssdk.services.devopsguru.model.ProactiveInsightSummary 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.devopsguru.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 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;

/**
 * 

* Details about a proactive insight. This object is returned by DescribeInsight. *

*/ @Generated("software.amazon.awssdk:codegen") public final class ProactiveInsightSummary implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Id") .getter(getter(ProactiveInsightSummary::id)).setter(setter(Builder::id)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Id").build()).build(); private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Name") .getter(getter(ProactiveInsightSummary::name)).setter(setter(Builder::name)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name").build()).build(); private static final SdkField SEVERITY_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("Severity").getter(getter(ProactiveInsightSummary::severityAsString)).setter(setter(Builder::severity)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Severity").build()).build(); private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status") .getter(getter(ProactiveInsightSummary::statusAsString)).setter(setter(Builder::status)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build(); private static final SdkField INSIGHT_TIME_RANGE_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("InsightTimeRange") .getter(getter(ProactiveInsightSummary::insightTimeRange)).setter(setter(Builder::insightTimeRange)) .constructor(InsightTimeRange::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InsightTimeRange").build()).build(); private static final SdkField PREDICTION_TIME_RANGE_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("PredictionTimeRange") .getter(getter(ProactiveInsightSummary::predictionTimeRange)).setter(setter(Builder::predictionTimeRange)) .constructor(PredictionTimeRange::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PredictionTimeRange").build()) .build(); private static final SdkField RESOURCE_COLLECTION_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("ResourceCollection") .getter(getter(ProactiveInsightSummary::resourceCollection)).setter(setter(Builder::resourceCollection)) .constructor(ResourceCollection::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResourceCollection").build()) .build(); private static final SdkField SERVICE_COLLECTION_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("ServiceCollection") .getter(getter(ProactiveInsightSummary::serviceCollection)).setter(setter(Builder::serviceCollection)) .constructor(ServiceCollection::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ServiceCollection").build()).build(); private static final SdkField> ASSOCIATED_RESOURCE_ARNS_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("AssociatedResourceArns") .getter(getter(ProactiveInsightSummary::associatedResourceArns)) .setter(setter(Builder::associatedResourceArns)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AssociatedResourceArns").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 List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ID_FIELD, NAME_FIELD, SEVERITY_FIELD, STATUS_FIELD, INSIGHT_TIME_RANGE_FIELD, PREDICTION_TIME_RANGE_FIELD, RESOURCE_COLLECTION_FIELD, SERVICE_COLLECTION_FIELD, ASSOCIATED_RESOURCE_ARNS_FIELD)); private static final long serialVersionUID = 1L; private final String id; private final String name; private final String severity; private final String status; private final InsightTimeRange insightTimeRange; private final PredictionTimeRange predictionTimeRange; private final ResourceCollection resourceCollection; private final ServiceCollection serviceCollection; private final List associatedResourceArns; private ProactiveInsightSummary(BuilderImpl builder) { this.id = builder.id; this.name = builder.name; this.severity = builder.severity; this.status = builder.status; this.insightTimeRange = builder.insightTimeRange; this.predictionTimeRange = builder.predictionTimeRange; this.resourceCollection = builder.resourceCollection; this.serviceCollection = builder.serviceCollection; this.associatedResourceArns = builder.associatedResourceArns; } /** *

* The ID of the proactive insight. *

* * @return The ID of the proactive insight. */ public final String id() { return id; } /** *

* The name of the proactive insight. *

* * @return The name of the proactive insight. */ public final String name() { return name; } /** *

* The severity of the insight. For more information, see Understanding insight severities in the Amazon DevOps Guru User Guide. *

*

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

* * @return The severity of the insight. For more information, see Understanding insight severities in the Amazon DevOps Guru User Guide. * @see InsightSeverity */ public final InsightSeverity severity() { return InsightSeverity.fromValue(severity); } /** *

* The severity of the insight. For more information, see Understanding insight severities in the Amazon DevOps Guru User Guide. *

*

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

* * @return The severity of the insight. For more information, see Understanding insight severities in the Amazon DevOps Guru User Guide. * @see InsightSeverity */ public final String severityAsString() { return severity; } /** *

* The status of the proactive insight. *

*

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

* * @return The status of the proactive insight. * @see InsightStatus */ public final InsightStatus status() { return InsightStatus.fromValue(status); } /** *

* The status of the proactive insight. *

*

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

* * @return The status of the proactive insight. * @see InsightStatus */ public final String statusAsString() { return status; } /** * Returns the value of the InsightTimeRange property for this object. * * @return The value of the InsightTimeRange property for this object. */ public final InsightTimeRange insightTimeRange() { return insightTimeRange; } /** * Returns the value of the PredictionTimeRange property for this object. * * @return The value of the PredictionTimeRange property for this object. */ public final PredictionTimeRange predictionTimeRange() { return predictionTimeRange; } /** * Returns the value of the ResourceCollection property for this object. * * @return The value of the ResourceCollection property for this object. */ public final ResourceCollection resourceCollection() { return resourceCollection; } /** *

* A collection of the names of Amazon Web Services services. *

* * @return A collection of the names of Amazon Web Services services. */ public final ServiceCollection serviceCollection() { return serviceCollection; } /** * For responses, this returns true if the service returned a value for the AssociatedResourceArns 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 hasAssociatedResourceArns() { return associatedResourceArns != null && !(associatedResourceArns instanceof SdkAutoConstructList); } /** *

* The Amazon Resource Names (ARNs) of the Amazon Web Services resources that generated this insight. *

*

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

* * @return The Amazon Resource Names (ARNs) of the Amazon Web Services resources that generated this insight. */ public final List associatedResourceArns() { return associatedResourceArns; } @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(id()); hashCode = 31 * hashCode + Objects.hashCode(name()); hashCode = 31 * hashCode + Objects.hashCode(severityAsString()); hashCode = 31 * hashCode + Objects.hashCode(statusAsString()); hashCode = 31 * hashCode + Objects.hashCode(insightTimeRange()); hashCode = 31 * hashCode + Objects.hashCode(predictionTimeRange()); hashCode = 31 * hashCode + Objects.hashCode(resourceCollection()); hashCode = 31 * hashCode + Objects.hashCode(serviceCollection()); hashCode = 31 * hashCode + Objects.hashCode(hasAssociatedResourceArns() ? associatedResourceArns() : 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 ProactiveInsightSummary)) { return false; } ProactiveInsightSummary other = (ProactiveInsightSummary) obj; return Objects.equals(id(), other.id()) && Objects.equals(name(), other.name()) && Objects.equals(severityAsString(), other.severityAsString()) && Objects.equals(statusAsString(), other.statusAsString()) && Objects.equals(insightTimeRange(), other.insightTimeRange()) && Objects.equals(predictionTimeRange(), other.predictionTimeRange()) && Objects.equals(resourceCollection(), other.resourceCollection()) && Objects.equals(serviceCollection(), other.serviceCollection()) && hasAssociatedResourceArns() == other.hasAssociatedResourceArns() && Objects.equals(associatedResourceArns(), other.associatedResourceArns()); } /** * 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("ProactiveInsightSummary").add("Id", id()).add("Name", name()) .add("Severity", severityAsString()).add("Status", statusAsString()).add("InsightTimeRange", insightTimeRange()) .add("PredictionTimeRange", predictionTimeRange()).add("ResourceCollection", resourceCollection()) .add("ServiceCollection", serviceCollection()) .add("AssociatedResourceArns", hasAssociatedResourceArns() ? associatedResourceArns() : null).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Id": return Optional.ofNullable(clazz.cast(id())); case "Name": return Optional.ofNullable(clazz.cast(name())); case "Severity": return Optional.ofNullable(clazz.cast(severityAsString())); case "Status": return Optional.ofNullable(clazz.cast(statusAsString())); case "InsightTimeRange": return Optional.ofNullable(clazz.cast(insightTimeRange())); case "PredictionTimeRange": return Optional.ofNullable(clazz.cast(predictionTimeRange())); case "ResourceCollection": return Optional.ofNullable(clazz.cast(resourceCollection())); case "ServiceCollection": return Optional.ofNullable(clazz.cast(serviceCollection())); case "AssociatedResourceArns": return Optional.ofNullable(clazz.cast(associatedResourceArns())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((ProactiveInsightSummary) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The ID of the proactive insight. *

* * @param id * The ID of the proactive insight. * @return Returns a reference to this object so that method calls can be chained together. */ Builder id(String id); /** *

* The name of the proactive insight. *

* * @param name * The name of the proactive insight. * @return Returns a reference to this object so that method calls can be chained together. */ Builder name(String name); /** *

* The severity of the insight. For more information, see Understanding insight severities in the Amazon DevOps Guru User Guide. *

* * @param severity * The severity of the insight. For more information, see Understanding insight severities in the Amazon DevOps Guru User Guide. * @see InsightSeverity * @return Returns a reference to this object so that method calls can be chained together. * @see InsightSeverity */ Builder severity(String severity); /** *

* The severity of the insight. For more information, see Understanding insight severities in the Amazon DevOps Guru User Guide. *

* * @param severity * The severity of the insight. For more information, see Understanding insight severities in the Amazon DevOps Guru User Guide. * @see InsightSeverity * @return Returns a reference to this object so that method calls can be chained together. * @see InsightSeverity */ Builder severity(InsightSeverity severity); /** *

* The status of the proactive insight. *

* * @param status * The status of the proactive insight. * @see InsightStatus * @return Returns a reference to this object so that method calls can be chained together. * @see InsightStatus */ Builder status(String status); /** *

* The status of the proactive insight. *

* * @param status * The status of the proactive insight. * @see InsightStatus * @return Returns a reference to this object so that method calls can be chained together. * @see InsightStatus */ Builder status(InsightStatus status); /** * Sets the value of the InsightTimeRange property for this object. * * @param insightTimeRange * The new value for the InsightTimeRange property for this object. * @return Returns a reference to this object so that method calls can be chained together. */ Builder insightTimeRange(InsightTimeRange insightTimeRange); /** * Sets the value of the InsightTimeRange property for this object. * * This is a convenience method that creates an instance of the {@link InsightTimeRange.Builder} avoiding the * need to create one manually via {@link InsightTimeRange#builder()}. * *

* When the {@link Consumer} completes, {@link InsightTimeRange.Builder#build()} is called immediately and its * result is passed to {@link #insightTimeRange(InsightTimeRange)}. * * @param insightTimeRange * a consumer that will call methods on {@link InsightTimeRange.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #insightTimeRange(InsightTimeRange) */ default Builder insightTimeRange(Consumer insightTimeRange) { return insightTimeRange(InsightTimeRange.builder().applyMutation(insightTimeRange).build()); } /** * Sets the value of the PredictionTimeRange property for this object. * * @param predictionTimeRange * The new value for the PredictionTimeRange property for this object. * @return Returns a reference to this object so that method calls can be chained together. */ Builder predictionTimeRange(PredictionTimeRange predictionTimeRange); /** * Sets the value of the PredictionTimeRange property for this object. * * This is a convenience method that creates an instance of the {@link PredictionTimeRange.Builder} avoiding the * need to create one manually via {@link PredictionTimeRange#builder()}. * *

* When the {@link Consumer} completes, {@link PredictionTimeRange.Builder#build()} is called immediately and * its result is passed to {@link #predictionTimeRange(PredictionTimeRange)}. * * @param predictionTimeRange * a consumer that will call methods on {@link PredictionTimeRange.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #predictionTimeRange(PredictionTimeRange) */ default Builder predictionTimeRange(Consumer predictionTimeRange) { return predictionTimeRange(PredictionTimeRange.builder().applyMutation(predictionTimeRange).build()); } /** * Sets the value of the ResourceCollection property for this object. * * @param resourceCollection * The new value for the ResourceCollection property for this object. * @return Returns a reference to this object so that method calls can be chained together. */ Builder resourceCollection(ResourceCollection resourceCollection); /** * Sets the value of the ResourceCollection property for this object. * * This is a convenience method that creates an instance of the {@link ResourceCollection.Builder} avoiding the * need to create one manually via {@link ResourceCollection#builder()}. * *

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

* A collection of the names of Amazon Web Services services. *

* * @param serviceCollection * A collection of the names of Amazon Web Services services. * @return Returns a reference to this object so that method calls can be chained together. */ Builder serviceCollection(ServiceCollection serviceCollection); /** *

* A collection of the names of Amazon Web Services services. *

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

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

* The Amazon Resource Names (ARNs) of the Amazon Web Services resources that generated this insight. *

* * @param associatedResourceArns * The Amazon Resource Names (ARNs) of the Amazon Web Services resources that generated this insight. * @return Returns a reference to this object so that method calls can be chained together. */ Builder associatedResourceArns(Collection associatedResourceArns); /** *

* The Amazon Resource Names (ARNs) of the Amazon Web Services resources that generated this insight. *

* * @param associatedResourceArns * The Amazon Resource Names (ARNs) of the Amazon Web Services resources that generated this insight. * @return Returns a reference to this object so that method calls can be chained together. */ Builder associatedResourceArns(String... associatedResourceArns); } static final class BuilderImpl implements Builder { private String id; private String name; private String severity; private String status; private InsightTimeRange insightTimeRange; private PredictionTimeRange predictionTimeRange; private ResourceCollection resourceCollection; private ServiceCollection serviceCollection; private List associatedResourceArns = DefaultSdkAutoConstructList.getInstance(); private BuilderImpl() { } private BuilderImpl(ProactiveInsightSummary model) { id(model.id); name(model.name); severity(model.severity); status(model.status); insightTimeRange(model.insightTimeRange); predictionTimeRange(model.predictionTimeRange); resourceCollection(model.resourceCollection); serviceCollection(model.serviceCollection); associatedResourceArns(model.associatedResourceArns); } public final String getId() { return id; } public final void setId(String id) { this.id = id; } @Override public final Builder id(String id) { this.id = id; 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 getSeverity() { return severity; } public final void setSeverity(String severity) { this.severity = severity; } @Override public final Builder severity(String severity) { this.severity = severity; return this; } @Override public final Builder severity(InsightSeverity severity) { this.severity(severity == null ? null : severity.toString()); return this; } public final String getStatus() { return status; } public final void setStatus(String status) { this.status = status; } @Override public final Builder status(String status) { this.status = status; return this; } @Override public final Builder status(InsightStatus status) { this.status(status == null ? null : status.toString()); return this; } public final InsightTimeRange.Builder getInsightTimeRange() { return insightTimeRange != null ? insightTimeRange.toBuilder() : null; } public final void setInsightTimeRange(InsightTimeRange.BuilderImpl insightTimeRange) { this.insightTimeRange = insightTimeRange != null ? insightTimeRange.build() : null; } @Override public final Builder insightTimeRange(InsightTimeRange insightTimeRange) { this.insightTimeRange = insightTimeRange; return this; } public final PredictionTimeRange.Builder getPredictionTimeRange() { return predictionTimeRange != null ? predictionTimeRange.toBuilder() : null; } public final void setPredictionTimeRange(PredictionTimeRange.BuilderImpl predictionTimeRange) { this.predictionTimeRange = predictionTimeRange != null ? predictionTimeRange.build() : null; } @Override public final Builder predictionTimeRange(PredictionTimeRange predictionTimeRange) { this.predictionTimeRange = predictionTimeRange; return this; } public final ResourceCollection.Builder getResourceCollection() { return resourceCollection != null ? resourceCollection.toBuilder() : null; } public final void setResourceCollection(ResourceCollection.BuilderImpl resourceCollection) { this.resourceCollection = resourceCollection != null ? resourceCollection.build() : null; } @Override public final Builder resourceCollection(ResourceCollection resourceCollection) { this.resourceCollection = resourceCollection; return this; } public final ServiceCollection.Builder getServiceCollection() { return serviceCollection != null ? serviceCollection.toBuilder() : null; } public final void setServiceCollection(ServiceCollection.BuilderImpl serviceCollection) { this.serviceCollection = serviceCollection != null ? serviceCollection.build() : null; } @Override public final Builder serviceCollection(ServiceCollection serviceCollection) { this.serviceCollection = serviceCollection; return this; } public final Collection getAssociatedResourceArns() { if (associatedResourceArns instanceof SdkAutoConstructList) { return null; } return associatedResourceArns; } public final void setAssociatedResourceArns(Collection associatedResourceArns) { this.associatedResourceArns = AssociatedResourceArnsCopier.copy(associatedResourceArns); } @Override public final Builder associatedResourceArns(Collection associatedResourceArns) { this.associatedResourceArns = AssociatedResourceArnsCopier.copy(associatedResourceArns); return this; } @Override @SafeVarargs public final Builder associatedResourceArns(String... associatedResourceArns) { associatedResourceArns(Arrays.asList(associatedResourceArns)); return this; } @Override public ProactiveInsightSummary build() { return new ProactiveInsightSummary(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy