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.snowdevicemanagement.model.TaskSummary Maven / Gradle / Ivy
Go to download
The AWS Java SDK for Snow Device Management module holds the client classes that are used for
communicating with Snow Device Management.
/*
* 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.snowdevicemanagement.model;
import java.io.Serializable;
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.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;
/**
*
* Information about the task assigned to one or many devices.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class TaskSummary implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField STATE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("state")
.getter(getter(TaskSummary::stateAsString)).setter(setter(Builder::state))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("state").build()).build();
private static final SdkField> TAGS_FIELD = SdkField
.> builder(MarshallingType.MAP)
.memberName("tags")
.getter(getter(TaskSummary::tags))
.setter(setter(Builder::tags))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("tags").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 TASK_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("taskArn").getter(getter(TaskSummary::taskArn)).setter(setter(Builder::taskArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("taskArn").build()).build();
private static final SdkField TASK_ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("taskId")
.getter(getter(TaskSummary::taskId)).setter(setter(Builder::taskId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("taskId").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(STATE_FIELD, TAGS_FIELD,
TASK_ARN_FIELD, TASK_ID_FIELD));
private static final Map> SDK_NAME_TO_FIELD = Collections
.unmodifiableMap(new HashMap>() {
{
put("state", STATE_FIELD);
put("tags", TAGS_FIELD);
put("taskArn", TASK_ARN_FIELD);
put("taskId", TASK_ID_FIELD);
}
});
private static final long serialVersionUID = 1L;
private final String state;
private final Map tags;
private final String taskArn;
private final String taskId;
private TaskSummary(BuilderImpl builder) {
this.state = builder.state;
this.tags = builder.tags;
this.taskArn = builder.taskArn;
this.taskId = builder.taskId;
}
/**
*
* The state of the task assigned to one or many devices.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return
* {@link TaskState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #stateAsString}.
*
*
* @return The state of the task assigned to one or many devices.
* @see TaskState
*/
public final TaskState state() {
return TaskState.fromValue(state);
}
/**
*
* The state of the task assigned to one or many devices.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return
* {@link TaskState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #stateAsString}.
*
*
* @return The state of the task assigned to one or many devices.
* @see TaskState
*/
public final String stateAsString() {
return state;
}
/**
* For responses, this returns true if the service returned a value for the Tags 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 hasTags() {
return tags != null && !(tags instanceof SdkAutoConstructMap);
}
/**
*
* Optional metadata that you assign to a resource. You can use tags to categorize a resource in different ways,
* such as by purpose, owner, or environment.
*
*
* 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 #hasTags} method.
*
*
* @return Optional metadata that you assign to a resource. You can use tags to categorize a resource in different
* ways, such as by purpose, owner, or environment.
*/
public final Map tags() {
return tags;
}
/**
*
* The Amazon Resource Name (ARN) of the task.
*
*
* @return The Amazon Resource Name (ARN) of the task.
*/
public final String taskArn() {
return taskArn;
}
/**
*
* The task ID.
*
*
* @return The task ID.
*/
public final String taskId() {
return taskId;
}
@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(stateAsString());
hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : null);
hashCode = 31 * hashCode + Objects.hashCode(taskArn());
hashCode = 31 * hashCode + Objects.hashCode(taskId());
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 TaskSummary)) {
return false;
}
TaskSummary other = (TaskSummary) obj;
return Objects.equals(stateAsString(), other.stateAsString()) && hasTags() == other.hasTags()
&& Objects.equals(tags(), other.tags()) && Objects.equals(taskArn(), other.taskArn())
&& Objects.equals(taskId(), other.taskId());
}
/**
* 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("TaskSummary").add("State", stateAsString()).add("Tags", hasTags() ? tags() : null)
.add("TaskArn", taskArn()).add("TaskId", taskId()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "state":
return Optional.ofNullable(clazz.cast(stateAsString()));
case "tags":
return Optional.ofNullable(clazz.cast(tags()));
case "taskArn":
return Optional.ofNullable(clazz.cast(taskArn()));
case "taskId":
return Optional.ofNullable(clazz.cast(taskId()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Function getter(Function g) {
return obj -> g.apply((TaskSummary) obj);
}
private static BiConsumer setter(BiConsumer s) {
return (obj, val) -> s.accept((Builder) obj, val);
}
public interface Builder extends SdkPojo, CopyableBuilder {
/**
*
* The state of the task assigned to one or many devices.
*
*
* @param state
* The state of the task assigned to one or many devices.
* @see TaskState
* @return Returns a reference to this object so that method calls can be chained together.
* @see TaskState
*/
Builder state(String state);
/**
*
* The state of the task assigned to one or many devices.
*
*
* @param state
* The state of the task assigned to one or many devices.
* @see TaskState
* @return Returns a reference to this object so that method calls can be chained together.
* @see TaskState
*/
Builder state(TaskState state);
/**
*
* Optional metadata that you assign to a resource. You can use tags to categorize a resource in different ways,
* such as by purpose, owner, or environment.
*
*
* @param tags
* Optional metadata that you assign to a resource. You can use tags to categorize a resource in
* different ways, such as by purpose, owner, or environment.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder tags(Map tags);
/**
*
* The Amazon Resource Name (ARN) of the task.
*
*
* @param taskArn
* The Amazon Resource Name (ARN) of the task.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder taskArn(String taskArn);
/**
*
* The task ID.
*
*
* @param taskId
* The task ID.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder taskId(String taskId);
}
static final class BuilderImpl implements Builder {
private String state;
private Map tags = DefaultSdkAutoConstructMap.getInstance();
private String taskArn;
private String taskId;
private BuilderImpl() {
}
private BuilderImpl(TaskSummary model) {
state(model.state);
tags(model.tags);
taskArn(model.taskArn);
taskId(model.taskId);
}
public final String getState() {
return state;
}
public final void setState(String state) {
this.state = state;
}
@Override
public final Builder state(String state) {
this.state = state;
return this;
}
@Override
public final Builder state(TaskState state) {
this.state(state == null ? null : state.toString());
return this;
}
public final Map getTags() {
if (tags instanceof SdkAutoConstructMap) {
return null;
}
return tags;
}
public final void setTags(Map tags) {
this.tags = TagMapCopier.copy(tags);
}
@Override
public final Builder tags(Map tags) {
this.tags = TagMapCopier.copy(tags);
return this;
}
public final String getTaskArn() {
return taskArn;
}
public final void setTaskArn(String taskArn) {
this.taskArn = taskArn;
}
@Override
public final Builder taskArn(String taskArn) {
this.taskArn = taskArn;
return this;
}
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;
}
@Override
public TaskSummary build() {
return new TaskSummary(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
@Override
public Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
}
}