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

software.amazon.awssdk.services.datapipeline.model.TaskObject Maven / Gradle / Ivy

Go to download

The AWS Java SDK for AWS Data Pipeline module holds the client classes that are used for communicating with AWS Data Pipeline Service

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.datapipeline.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;

/**
 * 

* Contains information about a pipeline task that is assigned to a task runner. *

*/ @Generated("software.amazon.awssdk:codegen") public final class TaskObject implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField TASK_ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("taskId") .getter(getter(TaskObject::taskId)).setter(setter(Builder::taskId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("taskId").build()).build(); private static final SdkField PIPELINE_ID_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("pipelineId").getter(getter(TaskObject::pipelineId)).setter(setter(Builder::pipelineId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("pipelineId").build()).build(); private static final SdkField ATTEMPT_ID_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("attemptId").getter(getter(TaskObject::attemptId)).setter(setter(Builder::attemptId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("attemptId").build()).build(); private static final SdkField> OBJECTS_FIELD = SdkField .> builder(MarshallingType.MAP) .memberName("objects") .getter(getter(TaskObject::objects)) .setter(setter(Builder::objects)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("objects").build(), MapTrait.builder() .keyLocationName("key") .valueLocationName("value") .valueFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(PipelineObject::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("value").build()).build()).build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(TASK_ID_FIELD, PIPELINE_ID_FIELD, ATTEMPT_ID_FIELD, OBJECTS_FIELD)); private static final long serialVersionUID = 1L; private final String taskId; private final String pipelineId; private final String attemptId; private final Map objects; private TaskObject(BuilderImpl builder) { this.taskId = builder.taskId; this.pipelineId = builder.pipelineId; this.attemptId = builder.attemptId; this.objects = builder.objects; } /** *

* An internal identifier for the task. This ID is passed to the SetTaskStatus and ReportTaskProgress * actions. *

* * @return An internal identifier for the task. This ID is passed to the SetTaskStatus and * ReportTaskProgress actions. */ public final String taskId() { return taskId; } /** *

* The ID of the pipeline that provided the task. *

* * @return The ID of the pipeline that provided the task. */ public final String pipelineId() { return pipelineId; } /** *

* The ID of the pipeline task attempt object. AWS Data Pipeline uses this value to track how many times a task is * attempted. *

* * @return The ID of the pipeline task attempt object. AWS Data Pipeline uses this value to track how many times a * task is attempted. */ public final String attemptId() { return attemptId; } /** * For responses, this returns true if the service returned a value for the Objects 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 hasObjects() { return objects != null && !(objects instanceof SdkAutoConstructMap); } /** *

* Connection information for the location where the task runner will publish the output of the task. *

*

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

* * @return Connection information for the location where the task runner will publish the output of the task. */ public final Map objects() { return objects; } @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(taskId()); hashCode = 31 * hashCode + Objects.hashCode(pipelineId()); hashCode = 31 * hashCode + Objects.hashCode(attemptId()); hashCode = 31 * hashCode + Objects.hashCode(hasObjects() ? objects() : 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 TaskObject)) { return false; } TaskObject other = (TaskObject) obj; return Objects.equals(taskId(), other.taskId()) && Objects.equals(pipelineId(), other.pipelineId()) && Objects.equals(attemptId(), other.attemptId()) && hasObjects() == other.hasObjects() && Objects.equals(objects(), other.objects()); } /** * 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("TaskObject").add("TaskId", taskId()).add("PipelineId", pipelineId()) .add("AttemptId", attemptId()).add("Objects", hasObjects() ? objects() : null).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "taskId": return Optional.ofNullable(clazz.cast(taskId())); case "pipelineId": return Optional.ofNullable(clazz.cast(pipelineId())); case "attemptId": return Optional.ofNullable(clazz.cast(attemptId())); case "objects": return Optional.ofNullable(clazz.cast(objects())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((TaskObject) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* An internal identifier for the task. This ID is passed to the SetTaskStatus and * ReportTaskProgress actions. *

* * @param taskId * An internal identifier for the task. This ID is passed to the SetTaskStatus and * ReportTaskProgress actions. * @return Returns a reference to this object so that method calls can be chained together. */ Builder taskId(String taskId); /** *

* The ID of the pipeline that provided the task. *

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

* The ID of the pipeline task attempt object. AWS Data Pipeline uses this value to track how many times a task * is attempted. *

* * @param attemptId * The ID of the pipeline task attempt object. AWS Data Pipeline uses this value to track how many times * a task is attempted. * @return Returns a reference to this object so that method calls can be chained together. */ Builder attemptId(String attemptId); /** *

* Connection information for the location where the task runner will publish the output of the task. *

* * @param objects * Connection information for the location where the task runner will publish the output of the task. * @return Returns a reference to this object so that method calls can be chained together. */ Builder objects(Map objects); } static final class BuilderImpl implements Builder { private String taskId; private String pipelineId; private String attemptId; private Map objects = DefaultSdkAutoConstructMap.getInstance(); private BuilderImpl() { } private BuilderImpl(TaskObject model) { taskId(model.taskId); pipelineId(model.pipelineId); attemptId(model.attemptId); objects(model.objects); } public final String getTaskId() { return taskId; } public final void setTaskId(String taskId) { this.taskId = taskId; } @Override public final Builder taskId(String taskId) { this.taskId = taskId; return this; } public final String getPipelineId() { return pipelineId; } public final void setPipelineId(String pipelineId) { this.pipelineId = pipelineId; } @Override public final Builder pipelineId(String pipelineId) { this.pipelineId = pipelineId; return this; } public final String getAttemptId() { return attemptId; } public final void setAttemptId(String attemptId) { this.attemptId = attemptId; } @Override public final Builder attemptId(String attemptId) { this.attemptId = attemptId; return this; } public final Map getObjects() { Map result = PipelineObjectMapCopier.copyToBuilder(this.objects); if (result instanceof SdkAutoConstructMap) { return null; } return result; } public final void setObjects(Map objects) { this.objects = PipelineObjectMapCopier.copyFromBuilder(objects); } @Override public final Builder objects(Map objects) { this.objects = PipelineObjectMapCopier.copy(objects); return this; } @Override public TaskObject build() { return new TaskObject(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy