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.ssmsap.model.Operation Maven / Gradle / Ivy
/*
* 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.ssmsap.model;
import java.io.Serializable;
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.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;
/**
*
* The operations performed by AWS Systems Manager for SAP.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class Operation implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Id")
.getter(getter(Operation::id)).setter(setter(Builder::id))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Id").build()).build();
private static final SdkField TYPE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Type")
.getter(getter(Operation::type)).setter(setter(Builder::type))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Type").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status")
.getter(getter(Operation::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build();
private static final SdkField STATUS_MESSAGE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("StatusMessage").getter(getter(Operation::statusMessage)).setter(setter(Builder::statusMessage))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StatusMessage").build()).build();
private static final SdkField> PROPERTIES_FIELD = SdkField
.> builder(MarshallingType.MAP)
.memberName("Properties")
.getter(getter(Operation::properties))
.setter(setter(Builder::properties))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Properties").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 RESOURCE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ResourceType").getter(getter(Operation::resourceType)).setter(setter(Builder::resourceType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResourceType").build()).build();
private static final SdkField RESOURCE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ResourceId").getter(getter(Operation::resourceId)).setter(setter(Builder::resourceId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResourceId").build()).build();
private static final SdkField RESOURCE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ResourceArn").getter(getter(Operation::resourceArn)).setter(setter(Builder::resourceArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResourceArn").build()).build();
private static final SdkField START_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("StartTime").getter(getter(Operation::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)
.memberName("EndTime").getter(getter(Operation::endTime)).setter(setter(Builder::endTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EndTime").build()).build();
private static final SdkField LAST_UPDATED_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("LastUpdatedTime").getter(getter(Operation::lastUpdatedTime)).setter(setter(Builder::lastUpdatedTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastUpdatedTime").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ID_FIELD, TYPE_FIELD,
STATUS_FIELD, STATUS_MESSAGE_FIELD, PROPERTIES_FIELD, RESOURCE_TYPE_FIELD, RESOURCE_ID_FIELD, RESOURCE_ARN_FIELD,
START_TIME_FIELD, END_TIME_FIELD, LAST_UPDATED_TIME_FIELD));
private static final Map> SDK_NAME_TO_FIELD = Collections
.unmodifiableMap(new HashMap>() {
{
put("Id", ID_FIELD);
put("Type", TYPE_FIELD);
put("Status", STATUS_FIELD);
put("StatusMessage", STATUS_MESSAGE_FIELD);
put("Properties", PROPERTIES_FIELD);
put("ResourceType", RESOURCE_TYPE_FIELD);
put("ResourceId", RESOURCE_ID_FIELD);
put("ResourceArn", RESOURCE_ARN_FIELD);
put("StartTime", START_TIME_FIELD);
put("EndTime", END_TIME_FIELD);
put("LastUpdatedTime", LAST_UPDATED_TIME_FIELD);
}
});
private static final long serialVersionUID = 1L;
private final String id;
private final String type;
private final String status;
private final String statusMessage;
private final Map properties;
private final String resourceType;
private final String resourceId;
private final String resourceArn;
private final Instant startTime;
private final Instant endTime;
private final Instant lastUpdatedTime;
private Operation(BuilderImpl builder) {
this.id = builder.id;
this.type = builder.type;
this.status = builder.status;
this.statusMessage = builder.statusMessage;
this.properties = builder.properties;
this.resourceType = builder.resourceType;
this.resourceId = builder.resourceId;
this.resourceArn = builder.resourceArn;
this.startTime = builder.startTime;
this.endTime = builder.endTime;
this.lastUpdatedTime = builder.lastUpdatedTime;
}
/**
*
* The ID of the operation.
*
*
* @return The ID of the operation.
*/
public final String id() {
return id;
}
/**
*
* The type of the operation.
*
*
* @return The type of the operation.
*/
public final String type() {
return type;
}
/**
*
* The status of the operation.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link OperationStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The status of the operation.
* @see OperationStatus
*/
public final OperationStatus status() {
return OperationStatus.fromValue(status);
}
/**
*
* The status of the operation.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link OperationStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The status of the operation.
* @see OperationStatus
*/
public final String statusAsString() {
return status;
}
/**
*
* The status message of the operation.
*
*
* @return The status message of the operation.
*/
public final String statusMessage() {
return statusMessage;
}
/**
* For responses, this returns true if the service returned a value for the Properties 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 hasProperties() {
return properties != null && !(properties instanceof SdkAutoConstructMap);
}
/**
*
* The properties of the operation.
*
*
* 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 #hasProperties} method.
*
*
* @return The properties of the operation.
*/
public final Map properties() {
return properties;
}
/**
*
* The resource type of the operation.
*
*
* @return The resource type of the operation.
*/
public final String resourceType() {
return resourceType;
}
/**
*
* The resource ID of the operation.
*
*
* @return The resource ID of the operation.
*/
public final String resourceId() {
return resourceId;
}
/**
*
* The Amazon Resource Name (ARN) of the operation.
*
*
* @return The Amazon Resource Name (ARN) of the operation.
*/
public final String resourceArn() {
return resourceArn;
}
/**
*
* The start time of the operation.
*
*
* @return The start time of the operation.
*/
public final Instant startTime() {
return startTime;
}
/**
*
* The end time of the operation.
*
*
* @return The end time of the operation.
*/
public final Instant endTime() {
return endTime;
}
/**
*
* The time at which the operation was last updated.
*
*
* @return The time at which the operation was last updated.
*/
public final Instant lastUpdatedTime() {
return lastUpdatedTime;
}
@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(id());
hashCode = 31 * hashCode + Objects.hashCode(type());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(statusMessage());
hashCode = 31 * hashCode + Objects.hashCode(hasProperties() ? properties() : null);
hashCode = 31 * hashCode + Objects.hashCode(resourceType());
hashCode = 31 * hashCode + Objects.hashCode(resourceId());
hashCode = 31 * hashCode + Objects.hashCode(resourceArn());
hashCode = 31 * hashCode + Objects.hashCode(startTime());
hashCode = 31 * hashCode + Objects.hashCode(endTime());
hashCode = 31 * hashCode + Objects.hashCode(lastUpdatedTime());
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 Operation)) {
return false;
}
Operation other = (Operation) obj;
return Objects.equals(id(), other.id()) && Objects.equals(type(), other.type())
&& Objects.equals(statusAsString(), other.statusAsString())
&& Objects.equals(statusMessage(), other.statusMessage()) && hasProperties() == other.hasProperties()
&& Objects.equals(properties(), other.properties()) && Objects.equals(resourceType(), other.resourceType())
&& Objects.equals(resourceId(), other.resourceId()) && Objects.equals(resourceArn(), other.resourceArn())
&& Objects.equals(startTime(), other.startTime()) && Objects.equals(endTime(), other.endTime())
&& Objects.equals(lastUpdatedTime(), other.lastUpdatedTime());
}
/**
* 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("Operation").add("Id", id()).add("Type", type()).add("Status", statusAsString())
.add("StatusMessage", statusMessage()).add("Properties", hasProperties() ? properties() : null)
.add("ResourceType", resourceType()).add("ResourceId", resourceId()).add("ResourceArn", resourceArn())
.add("StartTime", startTime()).add("EndTime", endTime()).add("LastUpdatedTime", lastUpdatedTime()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Id":
return Optional.ofNullable(clazz.cast(id()));
case "Type":
return Optional.ofNullable(clazz.cast(type()));
case "Status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "StatusMessage":
return Optional.ofNullable(clazz.cast(statusMessage()));
case "Properties":
return Optional.ofNullable(clazz.cast(properties()));
case "ResourceType":
return Optional.ofNullable(clazz.cast(resourceType()));
case "ResourceId":
return Optional.ofNullable(clazz.cast(resourceId()));
case "ResourceArn":
return Optional.ofNullable(clazz.cast(resourceArn()));
case "StartTime":
return Optional.ofNullable(clazz.cast(startTime()));
case "EndTime":
return Optional.ofNullable(clazz.cast(endTime()));
case "LastUpdatedTime":
return Optional.ofNullable(clazz.cast(lastUpdatedTime()));
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((Operation) 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 operation.
*
*
* @param id
* The ID of the operation.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder id(String id);
/**
*
* The type of the operation.
*
*
* @param type
* The type of the operation.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder type(String type);
/**
*
* The status of the operation.
*
*
* @param status
* The status of the operation.
* @see OperationStatus
* @return Returns a reference to this object so that method calls can be chained together.
* @see OperationStatus
*/
Builder status(String status);
/**
*
* The status of the operation.
*
*
* @param status
* The status of the operation.
* @see OperationStatus
* @return Returns a reference to this object so that method calls can be chained together.
* @see OperationStatus
*/
Builder status(OperationStatus status);
/**
*
* The status message of the operation.
*
*
* @param statusMessage
* The status message of the operation.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder statusMessage(String statusMessage);
/**
*
* The properties of the operation.
*
*
* @param properties
* The properties of the operation.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder properties(Map properties);
/**
*
* The resource type of the operation.
*
*
* @param resourceType
* The resource type of the operation.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder resourceType(String resourceType);
/**
*
* The resource ID of the operation.
*
*
* @param resourceId
* The resource ID of the operation.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder resourceId(String resourceId);
/**
*
* The Amazon Resource Name (ARN) of the operation.
*
*
* @param resourceArn
* The Amazon Resource Name (ARN) of the operation.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder resourceArn(String resourceArn);
/**
*
* The start time of the operation.
*
*
* @param startTime
* The start time of the operation.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder startTime(Instant startTime);
/**
*
* The end time of the operation.
*
*
* @param endTime
* The end time of the operation.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder endTime(Instant endTime);
/**
*
* The time at which the operation was last updated.
*
*
* @param lastUpdatedTime
* The time at which the operation was last updated.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder lastUpdatedTime(Instant lastUpdatedTime);
}
static final class BuilderImpl implements Builder {
private String id;
private String type;
private String status;
private String statusMessage;
private Map properties = DefaultSdkAutoConstructMap.getInstance();
private String resourceType;
private String resourceId;
private String resourceArn;
private Instant startTime;
private Instant endTime;
private Instant lastUpdatedTime;
private BuilderImpl() {
}
private BuilderImpl(Operation model) {
id(model.id);
type(model.type);
status(model.status);
statusMessage(model.statusMessage);
properties(model.properties);
resourceType(model.resourceType);
resourceId(model.resourceId);
resourceArn(model.resourceArn);
startTime(model.startTime);
endTime(model.endTime);
lastUpdatedTime(model.lastUpdatedTime);
}
public final String getId() {
return id;
}
public final void setId(String id) {
this.id = id;
}
@Override
public final Builder id(String id) {
this.id = id;
return this;
}
public final String getType() {
return type;
}
public final void setType(String type) {
this.type = type;
}
@Override
public final Builder type(String type) {
this.type = type;
return this;
}
public final String getStatus() {
return status;
}
public final void setStatus(String status) {
this.status = status;
}
@Override
public final Builder status(String status) {
this.status = status;
return this;
}
@Override
public final Builder status(OperationStatus status) {
this.status(status == null ? null : status.toString());
return this;
}
public final String getStatusMessage() {
return statusMessage;
}
public final void setStatusMessage(String statusMessage) {
this.statusMessage = statusMessage;
}
@Override
public final Builder statusMessage(String statusMessage) {
this.statusMessage = statusMessage;
return this;
}
public final Map getProperties() {
if (properties instanceof SdkAutoConstructMap) {
return null;
}
return properties;
}
public final void setProperties(Map properties) {
this.properties = OperationPropertiesCopier.copy(properties);
}
@Override
public final Builder properties(Map properties) {
this.properties = OperationPropertiesCopier.copy(properties);
return this;
}
public final String getResourceType() {
return resourceType;
}
public final void setResourceType(String resourceType) {
this.resourceType = resourceType;
}
@Override
public final Builder resourceType(String resourceType) {
this.resourceType = resourceType;
return this;
}
public final String getResourceId() {
return resourceId;
}
public final void setResourceId(String resourceId) {
this.resourceId = resourceId;
}
@Override
public final Builder resourceId(String resourceId) {
this.resourceId = resourceId;
return this;
}
public final String getResourceArn() {
return resourceArn;
}
public final void setResourceArn(String resourceArn) {
this.resourceArn = resourceArn;
}
@Override
public final Builder resourceArn(String resourceArn) {
this.resourceArn = resourceArn;
return this;
}
public final Instant getStartTime() {
return startTime;
}
public final void setStartTime(Instant startTime) {
this.startTime = startTime;
}
@Override
public final Builder startTime(Instant startTime) {
this.startTime = startTime;
return this;
}
public final Instant getEndTime() {
return endTime;
}
public final void setEndTime(Instant endTime) {
this.endTime = endTime;
}
@Override
public final Builder endTime(Instant endTime) {
this.endTime = endTime;
return this;
}
public final Instant getLastUpdatedTime() {
return lastUpdatedTime;
}
public final void setLastUpdatedTime(Instant lastUpdatedTime) {
this.lastUpdatedTime = lastUpdatedTime;
}
@Override
public final Builder lastUpdatedTime(Instant lastUpdatedTime) {
this.lastUpdatedTime = lastUpdatedTime;
return this;
}
@Override
public Operation build() {
return new Operation(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
@Override
public Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
}
}