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

software.amazon.awssdk.services.eventbridge.model.PutEventsRequestEntry Maven / Gradle / Ivy

Go to download

The AWS Java SDK for EventBridge module holds the client classes that are used for communicating with EventBridge.

There is a newer version: 2.29.39
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.eventbridge.model;

import java.io.Serializable;
import java.time.Instant;
import java.util.Arrays;
import java.util.Collection;
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.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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* Represents an event to be submitted. *

*/ @Generated("software.amazon.awssdk:codegen") public final class PutEventsRequestEntry implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField TIME_FIELD = SdkField. builder(MarshallingType.INSTANT) .getter(getter(PutEventsRequestEntry::time)).setter(setter(Builder::time)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Time").build()).build(); private static final SdkField SOURCE_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(PutEventsRequestEntry::source)).setter(setter(Builder::source)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Source").build()).build(); private static final SdkField> RESOURCES_FIELD = SdkField .> builder(MarshallingType.LIST) .getter(getter(PutEventsRequestEntry::resources)) .setter(setter(Builder::resources)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Resources").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField DETAIL_TYPE_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(PutEventsRequestEntry::detailType)).setter(setter(Builder::detailType)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DetailType").build()).build(); private static final SdkField DETAIL_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(PutEventsRequestEntry::detail)).setter(setter(Builder::detail)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Detail").build()).build(); private static final SdkField EVENT_BUS_NAME_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(PutEventsRequestEntry::eventBusName)).setter(setter(Builder::eventBusName)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EventBusName").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(TIME_FIELD, SOURCE_FIELD, RESOURCES_FIELD, DETAIL_TYPE_FIELD, DETAIL_FIELD, EVENT_BUS_NAME_FIELD)); private static final long serialVersionUID = 1L; private final Instant time; private final String source; private final List resources; private final String detailType; private final String detail; private final String eventBusName; private PutEventsRequestEntry(BuilderImpl builder) { this.time = builder.time; this.source = builder.source; this.resources = builder.resources; this.detailType = builder.detailType; this.detail = builder.detail; this.eventBusName = builder.eventBusName; } /** *

* The time stamp of the event, per RFC3339. If no time * stamp is provided, the time stamp of the PutEvents call is used. *

* * @return The time stamp of the event, per RFC3339. If no * time stamp is provided, the time stamp of the PutEvents call is used. */ public Instant time() { return time; } /** *

* The source of the event. *

* * @return The source of the event. */ public String source() { return source; } /** * Returns true if the Resources property was specified by the sender (it may be empty), or false if the sender did * not specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service. */ public boolean hasResources() { return resources != null && !(resources instanceof SdkAutoConstructList); } /** *

* AWS resources, identified by Amazon Resource Name (ARN), which the event primarily concerns. Any number, * including zero, may be present. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* You can use {@link #hasResources()} to see if a value was sent in this field. *

* * @return AWS resources, identified by Amazon Resource Name (ARN), which the event primarily concerns. Any number, * including zero, may be present. */ public List resources() { return resources; } /** *

* Free-form string used to decide what fields to expect in the event detail. *

* * @return Free-form string used to decide what fields to expect in the event detail. */ public String detailType() { return detailType; } /** *

* A valid JSON string. There is no other schema imposed. The JSON string may contain fields and nested subobjects. *

* * @return A valid JSON string. There is no other schema imposed. The JSON string may contain fields and nested * subobjects. */ public String detail() { return detail; } /** *

* The event bus that will receive the event. Only the rules that are associated with this event bus will be able to * match the event. *

* * @return The event bus that will receive the event. Only the rules that are associated with this event bus will be * able to match the event. */ public String eventBusName() { return eventBusName; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(time()); hashCode = 31 * hashCode + Objects.hashCode(source()); hashCode = 31 * hashCode + Objects.hashCode(resources()); hashCode = 31 * hashCode + Objects.hashCode(detailType()); hashCode = 31 * hashCode + Objects.hashCode(detail()); hashCode = 31 * hashCode + Objects.hashCode(eventBusName()); return hashCode; } @Override public boolean equals(Object obj) { return equalsBySdkFields(obj); } @Override public boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof PutEventsRequestEntry)) { return false; } PutEventsRequestEntry other = (PutEventsRequestEntry) obj; return Objects.equals(time(), other.time()) && Objects.equals(source(), other.source()) && Objects.equals(resources(), other.resources()) && Objects.equals(detailType(), other.detailType()) && Objects.equals(detail(), other.detail()) && Objects.equals(eventBusName(), other.eventBusName()); } /** * 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 String toString() { return ToString.builder("PutEventsRequestEntry").add("Time", time()).add("Source", source()) .add("Resources", resources()).add("DetailType", detailType()).add("Detail", detail()) .add("EventBusName", eventBusName()).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Time": return Optional.ofNullable(clazz.cast(time())); case "Source": return Optional.ofNullable(clazz.cast(source())); case "Resources": return Optional.ofNullable(clazz.cast(resources())); case "DetailType": return Optional.ofNullable(clazz.cast(detailType())); case "Detail": return Optional.ofNullable(clazz.cast(detail())); case "EventBusName": return Optional.ofNullable(clazz.cast(eventBusName())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((PutEventsRequestEntry) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The time stamp of the event, per RFC3339. If no time * stamp is provided, the time stamp of the PutEvents call is used. *

* * @param time * The time stamp of the event, per RFC3339. If * no time stamp is provided, the time stamp of the PutEvents call is used. * @return Returns a reference to this object so that method calls can be chained together. */ Builder time(Instant time); /** *

* The source of the event. *

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

* AWS resources, identified by Amazon Resource Name (ARN), which the event primarily concerns. Any number, * including zero, may be present. *

* * @param resources * AWS resources, identified by Amazon Resource Name (ARN), which the event primarily concerns. Any * number, including zero, may be present. * @return Returns a reference to this object so that method calls can be chained together. */ Builder resources(Collection resources); /** *

* AWS resources, identified by Amazon Resource Name (ARN), which the event primarily concerns. Any number, * including zero, may be present. *

* * @param resources * AWS resources, identified by Amazon Resource Name (ARN), which the event primarily concerns. Any * number, including zero, may be present. * @return Returns a reference to this object so that method calls can be chained together. */ Builder resources(String... resources); /** *

* Free-form string used to decide what fields to expect in the event detail. *

* * @param detailType * Free-form string used to decide what fields to expect in the event detail. * @return Returns a reference to this object so that method calls can be chained together. */ Builder detailType(String detailType); /** *

* A valid JSON string. There is no other schema imposed. The JSON string may contain fields and nested * subobjects. *

* * @param detail * A valid JSON string. There is no other schema imposed. The JSON string may contain fields and nested * subobjects. * @return Returns a reference to this object so that method calls can be chained together. */ Builder detail(String detail); /** *

* The event bus that will receive the event. Only the rules that are associated with this event bus will be * able to match the event. *

* * @param eventBusName * The event bus that will receive the event. Only the rules that are associated with this event bus will * be able to match the event. * @return Returns a reference to this object so that method calls can be chained together. */ Builder eventBusName(String eventBusName); } static final class BuilderImpl implements Builder { private Instant time; private String source; private List resources = DefaultSdkAutoConstructList.getInstance(); private String detailType; private String detail; private String eventBusName; private BuilderImpl() { } private BuilderImpl(PutEventsRequestEntry model) { time(model.time); source(model.source); resources(model.resources); detailType(model.detailType); detail(model.detail); eventBusName(model.eventBusName); } public final Instant getTime() { return time; } @Override public final Builder time(Instant time) { this.time = time; return this; } public final void setTime(Instant time) { this.time = time; } public final String getSource() { return source; } @Override public final Builder source(String source) { this.source = source; return this; } public final void setSource(String source) { this.source = source; } public final Collection getResources() { return resources; } @Override public final Builder resources(Collection resources) { this.resources = EventResourceListCopier.copy(resources); return this; } @Override @SafeVarargs public final Builder resources(String... resources) { resources(Arrays.asList(resources)); return this; } public final void setResources(Collection resources) { this.resources = EventResourceListCopier.copy(resources); } public final String getDetailType() { return detailType; } @Override public final Builder detailType(String detailType) { this.detailType = detailType; return this; } public final void setDetailType(String detailType) { this.detailType = detailType; } public final String getDetail() { return detail; } @Override public final Builder detail(String detail) { this.detail = detail; return this; } public final void setDetail(String detail) { this.detail = detail; } public final String getEventBusName() { return eventBusName; } @Override public final Builder eventBusName(String eventBusName) { this.eventBusName = eventBusName; return this; } public final void setEventBusName(String eventBusName) { this.eventBusName = eventBusName; } @Override public PutEventsRequestEntry build() { return new PutEventsRequestEntry(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy