software.amazon.awssdk.services.customerprofiles.model.GetWorkflowResponse Maven / Gradle / Ivy
Show all versions of customerprofiles Show documentation
/*
* 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.customerprofiles.model;
import java.time.Instant;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
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.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;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class GetWorkflowResponse extends CustomerProfilesResponse implements
ToCopyableBuilder {
private static final SdkField WORKFLOW_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("WorkflowId").getter(getter(GetWorkflowResponse::workflowId)).setter(setter(Builder::workflowId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("WorkflowId").build()).build();
private static final SdkField WORKFLOW_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("WorkflowType").getter(getter(GetWorkflowResponse::workflowTypeAsString))
.setter(setter(Builder::workflowType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("WorkflowType").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status")
.getter(getter(GetWorkflowResponse::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build();
private static final SdkField ERROR_DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ErrorDescription").getter(getter(GetWorkflowResponse::errorDescription))
.setter(setter(Builder::errorDescription))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ErrorDescription").build()).build();
private static final SdkField START_DATE_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("StartDate").getter(getter(GetWorkflowResponse::startDate)).setter(setter(Builder::startDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StartDate").build()).build();
private static final SdkField LAST_UPDATED_AT_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("LastUpdatedAt").getter(getter(GetWorkflowResponse::lastUpdatedAt))
.setter(setter(Builder::lastUpdatedAt))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastUpdatedAt").build()).build();
private static final SdkField ATTRIBUTES_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("Attributes")
.getter(getter(GetWorkflowResponse::attributes)).setter(setter(Builder::attributes))
.constructor(WorkflowAttributes::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Attributes").build()).build();
private static final SdkField METRICS_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("Metrics").getter(getter(GetWorkflowResponse::metrics)).setter(setter(Builder::metrics))
.constructor(WorkflowMetrics::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Metrics").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(WORKFLOW_ID_FIELD,
WORKFLOW_TYPE_FIELD, STATUS_FIELD, ERROR_DESCRIPTION_FIELD, START_DATE_FIELD, LAST_UPDATED_AT_FIELD,
ATTRIBUTES_FIELD, METRICS_FIELD));
private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer();
private final String workflowId;
private final String workflowType;
private final String status;
private final String errorDescription;
private final Instant startDate;
private final Instant lastUpdatedAt;
private final WorkflowAttributes attributes;
private final WorkflowMetrics metrics;
private GetWorkflowResponse(BuilderImpl builder) {
super(builder);
this.workflowId = builder.workflowId;
this.workflowType = builder.workflowType;
this.status = builder.status;
this.errorDescription = builder.errorDescription;
this.startDate = builder.startDate;
this.lastUpdatedAt = builder.lastUpdatedAt;
this.attributes = builder.attributes;
this.metrics = builder.metrics;
}
/**
*
* Unique identifier for the workflow.
*
*
* @return Unique identifier for the workflow.
*/
public final String workflowId() {
return workflowId;
}
/**
*
* The type of workflow. The only supported value is APPFLOW_INTEGRATION.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #workflowType} will
* return {@link WorkflowType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #workflowTypeAsString}.
*
*
* @return The type of workflow. The only supported value is APPFLOW_INTEGRATION.
* @see WorkflowType
*/
public final WorkflowType workflowType() {
return WorkflowType.fromValue(workflowType);
}
/**
*
* The type of workflow. The only supported value is APPFLOW_INTEGRATION.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #workflowType} will
* return {@link WorkflowType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #workflowTypeAsString}.
*
*
* @return The type of workflow. The only supported value is APPFLOW_INTEGRATION.
* @see WorkflowType
*/
public final String workflowTypeAsString() {
return workflowType;
}
/**
*
* Status of workflow execution.
*
*
* 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 Status of workflow execution.
* @see Status
*/
public final Status status() {
return Status.fromValue(status);
}
/**
*
* Status of workflow execution.
*
*
* 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 Status of workflow execution.
* @see Status
*/
public final String statusAsString() {
return status;
}
/**
*
* Workflow error messages during execution (if any).
*
*
* @return Workflow error messages during execution (if any).
*/
public final String errorDescription() {
return errorDescription;
}
/**
*
* The timestamp that represents when workflow execution started.
*
*
* @return The timestamp that represents when workflow execution started.
*/
public final Instant startDate() {
return startDate;
}
/**
*
* The timestamp that represents when workflow execution last updated.
*
*
* @return The timestamp that represents when workflow execution last updated.
*/
public final Instant lastUpdatedAt() {
return lastUpdatedAt;
}
/**
*
* Attributes provided for workflow execution.
*
*
* @return Attributes provided for workflow execution.
*/
public final WorkflowAttributes attributes() {
return attributes;
}
/**
*
* Workflow specific execution metrics.
*
*
* @return Workflow specific execution metrics.
*/
public final WorkflowMetrics metrics() {
return metrics;
}
@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 + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(workflowId());
hashCode = 31 * hashCode + Objects.hashCode(workflowTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(errorDescription());
hashCode = 31 * hashCode + Objects.hashCode(startDate());
hashCode = 31 * hashCode + Objects.hashCode(lastUpdatedAt());
hashCode = 31 * hashCode + Objects.hashCode(attributes());
hashCode = 31 * hashCode + Objects.hashCode(metrics());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof GetWorkflowResponse)) {
return false;
}
GetWorkflowResponse other = (GetWorkflowResponse) obj;
return Objects.equals(workflowId(), other.workflowId())
&& Objects.equals(workflowTypeAsString(), other.workflowTypeAsString())
&& Objects.equals(statusAsString(), other.statusAsString())
&& Objects.equals(errorDescription(), other.errorDescription()) && Objects.equals(startDate(), other.startDate())
&& Objects.equals(lastUpdatedAt(), other.lastUpdatedAt()) && Objects.equals(attributes(), other.attributes())
&& Objects.equals(metrics(), other.metrics());
}
/**
* 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("GetWorkflowResponse").add("WorkflowId", workflowId())
.add("WorkflowType", workflowTypeAsString()).add("Status", statusAsString())
.add("ErrorDescription", errorDescription()).add("StartDate", startDate()).add("LastUpdatedAt", lastUpdatedAt())
.add("Attributes", attributes()).add("Metrics", metrics()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "WorkflowId":
return Optional.ofNullable(clazz.cast(workflowId()));
case "WorkflowType":
return Optional.ofNullable(clazz.cast(workflowTypeAsString()));
case "Status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "ErrorDescription":
return Optional.ofNullable(clazz.cast(errorDescription()));
case "StartDate":
return Optional.ofNullable(clazz.cast(startDate()));
case "LastUpdatedAt":
return Optional.ofNullable(clazz.cast(lastUpdatedAt()));
case "Attributes":
return Optional.ofNullable(clazz.cast(attributes()));
case "Metrics":
return Optional.ofNullable(clazz.cast(metrics()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Map> memberNameToFieldInitializer() {
Map> map = new HashMap<>();
map.put("WorkflowId", WORKFLOW_ID_FIELD);
map.put("WorkflowType", WORKFLOW_TYPE_FIELD);
map.put("Status", STATUS_FIELD);
map.put("ErrorDescription", ERROR_DESCRIPTION_FIELD);
map.put("StartDate", START_DATE_FIELD);
map.put("LastUpdatedAt", LAST_UPDATED_AT_FIELD);
map.put("Attributes", ATTRIBUTES_FIELD);
map.put("Metrics", METRICS_FIELD);
return Collections.unmodifiableMap(map);
}
private static Function