software.amazon.awssdk.services.supplychain.model.SendDataIntegrationEventRequest Maven / Gradle / Ivy
Show all versions of supplychain 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.supplychain.model;
import java.time.Instant;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
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.awscore.AwsRequestOverrideConfiguration;
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.DefaultValueTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.traits.TimestampFormatTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* The request parameters for SendDataIntegrationEvent.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class SendDataIntegrationEventRequest extends SupplyChainRequest implements
ToCopyableBuilder {
private static final SdkField INSTANCE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("instanceId").getter(getter(SendDataIntegrationEventRequest::instanceId))
.setter(setter(Builder::instanceId))
.traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("instanceId").build()).build();
private static final SdkField EVENT_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("eventType").getter(getter(SendDataIntegrationEventRequest::eventTypeAsString))
.setter(setter(Builder::eventType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("eventType").build()).build();
private static final SdkField DATA_FIELD = SdkField. builder(MarshallingType.STRING).memberName("data")
.getter(getter(SendDataIntegrationEventRequest::data)).setter(setter(Builder::data))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("data").build()).build();
private static final SdkField EVENT_GROUP_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("eventGroupId").getter(getter(SendDataIntegrationEventRequest::eventGroupId))
.setter(setter(Builder::eventGroupId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("eventGroupId").build()).build();
private static final SdkField EVENT_TIMESTAMP_FIELD = SdkField
. builder(MarshallingType.INSTANT)
.memberName("eventTimestamp")
.getter(getter(SendDataIntegrationEventRequest::eventTimestamp))
.setter(setter(Builder::eventTimestamp))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("eventTimestamp").build(),
TimestampFormatTrait.create(TimestampFormatTrait.Format.UNIX_TIMESTAMP)).build();
private static final SdkField CLIENT_TOKEN_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("clientToken")
.getter(getter(SendDataIntegrationEventRequest::clientToken))
.setter(setter(Builder::clientToken))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("clientToken").build(),
DefaultValueTrait.idempotencyToken()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(INSTANCE_ID_FIELD,
EVENT_TYPE_FIELD, DATA_FIELD, EVENT_GROUP_ID_FIELD, EVENT_TIMESTAMP_FIELD, CLIENT_TOKEN_FIELD));
private final String instanceId;
private final String eventType;
private final String data;
private final String eventGroupId;
private final Instant eventTimestamp;
private final String clientToken;
private SendDataIntegrationEventRequest(BuilderImpl builder) {
super(builder);
this.instanceId = builder.instanceId;
this.eventType = builder.eventType;
this.data = builder.data;
this.eventGroupId = builder.eventGroupId;
this.eventTimestamp = builder.eventTimestamp;
this.clientToken = builder.clientToken;
}
/**
*
* The AWS Supply Chain instance identifier.
*
*
* @return The AWS Supply Chain instance identifier.
*/
public final String instanceId() {
return instanceId;
}
/**
*
* The data event type.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #eventType} will
* return {@link DataIntegrationEventType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #eventTypeAsString}.
*
*
* @return The data event type.
* @see DataIntegrationEventType
*/
public final DataIntegrationEventType eventType() {
return DataIntegrationEventType.fromValue(eventType);
}
/**
*
* The data event type.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #eventType} will
* return {@link DataIntegrationEventType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #eventTypeAsString}.
*
*
* @return The data event type.
* @see DataIntegrationEventType
*/
public final String eventTypeAsString() {
return eventType;
}
/**
*
* The data payload of the event. For more information on the data schema to use, see Data entities supported
* in AWS Supply Chain .
*
*
* @return The data payload of the event. For more information on the data schema to use, see Data entities
* supported in AWS Supply Chain .
*/
public final String data() {
return data;
}
/**
*
* Event identifier (for example, orderId for InboundOrder) used for data sharing or partitioning.
*
*
* @return Event identifier (for example, orderId for InboundOrder) used for data sharing or partitioning.
*/
public final String eventGroupId() {
return eventGroupId;
}
/**
*
* The event timestamp (in epoch seconds).
*
*
* @return The event timestamp (in epoch seconds).
*/
public final Instant eventTimestamp() {
return eventTimestamp;
}
/**
*
* The idempotent client token.
*
*
* @return The idempotent client token.
*/
public final String clientToken() {
return clientToken;
}
@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(instanceId());
hashCode = 31 * hashCode + Objects.hashCode(eventTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(data());
hashCode = 31 * hashCode + Objects.hashCode(eventGroupId());
hashCode = 31 * hashCode + Objects.hashCode(eventTimestamp());
hashCode = 31 * hashCode + Objects.hashCode(clientToken());
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 SendDataIntegrationEventRequest)) {
return false;
}
SendDataIntegrationEventRequest other = (SendDataIntegrationEventRequest) obj;
return Objects.equals(instanceId(), other.instanceId()) && Objects.equals(eventTypeAsString(), other.eventTypeAsString())
&& Objects.equals(data(), other.data()) && Objects.equals(eventGroupId(), other.eventGroupId())
&& Objects.equals(eventTimestamp(), other.eventTimestamp()) && Objects.equals(clientToken(), other.clientToken());
}
/**
* 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("SendDataIntegrationEventRequest").add("InstanceId", instanceId())
.add("EventType", eventTypeAsString()).add("Data", data() == null ? null : "*** Sensitive Data Redacted ***")
.add("EventGroupId", eventGroupId()).add("EventTimestamp", eventTimestamp()).add("ClientToken", clientToken())
.build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "instanceId":
return Optional.ofNullable(clazz.cast(instanceId()));
case "eventType":
return Optional.ofNullable(clazz.cast(eventTypeAsString()));
case "data":
return Optional.ofNullable(clazz.cast(data()));
case "eventGroupId":
return Optional.ofNullable(clazz.cast(eventGroupId()));
case "eventTimestamp":
return Optional.ofNullable(clazz.cast(eventTimestamp()));
case "clientToken":
return Optional.ofNullable(clazz.cast(clientToken()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function