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

software.amazon.awssdk.services.applicationinsights.model.Problem Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Application Insights module holds the client classes that are used for communicating with Application Insights.

There is a newer version: 2.28.4
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.applicationinsights.model;

import java.io.Serializable;
import java.time.Instant;
import java.util.Arrays;
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.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.core.traits.MapTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
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;

/**
 * 

* Describes a problem that is detected by correlating observations. *

*/ @Generated("software.amazon.awssdk:codegen") public final class Problem implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField ID_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(Problem::id)).setter(setter(Builder::id)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Id").build()).build(); private static final SdkField TITLE_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(Problem::title)).setter(setter(Builder::title)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Title").build()).build(); private static final SdkField INSIGHTS_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(Problem::insights)).setter(setter(Builder::insights)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Insights").build()).build(); private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(Problem::statusAsString)).setter(setter(Builder::status)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build(); private static final SdkField AFFECTED_RESOURCE_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(Problem::affectedResource)).setter(setter(Builder::affectedResource)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AffectedResource").build()).build(); private static final SdkField START_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT) .getter(getter(Problem::startTime)).setter(setter(Builder::startTime)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StartTime").build()).build(); private static final SdkField END_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT) .getter(getter(Problem::endTime)).setter(setter(Builder::endTime)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EndTime").build()).build(); private static final SdkField SEVERITY_LEVEL_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(Problem::severityLevelAsString)).setter(setter(Builder::severityLevel)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SeverityLevel").build()).build(); private static final SdkField RESOURCE_GROUP_NAME_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(Problem::resourceGroupName)).setter(setter(Builder::resourceGroupName)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResourceGroupName").build()).build(); private static final SdkField> FEEDBACK_FIELD = SdkField .> builder(MarshallingType.MAP) .getter(getter(Problem::feedbackAsStrings)) .setter(setter(Builder::feedbackWithStrings)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Feedback").build(), MapTrait.builder() .keyLocationName("key") .valueLocationName("value") .valueFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("value").build()).build()).build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ID_FIELD, TITLE_FIELD, INSIGHTS_FIELD, STATUS_FIELD, AFFECTED_RESOURCE_FIELD, START_TIME_FIELD, END_TIME_FIELD, SEVERITY_LEVEL_FIELD, RESOURCE_GROUP_NAME_FIELD, FEEDBACK_FIELD)); private static final long serialVersionUID = 1L; private final String id; private final String title; private final String insights; private final String status; private final String affectedResource; private final Instant startTime; private final Instant endTime; private final String severityLevel; private final String resourceGroupName; private final Map feedback; private Problem(BuilderImpl builder) { this.id = builder.id; this.title = builder.title; this.insights = builder.insights; this.status = builder.status; this.affectedResource = builder.affectedResource; this.startTime = builder.startTime; this.endTime = builder.endTime; this.severityLevel = builder.severityLevel; this.resourceGroupName = builder.resourceGroupName; this.feedback = builder.feedback; } /** *

* The ID of the problem. *

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

* The name of the problem. *

* * @return The name of the problem. */ public String title() { return title; } /** *

* A detailed analysis of the problem using machine learning. *

* * @return A detailed analysis of the problem using machine learning. */ public String insights() { return insights; } /** *

* The status of the problem. *

*

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

* * @return The status of the problem. * @see Status */ public Status status() { return Status.fromValue(status); } /** *

* The status of the problem. *

*

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

* * @return The status of the problem. * @see Status */ public String statusAsString() { return status; } /** *

* The resource affected by the problem. *

* * @return The resource affected by the problem. */ public String affectedResource() { return affectedResource; } /** *

* The time when the problem started, in epoch seconds. *

* * @return The time when the problem started, in epoch seconds. */ public Instant startTime() { return startTime; } /** *

* The time when the problem ended, in epoch seconds. *

* * @return The time when the problem ended, in epoch seconds. */ public Instant endTime() { return endTime; } /** *

* A measure of the level of impact of the problem. *

*

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

* * @return A measure of the level of impact of the problem. * @see SeverityLevel */ public SeverityLevel severityLevel() { return SeverityLevel.fromValue(severityLevel); } /** *

* A measure of the level of impact of the problem. *

*

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

* * @return A measure of the level of impact of the problem. * @see SeverityLevel */ public String severityLevelAsString() { return severityLevel; } /** *

* The name of the resource group affected by the problem. *

* * @return The name of the resource group affected by the problem. */ public String resourceGroupName() { return resourceGroupName; } /** *

* Feedback provided by the user about the problem. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* You can use {@link #hasFeedback()} to see if a value was sent in this field. *

* * @return Feedback provided by the user about the problem. */ public Map feedback() { return FeedbackCopier.copyStringToEnum(feedback); } /** * Returns true if the Feedback property was specified by the sender (it may be empty), or false if the sender did * not specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service. */ public boolean hasFeedback() { return feedback != null && !(feedback instanceof SdkAutoConstructMap); } /** *

* Feedback provided by the user about the problem. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* You can use {@link #hasFeedback()} to see if a value was sent in this field. *

* * @return Feedback provided by the user about the problem. */ public Map feedbackAsStrings() { return feedback; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(id()); hashCode = 31 * hashCode + Objects.hashCode(title()); hashCode = 31 * hashCode + Objects.hashCode(insights()); hashCode = 31 * hashCode + Objects.hashCode(statusAsString()); hashCode = 31 * hashCode + Objects.hashCode(affectedResource()); hashCode = 31 * hashCode + Objects.hashCode(startTime()); hashCode = 31 * hashCode + Objects.hashCode(endTime()); hashCode = 31 * hashCode + Objects.hashCode(severityLevelAsString()); hashCode = 31 * hashCode + Objects.hashCode(resourceGroupName()); hashCode = 31 * hashCode + Objects.hashCode(feedbackAsStrings()); return hashCode; } @Override public boolean equals(Object obj) { return equalsBySdkFields(obj); } @Override public boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Problem)) { return false; } Problem other = (Problem) obj; return Objects.equals(id(), other.id()) && Objects.equals(title(), other.title()) && Objects.equals(insights(), other.insights()) && Objects.equals(statusAsString(), other.statusAsString()) && Objects.equals(affectedResource(), other.affectedResource()) && Objects.equals(startTime(), other.startTime()) && Objects.equals(endTime(), other.endTime()) && Objects.equals(severityLevelAsString(), other.severityLevelAsString()) && Objects.equals(resourceGroupName(), other.resourceGroupName()) && Objects.equals(feedbackAsStrings(), other.feedbackAsStrings()); } /** * 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 String toString() { return ToString.builder("Problem").add("Id", id()).add("Title", title()).add("Insights", insights()) .add("Status", statusAsString()).add("AffectedResource", affectedResource()).add("StartTime", startTime()) .add("EndTime", endTime()).add("SeverityLevel", severityLevelAsString()) .add("ResourceGroupName", resourceGroupName()).add("Feedback", feedbackAsStrings()).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Id": return Optional.ofNullable(clazz.cast(id())); case "Title": return Optional.ofNullable(clazz.cast(title())); case "Insights": return Optional.ofNullable(clazz.cast(insights())); case "Status": return Optional.ofNullable(clazz.cast(statusAsString())); case "AffectedResource": return Optional.ofNullable(clazz.cast(affectedResource())); case "StartTime": return Optional.ofNullable(clazz.cast(startTime())); case "EndTime": return Optional.ofNullable(clazz.cast(endTime())); case "SeverityLevel": return Optional.ofNullable(clazz.cast(severityLevelAsString())); case "ResourceGroupName": return Optional.ofNullable(clazz.cast(resourceGroupName())); case "Feedback": return Optional.ofNullable(clazz.cast(feedbackAsStrings())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((Problem) 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 problem. *

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

* The name of the problem. *

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

* A detailed analysis of the problem using machine learning. *

* * @param insights * A detailed analysis of the problem using machine learning. * @return Returns a reference to this object so that method calls can be chained together. */ Builder insights(String insights); /** *

* The status of the problem. *

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

* The status of the problem. *

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

* The resource affected by the problem. *

* * @param affectedResource * The resource affected by the problem. * @return Returns a reference to this object so that method calls can be chained together. */ Builder affectedResource(String affectedResource); /** *

* The time when the problem started, in epoch seconds. *

* * @param startTime * The time when the problem started, in epoch seconds. * @return Returns a reference to this object so that method calls can be chained together. */ Builder startTime(Instant startTime); /** *

* The time when the problem ended, in epoch seconds. *

* * @param endTime * The time when the problem ended, in epoch seconds. * @return Returns a reference to this object so that method calls can be chained together. */ Builder endTime(Instant endTime); /** *

* A measure of the level of impact of the problem. *

* * @param severityLevel * A measure of the level of impact of the problem. * @see SeverityLevel * @return Returns a reference to this object so that method calls can be chained together. * @see SeverityLevel */ Builder severityLevel(String severityLevel); /** *

* A measure of the level of impact of the problem. *

* * @param severityLevel * A measure of the level of impact of the problem. * @see SeverityLevel * @return Returns a reference to this object so that method calls can be chained together. * @see SeverityLevel */ Builder severityLevel(SeverityLevel severityLevel); /** *

* The name of the resource group affected by the problem. *

* * @param resourceGroupName * The name of the resource group affected by the problem. * @return Returns a reference to this object so that method calls can be chained together. */ Builder resourceGroupName(String resourceGroupName); /** *

* Feedback provided by the user about the problem. *

* * @param feedback * Feedback provided by the user about the problem. * @return Returns a reference to this object so that method calls can be chained together. */ Builder feedbackWithStrings(Map feedback); /** *

* Feedback provided by the user about the problem. *

* * @param feedback * Feedback provided by the user about the problem. * @return Returns a reference to this object so that method calls can be chained together. */ Builder feedback(Map feedback); } static final class BuilderImpl implements Builder { private String id; private String title; private String insights; private String status; private String affectedResource; private Instant startTime; private Instant endTime; private String severityLevel; private String resourceGroupName; private Map feedback = DefaultSdkAutoConstructMap.getInstance(); private BuilderImpl() { } private BuilderImpl(Problem model) { id(model.id); title(model.title); insights(model.insights); status(model.status); affectedResource(model.affectedResource); startTime(model.startTime); endTime(model.endTime); severityLevel(model.severityLevel); resourceGroupName(model.resourceGroupName); feedbackWithStrings(model.feedback); } public final String getId() { return id; } @Override public final Builder id(String id) { this.id = id; return this; } public final void setId(String id) { this.id = id; } public final String getTitle() { return title; } @Override public final Builder title(String title) { this.title = title; return this; } public final void setTitle(String title) { this.title = title; } public final String getInsights() { return insights; } @Override public final Builder insights(String insights) { this.insights = insights; return this; } public final void setInsights(String insights) { this.insights = insights; } public final String getStatus() { return status; } @Override public final Builder status(String status) { this.status = status; return this; } @Override public final Builder status(Status status) { this.status(status == null ? null : status.toString()); return this; } public final void setStatus(String status) { this.status = status; } public final String getAffectedResource() { return affectedResource; } @Override public final Builder affectedResource(String affectedResource) { this.affectedResource = affectedResource; return this; } public final void setAffectedResource(String affectedResource) { this.affectedResource = affectedResource; } public final Instant getStartTime() { return startTime; } @Override public final Builder startTime(Instant startTime) { this.startTime = startTime; return this; } public final void setStartTime(Instant startTime) { this.startTime = startTime; } public final Instant getEndTime() { return endTime; } @Override public final Builder endTime(Instant endTime) { this.endTime = endTime; return this; } public final void setEndTime(Instant endTime) { this.endTime = endTime; } public final String getSeverityLevel() { return severityLevel; } @Override public final Builder severityLevel(String severityLevel) { this.severityLevel = severityLevel; return this; } @Override public final Builder severityLevel(SeverityLevel severityLevel) { this.severityLevel(severityLevel == null ? null : severityLevel.toString()); return this; } public final void setSeverityLevel(String severityLevel) { this.severityLevel = severityLevel; } public final String getResourceGroupName() { return resourceGroupName; } @Override public final Builder resourceGroupName(String resourceGroupName) { this.resourceGroupName = resourceGroupName; return this; } public final void setResourceGroupName(String resourceGroupName) { this.resourceGroupName = resourceGroupName; } public final Map getFeedback() { return feedback; } @Override public final Builder feedbackWithStrings(Map feedback) { this.feedback = FeedbackCopier.copy(feedback); return this; } @Override public final Builder feedback(Map feedback) { this.feedback = FeedbackCopier.copyEnumToString(feedback); return this; } public final void setFeedback(Map feedback) { this.feedback = FeedbackCopier.copy(feedback); } @Override public Problem build() { return new Problem(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy