All Downloads are FREE. Search and download functionalities are using the official Maven repository.
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.pinpoint.model.JourneyRunExecutionMetricsResponse Maven / Gradle / Ivy
Go to download
The AWS Java SDK for Amazon Pinpoint module holds the client classes that are used for communicating
with Amazon Pinpoint Service
/*
* 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.pinpoint.model;
import java.io.Serializable;
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;
/**
*
* Provides the results of a query that retrieved the data for a standard execution metric that applies to a journey
* run, and provides information about that query.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class JourneyRunExecutionMetricsResponse implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField APPLICATION_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ApplicationId").getter(getter(JourneyRunExecutionMetricsResponse::applicationId))
.setter(setter(Builder::applicationId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ApplicationId").build()).build();
private static final SdkField JOURNEY_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("JourneyId").getter(getter(JourneyRunExecutionMetricsResponse::journeyId))
.setter(setter(Builder::journeyId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("JourneyId").build()).build();
private static final SdkField LAST_EVALUATED_TIME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("LastEvaluatedTime").getter(getter(JourneyRunExecutionMetricsResponse::lastEvaluatedTime))
.setter(setter(Builder::lastEvaluatedTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastEvaluatedTime").build()).build();
private static final SdkField> METRICS_FIELD = SdkField
.> builder(MarshallingType.MAP)
.memberName("Metrics")
.getter(getter(JourneyRunExecutionMetricsResponse::metrics))
.setter(setter(Builder::metrics))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Metrics").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 SdkField RUN_ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("RunId")
.getter(getter(JourneyRunExecutionMetricsResponse::runId)).setter(setter(Builder::runId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RunId").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(APPLICATION_ID_FIELD,
JOURNEY_ID_FIELD, LAST_EVALUATED_TIME_FIELD, METRICS_FIELD, RUN_ID_FIELD));
private static final long serialVersionUID = 1L;
private final String applicationId;
private final String journeyId;
private final String lastEvaluatedTime;
private final Map metrics;
private final String runId;
private JourneyRunExecutionMetricsResponse(BuilderImpl builder) {
this.applicationId = builder.applicationId;
this.journeyId = builder.journeyId;
this.lastEvaluatedTime = builder.lastEvaluatedTime;
this.metrics = builder.metrics;
this.runId = builder.runId;
}
/**
*
* The unique identifier for the application that the metric applies to.
*
*
* @return The unique identifier for the application that the metric applies to.
*/
public final String applicationId() {
return applicationId;
}
/**
*
* The unique identifier for the journey that the metric applies to.
*
*
* @return The unique identifier for the journey that the metric applies to.
*/
public final String journeyId() {
return journeyId;
}
/**
*
* The date and time, in ISO 8601 format, when Amazon Pinpoint last evaluated the journey run and updated the data
* for the metric.
*
*
* @return The date and time, in ISO 8601 format, when Amazon Pinpoint last evaluated the journey run and updated
* the data for the metric.
*/
public final String lastEvaluatedTime() {
return lastEvaluatedTime;
}
/**
* For responses, this returns true if the service returned a value for the Metrics 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 hasMetrics() {
return metrics != null && !(metrics instanceof SdkAutoConstructMap);
}
/**
*
* A JSON object that contains the results of the query. For information about the structure and contents of the
* results, see the Standard
* Amazon Pinpoint analytics metrics in the Amazon Pinpoint Developer Guide .
*
*
* 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 #hasMetrics} method.
*
*
* @return A JSON object that contains the results of the query. For information about the structure and contents of
* the results, see the Standard Amazon Pinpoint analytics metrics in the Amazon Pinpoint Developer Guide .
*/
public final Map metrics() {
return metrics;
}
/**
*
* The unique identifier for the journey run that the metric applies to.
*
*
* @return The unique identifier for the journey run that the metric applies to.
*/
public final String runId() {
return runId;
}
@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(applicationId());
hashCode = 31 * hashCode + Objects.hashCode(journeyId());
hashCode = 31 * hashCode + Objects.hashCode(lastEvaluatedTime());
hashCode = 31 * hashCode + Objects.hashCode(hasMetrics() ? metrics() : null);
hashCode = 31 * hashCode + Objects.hashCode(runId());
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 JourneyRunExecutionMetricsResponse)) {
return false;
}
JourneyRunExecutionMetricsResponse other = (JourneyRunExecutionMetricsResponse) obj;
return Objects.equals(applicationId(), other.applicationId()) && Objects.equals(journeyId(), other.journeyId())
&& Objects.equals(lastEvaluatedTime(), other.lastEvaluatedTime()) && hasMetrics() == other.hasMetrics()
&& Objects.equals(metrics(), other.metrics()) && Objects.equals(runId(), other.runId());
}
/**
* 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("JourneyRunExecutionMetricsResponse").add("ApplicationId", applicationId())
.add("JourneyId", journeyId()).add("LastEvaluatedTime", lastEvaluatedTime())
.add("Metrics", hasMetrics() ? metrics() : null).add("RunId", runId()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ApplicationId":
return Optional.ofNullable(clazz.cast(applicationId()));
case "JourneyId":
return Optional.ofNullable(clazz.cast(journeyId()));
case "LastEvaluatedTime":
return Optional.ofNullable(clazz.cast(lastEvaluatedTime()));
case "Metrics":
return Optional.ofNullable(clazz.cast(metrics()));
case "RunId":
return Optional.ofNullable(clazz.cast(runId()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function getter(Function g) {
return obj -> g.apply((JourneyRunExecutionMetricsResponse) obj);
}
private static BiConsumer setter(BiConsumer s) {
return (obj, val) -> s.accept((Builder) obj, val);
}
public interface Builder extends SdkPojo, CopyableBuilder {
/**
*
* The unique identifier for the application that the metric applies to.
*
*
* @param applicationId
* The unique identifier for the application that the metric applies to.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder applicationId(String applicationId);
/**
*
* The unique identifier for the journey that the metric applies to.
*
*
* @param journeyId
* The unique identifier for the journey that the metric applies to.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder journeyId(String journeyId);
/**
*
* The date and time, in ISO 8601 format, when Amazon Pinpoint last evaluated the journey run and updated the
* data for the metric.
*
*
* @param lastEvaluatedTime
* The date and time, in ISO 8601 format, when Amazon Pinpoint last evaluated the journey run and updated
* the data for the metric.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder lastEvaluatedTime(String lastEvaluatedTime);
/**
*
* A JSON object that contains the results of the query. For information about the structure and contents of the
* results, see the Standard
* Amazon Pinpoint analytics metrics in the Amazon Pinpoint Developer Guide .
*
*
* @param metrics
* A JSON object that contains the results of the query. For information about the structure and contents
* of the results, see the Standard Amazon Pinpoint analytics metrics in the Amazon Pinpoint Developer Guide .
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder metrics(Map metrics);
/**
*
* The unique identifier for the journey run that the metric applies to.
*
*
* @param runId
* The unique identifier for the journey run that the metric applies to.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder runId(String runId);
}
static final class BuilderImpl implements Builder {
private String applicationId;
private String journeyId;
private String lastEvaluatedTime;
private Map metrics = DefaultSdkAutoConstructMap.getInstance();
private String runId;
private BuilderImpl() {
}
private BuilderImpl(JourneyRunExecutionMetricsResponse model) {
applicationId(model.applicationId);
journeyId(model.journeyId);
lastEvaluatedTime(model.lastEvaluatedTime);
metrics(model.metrics);
runId(model.runId);
}
public final String getApplicationId() {
return applicationId;
}
public final void setApplicationId(String applicationId) {
this.applicationId = applicationId;
}
@Override
public final Builder applicationId(String applicationId) {
this.applicationId = applicationId;
return this;
}
public final String getJourneyId() {
return journeyId;
}
public final void setJourneyId(String journeyId) {
this.journeyId = journeyId;
}
@Override
public final Builder journeyId(String journeyId) {
this.journeyId = journeyId;
return this;
}
public final String getLastEvaluatedTime() {
return lastEvaluatedTime;
}
public final void setLastEvaluatedTime(String lastEvaluatedTime) {
this.lastEvaluatedTime = lastEvaluatedTime;
}
@Override
public final Builder lastEvaluatedTime(String lastEvaluatedTime) {
this.lastEvaluatedTime = lastEvaluatedTime;
return this;
}
public final Map getMetrics() {
if (metrics instanceof SdkAutoConstructMap) {
return null;
}
return metrics;
}
public final void setMetrics(Map metrics) {
this.metrics = MapOf__stringCopier.copy(metrics);
}
@Override
public final Builder metrics(Map metrics) {
this.metrics = MapOf__stringCopier.copy(metrics);
return this;
}
public final String getRunId() {
return runId;
}
public final void setRunId(String runId) {
this.runId = runId;
}
@Override
public final Builder runId(String runId) {
this.runId = runId;
return this;
}
@Override
public JourneyRunExecutionMetricsResponse build() {
return new JourneyRunExecutionMetricsResponse(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}